xmlsrv_plat/cxml_library_api/inc/nw_wbxml_reader.h
changeset 27 450972dee096
equal deleted inserted replaced
23:740e860b8acf 27:450972dee096
       
     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 #warning The CXML API will be removed wk25. Please see http://wikis.in.nokia.com/Browser/APIMigration for more information
       
    19 
       
    20 /** ----------------------------------------------------------------------- **
       
    21     @package:     NW_WBXML
       
    22 
       
    23     @synopsis:    default
       
    24 
       
    25     @description: Wbxml token definitions
       
    26 
       
    27  ** ----------------------------------------------------------------------- **/
       
    28 
       
    29 /* ----------------------------------------------------------------------- **
       
    30   Definitions for the WBXML parser's reader
       
    31 ** ----------------------------------------------------------------------- **/
       
    32 
       
    33 #ifndef NW_PARSER_WBXML_READER_H
       
    34 #define NW_PARSER_WBXML_READER_H
       
    35 
       
    36 #include <xml/cxml/cxml_proj.h>
       
    37 #include <xml/cxml/nw_wbxml_document.h>
       
    38 #include <xml/cxml/nw_wbxml_opaque.h>
       
    39 #include <xml/cxml/nw_wbxml_parse.h>
       
    40 
       
    41 #ifdef __cplusplus
       
    42 extern "C" {
       
    43 #endif /* __cplusplus */
       
    44 
       
    45 
       
    46 /* The "parser-reader" interface */
       
    47 
       
    48 /** ----------------------------------------------------------------------- **
       
    49     @function:    NW_WBXML_Parser_advance
       
    50 
       
    51     @synopsis:    Advance parser.
       
    52 
       
    53     @scope:       public
       
    54 
       
    55     @parameters:
       
    56        [in-out] NW_WBXML_Parser_t parser* parser
       
    57                   The parser.
       
    58 
       
    59        [in] NW_Int32 count
       
    60                   Amount to advance the parser.
       
    61 
       
    62     @description: Safely advance the parser through bytecode. The functions
       
    63                   which read values from the parser don't advance the parser
       
    64                   since this may not be necessary or safe (e.g. when reading
       
    65                   the last data item.).
       
    66 
       
    67     @returns:     NW_Int32
       
    68                   Amount advanced or -1 if out of range.
       
    69 
       
    70  ** ----------------------------------------------------------------------- **/
       
    71 NW_Int32 
       
    72 NW_WBXML_Parser_advance (NW_WBXML_Parser_t* parser, 
       
    73                          NW_Int32 count);
       
    74 
       
    75 
       
    76 /** ----------------------------------------------------------------------- **
       
    77     @function:    NW_WBXML_Parser_hasMoreBytecode
       
    78 
       
    79     @synopsis:    Check if there is more NW_Byte code to read.
       
    80     @scope:       public
       
    81 
       
    82     @parameters:
       
    83        [in] NW_WBXML_Parser_t* parser
       
    84                   The parser.
       
    85 
       
    86     @description: Check if there is more NW_Byte code to read.
       
    87 
       
    88     @returns:     NW_Int32
       
    89                   1 if more left otherwise 0.
       
    90 
       
    91  ** ----------------------------------------------------------------------- **/
       
    92 NW_Int32 
       
    93 NW_WBXML_Parser_hasMoreBytecode (NW_WBXML_Parser_t* parser);
       
    94 
       
    95 
       
    96 /** ----------------------------------------------------------------------- **
       
    97     @function:    NW_WBXML_Parser_readUint8
       
    98 
       
    99     @synopsis:    Read 8 bit unsigned integer.
       
   100 
       
   101     @scope:       public
       
   102 
       
   103     @parameters:
       
   104        [in-out] NW_WBXML_Parser_t* parser
       
   105                   The parser.
       
   106 
       
   107     @description: Read 8 bit unsigned integer.
       
   108 
       
   109     @returns:     NW_Uint8
       
   110                   The integer.
       
   111 
       
   112  ** ----------------------------------------------------------------------- **/
       
   113 NW_Uint8 
       
   114 NW_WBXML_Parser_readUint8 (NW_WBXML_Parser_t* parser);
       
   115 
       
   116 
       
   117 /** ----------------------------------------------------------------------- **
       
   118     @function:    NW_WBXML_Parser_readMbUint32
       
   119 
       
   120     @synopsis:    Read 32 bit unsigned integer.
       
   121 
       
   122     @scope:       public
       
   123 
       
   124     @parameters:
       
   125        [in-out] NW_WBXML_Parser_t* parser
       
   126                   The parser.
       
   127 
       
   128        [in] NW_Uint32* val
       
   129                   The value.
       
   130 
       
   131     @description: Read 32 bit unsigned integer.
       
   132 
       
   133     @returns:     NW_Int32
       
   134                   Number of bytes read or -1 if failed..
       
   135 
       
   136  ** ----------------------------------------------------------------------- **/
       
   137 NW_Int32 
       
   138 NW_WBXML_Parser_readMbUint32 (NW_WBXML_Parser_t* parser, 
       
   139                               NW_Uint32* val);
       
   140 
       
   141 
       
   142 /** ----------------------------------------------------------------------- **
       
   143     @function:    NW_WBXML_Parser_getInlineStrLen
       
   144 
       
   145     @synopsis:    Get inline string length.
       
   146 
       
   147     @scope:       public
       
   148 
       
   149     @parameters:
       
   150        [in] NW_WBXML_Parser_t* parser
       
   151                   The parser.
       
   152 
       
   153        [in] NW_WBXML_Document_t* doc
       
   154                   The document.
       
   155 
       
   156     @description: Safely get the length of an inline string at current 
       
   157                   parser position.
       
   158 
       
   159     @returns:     NW_Int32
       
   160                   Number of bytes read or -1 if failed.
       
   161 
       
   162  ** ----------------------------------------------------------------------- **/
       
   163 NW_Int32 
       
   164 NW_WBXML_Parser_getInlineStrLen (NW_WBXML_Parser_t* parser, 
       
   165                                  NW_WBXML_Document_t* doc);
       
   166 
       
   167 
       
   168 /** ----------------------------------------------------------------------- **
       
   169     @function:    NW_WBXML_Parser_getStringInline
       
   170 
       
   171     @synopsis:    Get inline string.
       
   172 
       
   173     @scope:       public
       
   174 
       
   175     @parameters:
       
   176        [in-out] NW_WBXML_Parser_t* parser
       
   177                   The parser.
       
   178 
       
   179        [in] NW_WBXML_Document_t* doc
       
   180                   The document.
       
   181 
       
   182        [out] NW_String_t* s
       
   183                   The returned string.default
       
   184 
       
   185     @description: Safely read an inline string at the current parser position.
       
   186 
       
   187     @returns:     NW_Status_t
       
   188                   Status of operation.
       
   189 
       
   190        [NW_STAT_SUCCESS]
       
   191                   String read.
       
   192 
       
   193        [NW_STAT_WBXML_ERROR_BYTECODE]
       
   194                   Read error.
       
   195 
       
   196  ** ----------------------------------------------------------------------- **/
       
   197 IMPORT_C NW_Status_t
       
   198 NW_WBXML_Parser_getStringInline(NW_WBXML_Parser_t* parser,
       
   199                                 NW_WBXML_Document_t* doc,
       
   200                                 NW_String_t* s);
       
   201 
       
   202 
       
   203 /** ----------------------------------------------------------------------- **
       
   204     @function:    NW_WBXML_Parser_getOpaque
       
   205 
       
   206     @synopsis:    Get opaque.
       
   207 
       
   208     @scope:       public
       
   209 
       
   210     @parameters:
       
   211        [in-out] NW_WBXML_Parser_t* parser
       
   212                   The parser.
       
   213 
       
   214        [in] NW_Uint32 length
       
   215                   Maximum nuber of bytes to read.
       
   216 
       
   217        [out] NW_WBXML_Opaque_t* o
       
   218                   Opaque storage.
       
   219 
       
   220     @description: Safely get an opaque at the current parser position.
       
   221 
       
   222     @returns:     NW_Status_t
       
   223                   Status of operation.
       
   224 
       
   225        [NW_STAT_SUCCESS]
       
   226                   Always returns success.
       
   227 
       
   228  ** ----------------------------------------------------------------------- **/
       
   229 IMPORT_C NW_Status_t
       
   230 NW_WBXML_Parser_getOpaque(NW_WBXML_Parser_t* parser, 
       
   231                           NW_Uint32 length, 
       
   232                           NW_WBXML_Opaque_t* o);
       
   233 
       
   234 
       
   235 /** ----------------------------------------------------------------------- **
       
   236     @function:    NW_WBXML_Parser_readStringTable
       
   237 
       
   238     @synopsis:    Read string table.
       
   239 
       
   240     @scope:       public
       
   241 
       
   242     @parameters:
       
   243        [in-out] NW_WBXML_Parser_t* parser
       
   244                   The parser.
       
   245 
       
   246        [in] NW_WBXML_Document_t* doc
       
   247                   The document.
       
   248 
       
   249        [out] NW_Byte** table
       
   250                   The loaded table.
       
   251 
       
   252     @description: Read in the string table.
       
   253 
       
   254     @returns:     NW_Status_t
       
   255                   Status of operation.
       
   256 
       
   257        [NW_STAT_SUCCESS]
       
   258                   String table read.
       
   259 
       
   260        [NW_STAT_WBXML_ERROR_BYTECODE]
       
   261                   Read error.
       
   262 
       
   263  ** ----------------------------------------------------------------------- **/
       
   264 NW_Status_t
       
   265 NW_WBXML_Parser_readStringTable(NW_WBXML_Parser_t* parser, 
       
   266                                 NW_WBXML_Document_t* doc,
       
   267                                 NW_Byte** table); 
       
   268 
       
   269 
       
   270 #ifdef __cplusplus
       
   271 } /* extern "C" { */
       
   272 #endif /* __cplusplus */
       
   273 
       
   274 #endif  /* NW_PARSER_WBXML_READER_H */