PageRenderTime 30ms CodeModel.GetById 13ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/Source/externals/GData/Source/Clients/CodeSearch/GDataCodeSearchMatch.m

http://google-email-uploader-mac.googlecode.com/
Objective C | 71 lines | 30 code | 15 blank | 26 comment | 1 complexity | ff3b182202042632924ca4320602d490 MD5 | raw file
 1/* Copyright (c) 2007-2008 Google Inc.
 2*
 3* Licensed under the Apache License, Version 2.0 (the "License");
 4* you may not use this file except in compliance with the License.
 5* You may obtain a copy of the License at
 6*
 7*     http://www.apache.org/licenses/LICENSE-2.0
 8*
 9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16//
17//  GDataCodeSearchMatch.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CODESEARCH_SERVICE
21
22#import "GDataCodeSearchMatch.h"
23#import "GDataEntryCodeSearch.h"
24
25static NSString* const kLineNumberAttr = @"lineNumber";
26
27@implementation GDataCodeSearchMatch 
28
29// For code search source matches, like
30//
31//  <gcs:match lineNumber="23" type="text/html">
32//    found &lt;b&gt; query &lt;/b&gt;
33//  </gcs:match>
34//
35// See http://code.google.com/apis/codesearch/reference.html
36
37+ (NSString *)extensionElementURI       { return kGDataNamespaceCodeSearch; }
38+ (NSString *)extensionElementPrefix    { return kGDataNamespaceCodeSearchPrefix; }
39+ (NSString *)extensionElementLocalName { return @"match"; }
40
41+ (id)matchWithStringValue:(NSString *)valueStr
42                      type:(NSString *)type
43          lineNumberString:(NSString *)lineNumberStr {
44
45  GDataCodeSearchMatch *obj = [self object];
46  [obj setStringValue:valueStr];
47  [obj setType:type];
48  [obj setLineNumberString:lineNumberStr];
49  return obj;
50}
51
52- (void)addParseDeclarations {
53  
54  // we're a subclass of GDataTextConstruct, so add its attributes and
55  // content value also
56  [super addParseDeclarations];
57  
58  NSArray *attrs = [NSArray arrayWithObject:kLineNumberAttr];
59  [self addLocalAttributeDeclarations:attrs];  
60}
61
62- (NSString *)lineNumberString {
63  return [self stringValueForAttribute:kLineNumberAttr];
64}
65
66- (void)setLineNumberString:(NSString *)str {
67  [self setStringValue:str forAttribute:kLineNumberAttr];
68}
69@end
70
71#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CODESEARCH_SERVICE