mirror of https://gitee.com/bigwinds/arangodb
Add latest upstream changes to VelocyPack.
This commit is contained in:
parent
df85f1689e
commit
4313b82129
|
@ -349,6 +349,8 @@ class Builder {
|
|||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void addNull() {
|
||||
reserveSpace(1);
|
||||
_start[_pos++] = 0x18;
|
||||
|
@ -421,6 +423,8 @@ class Builder {
|
|||
return target;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
inline void addArray(bool unindexed = false) {
|
||||
addCompoundValue(unindexed ? 0x13 : 0x06);
|
||||
}
|
||||
|
|
|
@ -123,9 +123,6 @@ class Parser {
|
|||
_b.reset(&builder, BuilderNonDeleter());
|
||||
}
|
||||
|
||||
// FIXME: withdraw this:
|
||||
Builder& builder() { return *_b; }
|
||||
|
||||
Builder const& builder() const { return *_b; }
|
||||
|
||||
static std::shared_ptr<Builder> fromJson(
|
||||
|
|
|
@ -49,7 +49,20 @@ ValueLength Parser::parseInternal(bool multi) {
|
|||
|
||||
ValueLength nr = 0;
|
||||
do {
|
||||
parseJson();
|
||||
bool haveReported = false;
|
||||
if (!_b->_stack.empty()) {
|
||||
_b->reportAdd(_b->_stack.back());
|
||||
haveReported = true;
|
||||
}
|
||||
try {
|
||||
parseJson();
|
||||
}
|
||||
catch (...) {
|
||||
if (haveReported) {
|
||||
_b->cleanupAdd();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
nr++;
|
||||
while (_pos < _size && isWhiteSpace(_start[_pos])) {
|
||||
++_pos;
|
||||
|
|
|
@ -219,7 +219,7 @@ Slice Slice::fromJson(SliceScope& scope, std::string const& json,
|
|||
Parser parser(options);
|
||||
parser.parse(json);
|
||||
|
||||
Builder& b = parser.builder(); // don't copy Builder contents here
|
||||
Builder const& b = parser.builder(); // don't copy Builder contents here
|
||||
return scope.add(b.start(), b.size(), options);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue