> The XQuery Processor
00001 /* 00002 * Copyright 2006-2008 The FLWOR Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef ZORBA_ITEM_FACTORY_API_H 00017 #define ZORBA_ITEM_FACTORY_API_H 00018 00019 #include <zorba/api_shared_types.h> 00020 00021 namespace zorba { 00022 00023 /** \brief ItemFactory to create Items. 00024 * 00025 * An instance of this class can be obtained by calling getItemFactory on the Zorba object. 00026 * 00027 * Each createXXX function of this class creates an Item of an XML Schema item. 00028 * If an isNull() call on an Item created by this function returns true the 00029 * given Item could not be created. 00030 */ 00031 class ItemFactory 00032 { 00033 public: 00034 /** \brief Destructor 00035 */ 00036 virtual ~ItemFactory() {} 00037 00038 /** \brief Creates a String Item 00039 * see [http://www.w3.org/TR/xmlschema-2/#string] 00040 * 00041 * @param aString String representation of the String Item. 00042 * @return The String Item 00043 */ 00044 virtual Item 00045 createString(const String& aString) = 0; 00046 00047 /** \brief Creates an AnyURI Item 00048 * see [http://www.w3.org/TR/xmlschema-2/#anyURI] 00049 * 00050 * @param aURI String representation of the AnyURI. 00051 * @return The AnyURI Item. 00052 */ 00053 virtual Item 00054 createAnyURI(const String& aURI) = 0; 00055 00056 /** \brief Creates a QName Item 00057 * see [http://www.w3.org/TR/xmlschema-2/#QName] 00058 * 00059 * @param aNamespace String representation of the namespace. 00060 * @param aPrefix String representation of the prefix. 00061 * @param aLocalname String representation of the localname. 00062 * 00063 * @return The QName Item. 00064 */ 00065 virtual Item 00066 createQName(const String& aNamespace, const String& aPrefix, 00067 const String& aLocalname) = 0; 00068 00069 /** \brief Creates a QName Item 00070 * see [http://www.w3.org/TR/xmlschema-2/#QName] 00071 * 00072 * @param aNamespace String representation of the namespace. 00073 * @param aLocalname String representation of the localname. * 00074 * @return The QName Item. 00075 */ 00076 virtual Item 00077 createQName(const String& aNamespace, const String& aLocalname) = 0; 00078 00079 /** \brief Creates a NCName Item 00080 * see [http://www.w3.org/TR/xmlschema-2/#NCName] 00081 * 00082 * @param aValue String representation of the NCName. 00083 * @return The NCName Item. 00084 */ 00085 virtual Item 00086 createNCName(const String& aValue) = 0; 00087 00088 00089 /** \brief Creates a Base64Binary Item 00090 * see [http://www.w3.org/TR/xmlschema-2/#base64Binary] 00091 * 00092 * @param aBinData a pointer to the base64 binary data. 00093 * @param aLength the length of the base64 binary data. 00094 * @return The Base64Binary Item. 00095 */ 00096 virtual Item 00097 createBase64Binary(const char* aBinData, size_t aLength) = 0; 00098 00099 /** \brief Creates a Boolean Item 00100 * see [http://www.w3.org/TR/xmlschema-2/#bool] 00101 * 00102 * @param aValue bool representation of the Boolean. 00103 * @return The Boolean Item. 00104 */ 00105 virtual Item 00106 createBoolean(bool aValue) = 0; 00107 00108 /** \brief Creates a Decimal Item 00109 * see [http://www.w3.org/TR/xmlschema-2/#decimal] 00110 * 00111 * @param aValue unsigned long representation of the Decimal. 00112 * @return The Decimal Item. 00113 */ 00114 virtual Item 00115 createDecimalFromLong (unsigned long aValue) = 0; 00116 00117 /** \brief Creates a Decimal Item 00118 * see [http://www.w3.org/TR/xmlschema-2/#decimal] 00119 * 00120 * @param aValue double representation of the Decimal. 00121 * @return The Decimal Item. 00122 */ 00123 virtual Item 00124 createDecimalFromDouble (double aValue) = 0; 00125 00126 /** \brief Creates a Decimal Item 00127 * see [http://www.w3.org/TR/xmlschema-2/#decimal] 00128 * 00129 * @param aValue String representation of the Decimal (e.g. 12678967.543233). 00130 * @return The Decimal Item. 00131 */ 00132 virtual Item 00133 createDecimal (const String& aValue) = 0; 00134 00135 /** \brief Creates an Integer Item 00136 * see [http://www.w3.org/TR/xmlschema-2/#integer] 00137 * 00138 * @param aInteger unsigned long representation of the Integer. 00139 * @return The Integer Item. 00140 */ 00141 virtual Item 00142 createInteger(long long aInteger) = 0; 00143 00144 /** \brief Creates an Integer Item 00145 * see [http://www.w3.org/TR/xmlschema-2/#integer] 00146 * 00147 * @param aInteger String representation of the Integer. 00148 * @return The Integer Item. 00149 */ 00150 virtual Item 00151 createInteger(const String& aInteger) = 0; 00152 00153 /** \brief Creates a Long Item 00154 * see [http://www.w3.org/TR/xmlschema-2/#long] 00155 * 00156 * @param aLong long long representation of the Long. 00157 * @return The Long Item. 00158 */ 00159 virtual Item 00160 createLong ( long long aLong ) = 0; 00161 00162 /** \brief Creates a Int Item 00163 * see [http://www.w3.org/TR/xmlschema-2/#int] 00164 * 00165 * @param aInt int representation of the Int. 00166 * @return The NCName Item. 00167 */ 00168 virtual Item 00169 createInt ( int aInt ) = 0; 00170 00171 /** \brief Creates a Short Item 00172 * see [http://www.w3.org/TR/xmlschema-2/#short] 00173 * 00174 * @param aShort short representation of the Short. 00175 * @return The Short Item. 00176 */ 00177 virtual Item 00178 createShort ( short aShort ) = 0; 00179 00180 /** \brief Creates a Byte Item 00181 * see [http://www.w3.org/TR/xmlschema-2/#byte] 00182 * 00183 * @param aByte char representation of the Byte. 00184 * @return The Byte Item. 00185 */ 00186 virtual Item 00187 createByte ( char aByte ) = 0; 00188 00189 /** \brief Creates a Date Item 00190 * see [http://www.w3.org/TR/xmlschema-2/#date] 00191 * 00192 * @param aDate String representation of the Date (e.g. 2002-10-10). 00193 * @return The Date Item. 00194 */ 00195 virtual Item 00196 createDate ( const String& aDate ) = 0; 00197 00198 /** \brief Creates a Date Item 00199 * see [http://www.w3.org/TR/xmlschema-2/#date] 00200 * 00201 * @param aYear short-valued representation of the year. 00202 * @param aMonth short-valued representation of the month. 00203 * @param aDay short-valued representation of the day. 00204 * @return The Date Item. 00205 */ 00206 virtual Item 00207 createDate ( short aYear, short aMonth, short aDay ) = 0; 00208 00209 /** \brief Creates a DateTime Item 00210 * see [http://www.w3.org/TR/xmlschema-2/#dateTime] 00211 * 00212 * @param aYear short-valued representation of the year. 00213 * @param aMonth short-valued representation of the month. 00214 * @param aDay short-valued representation of the day. 00215 * @param aHour short-valued representation of the hour. 00216 * @param aMinute short-valued representation of the minute. 00217 * @param aSecond double-valued representation of the seconds and fractional seconds. 00218 * @param aTimeZone_hours short-valued representation of the difference in hours to UTC. 00219 * @return The DateTime Item. 00220 */ 00221 virtual Item 00222 createDateTime(short aYear, short aMonth, short aDay, 00223 short aHour, short aMinute, double aSecond, 00224 short aTimeZone_hours) = 0; 00225 00226 /** \brief Creates a DateTime Item 00227 * see [http://www.w3.org/TR/xmlschema-2/#dateTime] 00228 * 00229 * @param aDateTimeValue String representation of the datetime value 00230 * (for example, 2002-10-10T12:00:00-05:00). 00231 * @return The DateTime Item. 00232 */ 00233 virtual Item 00234 createDateTime( const String& aDateTimeValue ) = 0; 00235 00236 /** \brief Creates a Double Item 00237 * see [http://www.w3.org/TR/xmlschema-2/#double] 00238 * 00239 * @param aValue double representation of the Double. 00240 * @return The Double Item. 00241 */ 00242 virtual Item 00243 createDouble ( double aValue ) = 0; 00244 00245 /** \brief Creates a Double Item 00246 * see [http://www.w3.org/TR/xmlschema-2/#double] 00247 * 00248 * @param aValue String representation of the Double. 00249 * @return The Double Item. 00250 */ 00251 virtual Item 00252 createDouble ( const String& aValue ) = 0; 00253 00254 /** \brief Creates a Duration Item 00255 * see [http://www.w3.org/TR/xmlschema-2/#duration] 00256 * 00257 * @param aValue String representation of the NCName. 00258 * @return The Duration Item. 00259 */ 00260 virtual Item 00261 createDuration( const String& aValue ) = 0; 00262 00263 /** \brief Creates a Duration Item 00264 * see [http://www.w3.org/TR/xmlschema-2/#duration] 00265 * 00266 * @param aYear short-valued representation of the years. 00267 * @param aMonths short-valued representation of the months. 00268 * @param aDays short-valued representation of the days. 00269 * @param aHours short-valued representation of the hours. 00270 * @param aMinutes short-valued representation of the minutes. 00271 * @param aSeconds double-valued representation of the seconds and fractional seconds. 00272 * @return The Duration Item. 00273 */ 00274 virtual Item 00275 createDuration ( short aYear, short aMonths, short aDays, 00276 short aHours, short aMinutes, double aSeconds ) = 0; 00277 00278 /** \brief creates a float item 00279 * see [http://www.w3.org/tr/xmlschema-2/#float] 00280 * 00281 * @param aValue string representation of the float. 00282 * @return the float item. 00283 */ 00284 virtual Item 00285 createFloat ( const String& aValue ) = 0; 00286 00287 /** \brief creates a float item 00288 * see [http://www.w3.org/tr/xmlschema-2/#float] 00289 * 00290 * @param aValue float representation of the float. 00291 * @return the float item. 00292 */ 00293 virtual Item 00294 createFloat ( float aValue ) = 0; 00295 00296 /** \brief Creates a gDay Item 00297 * see [http://www.w3.org/TR/xmlschema-2/#gDay] 00298 * 00299 * @param aValue String representation of the gDay. 00300 * @return The gDay Item. 00301 */ 00302 virtual Item 00303 createGDay ( const String& aValue ) = 0; 00304 00305 /** \brief Creates a gDay Item 00306 * see [http://www.w3.org/TR/xmlschema-2/#gDay] 00307 * 00308 * @param aDay short representation of the gDay. 00309 * @return The gDay Item. 00310 */ 00311 virtual Item 00312 createGDay ( short aDay ) = 0; 00313 00314 /** \brief Creates a gMonth Item 00315 * see [http://www.w3.org/TR/xmlschema-2/#gMonth] 00316 * 00317 * @param aValue String representation of the gMonth. 00318 * @return The gMonth Item. 00319 */ 00320 virtual Item 00321 createGMonth ( const String& aValue ) = 0; 00322 00323 /** \brief Creates a gMonth Item 00324 * see [http://www.w3.org/TR/xmlschema-2/#gMonth] 00325 * 00326 * @param aMonth short representation of the gMonth. 00327 * @return The gMonth Item. 00328 */ 00329 virtual Item 00330 createGMonth ( short aMonth ) = 0; 00331 00332 /** \brief Creates a gMonthDay Item 00333 * see [http://www.w3.org/TR/xmlschema-2/#gMonthDay] 00334 * 00335 * @param aValue String representation of the gMonthDay. 00336 * @return The gMonthDay Item. 00337 */ 00338 virtual Item 00339 createGMonthDay ( const String& aValue ) = 0; 00340 00341 /** \brief Creates a gMonthDay Item 00342 * see [http://www.w3.org/TR/xmlschema-2/#gMonthDay] 00343 * 00344 * @param aMonth short representation of the month. 00345 * @param aDay short representation of the day. 00346 * @return The gMonthDay Item. 00347 */ 00348 virtual Item 00349 createGMonthDay ( short aMonth, short aDay ) = 0; 00350 00351 /** \brief Creates a gYear Item 00352 * see [http://www.w3.org/TR/xmlschema-2/#gYear] 00353 * 00354 * @param aValue String representation of the gYear. 00355 * @return The gYear Item. 00356 */ 00357 virtual Item 00358 createGYear ( const String& aValue ) = 0; 00359 00360 /** \brief Creates a gYear Item 00361 * see [http://www.w3.org/TR/xmlschema-2/#gYear] 00362 * 00363 * @param aYear short representation of the gYear. 00364 * @return The gYear Item. 00365 */ 00366 virtual Item 00367 createGYear ( short aYear ) = 0; 00368 00369 /** \brief Creates a gYearMonth Item 00370 * see [http://www.w3.org/TR/xmlschema-2/#gYearMonth] 00371 * 00372 * @param aValue String representation of the gYearMonth. 00373 * @return The gYearMonth Item. 00374 */ 00375 virtual Item 00376 createGYearMonth ( const String& aValue ) = 0; 00377 00378 /** \brief Creates a gYearMonth Item 00379 * see [http://www.w3.org/TR/xmlschema-2/#gYearMonth] 00380 * 00381 * @param aYear short representation of the year. 00382 * @param aMonth short representation of the month. 00383 * @return The gYearMonth Item. 00384 */ 00385 virtual Item 00386 createGYearMonth ( short aYear, short aMonth ) = 0; 00387 00388 /** \brief Creates a HexBinary Item 00389 * see [http://www.w3.org/TR/xmlschema-2/#hexBinary] 00390 * 00391 * @param aHexData pointer to the hexdata. 00392 * @param aSize size of the hexdata. 00393 * @return The HexBinary Item. 00394 */ 00395 virtual Item 00396 createHexBinary ( const char* aHexData, size_t aSize ) = 0; 00397 00398 /** \brief Creates a negativeInteger Item 00399 * see [http://www.w3.org/TR/xmlschema-2/#negativeInteger] 00400 * 00401 * @param aValue long long representation of the negativeInteger. 00402 * @return The negativeInteger Item. 00403 */ 00404 virtual Item 00405 createNegativeInteger ( long long aValue ) = 0; 00406 00407 /** \brief Creates a nonNegativeInteger Item 00408 * see [http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger] 00409 * 00410 * @param aValue unsigned long representation of the nonNegativeInteger. 00411 * @return The nonNegativeInteger Item. 00412 */ 00413 virtual Item 00414 createNonNegativeInteger ( unsigned long long aValue ) = 0; 00415 00416 /** \brief Creates a nonPositiveInteger Item 00417 * see [http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger] 00418 * 00419 * @param aValue long long representation of the NCName. 00420 * @return The nonPositiveInteger Item. 00421 */ 00422 virtual Item 00423 createNonPositiveInteger ( long long aValue ) = 0; 00424 00425 /** \brief Creates a positiveInteger\ Item 00426 * see [http://www.w3.org/TR/xmlschema-2/#positiveInteger] 00427 * 00428 * @param aValue unsigned long representation of the positiveInteger. 00429 * @return The positiveInteger Item. 00430 */ 00431 virtual Item 00432 createPositiveInteger ( unsigned long long aValue ) = 0; 00433 00434 /** \brief Creates a Time Item 00435 * see [http://www.w3.org/TR/xmlschema-2/#time] 00436 * 00437 * @param aValue String representation of the Time. 00438 * @return The Time Item 00439 */ 00440 virtual Item 00441 createTime ( const String& aValue ) = 0; 00442 00443 /** \brief Creates a Time Item 00444 * see [http://www.w3.org/TR/xmlschema-2/#time] 00445 * 00446 * @param aHour short representation of the hour. 00447 * @param aMinute short representation of the minute. 00448 * @param aSecond double representation of the seconds and fractional seconds. 00449 * @return The Time Item. 00450 */ 00451 virtual Item 00452 createTime ( short aHour, short aMinute, double aSecond ) = 0; 00453 00454 /** \brief Creates a Time Item 00455 * see [http://www.w3.org/TR/xmlschema-2/#time] 00456 * 00457 * @param aHour short representation of the hour. 00458 * @param aMinute short representation of the minute. 00459 * @param aSecond double representation of the seconds and fractional seconds. 00460 * @param aTimeZone_hours short representation of the timezone difference in hours to UTC. 00461 * @return The Time Item. 00462 */ 00463 virtual Item 00464 createTime ( short aHour, short aMinute, double aSecond, short aTimeZone_hours ) = 0; 00465 00466 /** \brief Creates an Unsigned Byte Item 00467 * see [http://www.w3.org/TR/xmlschema-2/#unsignedByte] 00468 * 00469 * @param aValue unsignedByte unsigned char representation of the unsigned byte. 00470 * @return The Unsigned Byte Item. 00471 */ 00472 virtual Item 00473 createUnsignedByte(const unsigned char aValue) = 0; 00474 00475 /** \brief Creates an unsigned int Item 00476 * see [http://www.w3.org/TR/xmlschema-2/#unsignedInt] 00477 * 00478 * @param aValue unsigned int representation of the unsignedInt. 00479 * @return The unsignedInt Item. 00480 */ 00481 virtual Item 00482 createUnsignedInt(unsigned int aValue) = 0; 00483 00484 /** \brief Creates an unsignedLong Item 00485 * see [http://www.w3.org/TR/xmlschema-2/#unsignedLong] 00486 * 00487 * @param aValue unsignedLong long long representation of the unsignedLong. 00488 * @return The unsignedLong Item. 00489 */ 00490 virtual Item 00491 createUnsignedLong(unsigned long long aValue) = 0; 00492 00493 /** \brief Creates a unsignedShort Item 00494 * see [http://www.w3.org/TR/xmlschema-2/#unsignedShort] 00495 * 00496 * @param aValue unsigned short representation of the unsignedShort. 00497 * @return The unsignedShort Item. 00498 */ 00499 virtual Item 00500 createUnsignedShort(unsigned short aValue) = 0; 00501 00502 00503 }; /* class ItemFactory */ 00504 00505 } /* namespace zorba */ 00506 #endif