It's not uncommon for code for Windows to use the _MSC_VER preprocessor
macro to identify that it's being compiled for Windows so it's also not
uncommon for compilers other than the real MSVC compiler to also set
this to be able to compile such code.
It's also not possible to use _MSC_VER to determine whether the C++
standard library implementation used is the Microsoft STL.
Clang will however refuse to instantiate a template with a forward
declared type, so the code that currently does this needs to be moved to
after the type has been properly defined, which in turn makes MSVC warn
that those templates aren't instantiated, so those warnings need to be
disabled, but then the disabling of warning C4661 doesn't work any
longer (for some unknown reason) but this can be resolved by properly
deleting the non-existent operators instead of disabling the warning.
Previously, there were separate overrides for the options and
attributes parsing methods in the parser that were used in different
context. (Options can appear in Operator and Markup, while attributes
can appear in Expression and Markup.)
This is a refactoring that eliminates this duplicated code.
To enable it, a builder is added for the internal OptionMap type.
Separately, this patch also explicitly deletes copy constructors
and copy assignment operators for all Builder classes; a bug in an
earlier version of this patch caused me to notice this hadn't been
done. Also explicitly deletes move constructors/assignment operators
with the exception of OptionMap::Builder (OptionMap is non-public,
so that shouldn't cause confusion).
The implementation was keeping a cache of FormatterFactory
objects so that subsequent calls to the same formatter re-use the
same object.
The problem is that this is unsafe, because
`MFFunctionRegistry::getFormatter()` returns a non-const `FormatterFactory*`;
so if the caller deleted the resulting pointer, the formatter cache
would contain a dangling pointer.
This optimization was added because of an ICU4J test that checked for
the presence of the optimization. However, for separate reasons
(making `adoptFormatter()` actually adopt its argument), this test
was already removed.
The caching could be re-added later if that optimization is needed,
but for now, remove it (also, no tests were checking for its presence).
Also fix ICU-12620 which is mark duplicate of ICU-9972 just now.
and fix ICU-22258.
Separate the new year and winter solstice cache since the calculated
value for these two calendar are mostly but not always the same due
to slightly different observation timeZone.
Remove the epochYear and zoneAstroCalc from the member data
and instead return them from a getStting() method with the two caches
since all four of them are constant per subclass of ChineseCalendar
and do not need to be different per object.
The known issues in the TestLimit is caused by both Calendar get/put the
value from the same cache while the calculated result depends on the
timeZone zoneAstroCalc.
substitution is using a DecimalFormat and its owning rule also has a modulus substitution. Took out a redundant
call to floor(). Added a hack to allow the caller to change the rounding behavior with setRoundingMode().
Added appropriate unit tests. Added additional documentation of the behavior to the API docs.
Change the logic of handling year in era 0 counting backwards
to depend on a boolean virtual function instead of adding
string comparsion code in the base class to have specific knowledge of
behavior of subclass.
Test set+set, set+add, set+roll, add+add, roll+roll
Fix more int32_t overflow problems.
Optimize both Java and C++ Hebrew Calendar month/year advancement by first consider
every 235 months is 19 years before iteration.
This makes it possible to call public functions that take a string class
as a template parameter and return an object of that class (implemented
through the StringByteSink helper class) also with the CharString class,
even though this class doesn't actually provide the public API required
by StringByteSink.
This makes it possible to use such more modern APIs also internally.
The repeated sequence of allocating a CharString and CharStringByteSink,
before calling some function that writes into this, can be moved into a
single shared helper function which then is used to give all ulocimp.h
functions that write to ByteSink an overload that instead returns a
CharString, to make call sites look like perfectly normal C++ code.
· No function should do anything if an error has already occurred.
· On error, a value of 0, nullptr, {}, etc., should be returned.
· Values shouldn't have overloaded meanings (eg. index or found).
· Values that are never used should not be returned at all.
- [x] Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22671
- [x] Required: The PR title must be prefixed with a JIRA Issue number. <!-- For example: "ICU-1234 Fix xyz" -->
- [x] Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
- [x] Required: Each commit message must be prefixed with a JIRA Issue number. <!-- For example: "ICU-1234 Fix xyz" -->
- [ ] Issue accepted (done by Technical Committee after discussion)
- [ ] Tests included, if applicable
- [ ] API docs and/or User Guide docs changed or added, if applicable