/core/externals/update-engine/externals/gdata-objectivec-client/Source/BaseClasses/GDataQuery.h

http://macfuse.googlecode.com/ · C++ Header · 176 lines · 102 code · 46 blank · 28 comment · 0 complexity · cecb82b733c660281e4921595c5a9825 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. // GDataQuery.h
  17. //
  18. #import "GDataCategory.h"
  19. #import "GDataDateTime.h"
  20. #undef _EXTERN
  21. #undef _INITIALIZE_AS
  22. #ifdef GDATAQUERY_DEFINE_GLOBALS
  23. #define _EXTERN
  24. #define _INITIALIZE_AS(x) =x
  25. #else
  26. #define _EXTERN GDATA_EXTERN
  27. #define _INITIALIZE_AS(x)
  28. #endif
  29. // result formats
  30. _EXTERN NSString* const kGDataQueryResultServiceDocument _INITIALIZE_AS(@"atom-service"); // service introspection
  31. // categories within a filter are ORed; multiple filters in
  32. // a query are ANDed
  33. @interface GDataCategoryFilter : NSObject <NSCopying> {
  34. NSMutableArray *categories_;
  35. NSMutableArray *excludeCategories_;
  36. }
  37. + (GDataCategoryFilter *)categoryFilter;
  38. - (NSArray *)categories;
  39. - (void)setCategories:(NSArray *)categories;
  40. - (void)addCategory:(GDataCategory *)category;
  41. - (void)addCategoryWithScheme:(NSString *)scheme term:(NSString *)term;
  42. - (NSArray *)excludeCategories;
  43. - (void)setExcludeCategories:(NSArray *)excludeCategories;
  44. - (void)addExcludeCategory:(GDataCategory *)excludeCategory;
  45. - (void)addExcludeCategoryWithScheme:(NSString *)scheme term:(NSString *)term;
  46. - (NSString *)stringValue;
  47. @end
  48. @interface GDataQuery : NSObject <NSCopying> {
  49. NSURL *feedURL_;
  50. NSMutableArray *categoryFilters_;
  51. NSMutableDictionary *customParameters_;
  52. }
  53. + (id)queryWithFeedURL:(NSURL *)feedURL;
  54. - (id)initWithFeedURL:(NSURL *)feedURL;
  55. - (NSURL *)URL;
  56. - (NSURL *)feedURL;
  57. - (void)setFeedURL:(NSURL *)feedURL;
  58. // startIndex and maxResults use -1 to indicate parameter is not set
  59. - (NSInteger)startIndex;
  60. - (void)setStartIndex:(NSInteger)startIndex;
  61. - (NSInteger)maxResults;
  62. - (void)setMaxResults:(NSInteger)maxResults;
  63. - (NSString *)fieldSelection;
  64. - (void)setFieldSelection:(NSString *)str;
  65. - (NSString *)fullTextQueryString;
  66. - (void)setFullTextQueryString:(NSString *)str;
  67. - (NSString *)author;
  68. - (void)setAuthor:(NSString *)author;
  69. - (NSString *)orderBy;
  70. - (void)setOrderBy:(NSString *)author;
  71. - (BOOL)isAscendingOrder;
  72. - (void)setIsAscendingOrder:(BOOL)flag;
  73. - (BOOL)shouldShowDeleted;
  74. - (void)setShouldShowDeleted:(BOOL)flag;
  75. - (BOOL)shouldRequireAllDeleted;
  76. - (void)setShouldRequireAllDeleted:(BOOL)flag;
  77. - (BOOL)shouldShowOnlyDeleted;
  78. - (void)setShouldShowOnlyDeleted:(BOOL)flag;
  79. - (BOOL)isStrict;
  80. - (void)setIsStrict:(BOOL)flag;
  81. - (BOOL)shouldPrettyPrint;
  82. - (void)setShouldPrettyPrint:(BOOL)flag;
  83. - (NSString *)protocolVersion;
  84. - (void)setProtocolVersion:(NSString *)str;
  85. - (NSString *)resultFormat; // the "alt" parameter
  86. - (void)setResultFormat:(NSString *)str;
  87. - (NSString *)language;
  88. - (void)setLanguage:(NSString *)str;
  89. - (GDataDateTime *)publishedMinDateTime;
  90. - (void)setPublishedMinDateTime:(GDataDateTime *)dateTime;
  91. - (GDataDateTime *)publishedMaxDateTime;
  92. - (void)setPublishedMaxDateTime:(GDataDateTime *)dateTime;
  93. - (GDataDateTime *)updatedMinDateTime;
  94. - (void)setUpdatedMinDateTime:(GDataDateTime *)dateTime;
  95. - (GDataDateTime *)updatedMaxDateTime;
  96. - (void)setUpdatedMaxDateTime:(GDataDateTime *)dateTime;
  97. - (BOOL)shouldFormatErrorsAsXML;
  98. - (void)setShouldFormatErrorsAsXML:(BOOL)flag;
  99. - (NSArray *)categoryFilters;
  100. - (void)setCategoryFilters:(NSArray *)filters;
  101. - (void)addCategoryFilter:(GDataCategoryFilter *)filter;
  102. - (void)addCategoryFilterWithCategory:(GDataCategory *)category;
  103. - (void)addCategoryFilterWithScheme:(NSString *)scheme term:(NSString *)term;
  104. - (NSDictionary *)customParameters;
  105. - (void)setCustomParameters:(NSDictionary *)dict;
  106. // adding a parameter with a value of nil will remove
  107. // the parameter from the list
  108. - (void)addCustomParameterWithName:(NSString *)name
  109. value:(NSString *)value;
  110. - (void)removeCustomParameterWithName:(NSString *)name;
  111. - (NSString *)valueForParameterWithName:(NSString *)name;
  112. // convenience methods for int parameters
  113. // if val==invalidVal, the parameter is removed
  114. - (void)addCustomParameterWithName:(NSString *)name
  115. intValue:(NSInteger)val
  116. removeForValue:(NSInteger)invalidVal;
  117. // if the named parameter is not found, missingVal is returned
  118. - (NSInteger)intValueForParameterWithName:(NSString *)name
  119. missingParameterValue:(NSInteger)missingVal;
  120. // convenience methods for boolean parameters
  121. - (void)addCustomParameterWithName:(NSString *)name
  122. boolValue:(BOOL)flag
  123. defaultValue:(BOOL)defaultValue;
  124. - (BOOL)boolValueForParameterWithName:(NSString *)name
  125. defaultValue:(BOOL)defaultValue;
  126. // convenience methods for dateTime parameters
  127. - (void)addCustomParameterWithName:(NSString *)name
  128. dateTime:(GDataDateTime *)dateTime;
  129. - (GDataDateTime *)dateTimeForParameterWithName:(NSString *)name;
  130. @end