[ion] Namespace Ion::UTF8Helper and Ion::UTF8Decoder

This commit is contained in:
Émilie Feral
2019-04-26 17:47:40 +02:00
parent a499aa9b2c
commit 23da0d3f2c
39 changed files with 145 additions and 129 deletions

View File

@@ -67,15 +67,15 @@ CartesianFunction CartesianFunction::NewModel(Ion::Storage::Record::ErrorStatus
int CartesianFunction::derivativeNameWithArgument(char * buffer, size_t bufferSize, CodePoint arg) {
// Fill buffer with f(x). Keep size for derivative sign.
int derivativeSize = UTF8Decoder::CharSizeOfCodePoint('\'');
int derivativeSize = Ion::UTF8Decoder::CharSizeOfCodePoint('\'');
int numberOfChars = nameWithArgument(buffer, bufferSize - derivativeSize, arg);
assert(numberOfChars + derivativeSize < bufferSize);
char * firstParenthesis = const_cast<char *>(UTF8Helper::CodePointSearch(buffer, '('));
if (!UTF8Helper::CodePointIs(firstParenthesis, '(')) {
char * firstParenthesis = const_cast<char *>(Ion::UTF8Helper::CodePointSearch(buffer, '('));
if (!Ion::UTF8Helper::CodePointIs(firstParenthesis, '(')) {
return numberOfChars;
}
memmove(firstParenthesis + derivativeSize, firstParenthesis, buffer + numberOfChars - firstParenthesis);
UTF8Decoder::CodePointToChars('\'', firstParenthesis, derivativeSize);
Ion::UTF8Decoder::CodePointToChars('\'', firstParenthesis, derivativeSize);
return numberOfChars + derivativeSize;
}