xmlsrv_plat/cxml_library_api/inc/nw_string_string.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_String
       
    21 
       
    22     @synopsis:    default
       
    23 
       
    24     @description: default
       
    25 
       
    26  ** ----------------------------------------------------------------------- **/
       
    27 
       
    28 #ifndef NW_STRING_STRING_H
       
    29 #define NW_STRING_STRING_H
       
    30 
       
    31 #include <xml/cxml/cxml_proj.h>
       
    32 #include <xml/cxml/nw_string_char.h>
       
    33 
       
    34 #ifdef __cplusplus
       
    35 extern "C"
       
    36 {
       
    37 #endif /* __cplusplus */
       
    38 
       
    39 
       
    40 /** ----------------------------------------------------------------------- **
       
    41     @struct:      NW_String_String
       
    42 
       
    43     @synopsis:    The basic wbxml string type.
       
    44 
       
    45     @scope:       public
       
    46     @variables:
       
    47        NW_Uint32 length
       
    48                   In bytes.
       
    49 
       
    50        NW_Byte* storage
       
    51                   default
       
    52 
       
    53     @description: The basic wbxml string type.
       
    54  ** ----------------------------------------------------------------------- **/
       
    55 typedef struct NW_String_String_s{
       
    56   NW_Uint32 length;
       
    57   NW_Byte* storage;
       
    58 }NW_String_String_t;
       
    59 
       
    60 /* Deprecated - Left in for backward compatibility */
       
    61 typedef struct NW_String_String_s NW_String_t;
       
    62 
       
    63 typedef struct NW_String_String_s NW_String_UCS2String_t;
       
    64 
       
    65 /** ----------------------------------------------------------------------- **
       
    66     @function:    NW_String_new
       
    67 
       
    68     @synopsis:    Consructor.
       
    69 
       
    70     @scope:       public
       
    71 
       
    72     @description: Constructor.
       
    73 
       
    74     @returns:     NW_String_t*
       
    75                   New string or NULL if out of memory.
       
    76 
       
    77  ** ----------------------------------------------------------------------- **/
       
    78 IMPORT_C NW_String_t*
       
    79 NW_String_new (void);
       
    80 
       
    81 
       
    82 /** ----------------------------------------------------------------------- **
       
    83     @function:    NW_String_initialize
       
    84 
       
    85     @synopsis:    Initialize.
       
    86 
       
    87     @scope:       public
       
    88 
       
    89     @parameters:
       
    90        [in] NW_String_t* string
       
    91                   The string.
       
    92 
       
    93        [in] void* storage
       
    94                   The storage.
       
    95 
       
    96        [in] NW_Uint32 encoding
       
    97                   The encoding.
       
    98 
       
    99     @description: Initialize the string by assigning length, encoding 
       
   100                   and storage. Note that the length is calculated.
       
   101 
       
   102     @returns:     NW_Status_t
       
   103                   Status of operation.
       
   104 
       
   105        [NW_STAT_SUCCESS]
       
   106                   String initialized.
       
   107 
       
   108        [NW_STAT_FAILURE]
       
   109                   String not initialized.
       
   110 
       
   111        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   112                   Unsupported charset.
       
   113 
       
   114  ** ----------------------------------------------------------------------- **/
       
   115 IMPORT_C NW_Status_t 
       
   116 NW_String_initialize (NW_String_t* string, void *storage, NW_Uint32 encoding);
       
   117 
       
   118 
       
   119 /** ----------------------------------------------------------------------- **
       
   120     @function:    NW_String_delete
       
   121 
       
   122     @synopsis:    Delete.
       
   123 
       
   124     @scope:       public
       
   125 
       
   126     @parameters:
       
   127        [in-out] NW_String_t* string
       
   128                   The string.
       
   129 
       
   130     @description: Freeing a string may not free the storage. String storage 
       
   131                   is complicated by the fact that it can be allocated outside 
       
   132                   the bounds of the parser. If so, it is not freed here.
       
   133 
       
   134  ** ----------------------------------------------------------------------- **/
       
   135 IMPORT_C void 
       
   136 NW_String_delete(NW_String_t* string);
       
   137 
       
   138 
       
   139 /** ----------------------------------------------------------------------- **
       
   140     @function:    NW_String_getByteCount
       
   141 
       
   142     @synopsis:    Returns number of bytes in the string including NULL 
       
   143                   terminator.
       
   144 
       
   145     @scope:       public
       
   146 
       
   147     @parameters:
       
   148        [in] NW_String_t* string
       
   149                   The string.
       
   150 
       
   151     @description: Returns number of bytes in the string including NULL 
       
   152                   terminator.
       
   153 
       
   154     @returns:     NW_Uint16
       
   155                   Length in bytes.
       
   156 
       
   157  ** ----------------------------------------------------------------------- **/
       
   158 IMPORT_C NW_Uint32 
       
   159 NW_String_getByteCount (NW_String_t* string);
       
   160 
       
   161 
       
   162 /** ----------------------------------------------------------------------- **
       
   163     @function:    NW_String_getCharCount
       
   164 
       
   165     @synopsis:    Returns number of characters in the string excluding NULL 
       
   166                   terminator.
       
   167 
       
   168     @scope:       public
       
   169 
       
   170     @parameters:
       
   171        [in] NW_String_t* string
       
   172                   The string.
       
   173 
       
   174        [in] NW_Uint32 encoding
       
   175                   The encoding.
       
   176 
       
   177     @description: Returns number of characters in the string excluding NULL 
       
   178                   terminator.
       
   179 
       
   180     @returns:     NW_Uint16
       
   181                   Length of string in characters.
       
   182 
       
   183  ** ----------------------------------------------------------------------- **/
       
   184 IMPORT_C NW_Uint16 
       
   185 NW_String_getCharCount(NW_String_t* string, NW_Uint32 encoding);
       
   186 
       
   187 /* 
       
   188  * The following function is a duplication of NW_String_getByteCount to
       
   189  * handle big files.  For not affecting the components other than
       
   190  * browser, this function is only called inside the browser.).
       
   191  *
       
   192  * INSTEAD OF CALLING NW_String_getByteCount, ALL THE BROWSER CODES SHOULD
       
   193  * CALL THIS DUPLICATE FUNCTION TO GET CHARACTER COUNTS.
       
   194  * 
       
   195  */
       
   196 IMPORT_C NW_Uint32 
       
   197 NW_String_getCharCount32(NW_String_t* string, NW_Uint32 encoding);
       
   198 
       
   199 /** ----------------------------------------------------------------------- **
       
   200     @function:    NW_String_getStorage
       
   201 
       
   202     @synopsis:    Returns NULL or valid storage.
       
   203 
       
   204     @scope:       public
       
   205 
       
   206     @parameters:
       
   207        [in] NW_String_t* str
       
   208                   The string.
       
   209 
       
   210     @description: Returns the storage occupied by the string (in bytes).
       
   211 
       
   212     @returns:     NW_Byte*
       
   213                   String storage. 
       
   214 
       
   215  ** ----------------------------------------------------------------------- **/
       
   216 IMPORT_C NW_Byte*
       
   217 NW_String_getStorage(NW_String_t* str);
       
   218 
       
   219 
       
   220 /** ----------------------------------------------------------------------- **
       
   221     @function:    NW_String_equals
       
   222 
       
   223     @synopsis:    Determines if strings are equal.
       
   224 
       
   225     @scope:       public
       
   226 
       
   227     @parameters:
       
   228        [in] const NW_String_t* string1
       
   229                   The string.
       
   230 
       
   231        [in] const NW_String_t* string2
       
   232                   The other string.
       
   233 
       
   234     @description: This function assumes the encoding of each string is 
       
   235                   the same. It does not attempt to convert strings of 
       
   236                   different encodings because encoding is regarded as 
       
   237                   implicit for XML strings. NOte that if both string 
       
   238                   pointers are NULL thay are considered unequal. 
       
   239 
       
   240     @returns:     NW_Int32
       
   241                   1 if the strings are equal; otherwise 0.
       
   242 
       
   243  ** ----------------------------------------------------------------------- **/
       
   244 IMPORT_C NW_Int32 
       
   245 NW_String_equals(const NW_String_t* string1, const NW_String_t* string2);
       
   246 
       
   247 
       
   248 /** ----------------------------------------------------------------------- **
       
   249     @function:    NW_String_getUserOwnsStorage
       
   250 
       
   251     @synopsis:    Get user owns storage flag.
       
   252 
       
   253     @scope:       public
       
   254 
       
   255     @parameters:
       
   256        [in] NW_String_t* s
       
   257                   The string.
       
   258 
       
   259     @description: Get user owns storage flag. If the user owns the storage
       
   260                   it means that this string is the sole user of the storage
       
   261                   and can delete it when done.
       
   262 
       
   263     @returns:     NW_Bool
       
   264                   NW_TRUE if user owns storage, otherwise NW_FALSE.
       
   265 
       
   266  ** ----------------------------------------------------------------------- **/
       
   267 IMPORT_C NW_Bool
       
   268 NW_String_getUserOwnsStorage(NW_String_t* s);
       
   269 
       
   270 
       
   271 /** ----------------------------------------------------------------------- **
       
   272     @function:    NW_String_setUserOwnsStorage
       
   273 
       
   274     @synopsis:    Set user owns storage flag.
       
   275 
       
   276     @scope:       public
       
   277 
       
   278     @parameters:
       
   279        [in-out] NW_String_t* s
       
   280                   The string.
       
   281 
       
   282     @description: Set user owns storage flag. (see NW_String_getUserOwnsStorage)
       
   283 
       
   284     @returns:     NW_Status_t
       
   285                   Status of operation.
       
   286 
       
   287        [NW_STAT_SUCCESS]
       
   288                   Always returns success.
       
   289 
       
   290  ** ----------------------------------------------------------------------- **/
       
   291 IMPORT_C NW_Status_t
       
   292 NW_String_setUserOwnsStorage(NW_String_t* s);
       
   293 
       
   294 
       
   295 /** ----------------------------------------------------------------------- **
       
   296     @function:    NW_String_clearUserOwnsStorage
       
   297 
       
   298     @synopsis:    Clear user owns storage flag.
       
   299 
       
   300     @scope:       public
       
   301 
       
   302     @parameters:
       
   303        [in-out] NW_String_t* s
       
   304                   The string.
       
   305 
       
   306     @description: Clear user owns storage flag. This means that someone
       
   307                   else may own the storage.
       
   308 
       
   309     @returns:     NW_Status_t
       
   310                   Status of operation.
       
   311 
       
   312        [NW_STAT_SUCCESS]
       
   313                   Always returns success.
       
   314 
       
   315  ** ----------------------------------------------------------------------- **/
       
   316 IMPORT_C NW_Status_t
       
   317 NW_String_clearUserOwnsStorage(NW_String_t* s);
       
   318 
       
   319 /* ----------------------------------------------------------------------- **
       
   320    Conversion routines   
       
   321 ** ----------------------------------------------------------------------- **/
       
   322 
       
   323 /** ----------------------------------------------------------------------- **
       
   324     @function:    NW_String_stringToUCS2
       
   325 
       
   326     @synopsis:    Convert string to UCS2.
       
   327 
       
   328     @scope:       public
       
   329 
       
   330     @parameters:
       
   331        [out] NW_String_UCS2String_t** u
       
   332                   The converted string.
       
   333 
       
   334        [in] NW_String_t* string
       
   335                   The string to convert.
       
   336 
       
   337        [in] NW_Uint32 encoding
       
   338                   The encoding of the string to be converted
       
   339 
       
   340     @description: Converts a string of a given encoding to ucs2_char.
       
   341 
       
   342     @returns:     NW_Status_t
       
   343                   Status of operation.
       
   344 
       
   345        [NW_STAT_SUCCESS]
       
   346                   String converted.
       
   347 
       
   348        [NW_STAT_FAILURE]
       
   349                   String not converted.
       
   350 
       
   351        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   352                   Unsupported charset.
       
   353 
       
   354  ** ----------------------------------------------------------------------- **/
       
   355 NW_Status_t 
       
   356 NW_String_stringToUCS2(NW_String_UCS2String_t** u, NW_String_t* string, NW_Uint32 encoding);
       
   357 
       
   358 
       
   359 /** ----------------------------------------------------------------------- **
       
   360     @function:    NW_String_UCS2BuffToString
       
   361 
       
   362     @synopsis:    Convert UCS2 buffer to string.
       
   363 
       
   364     @scope:       public
       
   365 
       
   366     @parameters:
       
   367        [in] NW_String_UCS2Buff_t* u
       
   368                   Source of data to convert.
       
   369 
       
   370        [out] NW_String_t* string
       
   371                   The converted string.
       
   372 
       
   373        [in] NW_Uint32 encoding
       
   374                   default
       
   375 
       
   376     @description: Convert UCS2 buffer to string.
       
   377 
       
   378     @returns:     NW_Status_t
       
   379                   Status of operation.
       
   380 
       
   381        [NW_STAT_SUCCESS]
       
   382                   String converted.
       
   383 
       
   384        [NW_STAT_OUT_OFMEMORY]
       
   385                   Out of memory.
       
   386 
       
   387        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   388                   Unsupported charset.
       
   389 
       
   390  ** ----------------------------------------------------------------------- **/
       
   391 IMPORT_C NW_Status_t 
       
   392 NW_String_UCS2BuffToString(NW_String_UCS2Buff_t* u, NW_String_t* string, NW_Uint32 encoding);
       
   393 
       
   394 
       
   395 /** ----------------------------------------------------------------------- **
       
   396     @function:    NW_String_stringToUCS2Buff
       
   397 
       
   398     @synopsis:    Convert string to UCS2 buffer.
       
   399 
       
   400     @scope:       public
       
   401 
       
   402     @parameters:
       
   403        [in] NW_String_t* string
       
   404                   The string.
       
   405 
       
   406        [in] NW_Uint32 encoding
       
   407                   Initial encoding.
       
   408 
       
   409     @description: Convert a NW_String_t (in any of the supported character
       
   410                   set encodings) to a UCS2Buff string. Caller is responsible
       
   411                   for freeing the pointer returned by this function. Returned
       
   412                   array is null-terminated.
       
   413 
       
   414     @returns:     NW_String_UCS2Buff_t* 
       
   415                   USC2 buffer or NULL if it fails.
       
   416 
       
   417  ** ----------------------------------------------------------------------- **/
       
   418 NW_String_UCS2Buff_t* 
       
   419 NW_String_stringToUCS2Buff(NW_String_t* string, NW_Uint32 encoding);
       
   420 
       
   421 
       
   422 /** ----------------------------------------------------------------------- **
       
   423     @function:    NW_String_ucs2CharToString
       
   424 
       
   425     @synopsis:    Convert UCS2 characters to string.
       
   426     @scope:       public
       
   427 
       
   428     @parameters:
       
   429        [in-out] NW_String_t* string
       
   430                   The string.
       
   431 
       
   432        [in] NW_Ucs2* u
       
   433                   The characters to convert.
       
   434 
       
   435        [in] NW_Uint32 encoding
       
   436                   Target encoding.
       
   437 
       
   438     @description: Convert UCS2 characters to string.
       
   439 
       
   440     @returns:     NW_Status_t
       
   441                   The status of the operation.
       
   442 
       
   443        [NW_STAT_SUCCESS]
       
   444                   String filled with chars.
       
   445 
       
   446        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   447                   Unsupported encoding.
       
   448 
       
   449        [NW_STAT_OUT_OF_MEMORY]
       
   450                   String storage could not be allocated.
       
   451 
       
   452  ** ----------------------------------------------------------------------- **/
       
   453 IMPORT_C NW_Status_t 
       
   454 NW_String_ucs2CharToString (NW_String_t* string, NW_Ucs2* u, NW_Uint32 encoding);
       
   455 
       
   456 
       
   457 /** ----------------------------------------------------------------------- **
       
   458     @function:    NW_String_entityToString
       
   459 
       
   460     @synopsis:    Convert entity to string.
       
   461     @scope:       public
       
   462 
       
   463     @parameters:
       
   464        [in] NW_Uint32 entity
       
   465                   default
       
   466 
       
   467        [in-out] NW_String_t* str
       
   468                   The string.
       
   469 
       
   470        [in] NW_Uint32 encoding
       
   471                   Target encoding.
       
   472 
       
   473     @description: Convert entity to string.
       
   474 
       
   475     @returns:     NW_Status_t
       
   476                   The status of the operation.
       
   477 
       
   478        [NW_STAT_SUCCESS]
       
   479                   String initialized from entity.
       
   480 
       
   481        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   482                   Unsupported encoding.
       
   483 
       
   484        [NW_STAT_OUT_OF_MEMORY]
       
   485                   String storage could not be allocated.
       
   486 
       
   487  ** ----------------------------------------------------------------------- **/
       
   488 IMPORT_C NW_Status_t 
       
   489 NW_String_entityToString(NW_Uint32 entity, NW_String_t* str, NW_Uint32 encoding);
       
   490 
       
   491 
       
   492 /** ----------------------------------------------------------------------- **
       
   493     @function:    NW_String_byteToString
       
   494 
       
   495     @synopsis:    Convert byte array to string.
       
   496 
       
   497     @scope:       public
       
   498 
       
   499     @parameters:
       
   500        [in] NW_Byte* s
       
   501                   Bytes to initialize string with.
       
   502 
       
   503        [in-out] NW_String_t* str
       
   504                   The string.
       
   505 
       
   506        [in] NW_Uint32 encoding
       
   507                   The encoding.
       
   508 
       
   509     @description: Convert byte to string.
       
   510 
       
   511     @returns:     NW_Status_t
       
   512                   The status of the operation.
       
   513 
       
   514        [NW_STAT_SUCCESS]
       
   515                   String initialized from bytes.
       
   516 
       
   517        [NW_STAT_FAILURE]
       
   518                   String not initialized.
       
   519 
       
   520  ** ----------------------------------------------------------------------- **/
       
   521 NW_Status_t 
       
   522 NW_String_byteToString(NW_Byte* s, NW_String_t* str, NW_Uint32 encoding);
       
   523 
       
   524 
       
   525 /** ----------------------------------------------------------------------- **
       
   526     @function:    NW_String_tokenToString
       
   527 
       
   528     @synopsis:    Token to string.
       
   529 
       
   530     @scope:       public
       
   531 
       
   532     @parameters:
       
   533        [in] NW_Uint32 token
       
   534                   default
       
   535 
       
   536        [in-out] NW_String_t* str
       
   537                   The string.
       
   538 
       
   539        [in] NW_Uint32 encoding
       
   540                   default
       
   541 
       
   542     @description: Token to string.
       
   543 
       
   544     @returns:     NW_Status_t
       
   545                   Status of operation.
       
   546 
       
   547        [NW_STAT_SUCCESS]
       
   548                   String converted.
       
   549 
       
   550        [NW_STAT_FAILURE]
       
   551                   Token not found in current dictionary.
       
   552 
       
   553        [NW_STAT_OUT_OF_MEMORY]
       
   554                   Out of memory.
       
   555 
       
   556        [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED]
       
   557                   Unsupported charset.
       
   558 
       
   559  ** ----------------------------------------------------------------------- **/
       
   560 IMPORT_C NW_Status_t 
       
   561 NW_String_tokenToString(NW_Uint32 token, NW_String_t* str, NW_Uint32 encoding);
       
   562 
       
   563 /* ----------------------------------------------------------------------- **
       
   564    String manipulation functions
       
   565 ** ----------------------------------------------------------------------- **/
       
   566 
       
   567 
       
   568 /** ----------------------------------------------------------------------- **
       
   569     @function:    NW_String_copy
       
   570 
       
   571     @synopsis:    Copy string duplicating storage.
       
   572 
       
   573     @scope:       public
       
   574 
       
   575     @parameters:
       
   576        [out] NW_String_t* dest
       
   577                   The destination string.
       
   578 
       
   579        [in] NW_String_t* source
       
   580                   The source string.
       
   581 
       
   582     @description: If the source owns the storage (i.e. it can modify and/or 
       
   583                   delete it) than performs a deep copy. This duplicates the 
       
   584                   storage. Otherwise it performs a shallow copy.
       
   585 
       
   586     @returns:     NW_Status_t
       
   587                   Status of operation.
       
   588 
       
   589        [NW_STAT_SUCCESS]
       
   590                   String copied.
       
   591   
       
   592        [NW_STAT_OUT_OF_MEMORY]
       
   593                   Ran out of memory.
       
   594 
       
   595  ** ----------------------------------------------------------------------- **/
       
   596 NW_Status_t 
       
   597 NW_String_copy(NW_String_t* dest, NW_String_t* source);
       
   598 
       
   599 
       
   600 /** ----------------------------------------------------------------------- **
       
   601     @function:    NW_String_shallowCopy
       
   602 
       
   603     @synopsis:    Copies without duplicating storage.
       
   604 
       
   605     @scope:       public
       
   606 
       
   607     @parameters:
       
   608        [out] NW_String_t* dest
       
   609                   The destination string.
       
   610 
       
   611        [in] NW_String_t* source
       
   612                   The source string.
       
   613 
       
   614     @description: Performs a shallow copy. The storage is shared with 
       
   615                   the copy, not duplicated.
       
   616 
       
   617     @returns:     NW_Status_t
       
   618                   Status of operation.
       
   619 
       
   620        [NW_STAT_SUCCESS]
       
   621                   Always returns success.
       
   622 
       
   623  ** ----------------------------------------------------------------------- **/
       
   624 IMPORT_C NW_Status_t
       
   625 NW_String_shallowCopy(NW_String_t* dest, NW_String_t* source);
       
   626 
       
   627 
       
   628 /** ----------------------------------------------------------------------- **
       
   629     @function:    NW_String_deepCopy
       
   630 
       
   631     @synopsis:    Copy string duplicating storage.
       
   632 
       
   633     @scope:       public
       
   634 
       
   635     @parameters:
       
   636        [out] NW_String_t* dest
       
   637                   The destination string.
       
   638 
       
   639        [in] NW_String_t* source
       
   640                   The source string.
       
   641 
       
   642     @description: Performs a deep copy. The storage is duplicated so it 
       
   643                   is not shared with the original.
       
   644 
       
   645     @returns:     NW_Status_t
       
   646                   Status of operation.
       
   647 
       
   648        [NW_STAT_SUCCESS]
       
   649                   String copied.
       
   650   
       
   651        [NW_STAT_OUT_OF_MEMORY]
       
   652                   Ran out of memory.
       
   653 
       
   654  ** ----------------------------------------------------------------------- **/
       
   655 IMPORT_C NW_Status_t
       
   656 NW_String_deepCopy(NW_String_t* dest, NW_String_t* source);
       
   657 
       
   658 
       
   659 /** ----------------------------------------------------------------------- **
       
   660     @function:    NW_String_concatenate
       
   661 
       
   662     @synopsis:    Concatenates two strings together.
       
   663 
       
   664     @scope:       public
       
   665 
       
   666     @parameters:
       
   667        [in-out] NW_String_t* dest
       
   668                   The destination string.
       
   669 
       
   670        [in] NW_String_t* source
       
   671                   The source string.
       
   672 
       
   673        [in] NW_Uint32 encoding
       
   674                   Encoding both strings are assumed to have.
       
   675 
       
   676     @description: Concatenated two strings together.
       
   677 
       
   678     @returns:     NW_Status_t
       
   679                   Status of operation.
       
   680 
       
   681        [NW_STAT_SUCCESS]
       
   682                   String copied.
       
   683   
       
   684        [NW_STAT_OUT_OF_MEMORY]
       
   685                   Ran out of memory.
       
   686 
       
   687  ** ----------------------------------------------------------------------- **/
       
   688 IMPORT_C NW_Status_t
       
   689 NW_String_concatenate(NW_String_t* dest, NW_String_t* source, NW_Uint32 encoding);
       
   690 
       
   691 
       
   692 /** ----------------------------------------------------------------------- **
       
   693     @function:    NW_String_findChar
       
   694 
       
   695     @synopsis:    Finds char in string.
       
   696 
       
   697     @scope:       public
       
   698 
       
   699     @parameters:
       
   700        [in] NW_String_t* string
       
   701                   The string.
       
   702 
       
   703        [in] NW_Int32 character
       
   704                   Character to find.
       
   705 
       
   706     @description: Find char in string.
       
   707 
       
   708     @returns:     NW_Byte*
       
   709                   Pointer to character if found, otherwise NULL.
       
   710 
       
   711  ** ----------------------------------------------------------------------- **/
       
   712 NW_Byte*
       
   713 NW_String_findChar(NW_String_t* string, NW_Int32 character, NW_Uint32 encoding);
       
   714 
       
   715 
       
   716 /* ----------------------------------------------------------------------- **
       
   717    Functions
       
   718 ** ----------------------------------------------------------------------- **/
       
   719 
       
   720 /** ----------------------------------------------------------------------- **
       
   721     @function:    NW_String_ucs2CharInit
       
   722 
       
   723     @synopsis:    Initialize UCS2 characters.
       
   724 
       
   725     @scope:       public
       
   726 
       
   727     @parameters:
       
   728        [out] NW_Ucs2** data
       
   729                   Allocated storage.
       
   730 
       
   731        [in] NW_Uint32 length
       
   732                   The length.
       
   733 
       
   734     @description: Allocates enough storage to hold the specified number 
       
   735                   of characters.
       
   736 
       
   737     @returns:     NW_Status_t
       
   738                   Status of operation.
       
   739 
       
   740        [NW_STAT_SUCCESS]
       
   741                   String copied.
       
   742   
       
   743        [NW_STAT_OUT_OF_MEMORY]
       
   744                   Ran out of memory.
       
   745 
       
   746  ** ----------------------------------------------------------------------- **/
       
   747 NW_Status_t 
       
   748 NW_String_ucs2CharInit(NW_Ucs2** data, NW_Uint32 length);
       
   749 
       
   750 
       
   751 /** ----------------------------------------------------------------------- **
       
   752     @function:    NW_String_ucs2CharLength
       
   753 
       
   754     @synopsis:    Get character length.
       
   755 
       
   756     @scope:       public
       
   757 
       
   758     @parameters:
       
   759        [in] NW_Ucs2* data
       
   760                   Buffer to count.
       
   761 
       
   762     @description: Get character length.
       
   763 
       
   764     @returns:     NW_Int32
       
   765                   Length of buffer in characters.
       
   766 
       
   767  ** ----------------------------------------------------------------------- **/
       
   768 IMPORT_C NW_Int32 
       
   769 NW_String_ucs2CharLength (NW_Ucs2* data);
       
   770 
       
   771 
       
   772 /** ----------------------------------------------------------------------- **
       
   773     @function:    NW_String_byteToUCS2Char
       
   774 
       
   775     @synopsis:    Convert byte to UCS2 characters.
       
   776 
       
   777     @scope:       public
       
   778 
       
   779     @parameters:
       
   780        [in] NW_Byte* b
       
   781                   default
       
   782 
       
   783        [in] NW_Uint32 length
       
   784                   default
       
   785 
       
   786        [out] NW_Ucs2** data
       
   787                   default
       
   788 
       
   789     @description: Given an arbitrary NW_Byte array with no known character 
       
   790                   encoding, convert it to a NW_Ucs2 string. Actually it 
       
   791                   copies the bytes and assumes the source is UCS2 encoding. 
       
   792 
       
   793     @returns:     NW_Status_t
       
   794                   Status of operation.
       
   795 
       
   796        [NW_STAT_SUCCESS]
       
   797                   Bytes copied.
       
   798   
       
   799        [NW_STAT_OUT_OF_MEMORY]
       
   800                   Ran out of memory.
       
   801 
       
   802  ** ----------------------------------------------------------------------- **/
       
   803 IMPORT_C NW_Status_t
       
   804 NW_String_byteToUCS2Char (NW_Byte* b, NW_Uint32 length, NW_Ucs2** data);
       
   805 
       
   806 
       
   807 /** ----------------------------------------------------------------------- **
       
   808     @function:    NW_String_entityToUCS2Char
       
   809 
       
   810     @synopsis:    Convert entity to UCS2 character.
       
   811 
       
   812     @scope:       public
       
   813 
       
   814     @parameters:
       
   815        [in] NW_Uint32 entity
       
   816                   default
       
   817 
       
   818        [out] NW_Ucs2** data
       
   819                   default
       
   820 
       
   821     @description: Convert entity to UCS2 character.
       
   822 
       
   823     @returns:     NW_Status_t
       
   824                   Status of operation.
       
   825 
       
   826        [NW_STAT_SUCCESS]
       
   827                   Bytes copied.
       
   828   
       
   829        [NW_STAT_OUT_OF_MEMORY]
       
   830                   Ran out of memory.
       
   831 
       
   832  ** ----------------------------------------------------------------------- **/
       
   833 IMPORT_C NW_Status_t
       
   834 NW_String_entityToUCS2Char(NW_Uint32 entity, NW_Ucs2** data);
       
   835 
       
   836 /*
       
   837  * Given an arbitrary NW_Byte array with no known character encoding, 
       
   838  * convert it to a NW_Ucs2 string.
       
   839  *
       
   840  */
       
   841 /* Not used. 8/14/01 */
       
   842 /*
       
   843 NW_Status_t 
       
   844 NW_String_tokenToUCS2Char(NW_Uint32 token, NW_Ucs2** data);
       
   845 */
       
   846 
       
   847 /** ----------------------------------------------------------------------- **
       
   848     @function:    NW_String_stringToUCS2Char
       
   849 
       
   850     @synopsis:    default
       
   851 
       
   852     @scope:       public
       
   853 
       
   854     @parameters:
       
   855        [in] const string
       
   856                   default
       
   857 
       
   858        [in] NW_Uint32 encoding
       
   859                   default
       
   860 
       
   861        [out] NW_Ucs2 **data
       
   862                   default
       
   863 
       
   864     @description: default
       
   865 
       
   866     @returns:     NW_Status_t
       
   867                   Status of operation.
       
   868 
       
   869        [NW_STAT_SUCCESS]
       
   870                   Bytes copied.
       
   871   
       
   872        [NW_STAT_FAILURE]
       
   873                   No bytes to copy.
       
   874   
       
   875        [NW_STAT_OUT_OF_MEMORY]
       
   876                   Ran out of memory.
       
   877 
       
   878  ** ----------------------------------------------------------------------- **/
       
   879 IMPORT_C NW_Status_t 
       
   880 NW_String_stringToUCS2Char(const NW_String_t* string, NW_Uint32 encoding, NW_Ucs2 **data);
       
   881 
       
   882 /** ----------------------------------------------------------------------- **
       
   883     @function:    NW_String_deleteStorage
       
   884 
       
   885     @synopsis:    Delete storage.
       
   886 
       
   887     @scope:       public
       
   888 
       
   889     @parameters:
       
   890        [in-out] NW_String_t* s
       
   891                   The string.
       
   892 
       
   893     @description: Delete storage if user owns it otherwise does nothing.
       
   894 
       
   895     @returns:     NW_Status_t
       
   896                   Status of operation.
       
   897 
       
   898        [NW_STAT_SUCCESS]
       
   899                   Always returns success.
       
   900 
       
   901  ** ----------------------------------------------------------------------- **/
       
   902 IMPORT_C NW_Status_t
       
   903 NW_String_deleteStorage(NW_String_t* s);
       
   904 
       
   905 #ifdef __cplusplus
       
   906 } /*extern "C" { */
       
   907 #endif /* __cplusplus */
       
   908 
       
   909 #endif  /* NW_STRING_STRING_H */