summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/tools/genrb/ustr.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /intl/icu/source/tools/genrb/ustr.h
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'intl/icu/source/tools/genrb/ustr.h')
-rw-r--r--intl/icu/source/tools/genrb/ustr.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/intl/icu/source/tools/genrb/ustr.h b/intl/icu/source/tools/genrb/ustr.h
new file mode 100644
index 0000000000..8a69e9d4d5
--- /dev/null
+++ b/intl/icu/source/tools/genrb/ustr.h
@@ -0,0 +1,81 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 1998-2012, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+*
+* File ustr.h
+*
+* Modification History:
+*
+* Date Name Description
+* 05/28/99 stephen Creation.
+*******************************************************************************
+*/
+
+#ifndef USTR_H
+#define USTR_H 1
+
+#include "unicode/utypes.h"
+
+#define U_APPEND_CHAR32(c,target,len) UPRV_BLOCK_MACRO_BEGIN { \
+ if (c <= 0xffff) \
+ { \
+ *(target)++ = (UChar) c; \
+ len=1; \
+ } \
+ else \
+ { \
+ target[0] = U16_LEAD(c); \
+ target[1] = U16_TRAIL(c); \
+ len=2; \
+ target +=2; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+#define U_APPEND_CHAR32_ONLY(c,target) UPRV_BLOCK_MACRO_BEGIN { \
+ if (c <= 0xffff) \
+ { \
+ *(target)++ = (UChar) c; \
+ } \
+ else \
+ { \
+ target[0] = U16_LEAD(c); \
+ target[1] = U16_TRAIL(c); \
+ target +=2; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+/* A C representation of a string "object" (to avoid realloc all the time) */
+struct UString {
+ UChar *fChars;
+ int32_t fLength;
+ int32_t fCapacity;
+};
+
+U_CFUNC void ustr_init(struct UString *s);
+
+U_CFUNC void
+ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status);
+
+U_CFUNC void ustr_deinit(struct UString *s);
+
+U_CFUNC void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status);
+
+U_CFUNC void ustr_cpy(struct UString *dst, const struct UString *src,
+ UErrorCode *status);
+
+U_CFUNC void ustr_cat(struct UString *dst, const struct UString *src,
+ UErrorCode *status);
+
+U_CFUNC void ustr_ncat(struct UString *dst, const struct UString *src,
+ int32_t n, UErrorCode *status);
+
+U_CFUNC void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status);
+U_CFUNC void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status);
+U_CFUNC void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status);
+#endif