mirror of https://gitee.com/bigwinds/arangodb
removed unused shaping functionality
This commit is contained in:
parent
cf3b00adc2
commit
a67877de66
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
using namespace arangodb::basics;
|
using namespace arangodb::basics;
|
||||||
|
|
||||||
// #define DEBUG_JSON_SHAPER 1
|
|
||||||
|
|
||||||
static int FillShapeValueJson(v8::Isolate* isolate, VocShaper* shaper,
|
static int FillShapeValueJson(v8::Isolate* isolate, VocShaper* shaper,
|
||||||
TRI_shape_value_t* dst,
|
TRI_shape_value_t* dst,
|
||||||
v8::Handle<v8::Value> const json, size_t level,
|
v8::Handle<v8::Value> const json, size_t level,
|
||||||
|
@ -1449,68 +1447,3 @@ v8::Handle<v8::Value> TRI_JsonShapeData(v8::Isolate* isolate, VocShaper* shaper,
|
||||||
return JsonShapeData(isolate, shaper, shape, data, size);
|
return JsonShapeData(isolate, shaper, shape, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a V8 object to a TRI_shaped_json_t
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonV8Object(v8::Isolate* isolate,
|
|
||||||
v8::Handle<v8::Value> const object,
|
|
||||||
VocShaper* shaper, bool create) {
|
|
||||||
TRI_shape_value_t dst;
|
|
||||||
std::set<int> seenHashes;
|
|
||||||
std::vector<v8::Handle<v8::Object>> seenObjects;
|
|
||||||
|
|
||||||
int res = FillShapeValueJson(isolate, shaper, &dst, object, 0, seenHashes,
|
|
||||||
seenObjects, create);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
if (res == TRI_RESULT_ELEMENT_NOT_FOUND) {
|
|
||||||
TRI_set_errno(res);
|
|
||||||
} else {
|
|
||||||
TRI_set_errno(TRI_ERROR_ARANGO_SHAPER_FAILED);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRI_shaped_json_t* shaped = static_cast<TRI_shaped_json_t*>(
|
|
||||||
TRI_Allocate(shaper->memoryZone(), sizeof(TRI_shaped_json_t), false));
|
|
||||||
|
|
||||||
if (shaped == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
shaped->_sid = dst._sid;
|
|
||||||
shaped->_data.length = (uint32_t)dst._size;
|
|
||||||
shaped->_data.data = dst._value;
|
|
||||||
|
|
||||||
return shaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a V8 object to a TRI_shaped_json_t in place
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_FillShapedJsonV8Object(v8::Isolate* isolate,
|
|
||||||
v8::Handle<v8::Value> const object,
|
|
||||||
TRI_shaped_json_t* result, VocShaper* shaper,
|
|
||||||
bool create) {
|
|
||||||
TRI_shape_value_t dst;
|
|
||||||
std::set<int> seenHashes;
|
|
||||||
std::vector<v8::Handle<v8::Object>> seenObjects;
|
|
||||||
|
|
||||||
int res = FillShapeValueJson(isolate, shaper, &dst, object, 0, seenHashes,
|
|
||||||
seenObjects, create);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
if (res != TRI_RESULT_ELEMENT_NOT_FOUND) {
|
|
||||||
res = TRI_ERROR_BAD_PARAMETER;
|
|
||||||
}
|
|
||||||
return TRI_set_errno(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
result->_sid = dst._sid;
|
|
||||||
result->_data.length = (uint32_t)dst._size;
|
|
||||||
result->_data.data = dst._value;
|
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
|
@ -48,20 +48,4 @@ v8::Handle<v8::Value> TRI_JsonShapeData(v8::Isolate* isolate, VocShaper*,
|
||||||
TRI_shape_t const*, char const* data,
|
TRI_shape_t const*, char const* data,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts an V8 object to a TRI_shaped_json_t
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonV8Object(v8::Isolate* isolate,
|
|
||||||
v8::Handle<v8::Value> const,
|
|
||||||
VocShaper*, bool);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a V8 object to a TRI_shaped_json_t in place
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_FillShapedJsonV8Object(v8::Isolate* isolate,
|
|
||||||
v8::Handle<v8::Value> const, TRI_shaped_json_t*,
|
|
||||||
VocShaper*, bool);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,10 +23,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "Shaper.h"
|
#include "Shaper.h"
|
||||||
#include "Basics/associative.h"
|
|
||||||
#include "Basics/hashes.h"
|
|
||||||
#include "Basics/StringBuffer.h"
|
|
||||||
#include "Basics/tri-strings.h"
|
|
||||||
|
|
||||||
// #define DEBUG_JSON_SHAPER 1
|
// #define DEBUG_JSON_SHAPER 1
|
||||||
|
|
||||||
|
@ -99,36 +95,3 @@ Shaper::Shaper() {}
|
||||||
|
|
||||||
Shaper::~Shaper() {}
|
Shaper::~Shaper() {}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief checks whether a shape is of primitive type
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shape_t const* Shaper::lookupSidBasicShape(TRI_shape_sid_t sid) {
|
|
||||||
if (sid > BasicShapes::TRI_SHAPE_SID_LIST) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BasicShapes::ShapeAddresses[sid];
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief checks whether a shape is of primitive type
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shape_t const* Shaper::lookupBasicShape(TRI_shape_t const* shape) {
|
|
||||||
if (shape->_type == TRI_SHAPE_NULL) {
|
|
||||||
return &BasicShapes::_shapeNull;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_BOOLEAN) {
|
|
||||||
return &BasicShapes::_shapeBoolean;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_NUMBER) {
|
|
||||||
return &BasicShapes::_shapeNumber;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_SHORT_STRING) {
|
|
||||||
return &BasicShapes::_shapeShortString;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_LONG_STRING) {
|
|
||||||
return &BasicShapes::_shapeLongString;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_LIST) {
|
|
||||||
return &BasicShapes::_shapeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#define ARANGOD_VOC_BASE_SHAPER_H 1
|
#define ARANGOD_VOC_BASE_SHAPER_H 1
|
||||||
|
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
#include "Basics/json.h"
|
|
||||||
#include "VocBase/shaped-json.h"
|
#include "VocBase/shaped-json.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -176,87 +176,6 @@ void TRI_PrintShape(VocShaper* shaper, TRI_shape_t const* shape, int indent) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a list of TRI_shape_value_t for debugging
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef DEBUG_JSON_SHAPER
|
|
||||||
|
|
||||||
static void PrintShapeValues(TRI_shape_value_t* values, size_t n) {
|
|
||||||
TRI_shape_value_t* p = values;
|
|
||||||
TRI_shape_value_t* e = values + n;
|
|
||||||
|
|
||||||
for (; p < e; ++p) {
|
|
||||||
switch (p->_type) {
|
|
||||||
case TRI_SHAPE_NULL:
|
|
||||||
printf("NULL aid: %u, sid: %u, fixed: %s, size: %u",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_BOOLEAN:
|
|
||||||
printf("BOOLEAN aid: %u, sid: %u, fixed: %s, size: %u, value: %s",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size,
|
|
||||||
*((TRI_shape_boolean_t const*)p->_value) ? "true" : "false");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_NUMBER:
|
|
||||||
printf("NUMBER aid: %u, sid: %u, fixed: %s, size: %u, value: %f",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size,
|
|
||||||
*((TRI_shape_number_t const*)p->_value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_SHORT_STRING:
|
|
||||||
printf("SHORT STRING aid: %u, sid: %u, fixed: %s, size: %u, value: %s",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size,
|
|
||||||
p->_value + sizeof(TRI_shape_length_short_string_t));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_LONG_STRING:
|
|
||||||
printf("LONG STRING aid: %u, sid: %u, fixed: %s, size: %u, value: %s",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size,
|
|
||||||
p->_value + sizeof(TRI_shape_length_long_string_t));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_ARRAY:
|
|
||||||
printf("ARRAY aid: %u, sid: %u, fixed: %s, size: %u",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_LIST:
|
|
||||||
printf("LIST aid: %u, sid: %u, fixed: %s, size: %u",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_HOMOGENEOUS_LIST:
|
|
||||||
printf("HOMOGENEOUS LIST aid: %u, sid: %u, fixed: %s, size: %u",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TRI_SHAPE_HOMOGENEOUS_SIZED_LIST:
|
|
||||||
printf("HOMOGENEOUS SIZED LIST aid: %u, sid: %u, fixed: %s, size: %u",
|
|
||||||
(unsigned int)p->_aid, (unsigned int)p->_sid,
|
|
||||||
p->_fixedSized ? "yes" : "no", (unsigned int)p->_size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf("unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief weight function for TRI_shape_type_t
|
/// @brief weight function for TRI_shape_type_t
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -2033,60 +1952,6 @@ void TRI_SortShapeValues(TRI_shape_value_t* values, size_t n) {
|
||||||
qsort(values, n, sizeof(TRI_shape_value_t), SortShapeValuesFunc);
|
qsort(values, n, sizeof(TRI_shape_value_t), SortShapeValuesFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a VelocyPack object into a shaped json object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonVelocyPack(VocShaper* shaper,
|
|
||||||
VPackSlice const& slice,
|
|
||||||
bool create) {
|
|
||||||
std::unique_ptr<TRI_json_t> json(
|
|
||||||
arangodb::basics::VelocyPackHelper::velocyPackToJson(slice));
|
|
||||||
return TRI_ShapedJsonJson(shaper, json.get(), create);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a json object into a shaped json object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonJson(VocShaper* shaper, TRI_json_t const* json,
|
|
||||||
bool create) {
|
|
||||||
TRI_ASSERT(json != nullptr);
|
|
||||||
|
|
||||||
TRI_shape_value_t dst;
|
|
||||||
|
|
||||||
dst._value = nullptr;
|
|
||||||
bool ok = FillShapeValueJson(shaper, &dst, json, 0, create);
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_JSON_SHAPER
|
|
||||||
printf("shape\n-----\n");
|
|
||||||
TRI_PrintShape(shaper, shaper->lookupShapeId(dst._sid), 0);
|
|
||||||
printf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// no need to prefill shaped with 0's as all attributes are set directly
|
|
||||||
// afterwards
|
|
||||||
TRI_shaped_json_t* shaped = static_cast<TRI_shaped_json_t*>(
|
|
||||||
TRI_Allocate(shaper->memoryZone(), sizeof(TRI_shaped_json_t), false));
|
|
||||||
|
|
||||||
if (shaped == nullptr) {
|
|
||||||
if (dst._value != nullptr) {
|
|
||||||
TRI_Free(shaper->memoryZone(), dst._value);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
shaped->_sid = dst._sid;
|
|
||||||
shaped->_data.length = (uint32_t)dst._size;
|
|
||||||
shaped->_data.data = dst._value;
|
|
||||||
|
|
||||||
return shaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief converts a shaped json object into a json object
|
/// @brief converts a shaped json object into a json object
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -2122,472 +1987,3 @@ TRI_json_t* TRI_JsonShapedJson(VocShaper* shaper,
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a shaped json object into a VelocyPack Object
|
|
||||||
/// NOTE: Transforms via TRI_json_t.
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
std::shared_ptr<VPackBuilder> TRI_VelocyPackShapedJson(
|
|
||||||
VocShaper* shaper, TRI_shaped_json_t const* shaped) {
|
|
||||||
std::unique_ptr<TRI_json_t> tmp(TRI_JsonShapedJson(shaper, shaped));
|
|
||||||
return arangodb::basics::JsonHelper::toVelocyPack(tmp.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a shaped json to a string buffer, without the outer braces
|
|
||||||
/// this can only be used to stringify shapes of type array
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool TRI_StringifyArrayShapedJson(T* shaper, TRI_string_buffer_t* buffer,
|
|
||||||
TRI_shaped_json_t const* shaped,
|
|
||||||
bool prepend) {
|
|
||||||
TRI_shape_t const* shape = shaper->lookupShapeId(shaped->_sid);
|
|
||||||
|
|
||||||
if (shape == nullptr || shape->_type != TRI_SHAPE_ARRAY) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prepend) {
|
|
||||||
TRI_array_shape_t const* s = (TRI_array_shape_t const*)shape;
|
|
||||||
if (s->_fixedEntries + s->_variableEntries > 0) {
|
|
||||||
TRI_AppendCharStringBuffer(buffer, ',');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t num;
|
|
||||||
return StringifyJsonShapeDataArray(shaper, buffer, shape, shaped->_data.data,
|
|
||||||
shaped->_data.length, false, &num);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a shaped json to a string buffer
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_StringifyAugmentedShapedJson(VocShaper* shaper,
|
|
||||||
struct TRI_string_buffer_t* buffer,
|
|
||||||
TRI_shaped_json_t const* shaped,
|
|
||||||
TRI_json_t const* augment) {
|
|
||||||
TRI_shape_t const* shape = shaper->lookupShapeId(shaped->_sid);
|
|
||||||
|
|
||||||
if (shape == nullptr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (augment == nullptr || augment->_type != TRI_JSON_OBJECT ||
|
|
||||||
shape->_type != TRI_SHAPE_ARRAY) {
|
|
||||||
return StringifyJsonShapeData<VocShaper>(
|
|
||||||
shaper, buffer, shape, shaped->_data.data, shaped->_data.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
int res = TRI_AppendCharStringBuffer(buffer, '{');
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t num;
|
|
||||||
bool ok = StringifyJsonShapeDataArray<VocShaper>(
|
|
||||||
shaper, buffer, shape, shaped->_data.data, shaped->_data.length, false,
|
|
||||||
&num);
|
|
||||||
|
|
||||||
if (0 < num) {
|
|
||||||
res = TRI_AppendCharStringBuffer(buffer, ',');
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = TRI_Stringify2Json(buffer, augment);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = TRI_AppendCharStringBuffer(buffer, '}');
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthListShapedJson(TRI_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json) {
|
|
||||||
return *(TRI_shape_length_list_t*)json->_data.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtListShapedJson(TRI_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json, size_t position,
|
|
||||||
TRI_shaped_json_t* result) {
|
|
||||||
char const* ptr = json->_data.data;
|
|
||||||
TRI_shape_length_list_t n = *(TRI_shape_length_list_t*)ptr;
|
|
||||||
|
|
||||||
ptr += sizeof(TRI_shape_length_list_t);
|
|
||||||
TRI_shape_sid_t* sids = (TRI_shape_sid_t*)ptr;
|
|
||||||
|
|
||||||
ptr += n * sizeof(TRI_shape_sid_t);
|
|
||||||
TRI_shape_size_t* offsets = (TRI_shape_size_t*)ptr;
|
|
||||||
|
|
||||||
result->_sid = sids[position];
|
|
||||||
result->_data.data = ((char*)json->_data.data) + offsets[position];
|
|
||||||
result->_data.length = (uint32_t)(offsets[position + 1] - offsets[position]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a homogeneous list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthHomogeneousListShapedJson(
|
|
||||||
TRI_homogeneous_list_shape_t const* shape, TRI_shaped_json_t const* json) {
|
|
||||||
return *(TRI_shape_length_list_t*)json->_data.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a homogeneous list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtHomogeneousListShapedJson(TRI_homogeneous_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json,
|
|
||||||
size_t position,
|
|
||||||
TRI_shaped_json_t* result) {
|
|
||||||
char const* ptr = json->_data.data;
|
|
||||||
TRI_shape_length_list_t n = *(TRI_shape_length_list_t*)ptr;
|
|
||||||
|
|
||||||
if (n <= position) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr += sizeof(TRI_shape_length_list_t);
|
|
||||||
TRI_shape_size_t* offsets = (TRI_shape_size_t*)ptr;
|
|
||||||
|
|
||||||
result->_sid = shape->_sidEntry;
|
|
||||||
result->_data.data = ((char*)json->_data.data) + offsets[position];
|
|
||||||
result->_data.length = (uint32_t)(offsets[position + 1] - offsets[position]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a homogeneous sized list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthHomogeneousSizedListShapedJson(
|
|
||||||
TRI_homogeneous_sized_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json) {
|
|
||||||
return *(TRI_shape_length_list_t*)json->_data.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a homogeneous sized list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtHomogeneousSizedListShapedJson(
|
|
||||||
TRI_homogeneous_sized_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json, size_t position, TRI_shaped_json_t* result) {
|
|
||||||
char* ptr = json->_data.data;
|
|
||||||
TRI_shape_length_list_t n = *(TRI_shape_length_list_t*)ptr;
|
|
||||||
|
|
||||||
if (n <= position) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr += sizeof(TRI_shape_length_list_t);
|
|
||||||
|
|
||||||
result->_sid = shape->_sidEntry;
|
|
||||||
result->_data.data = ptr + (shape->_sizeEntry * position);
|
|
||||||
result->_data.length = (uint32_t)shape->_sizeEntry;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief get the string value encoded in a shaped json
|
|
||||||
/// this will return the pointer to the string and the string length in the
|
|
||||||
/// variables passed by reference
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_StringValueShapedJson(TRI_shape_t const* shape, char const* data,
|
|
||||||
char** value, size_t* length) {
|
|
||||||
if (shape->_type == TRI_SHAPE_SHORT_STRING) {
|
|
||||||
TRI_shape_length_short_string_t l;
|
|
||||||
|
|
||||||
l = *(TRI_shape_length_short_string_t const*)data;
|
|
||||||
data += sizeof(TRI_shape_length_short_string_t);
|
|
||||||
*length = l - 1;
|
|
||||||
*value = (char*)data;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (shape->_type == TRI_SHAPE_LONG_STRING) {
|
|
||||||
TRI_shape_length_long_string_t l;
|
|
||||||
|
|
||||||
l = *(TRI_shape_length_long_string_t const*)data;
|
|
||||||
data += sizeof(TRI_shape_length_long_string_t);
|
|
||||||
*length = l - 1;
|
|
||||||
*value = (char*)data;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no string type
|
|
||||||
*value = nullptr;
|
|
||||||
*length = 0;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief iterate over a shaped json object, using a callback function
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TRI_IterateShapeDataArray(VocShaper* shaper, TRI_shape_t const* shape,
|
|
||||||
char const* data,
|
|
||||||
bool (*filter)(VocShaper*, TRI_shape_t const*,
|
|
||||||
char const*, char const*,
|
|
||||||
uint64_t, void*),
|
|
||||||
void* ptr) {
|
|
||||||
TRI_array_shape_t const* s;
|
|
||||||
TRI_shape_aid_t const* aids;
|
|
||||||
TRI_shape_sid_t const* sids;
|
|
||||||
TRI_shape_size_t const* offsetsF;
|
|
||||||
TRI_shape_size_t const* offsetsV;
|
|
||||||
TRI_shape_size_t f;
|
|
||||||
TRI_shape_size_t i;
|
|
||||||
TRI_shape_size_t n;
|
|
||||||
TRI_shape_size_t v;
|
|
||||||
TRI_shape_sid_t cachedSid;
|
|
||||||
TRI_shape_t const* cachedShape;
|
|
||||||
char const* qtr;
|
|
||||||
|
|
||||||
TRI_ASSERT(shape->_type == TRI_SHAPE_ARRAY);
|
|
||||||
|
|
||||||
s = (TRI_array_shape_t const*)shape;
|
|
||||||
f = s->_fixedEntries;
|
|
||||||
v = s->_variableEntries;
|
|
||||||
n = f + v;
|
|
||||||
|
|
||||||
qtr = (char const*)shape;
|
|
||||||
qtr += sizeof(TRI_array_shape_t);
|
|
||||||
|
|
||||||
sids = (TRI_shape_sid_t const*)qtr;
|
|
||||||
qtr += n * sizeof(TRI_shape_sid_t);
|
|
||||||
|
|
||||||
aids = (TRI_shape_aid_t const*)qtr;
|
|
||||||
qtr += n * sizeof(TRI_shape_aid_t);
|
|
||||||
|
|
||||||
offsetsF = (TRI_shape_size_t const*)qtr;
|
|
||||||
|
|
||||||
cachedSid = 0;
|
|
||||||
cachedShape = nullptr;
|
|
||||||
|
|
||||||
for (i = 0; i < f; ++i, ++sids, ++aids, ++offsetsF) {
|
|
||||||
TRI_shape_aid_t aid;
|
|
||||||
TRI_shape_sid_t sid;
|
|
||||||
TRI_shape_size_t offset;
|
|
||||||
TRI_shape_t const* subshape;
|
|
||||||
char const* name;
|
|
||||||
|
|
||||||
sid = *sids;
|
|
||||||
aid = *aids;
|
|
||||||
offset = *offsetsF;
|
|
||||||
|
|
||||||
// use last sid if in cache
|
|
||||||
if (sid == cachedSid && cachedSid > 0) {
|
|
||||||
subshape = cachedShape;
|
|
||||||
} else {
|
|
||||||
cachedShape = subshape = shaper->lookupShapeId(sid);
|
|
||||||
cachedSid = sid;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = shaper->lookupAttributeId(aid);
|
|
||||||
|
|
||||||
if (subshape == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find shape #" << sid;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find attribute #" << aid;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter(shaper, subshape, name, data + offset, offsetsF[1] - offset,
|
|
||||||
ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
offsetsV = (TRI_shape_size_t const*)data;
|
|
||||||
|
|
||||||
for (i = 0; i < v; ++i, ++sids, ++aids, ++offsetsV) {
|
|
||||||
TRI_shape_sid_t sid;
|
|
||||||
TRI_shape_aid_t aid;
|
|
||||||
TRI_shape_size_t offset;
|
|
||||||
TRI_shape_t const* subshape;
|
|
||||||
char const* name;
|
|
||||||
|
|
||||||
sid = *sids;
|
|
||||||
aid = *aids;
|
|
||||||
offset = *offsetsV;
|
|
||||||
|
|
||||||
// use last sid if in cache
|
|
||||||
if (sid == cachedSid && cachedSid > 0) {
|
|
||||||
subshape = cachedShape;
|
|
||||||
} else {
|
|
||||||
cachedShape = subshape = shaper->lookupShapeId(sid);
|
|
||||||
cachedSid = sid;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = shaper->lookupAttributeId(aid);
|
|
||||||
|
|
||||||
if (subshape == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find shape #" << sid;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find attribute #" << aid;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter(shaper, subshape, name, data + offset, offsetsV[1] - offset,
|
|
||||||
ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief iterate over a shaped json list, using a callback function
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TRI_IterateShapeDataList(VocShaper* shaper, TRI_shape_t const* shape,
|
|
||||||
char const* data,
|
|
||||||
bool (*filter)(VocShaper*, TRI_shape_t const*,
|
|
||||||
char const*, uint64_t, void*),
|
|
||||||
void* ptr) {
|
|
||||||
TRI_shape_length_list_t i;
|
|
||||||
TRI_shape_length_list_t l;
|
|
||||||
|
|
||||||
if (shape->_type == TRI_SHAPE_LIST) {
|
|
||||||
shape_cache_t shapeCache;
|
|
||||||
|
|
||||||
char const* p = data;
|
|
||||||
l = *(TRI_shape_length_list_t const*)p;
|
|
||||||
|
|
||||||
p += sizeof(TRI_shape_length_list_t);
|
|
||||||
TRI_shape_sid_t const* sids = (TRI_shape_sid_t const*)p;
|
|
||||||
|
|
||||||
p += l * sizeof(TRI_shape_sid_t);
|
|
||||||
TRI_shape_size_t const* offsets = (TRI_shape_size_t const*)p;
|
|
||||||
|
|
||||||
shapeCache._sid = 0;
|
|
||||||
shapeCache._shape = nullptr;
|
|
||||||
|
|
||||||
for (i = 0; i < l; ++i, ++sids, ++offsets) {
|
|
||||||
TRI_shape_sid_t sid = *sids;
|
|
||||||
TRI_shape_size_t offset = *offsets;
|
|
||||||
|
|
||||||
// use last sid if in cache
|
|
||||||
TRI_shape_t const* subshape;
|
|
||||||
if (sid == shapeCache._sid && shapeCache._sid > 0) {
|
|
||||||
subshape = shapeCache._shape;
|
|
||||||
} else {
|
|
||||||
shapeCache._shape = subshape = shaper->lookupShapeId(sid);
|
|
||||||
shapeCache._sid = sid;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subshape == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find shape #" << sid;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter(shaper, subshape, data + offset, offsets[1] - offset, ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (shape->_type == TRI_SHAPE_HOMOGENEOUS_LIST) {
|
|
||||||
TRI_homogeneous_list_shape_t const* s =
|
|
||||||
(TRI_homogeneous_list_shape_t const*)shape;
|
|
||||||
TRI_shape_sid_t sid = s->_sidEntry;
|
|
||||||
|
|
||||||
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
|
|
||||||
|
|
||||||
if (subshape == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find shape #" << sid;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char const* p = data;
|
|
||||||
l = *(TRI_shape_length_list_t const*)p;
|
|
||||||
|
|
||||||
p += sizeof(TRI_shape_length_list_t);
|
|
||||||
TRI_shape_size_t const* offsets = (TRI_shape_size_t const*)p;
|
|
||||||
|
|
||||||
for (i = 0; i < l; ++i, ++offsets) {
|
|
||||||
TRI_shape_size_t offset = *offsets;
|
|
||||||
|
|
||||||
if (!filter(shaper, subshape, data + offset, offsets[1] - offset, ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (shape->_type == TRI_SHAPE_HOMOGENEOUS_SIZED_LIST) {
|
|
||||||
TRI_homogeneous_sized_list_shape_t const* s =
|
|
||||||
(TRI_homogeneous_sized_list_shape_t const*)shape;
|
|
||||||
TRI_shape_sid_t sid = s->_sidEntry;
|
|
||||||
|
|
||||||
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
|
|
||||||
|
|
||||||
if (subshape == nullptr) {
|
|
||||||
LOG(WARN) << "cannot find shape #" << sid;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char const* p = data;
|
|
||||||
l = *(TRI_shape_length_list_t const*)p;
|
|
||||||
|
|
||||||
TRI_shape_size_t length = s->_sizeEntry;
|
|
||||||
TRI_shape_size_t offset = sizeof(TRI_shape_length_list_t);
|
|
||||||
|
|
||||||
for (i = 0; i < l; ++i, offset += length) {
|
|
||||||
if (!filter(shaper, subshape, data + offset, length, ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a list of TRI_shape_value_t for debugging
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef DEBUG_JSON_SHAPER
|
|
||||||
|
|
||||||
void TRI_PrintShapeValues(TRI_shape_value_t* values, size_t n) {
|
|
||||||
PrintShapeValues(values, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief explicit instantiation of the two functions
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
template bool TRI_StringifyArrayShapedJson<VocShaper>(
|
|
||||||
VocShaper*, struct TRI_string_buffer_t*, TRI_shaped_json_t const*, bool);
|
|
||||||
|
|
|
@ -831,21 +831,6 @@ typedef struct TRI_shaped_json_s {
|
||||||
TRI_blob_t _data;
|
TRI_blob_t _data;
|
||||||
} TRI_shaped_json_t;
|
} TRI_shaped_json_t;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief shaped json sub-object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
typedef struct TRI_shaped_sub_s {
|
|
||||||
TRI_shape_sid_t _sid;
|
|
||||||
union {
|
|
||||||
char _data[8];
|
|
||||||
struct {
|
|
||||||
uint32_t _offset;
|
|
||||||
uint32_t _length;
|
|
||||||
} _position;
|
|
||||||
} _value;
|
|
||||||
} TRI_shaped_sub_t;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief json storage type of an attribute path
|
/// @brief json storage type of an attribute path
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -882,141 +867,12 @@ void TRI_FreeShapedJson(struct TRI_memory_zone_s*, TRI_shaped_json_t*);
|
||||||
|
|
||||||
void TRI_SortShapeValues(TRI_shape_value_t* values, size_t n);
|
void TRI_SortShapeValues(TRI_shape_value_t* values, size_t n);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a VelocyPack object into a shaped json object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonVelocyPack(VocShaper*,
|
|
||||||
arangodb::velocypack::Slice const&,
|
|
||||||
bool);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a json object into a shaped json object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_shaped_json_t* TRI_ShapedJsonJson(VocShaper*, TRI_json_t const*, bool);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief converts a shaped json object into a json object
|
/// @brief converts a shaped json object into a json object
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TRI_json_t* TRI_JsonShapedJson(VocShaper*, TRI_shaped_json_t const*);
|
TRI_json_t* TRI_JsonShapedJson(VocShaper*, TRI_shaped_json_t const*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief converts a shaped json object into a VelocyPack Object
|
|
||||||
/// NOTE: Transforms via TRI_json_t.
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
std::shared_ptr<arangodb::velocypack::Builder> TRI_VelocyPackShapedJson(
|
|
||||||
VocShaper*, TRI_shaped_json_t const*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a shaped json to a string buffer, without the outer braces
|
|
||||||
/// this can only be used to stringify shapes of type array
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool TRI_StringifyArrayShapedJson(T*, struct TRI_string_buffer_t*,
|
|
||||||
TRI_shaped_json_t const*, bool);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a shaped json to a string buffer
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_StringifyAugmentedShapedJson(VocShaper*, struct TRI_string_buffer_t*,
|
|
||||||
TRI_shaped_json_t const*,
|
|
||||||
TRI_json_t const*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthListShapedJson(TRI_list_shape_t const*,
|
|
||||||
TRI_shaped_json_t const*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtListShapedJson(TRI_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json, size_t position,
|
|
||||||
TRI_shaped_json_t* result);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a homogeneous list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthHomogeneousListShapedJson(
|
|
||||||
TRI_homogeneous_list_shape_t const* shape, TRI_shaped_json_t const* json);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a homogeneous list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtHomogeneousListShapedJson(TRI_homogeneous_list_shape_t const* shape,
|
|
||||||
TRI_shaped_json_t const* json,
|
|
||||||
size_t position,
|
|
||||||
TRI_shaped_json_t* result);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the length of a homogeneous sized list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
size_t TRI_LengthHomogeneousSizedListShapedJson(
|
|
||||||
TRI_homogeneous_sized_list_shape_t const* shape, TRI_shaped_json_t const*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief returns the n.th element of a homogeneous sized list
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_AtHomogeneousSizedListShapedJson(
|
|
||||||
TRI_homogeneous_sized_list_shape_t const* shape, TRI_shaped_json_t const*,
|
|
||||||
size_t position, TRI_shaped_json_t*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a TRI_shape_t for debugging
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef DEBUG_JSON_SHAPER
|
|
||||||
|
|
||||||
void TRI_PrintShape(VocShaper*, TRI_shape_t const* shape, int indent);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief get the string value encoded in a shaped json
|
|
||||||
/// this will return the pointer to the string and the string length in the
|
|
||||||
/// variables passed by reference
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool TRI_StringValueShapedJson(TRI_shape_t const*, char const*, char**,
|
|
||||||
size_t*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief iterate over a shaped json array, using a callback function
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TRI_IterateShapeDataArray(VocShaper*, TRI_shape_t const*, char const*,
|
|
||||||
bool (*)(VocShaper*, TRI_shape_t const*,
|
|
||||||
char const*, char const*, uint64_t,
|
|
||||||
void*),
|
|
||||||
void*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief iterate over a shaped json list, using a callback function
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TRI_IterateShapeDataList(VocShaper*, TRI_shape_t const*, char const*,
|
|
||||||
bool (*)(VocShaper*, TRI_shape_t const*,
|
|
||||||
char const*, uint64_t, void*),
|
|
||||||
void*);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief prints a list of TRI_shape_value_t for debugging
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TRI_PrintShapeValues(TRI_shape_value_t*, size_t);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief Hash and Equal comparison for a vector of TRI_shaped_json_t
|
/// @brief Hash and Equal comparison for a vector of TRI_shaped_json_t
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue