PageRenderTime 33ms CodeModel.GetById 21ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
C++ Header | 222 lines | 124 code | 51 blank | 47 comment | 0 complexity | dd20dfa9368824491aaf0dd8d84a281b 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//
 17// GDataEntryBase.h
 18//
 19// This is the base class for all standard GData feed entries.
 20//
 21
 22#import "GDataDateTime.h"
 23#import "GDataTextConstruct.h"
 24#import "GDataEntryContent.h"
 25#import "GDataPerson.h"
 26#import "GDataCategory.h"
 27#import "GDataDeleted.h"
 28#import "GDataBatchOperation.h"
 29#import "GDataBatchID.h"
 30#import "GDataBatchStatus.h"
 31#import "GDataBatchInterrupted.h"
 32#import "GDataAtomPubControl.h"
 33#import "GDataLink.h"
 34
 35#undef _EXTERN
 36#undef _INITIALIZE_AS
 37#ifdef GDATAENTRYBASE_DEFINE_GLOBALS
 38#define _EXTERN
 39#define _INITIALIZE_AS(x) =x
 40#else
 41#define _EXTERN GDATA_EXTERN
 42#define _INITIALIZE_AS(x)
 43#endif
 44
 45_EXTERN NSString* const kGDataCategoryScheme _INITIALIZE_AS(@"http://schemas.google.com/g/2005#kind");
 46
 47
 48@interface GDataEntryBase : GDataObject <NSCopying> {
 49  // either uploadData_ or uploadFileHandle_ may be set, but not both
 50  NSData *uploadData_;
 51  NSFileHandle *uploadFileHandle_;
 52  NSURL *uploadLocationURL_; // requires uploadFileHandle be set
 53  NSString *uploadMIMEType_;
 54  NSString *uploadSlug_; // for http slug (filename) header when uploading
 55  BOOL shouldUploadDataOnly_;
 56}
 57
 58+ (NSDictionary *)baseGDataNamespaces;
 59
 60+ (id)entry;
 61
 62// basic entry fields
 63- (NSString *)identifier;
 64- (void)setIdentifier:(NSString *)theIdString;
 65
 66- (GDataDateTime *)publishedDate;
 67- (void)setPublishedDate:(GDataDateTime *)thePublishedDate;
 68
 69- (GDataDateTime *)updatedDate;
 70- (void)setUpdatedDate:(GDataDateTime *)theUpdatedDate;
 71
 72- (GDataDateTime *)editedDate;
 73- (void)setEditedDate:(GDataDateTime *)theEditedDate;
 74
 75- (NSString *)ETag;
 76- (void)setETag:(NSString *)str;
 77
 78- (NSString *)fieldSelection;
 79- (void)setFieldSelection:(NSString *)str;
 80
 81- (NSString *)kind;
 82- (void)setKind:(NSString *)str;
 83
 84- (NSString *)resourceID;
 85- (void)setResourceID:(NSString *)str;
 86
 87- (GDataTextConstruct *)title;
 88- (void)setTitle:(GDataTextConstruct *)theTitle;
 89- (void)setTitleWithString:(NSString *)str;
 90
 91- (GDataTextConstruct *)summary;
 92- (void)setSummary:(GDataTextConstruct *)theSummary;
 93- (void)setSummaryWithString:(NSString *)str;
 94
 95- (GDataEntryContent *)content;
 96- (void)setContent:(GDataEntryContent *)theContent;
 97- (void)setContentWithString:(NSString *)str;
 98
 99- (GDataTextConstruct *)rightsString;
