summaryrefslogtreecommitdiffstats
path: root/xmrstak/rapidjson/schema.h
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/rapidjson/schema.h')
-rw-r--r--xmrstak/rapidjson/schema.h82
1 files changed, 41 insertions, 41 deletions
diff --git a/xmrstak/rapidjson/schema.h b/xmrstak/rapidjson/schema.h
index e7af3cf..aca3561 100644
--- a/xmrstak/rapidjson/schema.h
+++ b/xmrstak/rapidjson/schema.h
@@ -1,5 +1,5 @@
// Tencent is pleased to support the open source community by making RapidJSON available->
-//
+//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip-> All rights reserved->
//
// Licensed under the MIT License (the "License"); you may not use this file except
@@ -7,9 +7,9 @@
//
// http://opensource->org/licenses/MIT
//
-// Unless required by applicable law or agreed to in writing, software distributed
-// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-// CONDITIONS OF ANY KIND, either express or implied-> See the License for the
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied-> See the License for the
// specific language governing permissions and limitations under the License->
#ifndef RAPIDJSON_SCHEMA_H_
@@ -174,10 +174,10 @@ public:
bool Uint(unsigned u) { Number n; n.u.u = u; n.d = static_cast<double>(u); return WriteNumber(n); }
bool Int64(int64_t i) { Number n; n.u.i = i; n.d = static_cast<double>(i); return WriteNumber(n); }
bool Uint64(uint64_t u) { Number n; n.u.u = u; n.d = static_cast<double>(u); return WriteNumber(n); }
- bool Double(double d) {
- Number n;
+ bool Double(double d) {
+ Number n;
if (d < 0) n.u.i = static_cast<int64_t>(d);
- else n.u.u = static_cast<uint64_t>(d);
+ else n.u.u = static_cast<uint64_t>(d);
n.d = d;
return WriteNumber(n);
}
@@ -194,7 +194,7 @@ public:
bool StartObject() { return true; }
bool Key(const Ch* str, SizeType len, bool copy) { return String(str, len, copy); }
- bool EndObject(SizeType memberCount) {
+ bool EndObject(SizeType memberCount) {
uint64_t h = Hash(0, kObjectType);
uint64_t* kv = stack_.template Pop<uint64_t>(memberCount * 2);
for (SizeType i = 0; i < memberCount; i++)
@@ -202,9 +202,9 @@ public:
*stack_.template Push<uint64_t>() = h;
return true;
}
-
+
bool StartArray() { return true; }
- bool EndArray(SizeType elementCount) {
+ bool EndArray(SizeType elementCount) {
uint64_t h = Hash(0, kArrayType);
uint64_t* e = stack_.template Pop<uint64_t>(elementCount);
for (SizeType i = 0; i < elementCount; i++)
@@ -231,9 +231,9 @@ private:
};
bool WriteType(Type type) { return WriteBuffer(type, 0, 0); }
-
+
bool WriteNumber(const Number& n) { return WriteBuffer(kNumberType, &n, sizeof(n)); }
-
+
bool WriteBuffer(Type type, const void* data, size_t len) {
// FNV-1a from http://isthe.com/chongo/tech/comp/fnv/
uint64_t h = Hash(RAPIDJSON_UINT64_C2(0x84222325, 0xcbf29ce4), type);
@@ -433,7 +433,7 @@ public:
if (properties && properties->IsObject())
for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr)
AddUniqueElement(allProperties, itr->name);
-
+
if (required && required->IsArray())
for (ConstValueIterator itr = required->Begin(); itr != required->End(); ++itr)
if (itr->IsString())
@@ -660,7 +660,7 @@ public:
for (SizeType i = allOf_.begin; i < allOf_.begin + allOf_.count; i++)
if (!context.validators[i]->IsValid())
RAPIDJSON_INVALID_KEYWORD_RETURN(GetAllOfString());
-
+
if (anyOf_.schemas) {
for (SizeType i = anyOf_.begin; i < anyOf_.begin + anyOf_.count; i++)
if (context.validators[i]->IsValid())
@@ -688,13 +688,13 @@ public:
return true;
}
- bool Null(Context& context) const {
+ bool Null(Context& context) const {
if (!(type_ & (1 << kNullSchemaType)))
RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
return CreateParallelValidator(context);
}
-
- bool Bool(Context& context, bool) const {
+
+ bool Bool(Context& context, bool) const {
if (!(type_ & (1 << kBooleanSchemaType)))
RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
return CreateParallelValidator(context);
@@ -733,13 +733,13 @@ public:
if (!maximum_.IsNull() && !CheckDoubleMaximum(context, d))
return false;
-
+
if (!multipleOf_.IsNull() && !CheckDoubleMultipleOf(context, d))
return false;
-
+
return CreateParallelValidator(context);
}
-
+
bool String(Context& context, const Ch* str, SizeType length, bool) const {
if (!(type_ & (1 << kStringSchemaType)))
RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
@@ -760,7 +760,7 @@ public:
return CreateParallelValidator(context);
}
- bool StartObject(Context& context) const {
+ bool StartObject(Context& context) const {
if (!(type_ & (1 << kObjectSchemaType)))
RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
@@ -778,7 +778,7 @@ public:
return CreateParallelValidator(context);
}
-
+
bool Key(Context& context, const Ch* str, SizeType len, bool) const {
if (patternProperties_) {
context.patternPropertiesSchemaCount = 0;
@@ -854,7 +854,7 @@ public:
return true;
}
- bool StartArray(Context& context) const {
+ bool StartArray(Context& context) const {
if (!(type_ & (1 << kArraySchemaType)))
RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
@@ -864,12 +864,12 @@ public:
return CreateParallelValidator(context);
}
- bool EndArray(Context& context, SizeType elementCount) const {
+ bool EndArray(Context& context, SizeType elementCount) const {
context.inArray = false;
-
+
if (elementCount < minItems_)
RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinItemsString());
-
+
if (elementCount > maxItems_)
RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaxItemsString());
@@ -1055,13 +1055,13 @@ private:
if (anyOf_.schemas)
CreateSchemaValidators(context, anyOf_);
-
+
if (oneOf_.schemas)
CreateSchemaValidators(context, oneOf_);
-
+
if (not_)
context.validators[notValidatorIndex_] = context.factory.CreateSchemaValidator(*not_);
-
+
if (hasSchemaDependencies_) {
for (SizeType i = 0; i < propertyCount_; i++)
if (properties_[i].dependenciesSchema)
@@ -1082,7 +1082,7 @@ private:
SizeType len = name.GetStringLength();
const Ch* str = name.GetString();
for (SizeType index = 0; index < propertyCount_; index++)
- if (properties_[index].name.GetStringLength() == len &&
+ if (properties_[index].name.GetStringLength() == len &&
(std::memcmp(properties_[index].name.GetString(), str, sizeof(Ch) * len) == 0))
{
*outIndex = index;
@@ -1202,7 +1202,7 @@ private:
struct PatternProperty {
PatternProperty() : schema(), pattern() {}
- ~PatternProperty() {
+ ~PatternProperty() {
if (pattern) {
pattern->~RegexType();
AllocatorType::Free(pattern);
@@ -1564,7 +1564,7 @@ template <
typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>,
typename StateAllocator = CrtAllocator>
class GenericSchemaValidator :
- public internal::ISchemaStateFactory<typename SchemaDocumentType::SchemaType>,
+ public internal::ISchemaStateFactory<typename SchemaDocumentType::SchemaType>,
public internal::ISchemaValidator
{
public:
@@ -1582,7 +1582,7 @@ public:
*/
GenericSchemaValidator(
const SchemaDocumentType& schemaDocument,
- StateAllocator* allocator = 0,
+ StateAllocator* allocator = 0,
size_t schemaStackCapacity = kDefaultSchemaStackCapacity,
size_t documentStackCapacity = kDefaultDocumentStackCapacity)
:
@@ -1610,7 +1610,7 @@ public:
GenericSchemaValidator(
const SchemaDocumentType& schemaDocument,
OutputHandler& outputHandler,
- StateAllocator* allocator = 0,
+ StateAllocator* allocator = 0,
size_t schemaStackCapacity = kDefaultSchemaStackCapacity,
size_t documentStackCapacity = kDefaultDocumentStackCapacity)
:
@@ -1721,7 +1721,7 @@ RAPIDJSON_MULTILINEMACRO_END
RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(StartObject, ());
return valid_ = outputHandler_.StartObject();
}
-
+
bool Key(const Ch* str, SizeType len, bool copy) {
if (!valid_) return false;
AppendToken(str, len);
@@ -1729,8 +1729,8 @@ RAPIDJSON_MULTILINEMACRO_END
RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(Key, (str, len, copy));
return valid_ = outputHandler_.Key(str, len, copy);
}
-
- bool EndObject(SizeType memberCount) {
+
+ bool EndObject(SizeType memberCount) {
if (!valid_) return false;
RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(EndObject, (memberCount));
if (!CurrentSchema().EndObject(CurrentContext(), memberCount)) return valid_ = false;
@@ -1742,7 +1742,7 @@ RAPIDJSON_MULTILINEMACRO_END
RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(StartArray, ());
return valid_ = outputHandler_.StartArray();
}
-
+
bool EndArray(SizeType elementCount) {
if (!valid_) return false;
RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(EndArray, (elementCount));
@@ -1797,7 +1797,7 @@ private:
typedef GenericValue<UTF8<>, StateAllocator> HashCodeArray;
typedef internal::Hasher<EncodingType, StateAllocator> HasherType;
- GenericSchemaValidator(
+ GenericSchemaValidator(
const SchemaDocumentType& schemaDocument,
const SchemaType& root,
#if RAPIDJSON_SCHEMA_VERBOSE
@@ -1872,7 +1872,7 @@ private:
#endif
uint64_t h = CurrentContext().arrayUniqueness ? static_cast<HasherType*>(CurrentContext().hasher)->GetHashCode() : 0;
-
+
PopSchema();
if (!schemaStack_.Empty()) {
@@ -1913,7 +1913,7 @@ private:
}
RAPIDJSON_FORCEINLINE void PushSchema(const SchemaType& schema) { new (schemaStack_.template Push<Context>()) Context(*this, &schema); }
-
+
RAPIDJSON_FORCEINLINE void PopSchema() {
Context* c = schemaStack_.template Pop<Context>(1);
if (HashCodeArray* a = static_cast<HashCodeArray*>(c->arrayElementHashCodes)) {
OpenPOWER on IntegriCloud