2000-05-15 19:29:11 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
2003-06-03 20:58:22 +00:00
|
|
|
* Copyright (C) 2000-2003, International Business Machines
|
2000-05-15 19:29:11 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* File reslist.h
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 02/21/00 weiv Creation.
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RESLIST_H
|
|
|
|
#define RESLIST_H
|
|
|
|
|
2003-09-24 00:26:23 +00:00
|
|
|
#define KEY_SPACE_SIZE 65536
|
2000-07-10 20:20:05 +00:00
|
|
|
#define RESLIST_MAX_INT_VECTOR 2048
|
2000-05-15 19:29:11 +00:00
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/ures.h"
|
|
|
|
#include "unicode/ustring.h"
|
|
|
|
#include "uresdata.h"
|
|
|
|
#include "cmemory.h"
|
|
|
|
#include "cstring.h"
|
|
|
|
#include "unewdata.h"
|
2003-08-26 02:36:57 +00:00
|
|
|
#include "ustr.h"
|
2000-05-15 19:29:11 +00:00
|
|
|
|
2001-09-25 19:28:25 +00:00
|
|
|
U_CDECL_BEGIN
|
|
|
|
|
2000-05-15 19:29:11 +00:00
|
|
|
/* Resource bundle root table */
|
|
|
|
struct SRBRoot {
|
|
|
|
char *fLocale;
|
2003-09-24 00:26:23 +00:00
|
|
|
int32_t fKeyPoint;
|
2000-05-15 19:29:11 +00:00
|
|
|
char *fKeys;
|
2003-09-24 17:52:44 +00:00
|
|
|
int32_t fKeysCapacity;
|
2000-05-15 19:29:11 +00:00
|
|
|
int32_t fCount;
|
2003-09-24 00:26:23 +00:00
|
|
|
struct SResource *fRoot;
|
|
|
|
int32_t fMaxTableLength;
|
2000-05-15 19:29:11 +00:00
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SRBRoot *bundle_open(const struct UString* comment, UErrorCode *status);
|
2002-07-17 03:56:50 +00:00
|
|
|
void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status);
|
2002-03-16 03:40:05 +00:00
|
|
|
|
|
|
|
/* write a java resource file */
|
2002-07-10 20:30:56 +00:00
|
|
|
void bundle_write_java(struct SRBRoot *bundle, const char *outputDir, const char* outputEnc, char *writtenFilename,
|
|
|
|
int writtenFilenameLen, const char* packageName, const char* bundleName, UErrorCode *status);
|
2002-03-16 03:40:05 +00:00
|
|
|
|
2002-10-10 01:05:51 +00:00
|
|
|
/* write a xml resource file */
|
2003-05-20 00:50:45 +00:00
|
|
|
/* commented by Jing*/
|
|
|
|
/* void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc,
|
|
|
|
char *writtenFilename, int writtenFilenameLen,UErrorCode *status); */
|
|
|
|
|
|
|
|
/* added by Jing*/
|
|
|
|
void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc, const char* rbname,
|
|
|
|
char *writtenFilename, int writtenFilenameLen, const char* language, const char* package, UErrorCode *status);
|
2002-10-10 01:05:51 +00:00
|
|
|
|
2000-05-15 19:29:11 +00:00
|
|
|
void bundle_close(struct SRBRoot *bundle, UErrorCode *status);
|
|
|
|
void bundle_setlocale(struct SRBRoot *bundle, UChar *locale, UErrorCode *status);
|
2003-09-24 00:26:23 +00:00
|
|
|
int32_t bundle_addtag(struct SRBRoot *bundle, const char *tag, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
|
|
|
|
/* Various resource types */
|
2003-12-02 03:03:23 +00:00
|
|
|
struct SResource* res_open(const struct UString* comment, UErrorCode* status);
|
2000-05-15 19:29:11 +00:00
|
|
|
|
|
|
|
struct SResTable {
|
2003-09-24 17:52:44 +00:00
|
|
|
uint32_t fCount;
|
2000-05-15 19:29:11 +00:00
|
|
|
uint32_t fChildrenSize;
|
|
|
|
struct SResource *fFirst;
|
|
|
|
struct SRBRoot *fRoot;
|
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource* table_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void table_close(struct SResource *table, UErrorCode *status);
|
2001-07-11 20:31:32 +00:00
|
|
|
void table_add(struct SResource *table, struct SResource *res, int linenumber, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
|
|
|
|
struct SResArray {
|
|
|
|
uint32_t fCount;
|
|
|
|
uint32_t fChildrenSize;
|
|
|
|
struct SResource *fFirst;
|
|
|
|
struct SResource *fLast;
|
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource* array_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void array_close(struct SResource *array, UErrorCode *status);
|
|
|
|
void array_add(struct SResource *array, struct SResource *res, UErrorCode *status);
|
|
|
|
|
|
|
|
struct SResString {
|
|
|
|
uint32_t fLength;
|
|
|
|
UChar *fChars;
|
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource *string_open(struct SRBRoot *bundle, char *tag, const UChar *value, int32_t len, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void string_close(struct SResource *string, UErrorCode *status);
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource *alias_open(struct SRBRoot *bundle, char *tag, UChar *value, int32_t len, const struct UString* comment, UErrorCode *status);
|
2002-06-14 06:01:13 +00:00
|
|
|
void alias_close(struct SResource *string, UErrorCode *status);
|
|
|
|
|
2000-05-15 19:29:11 +00:00
|
|
|
struct SResIntVector {
|
|
|
|
uint32_t fCount;
|
|
|
|
uint32_t *fArray;
|
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource* intvector_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void intvector_close(struct SResource *intvector, UErrorCode *status);
|
|
|
|
void intvector_add(struct SResource *intvector, int32_t value, UErrorCode *status);
|
|
|
|
|
|
|
|
struct SResInt {
|
|
|
|
uint32_t fValue;
|
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource *int_open(struct SRBRoot *bundle, char *tag, int32_t value, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void int_close(struct SResource *intres, UErrorCode *status);
|
|
|
|
|
|
|
|
struct SResBinary {
|
|
|
|
uint32_t fLength;
|
|
|
|
uint8_t *fData;
|
2002-10-10 01:05:51 +00:00
|
|
|
char* fFileName; /* file name for binary or import binary tags if any */
|
2000-05-15 19:29:11 +00:00
|
|
|
};
|
|
|
|
|
2003-08-26 02:36:57 +00:00
|
|
|
struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t length, uint8_t *data, const char* fileName, const struct UString* comment, UErrorCode *status);
|
2000-05-15 19:29:11 +00:00
|
|
|
void bin_close(struct SResource *binres, UErrorCode *status);
|
|
|
|
|
|
|
|
/* Resource place holder */
|
|
|
|
|
|
|
|
struct SResource {
|
|
|
|
UResType fType;
|
2003-09-24 00:26:23 +00:00
|
|
|
int32_t fKey;
|
2000-05-15 19:29:11 +00:00
|
|
|
uint32_t fSize; /* Size in bytes outside the header part */
|
2001-07-11 20:31:32 +00:00
|
|
|
int line; /* used internally to report duplicate keys in tables */
|
2000-05-15 19:29:11 +00:00
|
|
|
struct SResource *fNext; /*This is for internal chaining while building*/
|
2003-08-26 02:36:57 +00:00
|
|
|
struct UString *fComment;
|
2000-05-15 19:29:11 +00:00
|
|
|
union {
|
|
|
|
struct SResTable fTable;
|
|
|
|
struct SResArray fArray;
|
|
|
|
struct SResString fString;
|
|
|
|
struct SResIntVector fIntVector;
|
|
|
|
struct SResInt fIntValue;
|
|
|
|
struct SResBinary fBinaryValue;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
void res_close(struct SResource *res, UErrorCode *status);
|
2001-11-03 02:54:08 +00:00
|
|
|
void setIncludeCopyright(UBool val);
|
2002-03-22 18:57:09 +00:00
|
|
|
UBool getIncludeCopyright(void);
|
2000-05-15 19:29:11 +00:00
|
|
|
|
2001-09-25 19:28:25 +00:00
|
|
|
U_CDECL_END
|
2000-05-15 19:29:11 +00:00
|
|
|
#endif /* #ifndef RESLIST_H */
|