100- (void)setRightsString:(GDataTextConstruct *)theRightsString;
101- (void)setRightsStringWithString:(NSString *)str;
102
103- (NSArray *)links;
104- (void)setLinks:(NSArray *)links;
105- (void)addLink:(GDataLink *)link;
106
107- (NSArray *)authors;
108- (void)setAuthors:(NSArray *)authors;
109- (void)addAuthor:(GDataPerson *)authorElement;
110
111- (NSArray *)contributors;
112- (void)setContributors:(NSArray *)array;
113- (void)addContributor:(GDataPerson *)obj;
114
115- (NSArray *)categories;
116- (void)setCategories:(NSArray *)categories;
117- (void)addCategory:(GDataCategory *)category;
118- (void)removeCategory:(GDataCategory *)category;
119
120// File upload
121//
122// Either uploadData or uploadFileHandle should be set, but not both
123- (NSData *)uploadData;
124- (void)setUploadData:(NSData *)data;
125
126- (NSFileHandle *)uploadFileHandle;
127- (void)setUploadFileHandle:(NSFileHandle *)fileHandle;
128
129// The location URL is used to restart upload of a file handle
130- (NSURL *)uploadLocationURL;
131- (void)setUploadLocationURL:(NSURL *)url;
132
133- (NSString *)uploadMIMEType;
134- (void)setUploadMIMEType:(NSString *)str;
135
136// support for uploading media data without the XML from the GDataObject
137- (BOOL)shouldUploadDataOnly;
138- (void)setShouldUploadDataOnly:(BOOL)flag;
139
140// http slug (filename) header when uploading
141- (NSString *)uploadSlug;
142- (void)setUploadSlug:(NSString *)str;
143
144// extension for entries which may include deleted elements
145- (BOOL)isDeleted;
146- (void)setIsDeleted:(BOOL)isDeleted;
147
148// extensions for Atom publishing control
149- (GDataAtomPubControl *)atomPubControl;
150- (void)setAtomPubControl:(GDataAtomPubControl *)obj;
151
152// batch support
153+ (NSDictionary *)batchNamespaces;
154
155- (GDataBatchOperation *)batchOperation;
156- (void)setBatchOperation:(GDataBatchOperation *)obj;
157
158// the batch ID is an arbitrary string defined by clients, and present in the
159// batch response feed to let the client match each entry's response to
160// the entry
161- (GDataBatchID *)batchID;
162- (void)setBatchID:(GDataBatchID *)obj;
163- (void)setBatchIDWithString:(NSString *)str;
164
165- (GDataBatchStatus *)batchStatus;
166- (void)setBatchStatus:(GDataBatchStatus *)obj;
167
168- (GDataBatchInterrupted *)batchInterrupted;
169- (void)setBatchInterrupted:(GDataBatchInterrupted *)obj;
170
171// convenience accessors
172
173- (NSArray *)categoriesWithScheme:(NSString *)scheme;
174
175// most entries have a category element with scheme kGDataCategoryScheme
176// that indicates the kind of entry
177- (GDataCategory *)kindCategory;
178
179- (NSArray *)linksWithRelAttributeValue:(NSString *)relValue;
180
181- (GDataLink *)linkWithRelAttributeValue:(NSString *)relValue;
182- (GDataLink *)linkWithRelAttributeValue:(NSString *)rel
183                                    type:(NSString *)type;
184
185- (GDataLink *)feedLink;
186- (GDataLink *)editLink;
187- (GDataLink *)editMediaLink;
188- (GDataLink *)alternateLink;
189- (GDataLink *)relatedLink;
190- (GDataLink *)postLink;
191- (GDataLink *)selfLink;
192- (GDataLink *)HTMLLink;
193- (GDataLink *)uploadEditLink;
194
195- (BOOL)canEdit;
196
197///////////////////////////////////////////////////////////////////////////////
198//
199//  Protected methods
200//
201//  All remaining methods are intended for use only by subclasses
202//  of GDataEntryBase.
203//
204
205// subclasses call registerEntryClass to register their standardEntryKind
206+ (void)registerEntryClass;
207
208+ (Class)entryClassForCategoryWithScheme:(NSString *)scheme
209                                    term:(NSString *)term;
210+ (Class)entryClassForKindAttributeValue:(NSString *)kind;
211
212// temporary bridge method
213+ (void)registerEntryClass:(Class)theClass
214     forCategoryWithScheme:(NSString *)scheme
215                      term:(NSString *)term;
216
217
218// subclasses override standardEntryKind to provide the term string for the
219// kind attribute of their kind category element, if any
220+ (NSString *)standardEntryKind;
221
222@end