intl/icu/source/tools/toolutil/unewdata.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/tools/toolutil/unewdata.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,111 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1999-2010, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  unewdata.h
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 1999oct25
    1.17 +*   created by: Markus W. Scherer
    1.18 +*/
    1.19 +
    1.20 +#ifndef __UNEWDATA_H__
    1.21 +#define __UNEWDATA_H__
    1.22 +
    1.23 +#include "unicode/utypes.h"
    1.24 +#include "unicode/udata.h"
    1.25 +
    1.26 +/* API for writing data -----------------------------------------------------*/
    1.27 +
    1.28 +/** @memo Forward declaration of the data memory creation type. */
    1.29 +typedef struct UNewDataMemory UNewDataMemory;
    1.30 +
    1.31 +/**
    1.32 + * Create a new binary data file.
    1.33 + * The file-writing <code>udata_</code> functions facilitate writing
    1.34 + * binary data files that can be read by ICU's <code>udata</code> API.
    1.35 + * This function opens a new file with a filename determined from its
    1.36 + * parameters - of the form "name.type".
    1.37 + * It then writes a short header, followed by the <code>UDataInfo</code>
    1.38 + * structure and, optionally, by the comment string.
    1.39 + * It then writes padding bytes to round up to a multiple of 16 bytes.
    1.40 + * Subsequent write operations will thus start at an offset in the file
    1.41 + * that is a multiple of 16. <code>udata_getMemory()</code> will return
    1.42 + * a pointer to this same starting offset.
    1.43 + *
    1.44 + * See udata.h .
    1.45 + *
    1.46 + * @param dir A string that specifies the directory where the data will be
    1.47 + *            written. If <code>NULL</code>, then
    1.48 + *            <code>u_getDataDirectory</code> is used.
    1.49 + * @param type A string that specifies the type of data to be written.
    1.50 + *             For example, resource bundles are written with type "res",
    1.51 + *             conversion tables with type "cnv".
    1.52 + *             This may be <code>NULL</code> or empty.
    1.53 + * @param name A string that specifies the name of the data.
    1.54 + * @param pInfo A pointer to a correctly filled <code>UDataInfo</code>
    1.55 + *              structure that will be copied into the file.
    1.56 + * @param comment A string (e.g., a copyright statement) that will be
    1.57 + *                copied into the file if it is not <code>NULL</code>
    1.58 + *                or empty. This string serves only as a comment in the binary
    1.59 + *                file. It will not be accessible by any API.
    1.60 + * @param pErrorCode An ICU UErrorCode parameter. It must not be <code>NULL</code>.
    1.61 + */
    1.62 +U_CAPI UNewDataMemory * U_EXPORT2
    1.63 +udata_create(const char *dir, const char *type, const char *name,
    1.64 +             const UDataInfo *pInfo,
    1.65 +             const char *comment,
    1.66 +             UErrorCode *pErrorCode);
    1.67 +
    1.68 +/** @memo Close a newly written binary file. */
    1.69 +U_CAPI uint32_t U_EXPORT2
    1.70 +udata_finish(UNewDataMemory *pData, UErrorCode *pErrorCode);
    1.71 +
    1.72 +/** @memo Write a dummy data file. */
    1.73 +U_CAPI void U_EXPORT2
    1.74 +udata_createDummy(const char *dir, const char *type, const char *name, UErrorCode *pErrorCode);
    1.75 +
    1.76 +/** @memo Write an 8-bit byte to the file. */
    1.77 +U_CAPI void U_EXPORT2
    1.78 +udata_write8(UNewDataMemory *pData, uint8_t byte);
    1.79 +
    1.80 +/** @memo Write a 16-bit word to the file. */
    1.81 +U_CAPI void U_EXPORT2
    1.82 +udata_write16(UNewDataMemory *pData, uint16_t word);
    1.83 +
    1.84 +/** @memo Write a 32-bit word to the file. */
    1.85 +U_CAPI void U_EXPORT2
    1.86 +udata_write32(UNewDataMemory *pData, uint32_t wyde);
    1.87 +
    1.88 +/** @memo Write a block of bytes to the file. */
    1.89 +U_CAPI void U_EXPORT2
    1.90 +udata_writeBlock(UNewDataMemory *pData, const void *s, int32_t length);
    1.91 +
    1.92 +/** @memo Write a block of arbitrary padding bytes to the file. */
    1.93 +U_CAPI void U_EXPORT2
    1.94 +udata_writePadding(UNewDataMemory *pData, int32_t length);
    1.95 +
    1.96 +/** @memo Write a <code>char*</code> string of platform "invariant characters" to the file. */
    1.97 +U_CAPI void U_EXPORT2
    1.98 +udata_writeString(UNewDataMemory *pData, const char *s, int32_t length);
    1.99 +
   1.100 +/** @memo Write a <code>UChar*</code> string of Unicode character code units to the file. */
   1.101 +U_CAPI void U_EXPORT2
   1.102 +udata_writeUString(UNewDataMemory *pData, const UChar *s, int32_t length);
   1.103 +
   1.104 +
   1.105 +/*
   1.106 + * Hey, Emacs, please set the following:
   1.107 + *
   1.108 + * Local Variables:
   1.109 + * indent-tabs-mode: nil
   1.110 + * End:
   1.111 + *
   1.112 + */
   1.113 +
   1.114 +#endif

mercurial