13#include <rtl/math.hxx>
26 , mbFirstFieldInNode(true)
39 assert(
mbClosed &&
"forgot to extract data?");
141 int written = snprintf(
pos, 7,
"\\u%.4x",
static_cast<unsigned int>(
ch));
164 *
pos++ =
ch == 0x2028 ?
'8' :
'9';
178 while (
i < rPropVal.getLength())
180 sal_uInt32
ch = rPropVal.iterateCodePoints(&
i);
185 *
mPos =
static_cast<char>(
ch);
188 else if (
ch <= 0x7FF)
192 *
mPos = 0x80 | (
ch & 0x3F);
195 else if (
ch <= 0xFFFF)
197 *
mPos = 0xE0 | (
ch >> 12);
199 *
mPos = 0x80 | ((
ch >> 6) & 0x3F);
201 *
mPos = 0x80 | (
ch & 0x3F);
206 *
mPos = 0xF0 | (
ch >> 18);
208 *
mPos = 0x80 | ((
ch >> 12) & 0x3F);
210 *
mPos = 0x80 | ((
ch >> 6) & 0x3F);
212 *
mPos = 0x80 | (
ch & 0x3F);
225 auto nPropNameLength = pPropName.length();
228 auto nWorstCasePropValLength = rPropVal.getLength() * 6;
229 ensureSpace(nPropNameLength + nWorstCasePropValLength + 8);
235 memcpy(
mPos,
": ", 2);
247 auto nWorstCasePropValLength = rPropVal.getLength() * 6 + 2;
256 auto nWorstCasePropValLength = rPropVal.size() * 2 + 2;
263 bool bReachedEnd =
false;
264 for (
size_t i = 0;
i < rPropVal.size() && !bReachedEnd; ++
i)
266 char ch = rPropVal[
i];
283 if (
i + 2 < rPropVal.size() && rPropVal[
i + 1] ==
'\x80'
284 && (rPropVal[
i + 2] ==
'\xA8' || rPropVal[
i + 2] ==
'\xA9'))
306 putLiteral(pPropName, nPropVal ? std::string_view(
"true") : std::string_view(
"false"));
311 auto nWorstCasePropValLength = rPropVal.getLength() * 6;
325 memcpy(
mPos, rRawBuf.data(), rRawBuf.size());
326 mPos += rRawBuf.size();
346 assert(!
mbClosed &&
"already extracted data");
350 auto newSize = (currentUsed + noMoreBytesRequired) * 2;
370 memcpy(
mPos,
"\": ", 3);
377 memcpy(
mPos, propValue.data(), propValue.size());
378 mPos += propValue.size();
386 assert(!
mbClosed &&
"data already extracted");