xml/cxmllibrary/src/dom/include/nw_dom_wbxmltypes.h
branchRCL_3
changeset 33 604ca70b6235
parent 32 889504eac4fb
child 40 80a0ad972c63
equal deleted inserted replaced
32:889504eac4fb 33:604ca70b6235
     1 /*
       
     2 * Copyright (c) 2000 - 2001 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /** ----------------------------------------------------------------------- **
       
    20     @package:     NW_DOM
       
    21 
       
    22     @synopsis:    default
       
    23 
       
    24     @description: default
       
    25 
       
    26  ** ----------------------------------------------------------------------- **/
       
    27 #ifndef NW_DOM_WBXML_TYPES_H
       
    28 #define NW_DOM_WBXML_TYPES_H
       
    29 
       
    30 #include <xml/cxml/cxml_proj.h>
       
    31 #include <xml/cxml/nw_dom_node.h>
       
    32 
       
    33 #ifdef __cplusplus
       
    34 extern "C"
       
    35 {
       
    36 #endif /* __cplusplus */
       
    37 
       
    38 
       
    39 /** ----------------------------------------------------------------------- **
       
    40     @typedef:     NW_DOM_Extension
       
    41 
       
    42     @synopsis:    Tiny Dom Extension.
       
    43 
       
    44     @scope:       public
       
    45      
       
    46     @type:        NW_TinyDom_Extension_t
       
    47 
       
    48     @description: 
       
    49                   Tiny Dom Extension.
       
    50 
       
    51  ** ----------------------------------------------------------------------- **/
       
    52 typedef NW_TinyDom_Extension_t NW_DOM_Extension_t;
       
    53 
       
    54 
       
    55 /** ----------------------------------------------------------------------- **
       
    56     @typedef:     NW_DOM_Opaque
       
    57 
       
    58     @synopsis:    Opaque DOM type.
       
    59 
       
    60     @scope:       public
       
    61      
       
    62     @type:        NW_WBXML_Opaque_t
       
    63 
       
    64     @description: 
       
    65                   Opaque DOM type.
       
    66 
       
    67  ** ----------------------------------------------------------------------- **/
       
    68 typedef NW_WBXML_Opaque_t NW_DOM_Opaque_t;
       
    69 
       
    70 
       
    71 /* * Extension **/
       
    72 
       
    73 /** ----------------------------------------------------------------------- **
       
    74     @function:    NW_DOM_Extension_new
       
    75 
       
    76     @synopsis:    Creates and initializes a new extension with a given 
       
    77                   token and string.
       
    78 
       
    79     @scope:       public
       
    80 
       
    81     @parameters:
       
    82        [in] NW_Uint32 token
       
    83                   Initialize with this token.
       
    84 
       
    85        [in] NW_String_t* str
       
    86                   Extension label.
       
    87 
       
    88     @description: Creates and initializes a new extension with a given 
       
    89                   token and string.
       
    90 
       
    91     @returns:     NW_DOM_Extension_t*
       
    92                   New extension.
       
    93 
       
    94  ** ----------------------------------------------------------------------- **/
       
    95 NW_DOM_Extension_t*
       
    96 NW_DOM_Extension_new(NW_Uint32 token, NW_String_t* str);
       
    97 
       
    98 
       
    99 /** ----------------------------------------------------------------------- **
       
   100     @function:    NW_DOM_Extension_initialize
       
   101 
       
   102     @synopsis:    Initializes an extension with a token and string.
       
   103 
       
   104     @scope:       public
       
   105 
       
   106     @parameters:
       
   107        [in-out] NW_DOM_Extension_t* ext
       
   108                   The extension.
       
   109 
       
   110        [in] NW_Uint32 token
       
   111                   Initialize with this token.
       
   112 
       
   113        [in] NW_String_t* str
       
   114                   Extension label.
       
   115 
       
   116     @description: Initializes an extension with a token and string.
       
   117 
       
   118     @returns:     NW_Status_t
       
   119                   Result of operation.
       
   120 
       
   121        [NW_STAT_SUCCESS]
       
   122                   Always returns success.
       
   123 
       
   124  ** ----------------------------------------------------------------------- **/
       
   125 NW_Status_t
       
   126 NW_DOM_Extension_initialize(NW_DOM_Extension_t* ext, 
       
   127                             NW_Uint32 token, 
       
   128                             NW_String_t* str);
       
   129 
       
   130 
       
   131 /** ----------------------------------------------------------------------- **
       
   132     @function:    NW_DOM_Extension_getString
       
   133 
       
   134     @synopsis:    Get string associated with this extension.
       
   135 
       
   136     @scope:       public
       
   137 
       
   138     @parameters:
       
   139        [in] NW_DOM_Extension_t* e
       
   140                   This extension.
       
   141 
       
   142        [out] NW_String_t* str
       
   143                   String for extension.
       
   144 
       
   145     @description: Get string associated with this extension.
       
   146 
       
   147     @returns:     NW_Status_t
       
   148                   Result of operation.
       
   149 
       
   150        [NW_STAT_SUCCESS]
       
   151                   Always returns success.
       
   152 
       
   153  ** ----------------------------------------------------------------------- **/
       
   154 NW_Status_t
       
   155 NW_DOM_Extension_getString(NW_DOM_Extension_t* e, 
       
   156                            NW_String_t* str);
       
   157 
       
   158 
       
   159 /** ----------------------------------------------------------------------- **
       
   160     @function:    NW_DOM_Extension_getToken
       
   161 
       
   162     @synopsis:    Returns token of extension.
       
   163 
       
   164     @scope:       public
       
   165 
       
   166     @parameters:
       
   167        [in] NW_DOM_Extension_t* e
       
   168                   This extension.
       
   169 
       
   170     @description: Returns token of extension.
       
   171 
       
   172     @returns:     NW_Uint32
       
   173                   Token or null if error.
       
   174 
       
   175  ** ----------------------------------------------------------------------- **/
       
   176 NW_Uint32
       
   177 NW_DOM_Extension_getToken(NW_DOM_Extension_t* e);
       
   178 
       
   179 
       
   180 /** ----------------------------------------------------------------------- **
       
   181     @function:    NW_DOM_Extension_delete
       
   182 
       
   183     @synopsis:    Deletes this extension.
       
   184 
       
   185     @scope:       public
       
   186 
       
   187     @parameters:
       
   188        [in-out] NW_DOM_Extension_t* e
       
   189                   This extension.
       
   190 
       
   191     @description: Deletes this extension.
       
   192 
       
   193     @returns:     NW_Status_t
       
   194                   Result of operation.
       
   195 
       
   196        [NW_STAT_SUCCESS]
       
   197                   Always returns success.
       
   198 
       
   199  ** ----------------------------------------------------------------------- **/
       
   200 NW_Status_t
       
   201 NW_DOM_Extension_delete(NW_DOM_Extension_t* e);
       
   202 
       
   203 
       
   204 /** ----------------------------------------------------------------------- **
       
   205     @function:    NW_DOM_Opaque_new
       
   206 
       
   207     @synopsis:    Creates a new Opaque type with a given data and length.
       
   208 
       
   209     @scope:       public
       
   210 
       
   211     @parameters:
       
   212        [in] NW_Uint32 length
       
   213                   Length of data block.
       
   214 
       
   215        [in] NW_Byte* data
       
   216                   Data block.
       
   217 
       
   218     @description: Creates a new Opaque type with a given data and length.
       
   219 
       
   220     @returns:     NW_DOM_Opaque_t*
       
   221                   New opaque object.
       
   222 
       
   223  ** ----------------------------------------------------------------------- **/
       
   224 NW_DOM_Opaque_t*
       
   225 NW_DOM_Opaque_new(NW_Uint32 length, NW_Byte* data);
       
   226 
       
   227 
       
   228 /** ----------------------------------------------------------------------- **
       
   229     @function:    NW_DOM_Opaque_initialize
       
   230 
       
   231     @synopsis:    Initializes an Opaque type with a given data and length.
       
   232 
       
   233     @scope:       public
       
   234 
       
   235     @parameters:
       
   236        [in-out] NW_DOM_Opaque_t* o
       
   237                   The opaque object.
       
   238 
       
   239        [in] NW_Uint32 length
       
   240                   Length of data block.
       
   241 
       
   242        [in] NW_Byte* data
       
   243                   Data block.
       
   244 
       
   245     @description: Initializes an Opaque type with a given data and length.
       
   246 
       
   247     @returns:     NW_Status_t
       
   248                   default
       
   249 
       
   250        [NW_STAT_SUCCESS]
       
   251                   Always returns success.
       
   252 
       
   253  ** ----------------------------------------------------------------------- **/
       
   254 NW_Status_t 
       
   255 NW_DOM_Opaque_initialize(NW_DOM_Opaque_t* o, 
       
   256                          NW_Uint32 length, 
       
   257                          NW_Byte* data);
       
   258 
       
   259 
       
   260 /** ----------------------------------------------------------------------- **
       
   261     @function:    NW_DOM_Opaque_getLength
       
   262 
       
   263     @synopsis:    Returns length of opaque data.
       
   264 
       
   265     @scope:       public
       
   266 
       
   267     @parameters:
       
   268        [in] NW_DOM_Opaque_t* opaque
       
   269                   This opaque object.
       
   270 
       
   271     @description: Returns length of opaque data.
       
   272 
       
   273     @returns:     NW_Uint32
       
   274                   Length of data.
       
   275 
       
   276  ** ----------------------------------------------------------------------- **/
       
   277 NW_Uint32
       
   278 NW_DOM_Opaque_getLength(NW_DOM_Opaque_t* opaque);
       
   279 
       
   280 
       
   281 /** ----------------------------------------------------------------------- **
       
   282     @function:    NW_DOM_Opaque_getData
       
   283 
       
   284     @synopsis:    Returns data from opaque.
       
   285 
       
   286     @scope:       public
       
   287 
       
   288     @parameters:
       
   289        [in] NW_DOM_Opaque_t* opaque
       
   290                   This opaque object.
       
   291 
       
   292     @description: Returns data from opaque.
       
   293 
       
   294     @returns:     NW_Byte*
       
   295                   Opaque data.
       
   296 
       
   297  ** ----------------------------------------------------------------------- **/
       
   298 NW_Byte*
       
   299 NW_DOM_Opaque_getData(NW_DOM_Opaque_t* opaque);
       
   300 
       
   301 
       
   302 /** ----------------------------------------------------------------------- **
       
   303     @function:    NW_DOM_Opaque_delete
       
   304 
       
   305     @synopsis:    Delete this opaque object.
       
   306 
       
   307     @scope:       public
       
   308 
       
   309     @parameters:
       
   310        [in] NW_DOM_Opaque_t* opaque
       
   311                   This opaque object.
       
   312 
       
   313     @description: Delete this opaque object. Frees memory for data.
       
   314 
       
   315     @returns:     NW_Status_t
       
   316                   Result of operation.
       
   317 
       
   318        [NW_STAT_SUCCESS]
       
   319                   Always returns success.
       
   320 
       
   321  ** ----------------------------------------------------------------------- **/
       
   322 NW_Status_t 
       
   323 NW_DOM_Opaque_delete(NW_DOM_Opaque_t* opaque);
       
   324 
       
   325 
       
   326 /** ----------------------------------------------------------------------- **
       
   327     @function:    NW_DOM_Opaque_getUserOwnsData
       
   328 
       
   329     @synopsis:    Determines if user owns data storage and can deallocate it.
       
   330 
       
   331     @scope:       public
       
   332 
       
   333     @parameters:
       
   334        [in] NW_DOM_Opaque_t* opaque
       
   335                   This opaque object.
       
   336 
       
   337     @description: Determines if user owns data storage and can deallocate it.
       
   338 
       
   339     @returns:     NW_Bool
       
   340                   NW_TRUE if user owns data storage and can deallocate it, 
       
   341                   otherwise NW_FALSE.
       
   342 
       
   343  ** ----------------------------------------------------------------------- **/
       
   344 NW_Bool
       
   345 NW_DOM_Opaque_getUserOwnsData(NW_DOM_Opaque_t* opaque);
       
   346 
       
   347 
       
   348 /** ----------------------------------------------------------------------- **
       
   349     @function:    NW_DOM_Opaque_setUserOwnsData
       
   350 
       
   351     @synopsis:    Set user ownership flag on opaque data.
       
   352 
       
   353     @scope:       public
       
   354 
       
   355     @parameters:
       
   356        [in-out] NW_DOM_Opaque_t* opaque
       
   357                   This opaque object.
       
   358 
       
   359     @description: Set user ownership flag on opaque data.
       
   360 
       
   361     @returns:     NW_Status_t
       
   362                    Result of operation.
       
   363 
       
   364        [NW_STAT_SUCCESS]
       
   365                   Always returns success.
       
   366 
       
   367  ** ----------------------------------------------------------------------- **/
       
   368 NW_Status_t
       
   369 NW_DOM_Opaque_setUserOwnsData(NW_DOM_Opaque_t* opaque);
       
   370 
       
   371 /*
       
   372 combined WBXML attribute value and text components
       
   373 */
       
   374 
       
   375 typedef enum NW_WbxmlComponent_e {
       
   376   NW_WBXML_ATTRIBUTE_VALUE_COMPONENT,
       
   377   NW_WBXML_TEXT_COMPONENT
       
   378 } NW_WbxmlComponent_t;
       
   379 
       
   380 NW_Status_t
       
   381 NW_DOM_WbxmlComponent_setType(NW_WbxmlComponent_t AttributeValueOrText,
       
   382                               NW_TinyDom_AttrVal_t* pV,
       
   383                               NW_Uint32 type);
       
   384 
       
   385 NW_Status_t
       
   386 NW_DOM_WbxmlComponent_initFromString(NW_TinyDom_AttrVal_t* pV,
       
   387                                      NW_String_t * pString);
       
   388 
       
   389 NW_Status_t
       
   390 NW_DOM_WbxmlComponent_initFromEntity(NW_TinyDom_AttrVal_t* pV,
       
   391                                      NW_Uint32 entity);
       
   392 
       
   393 NW_Status_t
       
   394 NW_DOM_WbxmlComponent_initFromExtension(NW_TinyDom_AttrVal_t* val,
       
   395                                         NW_Uint16 token,
       
   396                                         NW_String_t* str);
       
   397 NW_Status_t
       
   398 NW_DOM_WbxmlComponent_initFromExtensionInt(NW_TinyDom_AttrVal_t* val,
       
   399                                            NW_Uint16 token,
       
   400                                            NW_Uint32 x);
       
   401 NW_Status_t
       
   402 NW_DOM_WbxmlComponent_initFromOpaque(NW_TinyDom_AttrVal_t* pV,
       
   403                                      NW_Uint32 byteCount,
       
   404                                      NW_Uint8* pData);
       
   405 NW_Status_t
       
   406 NW_DOM_WbxmlComponent_initFromToken(NW_TinyDom_AttrVal_t* pV,
       
   407                                     NW_Uint32 token);
       
   408 
       
   409 NW_Uint32
       
   410 NW_DOM_WbxmlComponent_getEntity(NW_TinyDom_AttrVal_t* pV);
       
   411 
       
   412 NW_Status_t
       
   413 NW_DOM_WbxmlComponent_getString(NW_TinyDom_AttrVal_t* pV,
       
   414                                 NW_String_t* pString);
       
   415 
       
   416 NW_Status_t
       
   417 NW_DOM_WbxmlComponent_getExtensionToken(NW_TinyDom_AttrVal_t* val,
       
   418                                         NW_Uint16* pToken);
       
   419 
       
   420 NW_Uint16
       
   421 NW_DOM_WbxmlComponent_getExtension(NW_TinyDom_AttrVal_t* val,
       
   422                                    NW_String_t* str);
       
   423 
       
   424 NW_Status_t
       
   425 NW_DOM_WbxmlComponent_getExtensionInt(NW_TinyDom_AttrVal_t* val,
       
   426                                       NW_Uint32* x);
       
   427 NW_Uint8*
       
   428 NW_DOM_WbxmlComponent_getOpaque(NW_TinyDom_AttrVal_t* pV,
       
   429                                 NW_Uint32 *pOpaqueByteCount);
       
   430 
       
   431 NW_Uint16
       
   432 NW_DOM_WbxmlComponent_getToken(NW_TinyDom_AttrVal_t* pV);
       
   433 
       
   434 NW_Status_t
       
   435 NW_DOM_WbxmlComponent_toString(NW_TinyDom_AttrVal_t* pV,
       
   436                                NW_String_t *string,
       
   437                                NW_Uint32 encoding);
       
   438 
       
   439 /* converts an entire component sequence (via iterator on text or attrval) to string
       
   440 
       
   441 returns either NW_STAT_SUCCESS or NW_STAT_DOM_NO_STRING_RETURNED if something fails */
       
   442 NW_Status_t
       
   443 NW_DOM_WbxmlComponent_sequenceToString(NW_WbxmlComponent_t AttributeValueOrText,
       
   444                                        NW_TinyDom_AttributeHandle_t* pIterator,
       
   445                                        NW_Uint32 encoding,
       
   446                                        NW_String_t* pOutString);
       
   447 
       
   448 /* NW_Status_t NW_DOM_WbxmlComponent_[text|attribute]NextValue(pIterator, pV)
       
   449 returns status NW_STAT_WBXML_ITERATE_MORE or NW_STAT_WBXML_ITERATE_DONE and fills in
       
   450 *pV if returns NW_STAT_WBXML_ITERATE_MORE */
       
   451 #define NW_DOM_WbxmlComponent_textNextValue(pIterator, pV) \
       
   452 ((NW_TinyDom_TextHandle_iterate((pIterator), (pV)) == 0)? NW_STAT_WBXML_ITERATE_DONE : NW_STAT_WBXML_ITERATE_MORE)
       
   453 
       
   454 #define NW_DOM_WbxmlComponent_attributeNextValue(pIterator, pV) \
       
   455 ((NW_TinyDom_AttributeHandle_iterateValues((pIterator), (pV)) == 0)? NW_STAT_WBXML_ITERATE_DONE : NW_STAT_WBXML_ITERATE_MORE)
       
   456 
       
   457 
       
   458 #ifdef __cplusplus
       
   459 } // extern "C" {
       
   460 #endif /* __cplusplus */
       
   461 
       
   462 #endif  /* NW_DOM_WBXML_TYPES_H */