diff options
Diffstat (limited to 'graphics/asymptote/LspCpp/third_party/rapidjson/example')
17 files changed, 70 insertions, 70 deletions
diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.cpp index 59ae4c4101..2d32ea3539 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.cpp @@ -69,7 +69,7 @@ JsonReader& JsonReader::Member(const char* name) { if (!mError) { if (CURRENT.IsObject() && TOP.state == JsonReaderStackItem::Started) { Value::ConstMemberIterator memberItr = CURRENT.FindMember(name); - if (memberItr != CURRENT.MemberEnd()) + if (memberItr != CURRENT.MemberEnd()) STACK->push(JsonReaderStackItem(&memberItr->value, JsonReaderStackItem::BeforeStart)); else mError = true; @@ -218,7 +218,7 @@ JsonWriter::JsonWriter() : mWriter(), mStream() { mWriter = new PrettyWriter<StringBuffer>(*STREAM); } -JsonWriter::~JsonWriter() { +JsonWriter::~JsonWriter() { delete WRITER; delete STREAM; } @@ -249,7 +249,7 @@ bool JsonWriter::HasMember(const char*) const { } JsonWriter& JsonWriter::StartArray(size_t*) { - WRITER->StartArray(); + WRITER->StartArray(); return *this; } diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.h b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.h index 285ca73d6a..72d0cdd65c 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.h +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archiver.h @@ -17,7 +17,7 @@ public: /// Starts an object Archiver& StartObject(); - + /// After calling StartObject(), assign a member with a name Archiver& Member(const char* name); diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archivertest.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archivertest.cpp index 417a421a31..3b84e358b7 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archivertest.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/archiver/archivertest.cpp @@ -55,7 +55,7 @@ void test1() { ////////////////////////////////////////////////////////////////////////////// // Test2: std::vector <=> JSON array -// +// // You can map a JSON array to other data structures as well struct Group { @@ -67,7 +67,7 @@ struct Group { template <typename Archiver> Archiver& operator&(Archiver& ar, Group& g) { ar.StartObject(); - + ar.Member("groupName"); ar & g.groupName; @@ -203,14 +203,14 @@ class Canvas { public: Canvas() : shapes_() {} ~Canvas() { Clear(); } - + void Clear() { for (std::vector<Shape*>::iterator itr = shapes_.begin(); itr != shapes_.end(); ++itr) delete *itr; } void AddShape(Shape* shape) { shapes_.push_back(shape); } - + void Print(std::ostream& os) { for (std::vector<Shape*>::iterator itr = shapes_.begin(); itr != shapes_.end(); ++itr) { (*itr)->Print(os); diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/capitalize/capitalize.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/capitalize/capitalize.cpp index 7da37e9c50..c56640bc50 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/capitalize/capitalize.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/capitalize/capitalize.cpp @@ -1,6 +1,6 @@ // JSON condenser example -// This example parses JSON from stdin with validation, +// This example parses JSON from stdin with validation, // and re-output the JSON content to stdout with all string capitalized, and without whitespace. #include "rapidjson/reader.h" diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/condense/condense.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/condense/condense.cpp index 46dc350439..f2d05ca694 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/condense/condense.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/condense/condense.cpp @@ -1,6 +1,6 @@ // JSON condenser example -// This example parses JSON text from stdin with validation, +// This example parses JSON text from stdin with validation, // and re-output the JSON content to stdout without whitespace. #include "rapidjson/reader.h" diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkey/filterkey.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkey/filterkey.cpp index c34a050dc8..3ef72314ef 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkey/filterkey.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkey/filterkey.cpp @@ -19,7 +19,7 @@ class FilterKeyHandler { public: typedef char Ch; - FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) : + FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) : outputHandler_(outputHandler), keyString_(keyString), keyLength_(keyLength), filterValueDepth_(), filteredKeyCount_() {} @@ -32,8 +32,8 @@ public: bool Double(double d) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.Double(d) && EndValue(); } bool RawNumber(const Ch* str, SizeType len, bool copy) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.RawNumber(str, len, copy) && EndValue(); } bool String (const Ch* str, SizeType len, bool copy) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.String (str, len, copy) && EndValue(); } - - bool StartObject() { + + bool StartObject() { if (filterValueDepth_ > 0) { filterValueDepth_++; return true; @@ -43,9 +43,9 @@ public: return outputHandler_.StartObject(); } } - - bool Key(const Ch* str, SizeType len, bool copy) { - if (filterValueDepth_ > 0) + + bool Key(const Ch* str, SizeType len, bool copy) { + if (filterValueDepth_ > 0) return true; else if (len == keyLength_ && std::memcmp(str, keyString_, len) == 0) { filterValueDepth_ = 1; @@ -97,7 +97,7 @@ private: filterValueDepth_ = 0; return true; } - + OutputHandler& outputHandler_; const char* keyString_; const SizeType keyLength_; diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkeydom/filterkeydom.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkeydom/filterkeydom.cpp index 732cc81f13..b8cfdf0c80 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkeydom/filterkeydom.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/filterkeydom/filterkeydom.cpp @@ -20,7 +20,7 @@ class FilterKeyHandler { public: typedef char Ch; - FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) : + FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) : outputHandler_(outputHandler), keyString_(keyString), keyLength_(keyLength), filterValueDepth_(), filteredKeyCount_() {} @@ -33,8 +33,8 @@ public: bool Double(double d) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.Double(d) && EndValue(); } bool RawNumber(const Ch* str, SizeType len, bool copy) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.RawNumber(str, len, copy) && EndValue(); } bool String (const Ch* str, SizeType len, bool copy) { return filterValueDepth_ > 0 ? EndValue() : outputHandler_.String (str, len, copy) && EndValue(); } - - bool StartObject() { + + bool StartObject() { if (filterValueDepth_ > 0) { filterValueDepth_++; return true; @@ -44,9 +44,9 @@ public: return outputHandler_.StartObject(); } } - - bool Key(const Ch* str, SizeType len, bool copy) { - if (filterValueDepth_ > 0) + + bool Key(const Ch* str, SizeType len, bool copy) { + if (filterValueDepth_ > 0) return true; else if (len == keyLength_ && std::memcmp(str, keyString_, len) == 0) { filterValueDepth_ = 1; @@ -112,7 +112,7 @@ class FilterKeyReader { public: typedef char Ch; - FilterKeyReader(InputStream& is, const Ch* keyString, SizeType keyLength) : + FilterKeyReader(InputStream& is, const Ch* keyString, SizeType keyLength) : is_(is), keyString_(keyString), keyLength_(keyLength), parseResult_() {} diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/jsonx/jsonx.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/jsonx/jsonx.cpp index 954aa2b907..b08efc6087 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/jsonx/jsonx.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/jsonx/jsonx.cpp @@ -1,7 +1,7 @@ // JSON to JSONx conversion example, using SAX API. // JSONx is an IBM standard format to represent JSON as XML. // https://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.1.0/com.ibm.dp.doc/json_jsonx.html -// This example parses JSON text from stdin with validation, +// This example parses JSON text from stdin with validation, // and convert to JSONx format to stdout. // Need compile with -D__STDC_FORMAT_MACROS for defining PRId64 and PRIu64 macros. @@ -24,34 +24,34 @@ public: bool Null() { return WriteStartElement("null", true); } - + bool Bool(bool b) { - return + return WriteStartElement("boolean") && WriteString(b ? "true" : "false") && WriteEndElement("boolean"); } - + bool Int(int i) { char buffer[12]; return WriteNumberElement(buffer, sprintf(buffer, "%d", i)); } - + bool Uint(unsigned i) { char buffer[11]; return WriteNumberElement(buffer, sprintf(buffer, "%u", i)); } - + bool Int64(int64_t i) { char buffer[21]; return WriteNumberElement(buffer, sprintf(buffer, "%" PRId64, i)); } - + bool Uint64(uint64_t i) { char buffer[21]; return WriteNumberElement(buffer, sprintf(buffer, "%" PRIu64, i)); } - + bool Double(double d) { char buffer[30]; return WriteNumberElement(buffer, sprintf(buffer, "%.17g", d)); diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/lookaheadparser/lookaheadparser.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/lookaheadparser/lookaheadparser.cpp index f627f4d863..8824ef7867 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/lookaheadparser/lookaheadparser.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/lookaheadparser/lookaheadparser.cpp @@ -75,12 +75,12 @@ protected: kEnteringArray, kExitingArray }; - + Value v_; LookaheadParsingState st_; Reader r_; InsituStringStream ss_; - + static const int parseFlags = kParseDefaultFlags | kParseInsituFlag; }; @@ -94,14 +94,14 @@ void LookaheadParserHandler::ParseNext() { st_ = kError; return; } - + r_.IterativeParseNext<parseFlags>(ss_, *this); } class LookaheadParser : protected LookaheadParserHandler { public: LookaheadParser(char* str) : LookaheadParserHandler(str) {} - + bool EnterObject(); bool EnterArray(); const char* NextObjectKey(); @@ -117,9 +117,9 @@ public: void SkipValue(); Value* PeekValue(); int PeekType(); // returns a rapidjson::Type, or -1 for no value (at end of object/array) - + bool IsValid() { return st_ != kError; } - + protected: void SkipOut(int depth); }; @@ -129,7 +129,7 @@ bool LookaheadParser::EnterObject() { st_ = kError; return false; } - + ParseNext(); return true; } @@ -139,7 +139,7 @@ bool LookaheadParser::EnterArray() { st_ = kError; return false; } - + ParseNext(); return true; } @@ -150,12 +150,12 @@ const char* LookaheadParser::NextObjectKey() { ParseNext(); return result; } - + if (st_ != kExitingObject) { st_ = kError; return 0; } - + ParseNext(); return 0; } @@ -165,7 +165,7 @@ bool LookaheadParser::NextArrayValue() { ParseNext(); return false; } - + if (st_ == kError || st_ == kExitingObject || st_ == kHasKey) { st_ = kError; return false; @@ -190,7 +190,7 @@ double LookaheadParser::GetDouble() { st_ = kError; return 0.; } - + double result = v_.GetDouble(); ParseNext(); return result; @@ -201,7 +201,7 @@ bool LookaheadParser::GetBool() { st_ = kError; return false; } - + bool result = v_.GetBool(); ParseNext(); return result; @@ -221,7 +221,7 @@ const char* LookaheadParser::GetString() { st_ = kError; return 0; } - + const char* result = v_.GetString(); ParseNext(); return result; @@ -260,7 +260,7 @@ Value* LookaheadParser::PeekValue() { if (st_ >= kHasNull && st_ <= kHasKey) { return &v_; } - + return 0; } @@ -268,11 +268,11 @@ int LookaheadParser::PeekType() { if (st_ >= kHasNull && st_ <= kHasKey) { return v_.GetType(); } - + if (st_ == kEnteringArray) { return kArrayType; } - + if (st_ == kEnteringObject) { return kObjectType; } @@ -292,7 +292,7 @@ int main() { "\"skipString\":\"zzz\", \"reachedEnd\":null, \"t\":true }"; LookaheadParser r(json); - + RAPIDJSON_ASSERT(r.PeekType() == kObjectType); r.EnterObject(); @@ -319,9 +319,9 @@ int main() { } else if (0 == strcmp(key, "a")) { RAPIDJSON_ASSERT(r.PeekType() == kArrayType); - + r.EnterArray(); - + cout << key << ":[ "; while (r.NextArrayValue()) { if (r.PeekType() == kNumberType) { @@ -335,7 +335,7 @@ int main() { break; } } - + cout << "]" << endl; } else { @@ -343,7 +343,7 @@ int main() { r.SkipValue(); } } - + return 0; } diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/parsebyparts/parsebyparts.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/parsebyparts/parsebyparts.cpp index ff735394ec..3d8b494221 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/parsebyparts/parsebyparts.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/parsebyparts/parsebyparts.cpp @@ -35,7 +35,7 @@ public: if (!parseThread_.joinable()) return; - { + { std::unique_lock<std::mutex> lock(mutex_); // Wait until the buffer is read up (or parsing is completed) @@ -54,7 +54,7 @@ public: void ParsePart(const char* buffer, size_t length) { std::unique_lock<std::mutex> lock(mutex_); - + // Wait until the buffer is read up (or parsing is completed) while (!stream_.Empty() && !completed_) finish_.wait(lock); @@ -156,7 +156,7 @@ int main() { std::cout << "Error at offset " << d.GetErrorOffset() << ": " << GetParseError_En(d.GetParseError()) << std::endl; return EXIT_FAILURE; } - + // Stringify the JSON to cout OStreamWrapper os(std::cout); Writer<OStreamWrapper> writer(os); @@ -166,7 +166,7 @@ int main() { return EXIT_SUCCESS; } -#else // Not supporting C++11 +#else // Not supporting C++11 #include <iostream> int main() { diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/schemavalidator/schemavalidator.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/schemavalidator/schemavalidator.cpp index 8c7e26c795..9fa1bb10a1 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/schemavalidator/schemavalidator.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/schemavalidator/schemavalidator.cpp @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) { } fclose(fp); } - + // Then convert the Document into SchemaDocument SchemaDocument sd(d); diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/serialize/serialize.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/serialize/serialize.cpp index 12d87151e6..f1be5c4183 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/serialize/serialize.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/serialize/serialize.cpp @@ -50,7 +50,7 @@ public: template <typename Writer> void Serialize(Writer& writer) const { writer.StartObject(); - + writer.String("school"); #if RAPIDJSON_HAS_STDSTRING writer.String(school_); @@ -104,7 +104,7 @@ private: }; Dependent::~Dependent() { - delete education_; + delete education_; } class Employee : public Person { diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplepullreader/simplepullreader.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplepullreader/simplepullreader.cpp index a4fb1161a4..42c45ff1f6 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplepullreader/simplepullreader.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplepullreader/simplepullreader.cpp @@ -15,7 +15,7 @@ template <typename T> std::string stringify(T x) { struct MyHandler { const char* type; std::string data; - + MyHandler() : type(), data() {} bool Null() { type = "Null"; data.clear(); return true; } diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplereader/simplereader.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplereader/simplereader.cpp index 5aae8a1c0a..f86182dfb7 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplereader/simplereader.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplereader/simplereader.cpp @@ -12,11 +12,11 @@ struct MyHandler { bool Int64(int64_t i) { cout << "Int64(" << i << ")" << endl; return true; } bool Uint64(uint64_t u) { cout << "Uint64(" << u << ")" << endl; return true; } bool Double(double d) { cout << "Double(" << d << ")" << endl; return true; } - bool RawNumber(const char* str, SizeType length, bool copy) { + bool RawNumber(const char* str, SizeType length, bool copy) { cout << "Number(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; return true; } - bool String(const char* str, SizeType length, bool copy) { + bool String(const char* str, SizeType length, bool copy) { cout << "String(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; return true; } diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplewriter/simplewriter.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplewriter/simplewriter.cpp index 8d1275c292..2f4d83ad29 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplewriter/simplewriter.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/simplewriter/simplewriter.cpp @@ -8,8 +8,8 @@ using namespace std; int main() { StringBuffer s; Writer<StringBuffer> writer(s); - - writer.StartObject(); // Between StartObject()/EndObject(), + + writer.StartObject(); // Between StartObject()/EndObject(), writer.Key("hello"); // output a key, writer.String("world"); // follow by a value. writer.Key("t"); diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/traverseaspointer.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/traverseaspointer.cpp index 7e0c89923e..cf80f7acc6 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/traverseaspointer.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/traverseaspointer.cpp @@ -17,7 +17,7 @@ void traverse(const Value& v, const Pointer& p) { traverse(v[i], p.Append(i)); break; case kObjectType: - for (Value::ConstMemberIterator m = v.MemberBegin(); m != v.MemberEnd(); ++m) + for (Value::ConstMemberIterator m = v.MemberBegin(); m != v.MemberEnd(); ++m) traverse(m->value, p.Append(m->name.GetString(), m->name.GetStringLength())); break; default: diff --git a/graphics/asymptote/LspCpp/third_party/rapidjson/example/tutorial/tutorial.cpp b/graphics/asymptote/LspCpp/third_party/rapidjson/example/tutorial/tutorial.cpp index d6021c6689..f97b0be86e 100644 --- a/graphics/asymptote/LspCpp/third_party/rapidjson/example/tutorial/tutorial.cpp +++ b/graphics/asymptote/LspCpp/third_party/rapidjson/example/tutorial/tutorial.cpp @@ -32,7 +32,7 @@ int main(int, char*[]) { printf("\nParsing to document succeeded.\n"); //////////////////////////////////////////////////////////////////////////// - // 2. Access values in document. + // 2. Access values in document. printf("\nAccess values in document:\n"); assert(document.IsObject()); // Document is a JSON value represents the root of DOM. Root can be either an object or array. @@ -69,7 +69,7 @@ int main(int, char*[]) { assert(a.IsArray()); for (SizeType i = 0; i < a.Size(); i++) // rapidjson uses SizeType instead of size_t. printf("a[%d] = %d\n", i, a[i].GetInt()); - + int y = a[0].GetInt(); (void)y; @@ -128,7 +128,7 @@ int main(int, char*[]) { // Shorter but slower version: // document["hello"].SetString(buffer, document.GetAllocator()); - // Constructor version: + // Constructor version: // Value author(buffer, len, document.GetAllocator()); // Value author(buffer, document.GetAllocator()); memset(buffer2, 0, sizeof(buffer2)); // For demonstration purpose. |