1
0
Fork 0

Merge branch 'aql2' of ssh://github.com/triAGENS/ArangoDB into aql2

This commit is contained in:
Max Neunhoeffer 2014-07-30 11:37:07 +02:00
commit 234eb21ae9
2 changed files with 30 additions and 6 deletions

View File

@ -60,13 +60,11 @@ AstNode::~AstNode () {
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief convert the node into JSON
/// @brief return a JSON representation of the node
/// the caller is responsible for freeing the JSON later
////////////////////////////////////////////////////////////////////////////////
void AstNode::toJson (TRI_json_t* json,
TRI_memory_zone_t* zone) {
TRI_ASSERT(TRI_IsListJson(json));
TRI_json_t* AstNode::toJson (TRI_memory_zone_t* zone) {
TRI_json_t* node = TRI_CreateArrayJson(zone);
if (node == nullptr) {
@ -144,6 +142,24 @@ void AstNode::toJson (TRI_json_t* json,
TRI_Insert3ArrayJson(zone, node, "subNodes", subNodes);
}
return node;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a JSON representation of the node to the JSON list specified
/// in the first argument
////////////////////////////////////////////////////////////////////////////////
void AstNode::toJson (TRI_json_t* json,
TRI_memory_zone_t* zone) {
TRI_ASSERT(TRI_IsListJson(json));
TRI_json_t* node = toJson(zone);
if (node == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}
TRI_PushBack3ListJson(zone, json, node);
}

View File

@ -161,7 +161,15 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief convert the node into JSON
/// @brief return a JSON representation of the node
/// the caller is responsible for freeing the JSON later
////////////////////////////////////////////////////////////////////////////////
struct TRI_json_s* toJson (TRI_memory_zone_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a JSON representation of the node to the JSON list specified
/// in the first argument
////////////////////////////////////////////////////////////////////////////////
void toJson (TRI_json_t*,