1
0
Fork 0

Add latest upstream changes to VelocyPack.

This commit is contained in:
Max Neunhoeffer 2015-12-07 13:42:36 +01:00
parent df85f1689e
commit 4313b82129
4 changed files with 19 additions and 5 deletions

View File

@ -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);
}

View File

@ -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(

View File

@ -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;

View File

@ -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);
}