web_plat/cxml_library_api/inc/nw_encoder_domencoder.h
changeset 0 dd21522fd290
child 26 cb62a4f66ebe
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2000 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_Encoder
       
    21 
       
    22     @synopsis:    default
       
    23 
       
    24     @description: default
       
    25 
       
    26  ** ----------------------------------------------------------------------- **/
       
    27 #ifndef _NW_ENCODER_WRITER_HEADER_GUARD_
       
    28 #define _NW_ENCODER_WRITER_HEADER_GUARD_
       
    29 
       
    30 #include "nw_encoder_stringtable.h"
       
    31 #include "nw_encoder_wbxmlwriter.h"
       
    32 #include "nw_dom_attribute.h"
       
    33 #include "nw_dom_element.h"
       
    34 #include "nw_dom_text.h"
       
    35 #include "nw_dom_document.h"
       
    36 
       
    37 #ifdef __cplusplus
       
    38 extern "C"
       
    39 {
       
    40 #endif /* __cplusplus */
       
    41 
       
    42 
       
    43 #define MEMORY_INCREMENT 100
       
    44 
       
    45 /** ----------------------------------------------------------------------- **
       
    46     @struct:      NW_Encoder_Encoder
       
    47 
       
    48     @synopsis:    Encoder structure.
       
    49 
       
    50     @scope:       public
       
    51     @variables:
       
    52        NW_WBXML_Writer_t writer
       
    53                   The writer.
       
    54 
       
    55        NW_Uint32 encoding
       
    56                   Current encoding.
       
    57 
       
    58        NW_Encoder_StringTable_t* table
       
    59                   The string table.
       
    60 
       
    61     @description: Encoder structure.
       
    62  ** ----------------------------------------------------------------------- **/
       
    63 typedef struct NW_Encoder_Encoder_s{
       
    64   NW_WBXML_Writer_t writer;
       
    65   NW_Uint32 encoding;
       
    66   NW_Encoder_StringTable_t* stringTable;
       
    67   /* Some servers (for example, Wireless Villiage Oz as of January 2003)
       
    68      don't parse the string table references so this switch controls use of
       
    69      the string table during WBXML generation.  Set TRUE for normal WBXML.
       
    70      Set FALSE to prevent building a string table. */
       
    71   NW_Bool enableStringTable;
       
    72 } NW_Encoder_Encoder_t;
       
    73 
       
    74 /* Deprecated - here for backward compatibility */
       
    75 typedef struct NW_Encoder_Encoder_s NW_Encoder_t;
       
    76 
       
    77 
       
    78 /** ----------------------------------------------------------------------- **
       
    79     @function:    NW_Encoder_encodeWBXML
       
    80 
       
    81     @synopsis:    Encodes the document represented by the given
       
    82                   NW_DOM_DocumentNode_t.
       
    83 
       
    84     @scope:       public
       
    85 
       
    86     @parameters:
       
    87        [in] NW_Encoder_Encoder_t* encoder
       
    88                   The encoder.
       
    89 
       
    90        [in] NW_DOM_DocumentNode_t* docNode
       
    91                   Document node for the document to be encoded.
       
    92 
       
    93        [in] NW_Bool enableStringTableUse
       
    94                   Set to TRUE for normal WBXML.
       
    95                   Set to FALSE to prevent use of the string table.
       
    96 
       
    97        [out] NW_Uint32* length
       
    98                   Length of the encoded buffer.
       
    99 
       
   100        [out] NW_Byte** buffer
       
   101                   The encoded buffer.
       
   102 
       
   103     @description: Encodes the document represented by the given
       
   104                   NW_DOM_DocumentNode_t.
       
   105 
       
   106     @returns:     NW_Status_t
       
   107                   Status of operation.
       
   108 
       
   109        [NW_STAT_SUCCESS]
       
   110                   Document encoded.
       
   111 
       
   112        [NW_STAT_BAD_INPUT_PARAM]
       
   113                   Required parameter is NULL.
       
   114 
       
   115        [NW_STAT_OUT_OF_MEMORY]
       
   116                   Memory could not be allocated for buffer.
       
   117 
       
   118        [NW_STAT_DOM_NODE_TYPE_ERR]
       
   119                   Internal error.
       
   120 
       
   121  ** ----------------------------------------------------------------------- **/
       
   122 IMPORT_C NW_Status_t
       
   123 NW_Encoder_encodeWBXML(NW_Encoder_Encoder_t* encoder,
       
   124                        NW_DOM_DocumentNode_t* docNode,
       
   125                        NW_Bool enableStringTableUse,
       
   126                        NW_Uint32* length,
       
   127                        NW_Byte** buffer);
       
   128 
       
   129 #ifdef __cplusplus
       
   130 } /* extern "C" { */
       
   131 #endif /* __cplusplus */
       
   132 
       
   133 #endif