aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/rbnf.cpp
diff options
context:
space:
mode:
authorromankoshelev <romankoshelev@yandex-team.com>2023-08-14 19:51:50 +0300
committerromankoshelev <romankoshelev@yandex-team.com>2023-08-15 01:24:11 +0300
commitcfcd865e05c0d0525ea27d1e153a043b32a85138 (patch)
tree68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/i18n/rbnf.cpp
parentccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff)
downloadydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/i18n/rbnf.cpp')
-rw-r--r--contrib/libs/icu/i18n/rbnf.cpp538
1 files changed, 269 insertions, 269 deletions
diff --git a/contrib/libs/icu/i18n/rbnf.cpp b/contrib/libs/icu/i18n/rbnf.cpp
index 7f54fd7a33..06599b4fd1 100644
--- a/contrib/libs/icu/i18n/rbnf.cpp
+++ b/contrib/libs/icu/i18n/rbnf.cpp
@@ -45,19 +45,19 @@
#define U_ICUDATA_RBNF U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "rbnf"
-static const UChar gPercentPercent[] =
+static const char16_t gPercentPercent[] =
{
0x25, 0x25, 0
}; /* "%%" */
// All urbnf objects are created through openRules, so we init all of the
// Unicode string constants required by rbnf, nfrs, or nfr here.
-static const UChar gLenientParse[] =
+static const char16_t gLenientParse[] =
{
0x25, 0x25, 0x6C, 0x65, 0x6E, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x70, 0x61, 0x72, 0x73, 0x65, 0x3A, 0
}; /* "%%lenient-parse:" */
-static const UChar gSemiColon = 0x003B;
-static const UChar gSemiPercent[] =
+static const char16_t gSemiColon = 0x003B;
+static const char16_t gSemiPercent[] =
{
0x3B, 0x25, 0
}; /* ";%" */
@@ -87,48 +87,48 @@ protected:
public:
LocalizationInfo() : refcount(0) {}
- LocalizationInfo* ref(void) {
+ LocalizationInfo* ref() {
++refcount;
return this;
}
- LocalizationInfo* unref(void) {
+ LocalizationInfo* unref() {
if (refcount && --refcount == 0) {
delete this;
}
- return NULL;
+ return nullptr;
}
virtual bool operator==(const LocalizationInfo* rhs) const;
inline bool operator!=(const LocalizationInfo* rhs) const { return !operator==(rhs); }
- virtual int32_t getNumberOfRuleSets(void) const = 0;
- virtual const UChar* getRuleSetName(int32_t index) const = 0;
- virtual int32_t getNumberOfDisplayLocales(void) const = 0;
- virtual const UChar* getLocaleName(int32_t index) const = 0;
- virtual const UChar* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const = 0;
+ virtual int32_t getNumberOfRuleSets() const = 0;
+ virtual const char16_t* getRuleSetName(int32_t index) const = 0;
+ virtual int32_t getNumberOfDisplayLocales() const = 0;
+ virtual const char16_t* getLocaleName(int32_t index) const = 0;
+ virtual const char16_t* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const = 0;
- virtual int32_t indexForLocale(const UChar* locale) const;
- virtual int32_t indexForRuleSet(const UChar* ruleset) const;
+ virtual int32_t indexForLocale(const char16_t* locale) const;
+ virtual int32_t indexForRuleSet(const char16_t* ruleset) const;
// virtual UClassID getDynamicClassID() const = 0;
-// static UClassID getStaticClassID(void);
+// static UClassID getStaticClassID();
};
LocalizationInfo::~LocalizationInfo() {}
//UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(LocalizationInfo)
-// if both strings are NULL, this returns TRUE
+// if both strings are nullptr, this returns true
static UBool
-streq(const UChar* lhs, const UChar* rhs) {
+streq(const char16_t* lhs, const char16_t* rhs) {
if (rhs == lhs) {
- return TRUE;
+ return true;
}
if (lhs && rhs) {
return u_strcmp(lhs, rhs) == 0;
}
- return FALSE;
+ return false;
}
bool
@@ -148,7 +148,7 @@ LocalizationInfo::operator==(const LocalizationInfo* rhs) const {
int32_t dlc = getNumberOfDisplayLocales();
if (dlc == rhs->getNumberOfDisplayLocales()) {
for (int i = 0; i < dlc; ++i) {
- const UChar* locale = getLocaleName(i);
+ const char16_t* locale = getLocaleName(i);
int32_t ix = rhs->indexForLocale(locale);
// if no locale, ix is -1, getLocaleName returns null, so streq returns false
if (!streq(locale, rhs->getLocaleName(ix))) {
@@ -168,7 +168,7 @@ LocalizationInfo::operator==(const LocalizationInfo* rhs) const {
}
int32_t
-LocalizationInfo::indexForLocale(const UChar* locale) const {
+LocalizationInfo::indexForLocale(const char16_t* locale) const {
for (int i = 0; i < getNumberOfDisplayLocales(); ++i) {
if (streq(locale, getLocaleName(i))) {
return i;
@@ -178,7 +178,7 @@ LocalizationInfo::indexForLocale(const UChar* locale) const {
}
int32_t
-LocalizationInfo::indexForRuleSet(const UChar* ruleset) const {
+LocalizationInfo::indexForRuleSet(const char16_t* ruleset) const {
if (ruleset) {
for (int i = 0; i < getNumberOfRuleSets(); ++i) {
if (streq(ruleset, getRuleSetName(i))) {
@@ -198,9 +198,9 @@ class VArray {
int32_t size;
Fn_Deleter deleter;
public:
- VArray() : buf(NULL), cap(0), size(0), deleter(NULL) {}
+ VArray() : buf(nullptr), cap(0), size(0), deleter(nullptr) {}
- VArray(Fn_Deleter del) : buf(NULL), cap(0), size(0), deleter(del) {}
+ VArray(Fn_Deleter del) : buf(nullptr), cap(0), size(0), deleter(del) {}
~VArray() {
if (deleter) {
@@ -225,12 +225,12 @@ public:
} else {
cap += 256;
}
- if (buf == NULL) {
+ if (buf == nullptr) {
buf = (void**)uprv_malloc(cap * sizeof(void*));
} else {
buf = (void**)uprv_realloc(buf, cap * sizeof(void*));
}
- if (buf == NULL) {
+ if (buf == nullptr) {
// if we couldn't realloc, we leak the memory we've already allocated, but we're in deep trouble anyway
status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -243,9 +243,9 @@ public:
}
}
- void** release(void) {
+ void** release() {
void** result = buf;
- buf = NULL;
+ buf = nullptr;
cap = 0;
size = 0;
return result;
@@ -255,14 +255,14 @@ public:
class LocDataParser;
class StringLocalizationInfo : public LocalizationInfo {
- UChar* info;
- UChar*** data;
+ char16_t* info;
+ char16_t*** data;
int32_t numRuleSets;
int32_t numLocales;
friend class LocDataParser;
- StringLocalizationInfo(UChar* i, UChar*** d, int32_t numRS, int32_t numLocs)
+ StringLocalizationInfo(char16_t* i, char16_t*** d, int32_t numRS, int32_t numLocs)
: info(i), data(d), numRuleSets(numRS), numLocales(numLocs)
{
}
@@ -271,14 +271,14 @@ public:
static StringLocalizationInfo* create(const UnicodeString& info, UParseError& perror, UErrorCode& status);
virtual ~StringLocalizationInfo();
- virtual int32_t getNumberOfRuleSets(void) const override { return numRuleSets; }
- virtual const UChar* getRuleSetName(int32_t index) const override;
- virtual int32_t getNumberOfDisplayLocales(void) const override { return numLocales; }
- virtual const UChar* getLocaleName(int32_t index) const override;
- virtual const UChar* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const override;
+ virtual int32_t getNumberOfRuleSets() const override { return numRuleSets; }
+ virtual const char16_t* getRuleSetName(int32_t index) const override;
+ virtual int32_t getNumberOfDisplayLocales() const override { return numLocales; }
+ virtual const char16_t* getLocaleName(int32_t index) const override;
+ virtual const char16_t* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const override;
// virtual UClassID getDynamicClassID() const;
-// static UClassID getStaticClassID(void);
+// static UClassID getStaticClassID();
private:
void init(UErrorCode& status) const;
@@ -298,48 +298,48 @@ enum {
* Utility for parsing a localization string and returning a StringLocalizationInfo*.
*/
class LocDataParser {
- UChar* data;
- const UChar* e;
- UChar* p;
- UChar ch;
+ char16_t* data;
+ const char16_t* e;
+ char16_t* p;
+ char16_t ch;
UParseError& pe;
UErrorCode& ec;
public:
LocDataParser(UParseError& parseError, UErrorCode& status)
- : data(NULL), e(NULL), p(NULL), ch(0xffff), pe(parseError), ec(status) {}
+ : data(nullptr), e(nullptr), p(nullptr), ch(0xffff), pe(parseError), ec(status) {}
~LocDataParser() {}
/*
* On a successful parse, return a StringLocalizationInfo*, otherwise delete locData, set perror and status,
- * and return NULL. The StringLocalizationInfo will adopt locData if it is created.
+ * and return nullptr. The StringLocalizationInfo will adopt locData if it is created.
*/
- StringLocalizationInfo* parse(UChar* data, int32_t len);
+ StringLocalizationInfo* parse(char16_t* data, int32_t len);
private:
- inline void inc(void) {
+ inline void inc() {
++p;
ch = 0xffff;
}
- inline UBool checkInc(UChar c) {
+ inline UBool checkInc(char16_t c) {
if (p < e && (ch == c || *p == c)) {
inc();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
- inline UBool check(UChar c) {
+ inline UBool check(char16_t c) {
return p < e && (ch == c || *p == c);
}
- inline void skipWhitespace(void) {
+ inline void skipWhitespace() {
while (p < e && PatternProps::isWhiteSpace(ch != 0xffff ? ch : *p)) {
inc();
}
}
- inline UBool inList(UChar c, const UChar* list) const {
+ inline UBool inList(char16_t c, const char16_t* list) const {
if (*list == SPACE && PatternProps::isWhiteSpace(c)) {
- return TRUE;
+ return true;
}
while (*list && *list != c) {
++list;
@@ -348,36 +348,36 @@ private:
}
void parseError(const char* msg);
- StringLocalizationInfo* doParse(void);
+ StringLocalizationInfo* doParse();
- UChar** nextArray(int32_t& requiredLength);
- UChar* nextString(void);
+ char16_t** nextArray(int32_t& requiredLength);
+ char16_t* nextString();
};
#ifdef RBNF_DEBUG
#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
parseError(msg); \
- return NULL; \
+ return nullptr; \
} UPRV_BLOCK_MACRO_END
#define EXPLANATION_ARG explanationArg
#else
#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
- parseError(NULL); \
- return NULL; \
+ parseError(nullptr); \
+ return nullptr; \
} UPRV_BLOCK_MACRO_END
#define EXPLANATION_ARG
#endif
-static const UChar DQUOTE_STOPLIST[] = {
+static const char16_t DQUOTE_STOPLIST[] = {
QUOTE, 0
};
-static const UChar SQUOTE_STOPLIST[] = {
+static const char16_t SQUOTE_STOPLIST[] = {
TICK, 0
};
-static const UChar NOQUOTE_STOPLIST[] = {
+static const char16_t NOQUOTE_STOPLIST[] = {
SPACE, COMMA, CLOSE_ANGLE, OPEN_ANGLE, TICK, QUOTE, 0
};
@@ -387,10 +387,10 @@ DeleteFn(void* p) {
}
StringLocalizationInfo*
-LocDataParser::parse(UChar* _data, int32_t len) {
+LocDataParser::parse(char16_t* _data, int32_t len) {
if (U_FAILURE(ec)) {
if (_data) uprv_free(_data);
- return NULL;
+ return nullptr;
}
pe.line = 0;
@@ -398,15 +398,15 @@ LocDataParser::parse(UChar* _data, int32_t len) {
pe.postContext[0] = 0;
pe.preContext[0] = 0;
- if (_data == NULL) {
+ if (_data == nullptr) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if (len <= 0) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
uprv_free(_data);
- return NULL;
+ return nullptr;
}
data = _data;
@@ -419,24 +419,24 @@ LocDataParser::parse(UChar* _data, int32_t len) {
StringLocalizationInfo*
-LocDataParser::doParse(void) {
+LocDataParser::doParse() {
skipWhitespace();
if (!checkInc(OPEN_ANGLE)) {
ERROR("Missing open angle");
} else {
VArray array(DeleteFn);
- UBool mightHaveNext = TRUE;
+ UBool mightHaveNext = true;
int32_t requiredLength = -1;
while (mightHaveNext) {
- mightHaveNext = FALSE;
- UChar** elem = nextArray(requiredLength);
+ mightHaveNext = false;
+ char16_t** elem = nextArray(requiredLength);
skipWhitespace();
UBool haveComma = check(COMMA);
if (elem) {
array.add(elem, ec);
if (haveComma) {
inc();
- mightHaveNext = TRUE;
+ mightHaveNext = true;
}
} else if (haveComma) {
ERROR("Unexpected character");
@@ -457,22 +457,22 @@ LocDataParser::doParse(void) {
ERROR("Extra text after close of localization data");
}
- array.add(NULL, ec);
+ array.add(nullptr, ec);
if (U_SUCCESS(ec)) {
- int32_t numLocs = array.length() - 2; // subtract first, NULL
- UChar*** result = (UChar***)array.release();
+ int32_t numLocs = array.length() - 2; // subtract first, nullptr
+ char16_t*** result = (char16_t***)array.release();
- return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, NULL
+ return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, nullptr
}
}
ERROR("Unknown error");
}
-UChar**
+char16_t**
LocDataParser::nextArray(int32_t& requiredLength) {
if (U_FAILURE(ec)) {
- return NULL;
+ return nullptr;
}
skipWhitespace();
@@ -481,17 +481,17 @@ LocDataParser::nextArray(int32_t& requiredLength) {
}
VArray array;
- UBool mightHaveNext = TRUE;
+ UBool mightHaveNext = true;
while (mightHaveNext) {
- mightHaveNext = FALSE;
- UChar* elem = nextString();
+ mightHaveNext = false;
+ char16_t* elem = nextString();
skipWhitespace();
UBool haveComma = check(COMMA);
if (elem) {
array.add(elem, ec);
if (haveComma) {
inc();
- mightHaveNext = TRUE;
+ mightHaveNext = true;
}
} else if (haveComma) {
ERROR("Unexpected comma");
@@ -506,7 +506,7 @@ LocDataParser::nextArray(int32_t& requiredLength) {
}
}
- array.add(NULL, ec);
+ array.add(nullptr, ec);
if (U_SUCCESS(ec)) {
if (requiredLength == -1) {
requiredLength = array.length() + 1;
@@ -515,19 +515,19 @@ LocDataParser::nextArray(int32_t& requiredLength) {
ERROR("Array not of required length");
}
- return (UChar**)array.release();
+ return (char16_t**)array.release();
}
ERROR("Unknown Error");
}
-UChar*
+char16_t*
LocDataParser::nextString() {
- UChar* result = NULL;
+ char16_t* result = nullptr;
skipWhitespace();
if (p < e) {
- const UChar* terminators;
- UChar c = *p;
+ const char16_t* terminators;
+ char16_t c = *p;
UBool haveQuote = c == QUOTE || c == TICK;
if (haveQuote) {
inc();
@@ -535,13 +535,13 @@ LocDataParser::nextString() {
} else {
terminators = NOQUOTE_STOPLIST;
}
- UChar* start = p;
+ char16_t* start = p;
while (p < e && !inList(*p, terminators)) ++p;
if (p == e) {
ERROR("Unexpected end of data");
}
- UChar x = *p;
+ char16_t x = *p;
if (p > start) {
ch = x;
*p = 0x0; // terminate by writing to data
@@ -569,17 +569,17 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
return;
}
- const UChar* start = p - U_PARSE_CONTEXT_LEN - 1;
+ const char16_t* start = p - U_PARSE_CONTEXT_LEN - 1;
if (start < data) {
start = data;
}
- for (UChar* x = p; --x >= start;) {
+ for (char16_t* x = p; --x >= start;) {
if (!*x) {
start = x+1;
break;
}
}
- const UChar* limit = p + U_PARSE_CONTEXT_LEN - 1;
+ const char16_t* limit = p + U_PARSE_CONTEXT_LEN - 1;
if (limit > e) {
limit = e;
}
@@ -594,7 +594,7 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
UnicodeString msg;
msg.append(start, p - start);
- msg.append((UChar)0x002f); /* SOLIDUS/SLASH */
+ msg.append((char16_t)0x002f); /* SOLIDUS/SLASH */
msg.append(p, limit-p);
msg.append(UNICODE_STRING_SIMPLE("'"));
@@ -610,9 +610,9 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
#endif
uprv_free(data);
- data = NULL;
- p = NULL;
- e = NULL;
+ data = nullptr;
+ p = nullptr;
+ e = nullptr;
if (U_SUCCESS(ec)) {
ec = U_PARSE_ERROR;
@@ -624,18 +624,18 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
StringLocalizationInfo*
StringLocalizationInfo::create(const UnicodeString& info, UParseError& perror, UErrorCode& status) {
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
int32_t len = info.length();
if (len == 0) {
- return NULL; // no error;
+ return nullptr; // no error;
}
- UChar* p = (UChar*)uprv_malloc(len * sizeof(UChar));
+ char16_t* p = (char16_t*)uprv_malloc(len * sizeof(char16_t));
if (!p) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
info.extract(p, len, status);
if (!U_FAILURE(status)) {
@@ -647,7 +647,7 @@ StringLocalizationInfo::create(const UnicodeString& info, UParseError& perror, U
}
StringLocalizationInfo::~StringLocalizationInfo() {
- for (UChar*** p = (UChar***)data; *p; ++p) {
+ for (char16_t*** p = (char16_t***)data; *p; ++p) {
// remaining data is simply pointer into our unicode string data.
if (*p) uprv_free(*p);
}
@@ -656,29 +656,29 @@ StringLocalizationInfo::~StringLocalizationInfo() {
}
-const UChar*
+const char16_t*
StringLocalizationInfo::getRuleSetName(int32_t index) const {
if (index >= 0 && index < getNumberOfRuleSets()) {
return data[0][index];
}
- return NULL;
+ return nullptr;
}
-const UChar*
+const char16_t*
StringLocalizationInfo::getLocaleName(int32_t index) const {
if (index >= 0 && index < getNumberOfDisplayLocales()) {
return data[index+1][0];
}
- return NULL;
+ return nullptr;
}
-const UChar*
+const char16_t*
StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) const {
if (localeIndex >= 0 && localeIndex < getNumberOfDisplayLocales() &&
ruleIndex >= 0 && ruleIndex < getNumberOfRuleSets()) {
return data[localeIndex+1][ruleIndex+1];
}
- return NULL;
+ return nullptr;
}
// ----------
@@ -686,23 +686,23 @@ StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) c
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const UnicodeString& locs,
const Locale& alocale, UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(alocale)
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status);
init(description, locinfo, perror, status);
@@ -711,23 +711,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const UnicodeString& locs,
UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(Locale::getDefault())
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status);
init(description, locinfo, perror, status);
@@ -736,23 +736,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
LocalizationInfo* info,
const Locale& alocale, UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(alocale)
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
init(description, info, perror, status);
}
@@ -760,70 +760,70 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
UParseError& perror,
UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(Locale::getDefault())
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
- init(description, NULL, perror, status);
+ init(description, nullptr, perror, status);
}
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const Locale& aLocale,
UParseError& perror,
UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(aLocale)
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
- init(description, NULL, perror, status);
+ init(description, nullptr, perror, status);
}
RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status)
- : fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ : fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(alocale)
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
if (U_FAILURE(status)) {
return;
@@ -840,18 +840,18 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
}
// TODO: read localization info from resource
- LocalizationInfo* locinfo = NULL;
+ LocalizationInfo* locinfo = nullptr;
UResourceBundle* nfrb = ures_open(U_ICUDATA_RBNF, locale.getName(), &status);
if (U_SUCCESS(status)) {
setLocaleIDs(ures_getLocaleByType(nfrb, ULOC_VALID_LOCALE, &status),
ures_getLocaleByType(nfrb, ULOC_ACTUAL_LOCALE, &status));
- UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, NULL, &status);
+ UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, nullptr, &status);
if (U_FAILURE(status)) {
ures_close(nfrb);
}
- UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, NULL, &status);
+ UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, nullptr, &status);
if (U_FAILURE(status)) {
ures_close(rbnfRules);
ures_close(nfrb);
@@ -860,7 +860,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
UnicodeString desc;
while (ures_hasNext(ruleSets)) {
- desc.append(ures_getNextUnicodeString(ruleSets,NULL,&status));
+ desc.append(ures_getNextUnicodeString(ruleSets,nullptr,&status));
}
UParseError perror;
@@ -874,23 +874,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
: NumberFormat(rhs)
- , fRuleSets(NULL)
- , ruleSetDescriptions(NULL)
+ , fRuleSets(nullptr)
+ , ruleSetDescriptions(nullptr)
, numRuleSets(0)
- , defaultRuleSet(NULL)
+ , defaultRuleSet(nullptr)
, locale(rhs.locale)
- , collator(NULL)
- , decimalFormatSymbols(NULL)
- , defaultInfinityRule(NULL)
- , defaultNaNRule(NULL)
+ , collator(nullptr)
+ , decimalFormatSymbols(nullptr)
+ , defaultInfinityRule(nullptr)
+ , defaultNaNRule(nullptr)
, fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
- , lenient(FALSE)
- , lenientParseRules(NULL)
- , localizations(NULL)
- , capitalizationInfoSet(FALSE)
- , capitalizationForUIListMenu(FALSE)
- , capitalizationForStandAlone(FALSE)
- , capitalizationBrkIter(NULL)
+ , lenient(false)
+ , lenientParseRules(nullptr)
+ , localizations(nullptr)
+ , capitalizationInfoSet(false)
+ , capitalizationForUIListMenu(false)
+ , capitalizationForStandAlone(false)
+ , capitalizationBrkIter(nullptr)
{
this->operator=(rhs);
}
@@ -911,7 +911,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
UParseError perror;
setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols());
- init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status);
+ init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : nullptr, perror, status);
setDefaultRuleSet(rhs.getDefaultRuleSetName(), status);
setRoundingMode(rhs.getRoundingMode());
@@ -919,7 +919,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
capitalizationForUIListMenu = rhs.capitalizationForUIListMenu;
capitalizationForStandAlone = rhs.capitalizationForStandAlone;
#if !UCONFIG_NO_BREAK_ITERATION
- capitalizationBrkIter = (rhs.capitalizationBrkIter!=NULL)? rhs.capitalizationBrkIter->clone(): NULL;
+ capitalizationBrkIter = (rhs.capitalizationBrkIter!=nullptr)? rhs.capitalizationBrkIter->clone(): nullptr;
#endif
return *this;
@@ -944,30 +944,30 @@ RuleBasedNumberFormat::operator==(const Format& other) const
}
if (typeid(*this) == typeid(other)) {
- const RuleBasedNumberFormat& rhs = (const RuleBasedNumberFormat&)other;
+ const RuleBasedNumberFormat& rhs = static_cast<const RuleBasedNumberFormat&>(other);
// test for capitalization info equality is adequately handled
// by the NumberFormat test for fCapitalizationContext equality;
// the info here is just derived from that.
if (locale == rhs.locale &&
lenient == rhs.lenient &&
- (localizations == NULL
- ? rhs.localizations == NULL
- : (rhs.localizations == NULL
+ (localizations == nullptr
+ ? rhs.localizations == nullptr
+ : (rhs.localizations == nullptr
? false
: *localizations == rhs.localizations))) {
NFRuleSet** p = fRuleSets;
NFRuleSet** q = rhs.fRuleSets;
- if (p == NULL) {
- return q == NULL;
- } else if (q == NULL) {
+ if (p == nullptr) {
+ return q == nullptr;
+ } else if (q == nullptr) {
return false;
}
while (*p && *q && (**p == **q)) {
++p;
++q;
}
- return *q == NULL && *p == NULL;
+ return *q == nullptr && *p == nullptr;
}
}
@@ -978,7 +978,7 @@ UnicodeString
RuleBasedNumberFormat::getRules() const
{
UnicodeString result;
- if (fRuleSets != NULL) {
+ if (fRuleSets != nullptr) {
for (NFRuleSet** p = fRuleSets; *p; ++p) {
(*p)->appendRules(result);
}
@@ -990,7 +990,7 @@ UnicodeString
RuleBasedNumberFormat::getRuleSetName(int32_t index) const
{
if (localizations) {
- UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_t)-1);
+ UnicodeString string(true, localizations->getRuleSetName(index), (int32_t)-1);
return string;
}
else if (fRuleSets) {
@@ -1027,7 +1027,7 @@ RuleBasedNumberFormat::getNumberOfRuleSetNames() const
}
int32_t
-RuleBasedNumberFormat::getNumberOfRuleSetDisplayNameLocales(void) const {
+RuleBasedNumberFormat::getNumberOfRuleSetDisplayNameLocales() const {
if (localizations) {
return localizations->getNumberOfDisplayLocales();
}
@@ -1040,13 +1040,13 @@ RuleBasedNumberFormat::getRuleSetDisplayNameLocale(int32_t index, UErrorCode& st
return Locale("");
}
if (localizations && index >= 0 && index < localizations->getNumberOfDisplayLocales()) {
- UnicodeString name(TRUE, localizations->getLocaleName(index), -1);
+ UnicodeString name(true, localizations->getLocaleName(index), -1);
char buffer[64];
int32_t cap = name.length() + 1;
char* bp = buffer;
if (cap > 64) {
bp = (char *)uprv_malloc(cap);
- if (bp == NULL) {
+ if (bp == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return Locale("");
}
@@ -1068,12 +1068,12 @@ RuleBasedNumberFormat::getRuleSetDisplayName(int32_t index, const Locale& locale
if (localizations && index >= 0 && index < localizations->getNumberOfRuleSets()) {
UnicodeString localeName(localeParam.getBaseName(), -1, UnicodeString::kInvariant);
int32_t len = localeName.length();
- UChar* localeStr = localeName.getBuffer(len + 1);
+ char16_t* localeStr = localeName.getBuffer(len + 1);
while (len >= 0) {
localeStr[len] = 0;
int32_t ix = localizations->indexForLocale(localeStr);
if (ix >= 0) {
- UnicodeString name(TRUE, localizations->getDisplayName(ix, index), -1);
+ UnicodeString name(true, localizations->getDisplayName(ix, index), -1);
return name;
}
@@ -1081,7 +1081,7 @@ RuleBasedNumberFormat::getRuleSetDisplayName(int32_t index, const Locale& locale
do { --len;} while (len > 0 && localeStr[len] != 0x005f); // underscore
while (len > 0 && localeStr[len-1] == 0x005F) --len;
}
- UnicodeString name(TRUE, localizations->getRuleSetName(index), -1);
+ UnicodeString name(true, localizations->getRuleSetName(index), -1);
return name;
}
UnicodeString bogus;
@@ -1113,7 +1113,7 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
- return NULL;
+ return nullptr;
}
UnicodeString&
@@ -1326,7 +1326,7 @@ RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos,
if (capitalizationContext != UDISPCTX_CAPITALIZATION_NONE && startPos == 0 && currentResult.length() > 0) {
// capitalize currentResult according to context
UChar32 ch = currentResult.char32At(0);
- if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != NULL &&
+ if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != nullptr &&
( capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
(capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
@@ -1402,7 +1402,7 @@ RuleBasedNumberFormat::setLenient(UBool enabled)
lenient = enabled;
if (!enabled && collator) {
delete collator;
- collator = NULL;
+ collator = nullptr;
}
}
@@ -1413,7 +1413,7 @@ RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErro
if (U_SUCCESS(status)) {
if (ruleSetName.isEmpty()) {
if (localizations) {
- UnicodeString name(TRUE, localizations->getRuleSetName(0), -1);
+ UnicodeString name(true, localizations->getRuleSetName(0), -1);
defaultRuleSet = findRuleSet(name, status);
} else {
initDefaultRuleSet();
@@ -1422,7 +1422,7 @@ RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErro
status = U_ILLEGAL_ARGUMENT_ERROR;
} else {
NFRuleSet* result = findRuleSet(ruleSetName, status);
- if (result != NULL) {
+ if (result != nullptr) {
defaultRuleSet = result;
}
}
@@ -1443,7 +1443,7 @@ RuleBasedNumberFormat::getDefaultRuleSetName() const {
void
RuleBasedNumberFormat::initDefaultRuleSet()
{
- defaultRuleSet = NULL;
+ defaultRuleSet = nullptr;
if (!fRuleSets) {
return;
}
@@ -1480,7 +1480,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
{
// TODO: implement UParseError
uprv_memset(&pErr, 0, sizeof(UParseError));
- // Note: this can leave ruleSets == NULL, so remaining code should check
+ // Note: this can leave ruleSets == nullptr, so remaining code should check
if (U_FAILURE(status)) {
return;
}
@@ -1492,7 +1492,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
return;
}
- this->localizations = localizationInfos == NULL ? NULL : localizationInfos->ref();
+ this->localizations = localizationInfos == nullptr ? nullptr : localizationInfos->ref();
UnicodeString description(rules);
if (!description.length()) {
@@ -1533,7 +1533,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
// copy out the lenient-parse rules and delete them
// from the description
lenientParseRules = new UnicodeString();
- /* test for NULL */
+ /* test for nullptr */
if (lenientParseRules == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -1556,14 +1556,14 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
// our rule list is an array of the appropriate size
fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
- /* test for NULL */
+ /* test for nullptr */
if (fRuleSets == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
for (int i = 0; i <= numRuleSets; ++i) {
- fRuleSets[i] = NULL;
+ fRuleSets[i] = nullptr;
}
// divide up the descriptions into individual rule-set descriptions
@@ -1636,9 +1636,9 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
// confirm the names, if any aren't in the rules, that's an error
// it is ok if the rules contain public rule sets that are not in this list
for (int32_t i = 0; i < localizationInfos->getNumberOfRuleSets(); ++i) {
- UnicodeString name(TRUE, localizationInfos->getRuleSetName(i), -1);
+ UnicodeString name(true, localizationInfos->getRuleSetName(i), -1);
NFRuleSet* rs = findRuleSet(name, status);
- if (rs == NULL) {
+ if (rs == nullptr) {
break; // error
}
if (i == 0) {
@@ -1661,17 +1661,17 @@ RuleBasedNumberFormat::setContext(UDisplayContext value, UErrorCode& status)
if (!capitalizationInfoSet &&
(value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE)) {
initCapitalizationContextInfo(locale);
- capitalizationInfoSet = TRUE;
+ capitalizationInfoSet = true;
}
#if !UCONFIG_NO_BREAK_ITERATION
- if ( capitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
+ if ( capitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
(value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
status = U_ZERO_ERROR;
capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
if (U_FAILURE(status)) {
delete capitalizationBrkIter;
- capitalizationBrkIter = NULL;
+ capitalizationBrkIter = nullptr;
}
}
#endif
@@ -1682,15 +1682,15 @@ void
RuleBasedNumberFormat::initCapitalizationContextInfo(const Locale& thelocale)
{
#if !UCONFIG_NO_BREAK_ITERATION
- const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL;
+ const char * localeID = (thelocale != nullptr)? thelocale.getBaseName(): nullptr;
UErrorCode status = U_ZERO_ERROR;
- UResourceBundle *rb = ures_open(NULL, localeID, &status);
+ UResourceBundle *rb = ures_open(nullptr, localeID, &status);
rb = ures_getByKeyWithFallback(rb, "contextTransforms", rb, &status);
rb = ures_getByKeyWithFallback(rb, "number-spellout", rb, &status);
- if (U_SUCCESS(status) && rb != NULL) {
+ if (U_SUCCESS(status) && rb != nullptr) {
int32_t len = 0;
const int32_t * intVector = ures_getIntVector(rb, &len, &status);
- if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
+ if (U_SUCCESS(status) && intVector != nullptr && len >= 2) {
capitalizationForUIListMenu = static_cast<UBool>(intVector[0]);
capitalizationForStandAlone = static_cast<UBool>(intVector[1]);
}
@@ -1748,34 +1748,34 @@ RuleBasedNumberFormat::dispose()
delete *p;
}
uprv_free(fRuleSets);
- fRuleSets = NULL;
+ fRuleSets = nullptr;
}
if (ruleSetDescriptions) {
delete [] ruleSetDescriptions;
- ruleSetDescriptions = NULL;
+ ruleSetDescriptions = nullptr;
}
#if !UCONFIG_NO_COLLATION
delete collator;
#endif
- collator = NULL;
+ collator = nullptr;
delete decimalFormatSymbols;
- decimalFormatSymbols = NULL;
+ decimalFormatSymbols = nullptr;
delete defaultInfinityRule;
- defaultInfinityRule = NULL;
+ defaultInfinityRule = nullptr;
delete defaultNaNRule;
- defaultNaNRule = NULL;
+ defaultNaNRule = nullptr;
delete lenientParseRules;
- lenientParseRules = NULL;
+ lenientParseRules = nullptr;
#if !UCONFIG_NO_BREAK_ITERATION
delete capitalizationBrkIter;
- capitalizationBrkIter = NULL;
+ capitalizationBrkIter = nullptr;
#endif
if (localizations) {
@@ -1799,11 +1799,11 @@ RuleBasedNumberFormat::getCollator() const
{
#if !UCONFIG_NO_COLLATION
if (!fRuleSets) {
- return NULL;
+ return nullptr;
}
// lazy-evaluate the collator
- if (collator == NULL && lenient) {
+ if (collator == nullptr && lenient) {
// create a default collator based on the formatter's locale,
// then pull out that collator's rules, append any additional
// rules specified in the description, and create a _new_
@@ -1813,18 +1813,18 @@ RuleBasedNumberFormat::getCollator() const
Collator* temp = Collator::createInstance(locale, status);
RuleBasedCollator* newCollator;
- if (U_SUCCESS(status) && (newCollator = dynamic_cast<RuleBasedCollator*>(temp)) != NULL) {
+ if (U_SUCCESS(status) && (newCollator = dynamic_cast<RuleBasedCollator*>(temp)) != nullptr) {
if (lenientParseRules) {
UnicodeString rules(newCollator->getRules());
rules.append(*lenientParseRules);
newCollator = new RuleBasedCollator(rules, status);
// Exit if newCollator could not be created.
- if (newCollator == NULL) {
- return NULL;
+ if (newCollator == nullptr) {
+ return nullptr;
}
} else {
- temp = NULL;
+ temp = nullptr;
}
if (U_SUCCESS(status)) {
newCollator->setAttribute(UCOL_DECOMPOSITION_MODE, UCOL_ON, status);
@@ -1875,7 +1875,7 @@ RuleBasedNumberFormat::initializeDefaultInfinityRule(UErrorCode &status)
if (U_FAILURE(status)) {
return nullptr;
}
- if (defaultInfinityRule == NULL) {
+ if (defaultInfinityRule == nullptr) {
UnicodeString rule(UNICODE_STRING_SIMPLE("Inf: "));
rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::kInfinitySymbol));
LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
@@ -1919,11 +1919,11 @@ RuleBasedNumberFormat::getDefaultNaNRule() const
void
RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt)
{
- if (symbolsToAdopt == NULL) {
- return; // do not allow caller to set decimalFormatSymbols to NULL
+ if (symbolsToAdopt == nullptr) {
+ return; // do not allow caller to set decimalFormatSymbols to nullptr
}
- if (decimalFormatSymbols != NULL) {
+ if (decimalFormatSymbols != nullptr) {
delete decimalFormatSymbols;
}
@@ -1934,11 +1934,11 @@ RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo
UErrorCode status = U_ZERO_ERROR;
delete defaultInfinityRule;
- defaultInfinityRule = NULL;
+ defaultInfinityRule = nullptr;
initializeDefaultInfinityRule(status); // Reset with the new DecimalFormatSymbols
delete defaultNaNRule;
- defaultNaNRule = NULL;
+ defaultNaNRule = nullptr;
initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSymbols
if (fRuleSets) {