| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bfba66d commit 2d7e0b6
419 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -418,9 +418,9 @@ The externally maintained libraries used by Node.js are: | |||
| 418 | 418 | # Copyright (c) 2013 International Business Machines Corporation | |
| 419 | 419 | # and others. All Rights Reserved. | |
| 420 | 420 | # | |
| 421 | - # Project: http://code.google.com/p/lao-dictionary/ | ||
| 422 | - # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt | ||
| 423 | - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt | ||
| 421 | + # Project: https://github.com/veer66/lao-dictionary | ||
| 422 | + # Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt | ||
| 423 | + # License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt | ||
| 424 | 424 | # (copied below) | |
| 425 | 425 | # | |
| 426 | 426 | # This file is derived from the above dictionary, with slight | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -284,9 +284,9 @@ property of their respective owners. | |||
| 284 | 284 | # Copyright (c) 2013 International Business Machines Corporation | |
| 285 | 285 | # and others. All Rights Reserved. | |
| 286 | 286 | # | |
| 287 | - # Project: http://code.google.com/p/lao-dictionary/ | ||
| 288 | - # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt | ||
| 289 | - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt | ||
| 287 | + # Project: https://github.com/veer66/lao-dictionary | ||
| 288 | + # Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt | ||
| 289 | + # License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt | ||
| 290 | 290 | # (copied below) | |
| 291 | 291 | # | |
| 292 | 292 | # This file is derived from the above dictionary, with slight | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,8 @@ | |||
| 1 | 1 | ICU sources - auto generated by shrink-icu-src.py | |
| 2 | 2 | ||
| 3 | 3 | This directory contains the ICU subset used by --with-intl=full-icu | |
| 4 | - It is a strict subset of ICU 67 source files with the following exception(s): | ||
| 5 | - * deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file | ||
| 4 | + It is a strict subset of ICU 68 source files with the following exception(s): | ||
| 5 | + * deps/icu-small/source/data/in/icudt68l.dat.bz2 : compressed data file | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | To rebuild this directory, see ../../tools/icu/README.md | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + # © 2020 and later: Unicode, Inc. and others. | ||
| 2 | + # License & terms of use: http://www.unicode.org/copyright.html | ||
| 3 | + | ||
| 4 | + --- | ||
| 5 | + Language: Cpp | ||
| 6 | + BasedOnStyle: LLVM | ||
| 7 | + IndentWidth: 4 | ||
| 8 | + ColumnLimit: 105 | ||
| 9 | + AllowShortBlocksOnASingleLine: false | ||
| 10 | + AllowShortIfStatementsOnASingleLine: true | ||
| 11 | + ... | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,7 +101,7 @@ class BMPSet : public UMemory { | |||
| 101 | 101 | */ | |
| 102 | 102 | UBool latin1Contains[0x100]; | |
| 103 | 103 | ||
| 104 | - /* TRUE if contains(U+FFFD). */ | ||
| 104 | + /* true if contains(U+FFFD). */ | ||
| 105 | 105 | UBool containsFFFD; | |
| 106 | 106 | ||
| 107 | 107 | /* | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ class LanguageBreakEngine : public UMemory { | |||
| 54 | 54 | * a particular kind of break.</p> | |
| 55 | 55 | * | |
| 56 | 56 | * @param c A character which begins a run that the engine might handle | |
| 57 | - * @return TRUE if this engine handles the particular character and break | ||
| 57 | + * @return true if this engine handles the particular character and break | ||
| 58 | 58 | * type. | |
| 59 | 59 | */ | |
| 60 | 60 | virtual UBool handles(UChar32 c) const = 0; | |
@@ -171,7 +171,7 @@ class UnhandledEngine : public LanguageBreakEngine { | |||
| 171 | 171 | * a particular kind of break.</p> | |
| 172 | 172 | * | |
| 173 | 173 | * @param c A character which begins a run that the engine might handle | |
| 174 | - * @return TRUE if this engine handles the particular character and break | ||
| 174 | + * @return true if this engine handles the particular character and break | ||
| 175 | 175 | * type. | |
| 176 | 176 | */ | |
| 177 | 177 | virtual UBool handles(UChar32 c) const; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,9 +45,9 @@ class U_COMMON_API ByteSinkUtil { | |||
| 45 | 45 | static UBool appendUnchanged(const uint8_t *s, int32_t length, | |
| 46 | 46 | ByteSink &sink, uint32_t options, Edits *edits, | |
| 47 | 47 | UErrorCode &errorCode) { | |
| 48 | - if (U_FAILURE(errorCode)) { return FALSE; } | ||
| 48 | + if (U_FAILURE(errorCode)) { return false; } | ||
| 49 | 49 | if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); } | |
| 50 | - return TRUE; | ||
| 50 | + return true; | ||
| 51 | 51 | } | |
| 52 | 52 | ||
| 53 | 53 | static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ | |||
| 20 | 20 | #include "cmemory.h" | |
| 21 | 21 | #include "cstring.h" | |
| 22 | 22 | #include "uinvchar.h" | |
| 23 | + #include "ustr_imp.h" | ||
| 23 | 24 | ||
| 24 | 25 | U_NAMESPACE_BEGIN | |
| 25 | 26 | ||
@@ -46,6 +47,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const { | |||
| 46 | 47 | return p; | |
| 47 | 48 | } | |
| 48 | 49 | ||
| 50 | + int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const { | ||
| 51 | + if (U_FAILURE(errorCode)) { return len; } | ||
| 52 | + if (capacity < 0 || (capacity > 0 && dest == nullptr)) { | ||
| 53 | + errorCode = U_ILLEGAL_ARGUMENT_ERROR; | ||
| 54 | + return len; | ||
| 55 | + } | ||
| 56 | + const char *src = buffer.getAlias(); | ||
| 57 | + if (0 < len && len <= capacity && src != dest) { | ||
| 58 | + uprv_memcpy(dest, src, len); | ||
| 59 | + } | ||
| 60 | + return u_terminateChars(dest, capacity, len, &errorCode); | ||
| 61 | + } | ||
| 62 | + | ||
| 49 | 63 | CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) { | |
| 50 | 64 | if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) { | |
| 51 | 65 | len=s.len; | |
@@ -197,7 +211,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) { | |||
| 197 | 211 | } | |
| 198 | 212 | char c; | |
| 199 | 213 | if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { | |
| 200 | - append(U_FILE_SEP_CHAR, errorCode); | ||
| 214 | + append(getDirSepChar(), errorCode); | ||
| 201 | 215 | } | |
| 202 | 216 | append(s, errorCode); | |
| 203 | 217 | return *this; | |
@@ -207,9 +221,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) { | |||
| 207 | 221 | char c; | |
| 208 | 222 | if(U_SUCCESS(errorCode) && len>0 && | |
| 209 | 223 | (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { | |
| 210 | - append(U_FILE_SEP_CHAR, errorCode); | ||
| 224 | + append(getDirSepChar(), errorCode); | ||
| 211 | 225 | } | |
| 212 | 226 | return *this; | |
| 213 | 227 | } | |
| 214 | 228 | ||
| 229 | + char CharString::getDirSepChar() const { | ||
| 230 | + char dirSepChar = U_FILE_SEP_CHAR; | ||
| 231 | + #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) | ||
| 232 | + // We may need to return a different directory separator when building for Cygwin or MSYS2. | ||
| 233 | + if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR)) | ||
| 234 | + dirSepChar = U_FILE_ALT_SEP_CHAR; | ||
| 235 | + #endif | ||
| 236 | + return dirSepChar; | ||
| 237 | + } | ||
| 238 | + | ||
| 215 | 239 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory { | |||
| 87 | 87 | * The caller must uprv_free() the result. | |
| 88 | 88 | */ | |
| 89 | 89 | char *cloneData(UErrorCode &errorCode) const; | |
| 90 | + /** | ||
| 91 | + * Copies the contents of the string into dest. | ||
| 92 | + * Checks if there is enough space in dest, extracts the entire string if possible, | ||
| 93 | + * and NUL-terminates dest if possible. | ||
| 94 | + * | ||
| 95 | + * If the string fits into dest but cannot be NUL-terminated (length()==capacity), | ||
| 96 | + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. | ||
| 97 | + * If the string itself does not fit into dest (length()>capacity), | ||
| 98 | + * then the error code is set to U_BUFFER_OVERFLOW_ERROR. | ||
| 99 | + * | ||
| 100 | + * @param dest Destination string buffer. | ||
| 101 | + * @param capacity Size of the dest buffer (number of chars). | ||
| 102 | + * @param errorCode ICU error code. | ||
| 103 | + * @return length() | ||
| 104 | + */ | ||
| 105 | + int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; | ||
| 90 | 106 | ||
| 91 | 107 | bool operator==(StringPiece other) const { | |
| 92 | 108 | return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); | |
@@ -141,13 +157,13 @@ class U_COMMON_API CharString : public UMemory { | |||
| 141 | 157 | ||
| 142 | 158 | /** | |
| 143 | 159 | * Appends a filename/path part, e.g., a directory name. | |
| 144 | - * First appends a U_FILE_SEP_CHAR if necessary. | ||
| 160 | + * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. | ||
| 145 | 161 | * Does nothing if s is empty. | |
| 146 | 162 | */ | |
| 147 | 163 | CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); | |
| 148 | 164 | ||
| 149 | 165 | /** | |
| 150 | - * Appends a U_FILE_SEP_CHAR if this string is not empty | ||
| 166 | + * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty | ||
| 151 | 167 | * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. | |
| 152 | 168 | */ | |
| 153 | 169 | CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); | |
@@ -160,6 +176,12 @@ class U_COMMON_API CharString : public UMemory { | |||
| 160 | 176 | ||
| 161 | 177 | CharString(const CharString &other); // forbid copying of this class | |
| 162 | 178 | CharString &operator=(const CharString &other); // forbid copying of this class | |
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found. | ||
| 182 | + * Otherwise returns U_FILE_SEP_CHAR. | ||
| 183 | + */ | ||
| 184 | + char getDirSepChar() const; | ||
| 163 | 185 | }; | |
| 164 | 186 | ||
| 165 | 187 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,55 @@ | |||
| 1 | + // © 2020 and later: Unicode, Inc. and others. | ||
| 2 | + // License & terms of use: http://www.unicode.org/copyright.html | ||
| 3 | + | ||
| 4 | + // charstrmap.h | ||
| 5 | + // created: 2020sep01 Frank Yung-Fong Tang | ||
| 6 | + | ||
| 7 | + #ifndef __CHARSTRMAP_H__ | ||
| 8 | + #define __CHARSTRMAP_H__ | ||
| 9 | + | ||
| 10 | + #include <utility> | ||
| 11 | + #include "unicode/utypes.h" | ||
| 12 | + #include "unicode/uobject.h" | ||
| 13 | + #include "uhash.h" | ||
| 14 | + | ||
| 15 | + U_NAMESPACE_BEGIN | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * Map of const char * keys & values. | ||
| 19 | + * Stores pointers as is: Does not own/copy/adopt/release strings. | ||
| 20 | + */ | ||
| 21 | + class CharStringMap final : public UMemory { | ||
| 22 | + public: | ||
| 23 | + /** Constructs an unusable non-map. */ | ||
| 24 | + CharStringMap() : map(nullptr) {} | ||
| 25 | + CharStringMap(int32_t size, UErrorCode &errorCode) { | ||
| 26 | + map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, | ||
| 27 | + size, &errorCode); | ||
| 28 | + } | ||
| 29 | + CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) { | ||
| 30 | + other.map = nullptr; | ||
| 31 | + } | ||
| 32 | + CharStringMap(const CharStringMap &other) = delete; | ||
| 33 | + ~CharStringMap() { | ||
| 34 | + uhash_close(map); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT { | ||
| 38 | + map = other.map; | ||
| 39 | + other.map = nullptr; | ||
| 40 | + return *this; | ||
| 41 | + } | ||
| 42 | + CharStringMap &operator=(const CharStringMap &other) = delete; | ||
| 43 | + | ||
| 44 | + const char *get(const char *key) const { return static_cast<const char *>(uhash_get(map, key)); } | ||
| 45 | + void put(const char *key, const char *value, UErrorCode &errorCode) { | ||
| 46 | + uhash_put(map, const_cast<char *>(key), const_cast<char *>(value), &errorCode); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + private: | ||
| 50 | + UHashtable *map; | ||
| 51 | + }; | ||
| 52 | + | ||
| 53 | + U_NAMESPACE_END | ||
| 54 | + | ||
| 55 | + #endif // __CHARSTRMAP_H__ | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments