/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/CodeSearch/GDataCodeSearchMatch.m

http://macfuse.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. // GDataCodeSearchMatch.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CODESEARCH_SERVICE
  19. #import "GDataCodeSearchMatch.h"
  20. #import "GDataEntryCodeSearch.h"
  21. static NSString* const kLineNumberAttr = @"lineNumber";
  22. @implementation GDataCodeSearchMatch
  23. // For code search source matches, like
  24. //
  25. // <gcs:match lineNumber="23" type="text/html">
  26. // found &lt;b&gt; query &lt;/b&gt;
  27. // </gcs:match>
  28. //
  29. // See http://code.google.com/apis/codesearch/reference.html
  30. + (NSString *)extensionElementURI { return kGDataNamespaceCodeSearch; }
  31. + (NSString *)extensionElementPrefix { return kGDataNamespaceCodeSearchPrefix; }
  32. + (NSString *)extensionElementLocalName { return @"match"; }
  33. + (id)matchWithStringValue:(NSString *)valueStr
  34. type:(NSString *)type
  35. lineNumberString:(NSString *)lineNumberStr {
  36. GDataCodeSearchMatch *obj = [self object];
  37. [obj setStringValue:valueStr];
  38. [obj setType:type];
  39. [obj setLineNumberString:lineNumberStr];
  40. return obj;
  41. }
  42. - (void)addParseDeclarations {
  43. // we're a subclass of GDataTextConstruct, so add its attributes and
  44. // content value also
  45. [super addParseDeclarations];
  46. NSArray *attrs = [NSArray arrayWithObject:kLineNumberAttr];
  47. [self addLocalAttributeDeclarations:attrs];
  48. }
  49. - (NSString *)lineNumberString {
  50. return [self stringValueForAttribute:kLineNumberAttr];
  51. }
  52. - (void)setLineNumberString:(NSString *)str {
  53. [self setStringValue:str forAttribute:kLineNumberAttr];
  54. }
  55. @end
  56. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CODESEARCH_SERVICE