mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
d93657223f
|
@ -35,6 +35,9 @@
|
|||
#include "Basics/json.h"
|
||||
#include "Basics/StringBuffer.h"
|
||||
|
||||
#include "velocypack/Parser.h"
|
||||
#include "velocypack/Builder.h"
|
||||
|
||||
namespace triagens {
|
||||
namespace basics {
|
||||
|
||||
|
@ -280,6 +283,45 @@ namespace triagens {
|
|||
|
||||
static TRI_json_t const* checkAndGetArrayValue (TRI_json_t const*,
|
||||
char const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief TRI_json_t to VelocyPack, this is a temporary, inefficient method
|
||||
/// which must be removed later on.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::shared_ptr<arangodb::velocypack::Builder> toVelocyPack (
|
||||
TRI_json_t const* json) {
|
||||
std::string tmp = toString(json);
|
||||
arangodb::velocypack::Parser parser;
|
||||
try {
|
||||
parser.parse(tmp);
|
||||
}
|
||||
catch (...) {
|
||||
return std::shared_ptr<arangodb::velocypack::Builder>();
|
||||
}
|
||||
return parser.steal();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief TRI_json_t to VelocyPack, writing into an existing Builder
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int toVelocyPack (
|
||||
TRI_json_t const* json,
|
||||
arangodb::velocypack::Builder& builder) {
|
||||
std::string tmp = toString(json);
|
||||
arangodb::velocypack::Options opt;
|
||||
opt.clearBuilderBeforeParse = false;
|
||||
arangodb::velocypack::Parser parser(builder, &opt);
|
||||
try {
|
||||
parser.parse(tmp);
|
||||
}
|
||||
catch (...) {
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1149,7 +1191,6 @@ namespace triagens {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue