/Source/externals/GData/Source/Elements/GDataCategory.h

http://google-email-uploader-mac.googlecode.com/ · C++ Header · 78 lines · 41 code · 14 blank · 23 comment · 0 complexity · 7d1ea50d66458213a16afd1e507fabca MD5 · raw file

  1. /* Copyright (c) 2007 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. // GDataCategory.h
  17. //
  18. #import "GDataObject.h"
  19. #undef _EXTERN
  20. #undef _INITIALIZE_AS
  21. #ifdef GDATACATEGORY_DEFINE_GLOBALS
  22. #define _EXTERN
  23. #define _INITIALIZE_AS(x) =x
  24. #else
  25. #define _EXTERN GDATA_EXTERN
  26. #define _INITIALIZE_AS(x)
  27. #endif
  28. _EXTERN NSString* const kGDataCategoryLabelScheme _INITIALIZE_AS(@"http://schemas.google.com/g/2005/labels");
  29. _EXTERN NSString* const kGDataCategoryLabelStarred _INITIALIZE_AS(@"starred");
  30. _EXTERN NSString* const kGDataCategoryLabelTrashed _INITIALIZE_AS(@"trashed");
  31. _EXTERN NSString* const kGDataCategoryLabelPublished _INITIALIZE_AS(@"published");
  32. _EXTERN NSString* const kGDataCategoryLabelPrivate _INITIALIZE_AS(@"private");
  33. _EXTERN NSString* const kGDataCategoryLabelMine _INITIALIZE_AS(@"mine");
  34. _EXTERN NSString* const kGDataCategoryLabelSharedWithDomain _INITIALIZE_AS(@"shared-with-domain");
  35. _EXTERN NSString* const kGDataCategoryLabelHidden _INITIALIZE_AS(@"hidden");
  36. _EXTERN NSString* const kGDataCategoryLabelViewed _INITIALIZE_AS(@"viewed");
  37. // for categories, like
  38. // <category scheme="http://schemas.google.com/g/2005#kind"
  39. // term="http://schemas.google.com/g/2005#event"/>
  40. @interface GDataCategory : GDataObject <GDataExtension>
  41. + (GDataCategory *)categoryWithScheme:(NSString *)scheme
  42. term:(NSString *)term;
  43. + (GDataCategory *)categoryWithLabel:(NSString *)label;
  44. - (NSString *)scheme;
  45. - (void)setScheme:(NSString *)str;
  46. - (NSString *)term;
  47. - (void)setTerm:(NSString *)str;
  48. - (NSString *)label;
  49. - (void)setLabel:(NSString *)str;
  50. - (NSString *)labelLang;
  51. - (void)setLabelLang:(NSString *)str;
  52. #pragma mark -
  53. // utilities for extracting a subset of categories
  54. + (NSArray *)categoriesWithScheme:(NSString *)scheme fromCategories:(NSArray *)array;
  55. + (NSArray *)categoriesWithSchemePrefix:(NSString *)prefix fromCategories:(NSArray *)array;
  56. + (NSArray *)categoryLabelsFromCategories:(NSArray *)array;
  57. + (BOOL)categories:(NSArray *)array containsCategoryWithLabel:(NSString *)label;
  58. // this general search routine allows nil as "don't care" for scheme, term,
  59. // and label
  60. + (BOOL)categories:(NSArray *)array
  61. containsCategoryWithScheme:(NSString *)scheme
  62. term:(NSString *)term
  63. label:(NSString *)label;
  64. @end