commit d7b7d22a0ff7d01f342023a1ddeef48ac870775c Author: King_DuckZ Date: Sun Aug 11 04:02:13 2013 +0200 First import, libjson and empty main files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5da429d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build/ +*.swp +libjson/Objects_static/ +libjson/libjson.a diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d041298 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required (VERSION 2.6 FATAL_ERROR) +set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Final" CACHE STRING "possible configurations" FORCE) +set_property (GLOBAL PROPERTY DEBUG_CONFIGURATIONS "Debug;Release") +project (WordReference CXX) + +include(ExternalProject) + +set (LIBJSON_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/libjson) +set (LIBJSON_LIB_DIR ${PROJECT_SOURCE_DIR}/libjson) +set (LIBJSON_CODE_DIR ${PROJECT_SOURCE_DIR}/libjson) +set (${PROJECT_NAME}_Version_Major 0) +set (${PROJECT_NAME}_Version_Minor 1) +set (${PROJECT_NAME}_App_Name "\"${PROJECT_NAME}\"") +string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) +set (${PROJECT_NAME}_SourceCodeVar "\"\$${PROJECT_NAME_UPPER}_SOURCE_PATH\"") + +find_package(CURL REQUIRED) + +#System inclusion paths +include_directories(SYSTEM + ${CURL_INCLUDE_DIRS} +) +include_directories( + . +) +link_directories("${LIBJSON_LIB_DIR}") + +add_custom_target(build_json ALL + COMMAND ${CMAKE_MAKE_PROGRAM} + WORKING_DIRECTORY ${LIBJSON_CODE_DIR} + COMMENT "Original libjson makefile target" +) + +add_library(json STATIC IMPORTED) +set_property(TARGET json APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(json PROPERTIES IMPORTED_LOCATION_NOCONFIG "${LIBJSON_LIB_DIR}/libjson.a") +add_dependencies(json build_json) + +add_executable(${PROJECT_NAME} + main.cpp +) +target_link_libraries(${PROJECT_NAME} + "${CURL_LIBRARIES}" + json +) diff --git a/libjson/Documentation.pdf b/libjson/Documentation.pdf new file mode 100644 index 0000000..64a1e88 Binary files /dev/null and b/libjson/Documentation.pdf differ diff --git a/libjson/Getting Started/C++ Interface/array.htm b/libjson/Getting Started/C++ Interface/array.htm new file mode 100644 index 0000000..a9e77f7 --- /dev/null +++ b/libjson/Getting Started/C++ Interface/array.htm @@ -0,0 +1,43 @@ + + +libjson Array Example + + + + + + + +

libjson Array Example

+

This quick example will show you how to add an array to your JSON tree.

+

+
JSONNode n(JSON_NODE);
+n.push_back(JSONNode("RootA", "Hello World"));
+JSONNode c(JSON_ARRAY);
+c.set_name("ArrayOfNumbers");
+c.push_back(JSONNode("", 16));
+c.push_back(JSONNode("", 42));
+c.push_back(JSONNode("", 128));
+n.push_back(c);
+std::string jc = n.write_formatted();
+std::cout << jc << std::endl;
+ +

The result will look like this:

+
{
+    "RootA" : "Hello World",
+    "ArrayOfNumbers" : [
+        16,
+        42,
+        128
+    ]
+}
+

The first line generates a new root node for us to work with. This node will contain the entire JSON structure we want to create. Because this is created on the stack, there is no need to clean it up, it will do that when it goes out of scope.

+ +

Line 2 creates a new JSON_STRING node, i.e. a node that will have a string value, and attaches the new node to the end of our original root node n.

+

Line 3 creates a new child node and this time we're declaring a type of JSON_ARRAY that states the node will contain a number of nameless children nodes. While it's possible to have different data types in the same array, you should keep them all the same and treat it as if it were a typed array. Note that you can have an array of JSON_NODE objects, so you're not limited to simple data types, just be aware that the array will ignore any node names if you have them set.

+

Lines 5 through 7 add values to the array, in this case they're all integer values. Because a JSON array cannot contain named values, the name parameter is set to "".

+ +

Line 8 appends the array to our root node.

+

9 and 10 retrieve the formatted JSON string and dump it to stdout.

+ + \ No newline at end of file diff --git a/libjson/Getting Started/C++ Interface/basic_parser.htm b/libjson/Getting Started/C++ Interface/basic_parser.htm new file mode 100644 index 0000000..3d7565c --- /dev/null +++ b/libjson/Getting Started/C++ Interface/basic_parser.htm @@ -0,0 +1,57 @@ + + +libjson Basic Parser Example + + + + + + + +

libjson Basic Parser

+

Previously we looked at how to create a new JSON node tree programmatically that could be sent over the wire to consumer. Now we'll look at the consumer side and see how to parse the JSON string into our application.

+

+

First we'll look at the main function in our program that will take a JSON string as input, parse it using the library and pass the tree to a function that will extract useful data.

+
std::string json = "{\"RootA\":\"Value in parent node\",\"ChildNode\":{\"ChildA\":\"String Value\",\"ChildB\":42}}";
+JSONNode n = libjson::parse(json);
+ParseJSON(n);
+ +

The first line is just a simple JSON string containing a child object. You'll likely get a string from a web service, message buss or even a file.

+

Line 2 is where the magic happens in the library. We just pass the string to libjson::parse and if all is well, we'll receive a node tree in return. NOTE that the parser is going to allocate memory on the stack, so do not try and delete it, let it go out of scope.

+

Line 3 is a function call that we define for iterating through the JSON tree. While mine isn't pretty, it gets the job done for simple JSON objects.

+
void ParseJSON(const JSONNode & n){
+	JSONNode::const_iterator i = n.begin();
+	while (i != n.end()){
+		// recursively call ourselves to dig deeper into the tree
+		if (i -> type() == JSON_ARRAY || i -> type() == JSON_NODE){
+			ParseJSON(*i);
+		}
+
+		// get the node name and value as a string
+		std::string node_name = i -> name();
+
+		// find out where to store the values
+		if (node_name == "RootA"){
+			rootA = i -> as_string();
+		}
+		else if (node_name == "ChildA"){
+			childA = i -> as_string();
+		}
+		else if (node_name == "ChildB")
+			childB = i -> as_int();
+
+		//increment the iterator
+		++i;
+	}
+}
+ +

Next on line 7 we get a pointer to the first iterator of the node we're currently dealing with. The iterator lets us navigate through the child nodes, one by one.

+

Line 8 begins a while loop that will continue until we've reached the final iterator returned by json_end.

+

If the iterator is currenly pointing to a node of type JSON_ARRAY or JSON_NODE, that means we are at a branch that requires a new iterator for processing. Thus line 16 makes a recursive call to the function so that we can start processing on the child node. Without this call, we would get the name of the node but trying to get a value would return nothing.

+

On line 20 we call the name method that will return a string with the name of the node. If the node is not named or it's an array's value, the string will be empty, so check for that.

+ +

Lines 23 through 34 are a simple decision tree that attempt to match the name of the node to known values and if a match is made, we use one of the library functions to extract the value of the node. as_string naturally returns the value of the node as a string. This is probably the easiest to use in that it doesn't care if the value of the node is encased in quotation marks or not, it will always return a string. You can read any node as a string and then typecast to whatever need.

+

Line 38 increments our iterator to the next node.

+

So there you have a very simple little parser that will iterate through your tree and grab extract the data. Naturally you'll want to add error handling and tweak it for your own use.

+ + diff --git a/libjson/Getting Started/C++ Interface/child_node.htm b/libjson/Getting Started/C++ Interface/child_node.htm new file mode 100644 index 0000000..1f279c4 --- /dev/null +++ b/libjson/Getting Started/C++ Interface/child_node.htm @@ -0,0 +1,46 @@ + + +libjson Child Node Example + + + + + + + +

libjson Child Node Example

+

Now we'll look at how to create a branch off the main tree.

+

+
JSONNode n(JSON_NODE);
+n.push_back(JSONNode("RootA", "Value in parent node"));
+JSONNode c(JSON_NODE);
+c.set_name("ChildNode");
+c.push_back(JSONNode("ChildA", "String Value"));
+c.push_back(JSONNode("ChildB", 42));
+n.push_back(c);
+std::string jc = n.write_formatted();
+std::cout << jc << std::endl;
+ +

The result will look like this:

+
{
+    "RootA" : "Value in parent node",
+    "ChildNode" : {
+        "ChildA" : "String Value",
+        "ChildB" : 42
+    }
+}
+ +

As in the previous example, we create a root node to hold all of our child nodes on line one using the constructor.

+

Line 2 adds to the root a string node with the name "RootA" and a value of "Value in parent node".

+

On line 3 we're creating a new, floating node that will be a branch off the root. It's the same type as our root, JSON_NODE.

+

set_name lets us name the node that we've just created. If your branch is an object of some kind, you'll likely want to name it properly. Note that if you try to name the root node (n in our case), it won't be written out. The name will only appear if the JSON_NODE is a child of another node.

+ +

Lines 5 and 6 add new nodes with values to our branch node c.

+

Line 7 attaches our branch node c to the root node n after the string node named "RootA".

+

Line 8 returns the json_string nicely formatted and 9 prints it to stdout.

+ +

With these tools, we can create complicated JSON structures and mimick objects with child properties.

+ + + + \ No newline at end of file diff --git a/libjson/Getting Started/C++ Interface/simple_write.htm b/libjson/Getting Started/C++ Interface/simple_write.htm new file mode 100644 index 0000000..13e7053 --- /dev/null +++ b/libjson/Getting Started/C++ Interface/simple_write.htm @@ -0,0 +1,36 @@ + + +libjson Simple Write Example + + + + + + + +

libjson Simple Write Example

+

This example uses the C interface to create a set of JSON nodes that you can then dump to a string and use however you like.

+
JSONNode n(JSON_NODE);
+n.push_back(JSONNode("String Node", "String Value"));
+n.push_back(JSONNode("Integer Node", 42));
+n.push_back(JSONNode("Floating Point Node", 3.14));
+n.push_back(JSONNode("Boolean Node", true));
+std::string jc = n.write_formatted();
+std::cout << jc << std::endl;
+ +

The result will look like this:

+
{
+    "String Node" : "String Value",
+    "Integer Node" : 42,
+    "Floating Point Node" : 3.14,
+    "Boolean Node" : true
+}
+ +

The first line generates a new root node for us to work with. This node will contain the entire JSON structure we want to create.

+

Line 2 creates a new JSON_STRING node, i.e. a node that will have a string value, and attaches the new node to the end of our original root node n.

+

Line 3, 4 and 5 create and add new integer, floating point and boolean nodes respctively and add them to the root node. Both the integer and floating point methods will create JSON_NUMBER nodes where the numeric values will be printed to a JSON string without any quotation marks. The boolean method will take a true or a false and print a "true" or "false" in the final JSON string.

+ +

Line 6 returns a json_string that contains nicely formatted JSON code from the structure we just created. The string will be nicely tabbed and returned for human readability. Use this for debugging purposes. If you are going into production, use the write method instead which will compact the JSON into a single line that saves space for transmission over the Net or between components.

+ + + \ No newline at end of file diff --git a/libjson/Getting Started/Library Interface/array.htm b/libjson/Getting Started/Library Interface/array.htm new file mode 100644 index 0000000..68cf245 --- /dev/null +++ b/libjson/Getting Started/Library Interface/array.htm @@ -0,0 +1,48 @@ + + +libjson Array Example + + + + + + + +

libjson Array Example

+

This quick example will show you how to add an array to your JSON tree.

+

+
JSONNODE *n = json_new(JSON_NODE);
+json_push_back(n, json_new_a("RootA", "Hello World"));
+JSONNODE *c = json_new(JSON_ARRAY);
+json_set_name(c, "ArrayOfNumbers");
+json_push_back(c, json_new_i(NULL, 16));
+json_push_back(c, json_new_i(NULL, 42));
+json_push_back(c, json_new_i(NULL, 128));
+json_push_back(n, c);
+json_char *jc = json_write_formatted(n);
+printf("%s\n", jc);
+json_free(jc);
+json_delete(n);
+ +

The result will look like this:

+
{
+    "RootA" : "Hello World",
+    "ArrayOfNumbers" : [
+        16,
+        42,
+        128
+    ]
+}
+

The first line generates a new root node for us to work with. This node will contain the entire JSON structure we want to create. Note that, as mentioned in the documentation, any time you call a json_new… method, you are responsbile for freeing the memory allocated by the method. You can do this manually or by attaching the resulting node pointer to an existing node.

+ +

Line 2 creates a new JSON_STRING node, i.e. a node that will have a string value, and attaches the new node to the end of our original root node n. The json_new_a method will escape your string values when you go to write the final string.

+

Line 3 creates a new child node and this time we're declaring a type of JSON_ARRAY that states the node will contain a number of nameless children nodes. While it's possible to have different data types in the same array, you should keep them all the same and treat it as if it were a typed array. Note that you can have an array of JSON_NODE objects, so you're not limited to simple data types, just be aware that the array will ignore any node names if you have them set.

+

Lines 5 through 7 add values to the array, in this case they're all integer values. Because a JSON array cannot contain named values, the name parameter of json_new_i is set to NULL.

+ +

Line 8 appends the array to our root node.

+

9 and 10 retrieve the formatted JSON string and dump it to stdout.

+

11 frees memory allocated for our JSON string and 12 frees the entire tree structure.

+ +

Chris Larsen 2010-10-08

+ + \ No newline at end of file diff --git a/libjson/Getting Started/Library Interface/basic_parser.htm b/libjson/Getting Started/Library Interface/basic_parser.htm new file mode 100644 index 0000000..358b89b --- /dev/null +++ b/libjson/Getting Started/Library Interface/basic_parser.htm @@ -0,0 +1,77 @@ + + +libjson Basic Parser Example + + + + + + + +

libjson Basic Parser

+

Previously we looked at how to create a new JSON node tree programmatically that could be sent over the wire to consumer. Now we'll look at the consumer side and see how to parse the JSON string into our application.

+

+

First we'll look at the main function in our program that will take a JSON string as input, parse it using the library and pass the tree to a function that will extract useful data.

+
char *json = "{\"RootA\":\"Value in parent node\",\"ChildNode\":{\"ChildA\":\"String Value\",\"ChildB\":42}}";
+JSONNODE *n = json_parse(json);
+ParseJSON(n);
+json_delete(n);
+ +

The first line is just a simple JSON string containing a child object. You'll likely get a string from a web service, message buss or even a file.

+

Line 2 is where the magic happens in the library. We just pass the string to json_parse and if all is well, we'll receive a pointer to a node tree in return. NOTE that the parser is going to allocate memory for the node tree, so you have to free it on your own as we do in line 4.

+

Line 3 is a function call that we define for iterating through the JSON tree. While mine isn't pretty, it gets the job done for simple JSON objects.

+
void ParseJSON(JSONNODE *n){
+	if (n == NULL){
+		printf("Invalid JSON Node\n");
+		return;
+	}
+
+	JSONNODE_ITERATOR i = json_begin(n);
+	while (i != json_end(n)){
+		if (*i == NULL){
+			printf("Invalid JSON Node\n");
+			return;
+		}
+
+		// recursively call ourselves to dig deeper into the tree
+		if (json_type(*i) == JSON_ARRAY || json_type(*i) == JSON_NODE){
+			ParseJSON(*i);
+		}
+
+		// get the node name and value as a string
+		json_char *node_name = json_name(*i);
+
+		// find out where to store the values
+		if (strcmp(node_name, "RootA") == 0){
+			json_char *node_value = json_as_string(*i);
+			strcpy(rootA, node_value);
+			json_free(node_value);
+		}
+		else if (strcmp(node_name, "ChildA") == 0){
+			json_char *node_value = json_as_string(*i);
+			strcpy(childA, node_value);
+			json_free(node_value);
+		}
+		else if (strcmp(node_name, "ChildB") == 0)
+			childB = json_as_int(*i);
+
+		// cleanup and increment the iterator
+		json_free(node_name);
+		++i;
+	}
+}
+ +

The first thing you want to do is check for NULL. If at any point in the parsing you run into a NULL value, then its likely that the JSON string wasn't formatted properly.

+

Next on line 7 we get a pointer to the first iterator of the node we're currently dealing with. The iterator lets us navigate through the child nodes, one by one.

+

Line 8 begins a while loop that will continue until we've reached the final iterator returned by json_end.

+

Again, we should check for an invalid iterator in case something went screwey, and we do so on line 9.

+

If the iterator is currenly pointing to a node of type JSON_ARRAY or JSON_NODE, that means we are at a branch that requires a new iterator for processing. Thus line 16 makes a recursive call to the function so that we can start processing on the child node. Without this call, we would get the name of the node but trying to get a value would return nothing.

+

On line 20 we call the json_name method that will return a string with the name of the node. If the node is not named or it's an array's value, the string will be empty, so check for that. Also note that you MUST free the memory returned by json_name as we do on line 37.

+ +

Lines 23 through 34 are a simple decision tree that attempt to match the name of the node to known values and if a match is made, we use one of the library functions to extract the value of the node. json_as_string naturally returns the value of the node as a string. This is probably the easiest to use in that it doesn't care if the value of the node is encased in quotation marks or not, it will always return a string. You can read any node as a string and then typecast to whatever need.

+

Line 37 frees up the node name allocation.

+

Line 38 increments our iterator to the next node.

+

So there you have a very simple little parser that will iterate through your tree and grab extract the data. Naturally you'll want to add error handling and tweak it for your own use.

+

Chris Larsen 2010-10-08

+ + \ No newline at end of file diff --git a/libjson/Getting Started/Library Interface/child_node.htm b/libjson/Getting Started/Library Interface/child_node.htm new file mode 100644 index 0000000..86d4584 --- /dev/null +++ b/libjson/Getting Started/Library Interface/child_node.htm @@ -0,0 +1,50 @@ + + +libjson Child Node Example + + + + + + + +

libjson Child Node Example

+

Now we'll look at how to create a branch off the main tree.

+

+
JSONNODE *n = json_new(JSON_NODE);
+json_push_back(n, json_new_a("RootA", "Value in parent node"));
+JSONNODE *c = json_new(JSON_NODE);
+json_set_name(c, "ChildNode");
+json_push_back(c, json_new_a("ChildA", "String Value"));
+json_push_back(c, json_new_i("ChildB", 42));
+json_push_back(n, c);
+json_char *jc = json_write_formatted(n);
+printf("%s\n", jc);
+json_free(jc);
+json_delete(n);
+ +

The result will look like this:

+
{
+    "RootA" : "Value in parent node",
+    "ChildNode" : {
+        "ChildA" : "String Value",
+        "ChildB" : 42
+    }
+}
+ +

As in the previous example, we create a root node to hold all of our child nodes on line one using json_new.

+

Line 2 adds to the root a string node with the name "RootA" and a value of "Value in parent node".

+

On line 3 we're creating a new, floating node that will be a branch off the root. It's the same type as our root, JSON_NODE.

+

json_set_name lets us name the node that we've just created. If your branch is an object of some kind, you'll likely want to name it properly. Note that if you try to name the root node (n in our case), it won't be written out. The name will only appear if the JSON_NODE is a child of another node.

+ +

Lines 5 and 6 add new nodes with values to our branch node c.

+

Line 7 attaches our branch node c to the root node n after the string node named "RootA". Note that if you fail to attach the branch to another node, you'll have to delete it manually or risk a memory leak.

+

Line 8 returns the json_char string nicely formatted and 9 prints it to stdout.

+ +

Line 10 frees our JSON string and line 11 loops through our root tree and frees up the memory we've used.

+

With these tools, we can create complicated JSON structures and mimick objects with child properties.

+ + +

Chris Larsen 2010-10-08

+ + \ No newline at end of file diff --git a/libjson/Getting Started/Library Interface/scripts/shAutoloader.js b/libjson/Getting Started/Library Interface/scripts/shAutoloader.js new file mode 100644 index 0000000..4e29bdd --- /dev/null +++ b/libjson/Getting Started/Library Interface/scripts/shAutoloader.js @@ -0,0 +1,17 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('K M;I(M)1S 2U("2a\'t 4k M 4K 2g 3l 4G 4H");(6(){6 r(f,e){I(!M.1R(f))1S 3m("3s 15 4R");K a=f.1w;f=M(f.1m,t(f)+(e||""));I(a)f.1w={1m:a.1m,19:a.19?a.19.1a(0):N};H f}6 t(f){H(f.1J?"g":"")+(f.4s?"i":"")+(f.4p?"m":"")+(f.4v?"x":"")+(f.3n?"y":"")}6 B(f,e,a,b){K c=u.L,d,h,g;v=R;5K{O(;c--;){g=u[c];I(a&g.3r&&(!g.2p||g.2p.W(b))){g.2q.12=e;I((h=g.2q.X(f))&&h.P===e){d={3k:g.2b.W(b,h,a),1C:h};1N}}}}5v(i){1S i}5q{v=11}H d}6 p(f,e,a){I(3b.Z.1i)H f.1i(e,a);O(a=a||0;a-1},3d:6(g){e+=g}};c1&&p(e,"")>-1){a=15(J.1m,n.Q.W(t(J),"g",""));n.Q.W(f.1a(e.P),a,6(){O(K c=1;c<14.L-2;c++)I(14[c]===1d)e[c]=1d})}I(J.1w&&J.1w.19)O(K b=1;be.P&&J.12--}H e};I(!D)15.Z.1A=6(f){(f=n.X.W(J,f))&&J.1J&&!f[0].L&&J.12>f.P&&J.12--;H!!f};1r.Z.1C=6(f){M.1R(f)||(f=15(f));I(f.1J){K e=n.1C.1p(J,14);f.12=0;H e}H f.X(J)};1r.Z.Q=6(f,e){K a=M.1R(f),b,c;I(a&&1j e.58()==="3f"&&e.1i("${")===-1&&y)H n.Q.1p(J,14);I(a){I(f.1w)b=f.1w.19}Y f+="";I(1j e==="6")c=n.Q.W(J,f,6(){I(b){14[0]=1f 1r(14[0]);O(K d=0;dd.L-3;){i=1r.Z.1a.W(g,-1)+i;g=1Q.3i(g/10)}H(g?d[g]||"":"$")+i}Y{g=+i;I(g<=d.L-3)H d[g];g=b?p(b,i):-1;H g>-1?d[g+1]:h}})})}I(a&&f.1J)f.12=0;H c};1r.Z.1e=6(f,e){I(!M.1R(f))H n.1e.1p(J,14);K a=J+"",b=[],c=0,d,h;I(e===1d||+e<0)e=5D;Y{e=1Q.3i(+e);I(!e)H[]}O(f=M.3c(f);d=f.X(a);){I(f.12>c){b.U(a.1a(c,d.P));d.L>1&&d.P=e)1N}f.12===d.P&&f.12++}I(c===a.L){I(!n.1A.W(f,"")||h)b.U("")}Y b.U(a.1a(c));H b.L>e?b.1a(0,e):b};M.1h(/\\(\\?#[^)]*\\)/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"});M.1h(/\\((?!\\?)/,6(){J.19.U(N);H"("});M.1h(/\\(\\?<([$\\w]+)>/,6(f){J.19.U(f[1]);J.2N=R;H"("});M.1h(/\\\\k<([\\w$]+)>/,6(f){K e=p(J.19,f[1]);H e>-1?"\\\\"+(e+1)+(3R(f.2S.3a(f.P+f[0].L))?"":"(?:)"):f[0]});M.1h(/\\[\\^?]/,6(f){H f[0]==="[]"?"\\\\b\\\\B":"[\\\\s\\\\S]"});M.1h(/^\\(\\?([5A]+)\\)/,6(f){J.3d(f[1]);H""});M.1h(/(?:\\s+|#.*)+/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"},M.1B,6(){H J.2K("x")});M.1h(/\\./,6(){H"[\\\\s\\\\S]"},M.1B,6(){H J.2K("s")})})();1j 2e!="1d"&&(2e.M=M);K 1v=6(){6 r(a,b){a.1l.1i(b)!=-1||(a.1l+=" "+b)}6 t(a){H a.1i("3e")==0?a:"3e"+a}6 B(a){H e.1Y.2A[t(a)]}6 p(a,b,c){I(a==N)H N;K d=c!=R?a.3G:[a.2G],h={"#":"1c",".":"1l"}[b.1o(0,1)]||"3h",g,i;g=h!="3h"?b.1o(1):b.5u();I((a[h]||"").1i(g)!=-1)H a;O(a=0;d&&a\'+c+""});H a}6 n(a,b){a.1e("\\n");O(K c="",d=0;d<50;d++)c+=" ";H a=v(a,6(h){I(h.1i("\\t")==-1)H h;O(K g=0;(g=h.1i("\\t"))!=-1;)h=h.1o(0,g)+c.1o(0,b-g%b)+h.1o(g+1,h.L);H h})}6 x(a){H a.Q(/^\\s+|\\s+$/g,"")}6 D(a,b){I(a.Pb.P)H 1;Y I(a.Lb.L)H 1;H 0}6 y(a,b){6 c(k){H k[0]}O(K d=N,h=[],g=b.2D?b.2D:c;(d=b.1I.X(a))!=N;){K i=g(d,b);I(1j i=="3f")i=[1f e.2L(i,d.P,b.23)];h=h.1O(i)}H h}6 E(a){K b=/(.*)((&1G;|&1y;).*)/;H a.Q(e.3A.3M,6(c){K d="",h=N;I(h=b.X(c)){c=h[1];d=h[2]}H\'\'+c+""+d})}6 z(){O(K a=1E.36("1k"),b=[],c=0;c<1z 4I="1Z://2y.3L.3K/4L/5L"><3J><4N 1Z-4M="5G-5M" 6K="2O/1z; 6J=6I-8" /><1t>6L 1v<3B 1L="25-6M:6Q,6P,6O,6N-6F;6y-2f:#6x;2f:#6w;25-22:6v;2O-3D:3C;">1v3v 3.0.76 (72 73 3x)1Z://3u.2w/1v70 17 6U 71.6T 6X-3x 6Y 6D.6t 61 60 J 1k, 5Z 5R 5V <2R/>5U 5T 5S!\'}},1Y:{2j:N,2A:{}},1U:{},3A:{6n:/\\/\\*[\\s\\S]*?\\*\\//2c,6m:/\\/\\/.*$/2c,6l:/#.*$/2c,6k:/"([^\\\\"\\n]|\\\\.)*"/g,6o:/\'([^\\\\\'\\n]|\\\\.)*\'/g,6p:1f M(\'"([^\\\\\\\\"]|\\\\\\\\.)*"\',"3z"),6s:1f M("\'([^\\\\\\\\\']|\\\\\\\\.)*\'","3z"),6q:/(&1y;|<)!--[\\s\\S]*?--(&1G;|>)/2c,3M:/\\w+:\\/\\/[\\w-.\\/?%&=:@;]*/g,6a:{18:/(&1y;|<)\\?=?/g,1b:/\\?(&1G;|>)/g},69:{18:/(&1y;|<)%=?/g,1b:/%(&1G;|>)/g},6d:{18:/(&1y;|<)\\s*1k.*?(&1G;|>)/2T,1b:/(&1y;|<)\\/\\s*1k\\s*(&1G;|>)/2T}},16:{1H:6(a){6 b(i,k){H e.16.2o(i,k,e.13.1x[k])}O(K c=\'\',d=e.16.2x,h=d.2X,g=0;g";H c},2o:6(a,b,c){H\'<2W>\'+c+""},2b:6(a){K b=a.1F,c=b.1l||"";b=B(p(b,".20",R).1c);K d=6(h){H(h=15(h+"6f(\\\\w+)").X(c))?h[1]:N}("6g");b&&d&&e.16.2x[d].2B(b);a.3N()},2x:{2X:["21","2P"],21:{1H:6(a){I(a.V("2l")!=R)H"";K b=a.V("1t");H e.16.2o(a,"21",b?b:e.13.1x.21)},2B:6(a){a=1E.6j(t(a.1c));a.1l=a.1l.Q("47","")}},2P:{2B:6(){K a="68=0";a+=", 18="+(31.30-33)/2+", 32="+(31.2Z-2Y)/2+", 30=33, 2Z=2Y";a=a.Q(/^,/,"");a=1P.6Z("","38",a);a.2C();K b=a.1E;b.6W(e.13.1x.37);b.6V();a.2C()}}}},35:6(a,b){K c;I(b)c=[b];Y{c=1E.36(e.13.34);O(K d=[],h=0;h(.*?))\\\\]$"),s=1f M("(?<27>[\\\\w-]+)\\\\s*:\\\\s*(?<1T>[\\\\w-%#]+|\\\\[.*?\\\\]|\\".*?\\"|\'.*?\')\\\\s*;?","g");(j=s.X(k))!=N;){K o=j.1T.Q(/^[\'"]|[\'"]$/g,"");I(o!=N&&m.1A(o)){o=m.X(o);o=o.2V.L>0?o.2V.1e(/\\s*,\\s*/):[]}l[j.27]=o}g={1F:g,1n:C(i,l)};g.1n.1D!=N&&d.U(g)}H d},1M:6(a,b){K c=J.35(a,b),d=N,h=e.13;I(c.L!==0)O(K g=0;g")==o-3){m=m.4h(0,o-3);s=R}l=s?m:l}I((i.1t||"")!="")k.1t=i.1t;k.1D=j;d.2Q(k);b=d.2F(l);I((i.1c||"")!="")b.1c=i.1c;i.2G.74(b,i)}}},2E:6(a){w(1P,"4k",6(){e.1M(a)})}};e.2E=e.2E;e.1M=e.1M;e.2L=6(a,b,c){J.1T=a;J.P=b;J.L=a.L;J.23=c;J.1V=N};e.2L.Z.1q=6(){H J.1T};e.4l=6(a){6 b(j,l){O(K m=0;md)1N;Y I(g.P==c.P&&g.L>c.L)a[b]=N;Y I(g.P>=c.P&&g.P\'+c+""},3Q:6(a,b){K c="",d=a.1e("\\n").L,h=2u(J.V("2i-1s")),g=J.V("2z-1s-2t");I(g==R)g=(h+d-1).1q().L;Y I(3R(g)==R)g=0;O(K i=0;i\'+j+"":"")+i)}H a},4f:6(a){H a?"<4a>"+a+"":""},4b:6(a,b){6 c(l){H(l=l?l.1V||g:g)?l+" ":""}O(K d=0,h="",g=J.V("1D",""),i=0;i|&1y;2R\\s*\\/?&1G;/2T;I(e.13.46==R)b=b.Q(h,"\\n");I(e.13.44==R)b=b.Q(h,"");b=b.1e("\\n");h=/^\\s*/;g=4Q;O(K i=0;i0;i++){K k=b[i];I(x(k).L!=0){k=h.X(k);I(k==N){a=a;1N a}g=1Q.4q(k[0].L,g)}}I(g>0)O(i=0;i\'+(J.V("16")?e.16.1H(J):"")+\'<3Z 5z="0" 5H="0" 5J="0">\'+J.4f(J.V("1t"))+"<3T><3P>"+(1u?\'<2d 1g="1u">\'+J.3Q(a)+"":"")+\'<2d 1g="17">\'+b+""},2F:6(a){I(a===N)a="";J.17=a;K b=J.3Y("T");b.3X=J.1H(a);J.V("16")&&w(p(b,".16"),"5c",e.16.2b);J.V("3V-17")&&w(p(b,".17"),"56",f);H b},2Q:6(a){J.1c=""+1Q.5d(1Q.5n()*5k).1q();e.1Y.2A[t(J.1c)]=J;J.1n=C(e.2v,a||{});I(J.V("2k")==R)J.1n.16=J.1n.1u=11},5j:6(a){a=a.Q(/^\\s+|\\s+$/g,"").Q(/\\s+/g,"|");H"\\\\b(?:"+a+")\\\\b"},5f:6(a){J.28={18:{1I:a.18,23:"1k"},1b:{1I:a.1b,23:"1k"},17:1f M("(?<18>"+a.18.1m+")(?<17>.*?)(?<1b>"+a.1b.1m+")","5o")}}};H e}();1j 2e!="1d"&&(2e.1v=1v);',62,441,'||||||function|||||||||||||||||||||||||||||||||||||return|if|this|var|length|XRegExp|null|for|index|replace|true||div|push|getParam|call|exec|else|prototype||false|lastIndex|config|arguments|RegExp|toolbar|code|left|captureNames|slice|right|id|undefined|split|new|class|addToken|indexOf|typeof|script|className|source|params|substr|apply|toString|String|line|title|gutter|SyntaxHighlighter|_xregexp|strings|lt|html|test|OUTSIDE_CLASS|match|brush|document|target|gt|getHtml|regex|global|join|style|highlight|break|concat|window|Math|isRegExp|throw|value|brushes|brushName|space|alert|vars|http|syntaxhighlighter|expandSource|size|css|case|font|Fa|name|htmlScript|dA|can|handler|gm|td|exports|color|in|href|first|discoveredBrushes|light|collapse|object|cache|getButtonHtml|trigger|pattern|getLineHtml|nbsp|numbers|parseInt|defaults|com|items|www|pad|highlighters|execute|focus|func|all|getDiv|parentNode|navigator|INSIDE_CLASS|regexList|hasFlag|Match|useScriptTags|hasNamedCapture|text|help|init|br|input|gi|Error|values|span|list|250|height|width|screen|top|500|tagName|findElements|getElementsByTagName|aboutDialog|_blank|appendChild|charAt|Array|copyAsGlobal|setFlag|highlighter_|string|attachEvent|nodeName|floor|backref|output|the|TypeError|sticky|Za|iterate|freezeTokens|scope|type|textarea|alexgorbatchev|version|margin|2010|005896|gs|regexLib|body|center|align|noBrush|require|childNodes|DTD|xhtml1|head|org|w3|url|preventDefault|container|tr|getLineNumbersHtml|isNaN|userAgent|tbody|isLineHighlighted|quick|void|innerHTML|create|table|links|auto|smart|tab|stripBrs|tabs|bloggerMode|collapsed|plain|getCodeLinesHtml|caption|getMatchesHtml|findMatches|figureOutLineNumbers|removeNestedMatches|getTitleHtml|brushNotHtmlScript|substring|createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline|min|Can|ignoreCase|find|blur|extended|toLowerCase|aliases|addEventListener|innerText|textContent|wasn|select|createTextNode|removeChild|option|same|frame|xmlns|dtd|twice|1999|equiv|meta|htmlscript|transitional|1E3|expected|PUBLIC|DOCTYPE|on|W3C|XHTML|TR|EN|Transitional||configured|srcElement|Object|after|run|dblclick|matchChain|valueOf|constructor|default|switch|click|round|execAt|forHtmlScript|token|gimy|functions|getKeywords|1E6|escape|within|random|sgi|another|finally|supply|MSIE|ie|toUpperCase|catch|returnValue|definition|event|border|imsx|constructing|one|Infinity|from|when|Content|cellpadding|flags|cellspacing|try|xhtml|Type|spaces|2930402|hosted_button_id|lastIndexOf|donate|active|development|keep|to|xclick|_s|Xml|please|like|you|paypal|cgi|cmd|webscr|bin|highlighted|scrollbars|aspScriptTags|phpScriptTags|sort|max|scriptScriptTags|toolbar_item|_|command|command_|number|getElementById|doubleQuotedString|singleLinePerlComments|singleLineCComments|multiLineCComments|singleQuotedString|multiLineDoubleQuotedString|xmlComments|alt|multiLineSingleQuotedString|If|https|1em|000|fff|background|5em|xx|bottom|75em|Gorbatchev|large|serif|CDATA|continue|utf|charset|content|About|family|sans|Helvetica|Arial|Geneva|3em|nogutter|Copyright|syntax|close|write|2004|Alex|open|JavaScript|highlighter|July|02|replaceChild|offset|83'.split('|'),0,{})) diff --git a/libjson/Getting Started/Library Interface/scripts/shLegacy.js b/libjson/Getting Started/Library Interface/scripts/shLegacy.js new file mode 100644 index 0000000..6d9fd4d --- /dev/null +++ b/libjson/Getting Started/Library Interface/scripts/shLegacy.js @@ -0,0 +1,17 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?\\\\w+)\\\\]$","U"),i=1,p=0;p + +libjson Simple Write Example + + + + + + + +

libjson Simple Write Example

+

This example uses the C interface to create a set of JSON nodes that you can then dump to a string and use however you like.

+
JSONNODE *n = json_new(JSON_NODE);
+json_push_back(n, json_new_a("String Node", "String Value"));
+json_push_back(n, json_new_i("Integer Node", 42));
+json_push_back(n, json_new_f("Floating Point Node", 3.14));
+json_push_back(n, json_new_b("Boolean Node", 1));
+json_char *jc = json_write_formatted(n);
+printf("%s\n", jc);
+json_free(jc);
+json_delete(n);
+ +

The result will look like this:

+
{
+    "String Node" : "String Value",
+    "Integer Node" : 42,
+    "Floating Point Node" : 3.14,
+    "Boolean Node" : true
+}
+ +

The first line generates a new root node for us to work with. This node will contain the entire JSON structure we want to create. Note that, as mentioned in the documentation, any time you call a json_new… method, you are responsbile for freeing the memory allocated by the method. You can do this manually or by attaching the resulting node pointer to an existing node.

+

Line 2 creates a new JSON_STRING node, i.e. a node that will have a string value, and attaches the new node to the end of our original root node n. The json_new_a method will escape your string values when you go to write the final string.

+

Line 3, 4 and 5 create and add new integer, floating point and boolean nodes respctively and add them to the root node. Both the integer and floating point methods will create JSON_NUMBER nodes where the numeric values will be printed to a JSON string without any quotation marks. The boolean method will take a 0 or a 1 and print a "true" or "false" in the final JSON string.

+ +

Line 6 returns a json_char string that contains nicely formatted JSON code from the structure we just created. The string will be nicely tabbed and returned for human readability. Use this for debugging purposes. If you are going into production, use the json_write method instead which will compact the JSON into a single line that saves space for transmission over the Net or between components.
+ NOTE: similar to other libraries, the json_write and json_write_formatted methods allocate memory for the string, so you are responsible for freeing the memory after you're finished with it.

+ +

Line 8 frees the string that json_write_formatted allocated. Any time you use a library function that returns json_char, make sure to free it!

+

Line 9 is very important as it will free up all of the memory you've allocated for the JSONNODEs. Always call this function on a node when you're finished with it or you will have some nasty memory leaks to contend with.

+

That's the simplest way to create a JSON tree.

+

Chris Larsen 2010-10-08

+ + \ No newline at end of file diff --git a/libjson/Getting Started/Library Interface/styles/shCore.css b/libjson/Getting Started/Library Interface/styles/shCore.css new file mode 100644 index 0000000..34f6864 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCore.css @@ -0,0 +1,226 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreDefault.css b/libjson/Getting Started/Library Interface/styles/shCoreDefault.css new file mode 100644 index 0000000..08f9e10 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreDefault.css @@ -0,0 +1,328 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #e0e0e0 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: black !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #6ce26c !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #6ce26c !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: blue !important; + background: white !important; + border: 1px solid #6ce26c !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: blue !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #6ce26c !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: black !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #008200 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: blue !important; +} +.syntaxhighlighter .keyword { + color: #006699 !important; +} +.syntaxhighlighter .preprocessor { + color: gray !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #006699 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreDjango.css b/libjson/Getting Started/Library Interface/styles/shCoreDjango.css new file mode 100644 index 0000000..1db1f70 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreDjango.css @@ -0,0 +1,331 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #233729 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: #f8f8f8 !important; +} +.syntaxhighlighter .gutter { + color: #497958 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #41a83e !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #41a83e !important; + color: #0a2b1d !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #96dd3b !important; + background: black !important; + border: 1px solid #41a83e !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #96dd3b !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: white !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #41a83e !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #ffe862 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #f8f8f8 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #336442 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #9df39f !important; +} +.syntaxhighlighter .keyword { + color: #96dd3b !important; +} +.syntaxhighlighter .preprocessor { + color: #91bb9e !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #96dd3b !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #eb939a !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #91bb9e !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #edef7d !important; +} + +.syntaxhighlighter .comments { + font-style: italic !important; +} +.syntaxhighlighter .keyword { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreEclipse.css b/libjson/Getting Started/Library Interface/styles/shCoreEclipse.css new file mode 100644 index 0000000..a45de9f --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreEclipse.css @@ -0,0 +1,339 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #c3defe !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #787878 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #d4d0c8 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #d4d0c8 !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3f5fbf !important; + background: white !important; + border: 1px solid #d4d0c8 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3f5fbf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #aa7700 !important; +} +.syntaxhighlighter .toolbar { + color: #a0a0a0 !important; + background: #d4d0c8 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #a0a0a0 !important; +} +.syntaxhighlighter .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #3f5fbf !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #2a00ff !important; +} +.syntaxhighlighter .keyword { + color: #7f0055 !important; +} +.syntaxhighlighter .preprocessor { + color: #646464 !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #7f0055 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} +.syntaxhighlighter .xml .keyword { + color: #3f7f7f !important; + font-weight: normal !important; +} +.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { + color: #7f007f !important; +} +.syntaxhighlighter .xml .string { + font-style: italic !important; + color: #2a00ff !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreEmacs.css b/libjson/Getting Started/Library Interface/styles/shCoreEmacs.css new file mode 100644 index 0000000..706c77a --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreEmacs.css @@ -0,0 +1,324 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: black !important; +} +.syntaxhighlighter .line.alt1 { + background-color: black !important; +} +.syntaxhighlighter .line.alt2 { + background-color: black !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #2a3133 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: #d3d3d3 !important; +} +.syntaxhighlighter .gutter { + color: #d3d3d3 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #990000 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #990000 !important; + color: black !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #ebdb8d !important; + background: black !important; + border: 1px solid #990000 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #ebdb8d !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #ff7d27 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #990000 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #9ccff4 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #d3d3d3 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #ff7d27 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #ff9e7b !important; +} +.syntaxhighlighter .keyword { + color: aqua !important; +} +.syntaxhighlighter .preprocessor { + color: #aec4de !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #81cef9 !important; +} +.syntaxhighlighter .constants { + color: #ff9e7b !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: aqua !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #ebdb8d !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff7d27 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #aec4de !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreFadeToGrey.css b/libjson/Getting Started/Library Interface/styles/shCoreFadeToGrey.css new file mode 100644 index 0000000..6101eba --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreFadeToGrey.css @@ -0,0 +1,328 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: #121212 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #121212 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #121212 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #2c2c29 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: white !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #3185b9 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #3185b9 !important; + color: #121212 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3185b9 !important; + background: black !important; + border: 1px solid #3185b9 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3185b9 !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #d01d33 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #3185b9 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #96daff !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: white !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #696854 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #e3e658 !important; +} +.syntaxhighlighter .keyword { + color: #d01d33 !important; +} +.syntaxhighlighter .preprocessor { + color: #435a5f !important; +} +.syntaxhighlighter .variable { + color: #898989 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #aaaaaa !important; +} +.syntaxhighlighter .constants { + color: #96daff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #d01d33 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #ffc074 !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #4a8cdb !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #96daff !important; +} + +.syntaxhighlighter .functions { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreMDUltra.css b/libjson/Getting Started/Library Interface/styles/shCoreMDUltra.css new file mode 100644 index 0000000..2923ce7 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreMDUltra.css @@ -0,0 +1,324 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: #222222 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #222222 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #222222 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #253e5a !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: lime !important; +} +.syntaxhighlighter .gutter { + color: #38566f !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #222222 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #428bdd !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #428bdd !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: lime !important; +} +.syntaxhighlighter .toolbar { + color: #aaaaff !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #aaaaff !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #9ccff4 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: lime !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #428bdd !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: lime !important; +} +.syntaxhighlighter .keyword { + color: #aaaaff !important; +} +.syntaxhighlighter .preprocessor { + color: #8aa6c1 !important; +} +.syntaxhighlighter .variable { + color: aqua !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ff8000 !important; +} +.syntaxhighlighter .constants { + color: yellow !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #aaaaff !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: red !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: yellow !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreMidnight.css b/libjson/Getting Started/Library Interface/styles/shCoreMidnight.css new file mode 100644 index 0000000..e3733ee --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreMidnight.css @@ -0,0 +1,324 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #253e5a !important; +} +.syntaxhighlighter .line.highlighted.number { + color: #38566f !important; +} +.syntaxhighlighter table caption { + color: #d1edff !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #0f192a !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #428bdd !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #428bdd !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #1dc116 !important; +} +.syntaxhighlighter .toolbar { + color: #d1edff !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #d1edff !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #8aa6c1 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #d1edff !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #428bdd !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #1dc116 !important; +} +.syntaxhighlighter .keyword { + color: #b43d3d !important; +} +.syntaxhighlighter .preprocessor { + color: #8aa6c1 !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #b43d3d !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #f8bb00 !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: white !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shCoreRDark.css b/libjson/Getting Started/Library Interface/styles/shCoreRDark.css new file mode 100644 index 0000000..d093683 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shCoreRDark.css @@ -0,0 +1,324 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #323e41 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: #b9bdb6 !important; +} +.syntaxhighlighter table caption { + color: #b9bdb6 !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #1b2426 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #5ba1cf !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #5ba1cf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #5ce638 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #e0e8ff !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #b9bdb6 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #878a85 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #5ce638 !important; +} +.syntaxhighlighter .keyword { + color: #5ba1cf !important; +} +.syntaxhighlighter .preprocessor { + color: #435a5f !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #5ba1cf !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #e0e8ff !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: white !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeDefault.css b/libjson/Getting Started/Library Interface/styles/shThemeDefault.css new file mode 100644 index 0000000..1365411 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeDefault.css @@ -0,0 +1,117 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #e0e0e0 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: black !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #6ce26c !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #6ce26c !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: blue !important; + background: white !important; + border: 1px solid #6ce26c !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: blue !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #6ce26c !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: black !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #008200 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: blue !important; +} +.syntaxhighlighter .keyword { + color: #006699 !important; +} +.syntaxhighlighter .preprocessor { + color: gray !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #006699 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeDjango.css b/libjson/Getting Started/Library Interface/styles/shThemeDjango.css new file mode 100644 index 0000000..d8b4313 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeDjango.css @@ -0,0 +1,120 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #0a2b1d !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #233729 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: #f8f8f8 !important; +} +.syntaxhighlighter .gutter { + color: #497958 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #41a83e !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #41a83e !important; + color: #0a2b1d !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #96dd3b !important; + background: black !important; + border: 1px solid #41a83e !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #96dd3b !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: white !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #41a83e !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #ffe862 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #f8f8f8 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #336442 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #9df39f !important; +} +.syntaxhighlighter .keyword { + color: #96dd3b !important; +} +.syntaxhighlighter .preprocessor { + color: #91bb9e !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #96dd3b !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #eb939a !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #91bb9e !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #edef7d !important; +} + +.syntaxhighlighter .comments { + font-style: italic !important; +} +.syntaxhighlighter .keyword { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeEclipse.css b/libjson/Getting Started/Library Interface/styles/shThemeEclipse.css new file mode 100644 index 0000000..77377d9 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeEclipse.css @@ -0,0 +1,128 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #c3defe !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #787878 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #d4d0c8 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #d4d0c8 !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3f5fbf !important; + background: white !important; + border: 1px solid #d4d0c8 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3f5fbf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #aa7700 !important; +} +.syntaxhighlighter .toolbar { + color: #a0a0a0 !important; + background: #d4d0c8 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #a0a0a0 !important; +} +.syntaxhighlighter .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #3f5fbf !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #2a00ff !important; +} +.syntaxhighlighter .keyword { + color: #7f0055 !important; +} +.syntaxhighlighter .preprocessor { + color: #646464 !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #7f0055 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} +.syntaxhighlighter .xml .keyword { + color: #3f7f7f !important; + font-weight: normal !important; +} +.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { + color: #7f007f !important; +} +.syntaxhighlighter .xml .string { + font-style: italic !important; + color: #2a00ff !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeEmacs.css b/libjson/Getting Started/Library Interface/styles/shThemeEmacs.css new file mode 100644 index 0000000..dae5053 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeEmacs.css @@ -0,0 +1,113 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: black !important; +} +.syntaxhighlighter .line.alt1 { + background-color: black !important; +} +.syntaxhighlighter .line.alt2 { + background-color: black !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #2a3133 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: #d3d3d3 !important; +} +.syntaxhighlighter .gutter { + color: #d3d3d3 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #990000 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #990000 !important; + color: black !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #ebdb8d !important; + background: black !important; + border: 1px solid #990000 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #ebdb8d !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #ff7d27 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #990000 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #9ccff4 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #d3d3d3 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #ff7d27 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #ff9e7b !important; +} +.syntaxhighlighter .keyword { + color: aqua !important; +} +.syntaxhighlighter .preprocessor { + color: #aec4de !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #81cef9 !important; +} +.syntaxhighlighter .constants { + color: #ff9e7b !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: aqua !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #ebdb8d !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff7d27 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #aec4de !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeFadeToGrey.css b/libjson/Getting Started/Library Interface/styles/shThemeFadeToGrey.css new file mode 100644 index 0000000..8fbd871 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeFadeToGrey.css @@ -0,0 +1,117 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: #121212 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #121212 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #121212 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #2c2c29 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: white !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #3185b9 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #3185b9 !important; + color: #121212 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3185b9 !important; + background: black !important; + border: 1px solid #3185b9 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3185b9 !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #d01d33 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #3185b9 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #96daff !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: white !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #696854 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #e3e658 !important; +} +.syntaxhighlighter .keyword { + color: #d01d33 !important; +} +.syntaxhighlighter .preprocessor { + color: #435a5f !important; +} +.syntaxhighlighter .variable { + color: #898989 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #aaaaaa !important; +} +.syntaxhighlighter .constants { + color: #96daff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #d01d33 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #ffc074 !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #4a8cdb !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #96daff !important; +} + +.syntaxhighlighter .functions { + font-weight: bold !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeMDUltra.css b/libjson/Getting Started/Library Interface/styles/shThemeMDUltra.css new file mode 100644 index 0000000..f4db39c --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeMDUltra.css @@ -0,0 +1,113 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: #222222 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #222222 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #222222 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #253e5a !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: lime !important; +} +.syntaxhighlighter .gutter { + color: #38566f !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #222222 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #428bdd !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #428bdd !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: lime !important; +} +.syntaxhighlighter .toolbar { + color: #aaaaff !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #aaaaff !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #9ccff4 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: lime !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #428bdd !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: lime !important; +} +.syntaxhighlighter .keyword { + color: #aaaaff !important; +} +.syntaxhighlighter .preprocessor { + color: #8aa6c1 !important; +} +.syntaxhighlighter .variable { + color: aqua !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ff8000 !important; +} +.syntaxhighlighter .constants { + color: yellow !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #aaaaff !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: red !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: yellow !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeMidnight.css b/libjson/Getting Started/Library Interface/styles/shThemeMidnight.css new file mode 100644 index 0000000..c49563c --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeMidnight.css @@ -0,0 +1,113 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #0f192a !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #253e5a !important; +} +.syntaxhighlighter .line.highlighted.number { + color: #38566f !important; +} +.syntaxhighlighter table caption { + color: #d1edff !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #0f192a !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #428bdd !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #428bdd !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #1dc116 !important; +} +.syntaxhighlighter .toolbar { + color: #d1edff !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #d1edff !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #8aa6c1 !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #d1edff !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #428bdd !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #1dc116 !important; +} +.syntaxhighlighter .keyword { + color: #b43d3d !important; +} +.syntaxhighlighter .preprocessor { + color: #8aa6c1 !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #f7e741 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #b43d3d !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #f8bb00 !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: white !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/Getting Started/Library Interface/styles/shThemeRDark.css b/libjson/Getting Started/Library Interface/styles/shThemeRDark.css new file mode 100644 index 0000000..6305a10 --- /dev/null +++ b/libjson/Getting Started/Library Interface/styles/shThemeRDark.css @@ -0,0 +1,113 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.alt1 { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.alt2 { + background-color: #1b2426 !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #323e41 !important; +} +.syntaxhighlighter .line.highlighted.number { + color: #b9bdb6 !important; +} +.syntaxhighlighter table caption { + color: #b9bdb6 !important; +} +.syntaxhighlighter .gutter { + color: #afafaf !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #435a5f !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #435a5f !important; + color: #1b2426 !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #5ba1cf !important; + background: black !important; + border: 1px solid #435a5f !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #5ba1cf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #5ce638 !important; +} +.syntaxhighlighter .toolbar { + color: white !important; + background: #435a5f !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: white !important; +} +.syntaxhighlighter .toolbar a:hover { + color: #e0e8ff !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: #b9bdb6 !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #878a85 !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #5ce638 !important; +} +.syntaxhighlighter .keyword { + color: #5ba1cf !important; +} +.syntaxhighlighter .preprocessor { + color: #435a5f !important; +} +.syntaxhighlighter .variable { + color: #ffaa3e !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ffaa3e !important; +} +.syntaxhighlighter .constants { + color: #e0e8ff !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #5ba1cf !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: #e0e8ff !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: white !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: #ffaa3e !important; +} diff --git a/libjson/JSONOptions.h b/libjson/JSONOptions.h new file mode 100644 index 0000000..57c19f2 --- /dev/null +++ b/libjson/JSONOptions.h @@ -0,0 +1,360 @@ +#ifndef JSON_OPTIONS_H +#define JSON_OPTIONS_H + +/** + * This file holds all of the compiling options for easy access and so + * that you don't have to remember them, or look them up all the time + */ + + +/* + * JSON_LIBRARY must be declared if libjson is compiled as a static or dynamic + * library. This exposes a C-style interface, but none of the inner workings of libjson + */ +#define JSON_LIBRARY + + +/* + * JSON_STRICT removes all of libjson's extensions. Meaning no comments, no special numbers + */ +//#define JSON_STRICT + + +/* + * JSON_DEBUG is used to perform extra error checking. Because libjson usually + * does on the fly parsing, validation is impossible, so this option will allow + * you to register an error callback so that you can record what is going wrong + * before the library crashes. This option does not protect from these errors, + * it simply tells you about them, which is nice for debugging, but not preferable + * for release candidates + */ +//#define JSON_DEBUG + + +/* + * JSON_ISO_STRICT turns off all code that uses non-standard C++. This removes all + * references to long long and long double as well as a few others + */ +//#define JSON_ISO_STRICT + + +/* + * JSON_SAFE performs similarly to JSON_DEBUG, except this option does protect + * from the errors that it encounters. This option is recommended for those who + * feel it's possible for their program to encounter invalid json. + */ +#define JSON_SAFE + + +/* + * JSON_STDERROR routes error messages to cerr instead of a callback, this + * option hides the callback registering function. This will usually display + * messages in the console + */ +//#define JSON_STDERROR + + +/* + * JSON_PREPARSE causes all parsing to be done immediately. By default, libjson + * parses nodes on the fly as they are needed, this makes parsing much faster if + * your program gets a lot of information that it doesn't need. An example of + * this would be a client application communicating with a server if the server + * returns things like last modified date and other things that you don't use. + */ +//#define JSON_PREPARSE + + +/* + * JSON_LESS_MEMORY will force libjson to let go of memory as quickly as it can + * this is recommended for software that has to run on less than optimal machines. + * It will cut libjson's memory usage by about 20%, but also run slightly slower. + * It's recommended that you also compile using the -Os option, as this will also + * reduce the size of the library + */ +//#define JSON_LESS_MEMORY + + +/* + * JSON_UNICODE tells libjson to use wstrings instead of regular strings, this + * means that libjson supports the full array of unicode characters, but also takes + * much more memory and processing power. + */ +//#define JSON_UNICODE + + +/* + * JSON_REF_COUNT causes libjson to reference count JSONNodes, which makes copying + * and passing them around much faster. It is recommended that this stay on for + * most uses + */ +#define JSON_REF_COUNT + + +/* + * JSON_BINARY is used to support binary, which is base64 encoded and decoded by libjson, + * if this option is not turned off, no base64 support is included + */ +#define JSON_BINARY + + +/* + * JSON_EXPOSE_BASE64 is used to turn on the functionality of libjson's base64 encoding + * and decoding. This may be useful if you want to obfuscate your json, or send binary data over + * a network + */ +#define JSON_EXPOSE_BASE64 + + +/* + * JSON_ITERATORS turns on all of libjson's iterating functionality. This would usually + * only be turned off while compiling for use with C + */ +#define JSON_ITERATORS + + +/* + * JSON_STREAM turns on libjson's streaming functionality. This allows you to give parts of + * your json into a stream, which will automatically hit a callback when full nodes are + * completed + */ +#define JSON_STREAM + + +/* + * JSON_MEMORY_CALLBACKS exposes functions to register callbacks for allocating, resizing, + * and freeing memory. Because libjson is designed for customizability, it is feasible + * that some users would like to further add speed by having the library utilize a memory + * pool. With this option turned on, the default behavior is still done internally unless + * a callback is registered. So you can have this option on and not use it. + */ +//#define JSON_MEMORY_CALLBACKS + + +/* + * JSON_MEMORY_MANAGE is used to create functionality to automatically track and clean + * up memory that has been allocated by the user. This includes strings, binary data, and + * nodes. It also exposes bulk delete functions. + */ +//#define JSON_MEMORY_MANAGE + + +/* + * JSON_MEMORY_POOL Turns on libjson's iteraction with mempool++. It is more efficient that simply + * connecting mempool++ to the callbacks because it integrates things internally and uses a number + * of memory pools. This value tells libjson how large of a memory pool to start out with. 500KB + * should suffice for most cases. libjson will distribute that within the pool for the best + * performance depending on other settings. + */ +//#define JSON_MEMORY_POOL 524288 + + +/* + * JSON_MUTEX_CALLBACKS exposes functions to register callbacks to lock and unlock + * mutexs and functions to lock and unlock JSONNodes and all of it's children. This + * does not prevent other threads from accessing the node, but will prevent them from + * locking it. It is much easier for the end programmer to allow libjson to manage + * your mutexs because of reference counting and manipulating trees, libjson automatically + * tracks mutex controls for you, so you only ever lock what you need to + */ +//#define JSON_MUTEX_CALLBACKS + + +/* + * JSON_MUTEX_MANAGE lets you set mutexes and forget them, libjson will not only keep + * track of the mutex, but also keep a count of how many nodes are using it, and delete + * it when there are no more references + */ +//#define JSON_MUTEX_MANAGE + + +/* + * JSON_NO_C_CONSTS removes consts from the C interface. It still acts the same way, but + * this may be useful for using the header with languages or variants that don't have const + */ +//#define JSON_NO_C_CONSTS + + +/* + * JSON_OCTAL allows libjson to use octal values in numbers. + */ +//#define JSON_OCTAL + + +/* + * JSON_WRITE_PRIORITY turns on libjson's writing capabilties. Without this libjson can only + * read and parse json, this allows it to write back out. Changing the value of the writer + * changes how libjson compiles, and how fast it will go when writing + */ +#define JSON_WRITE_PRIORITY MED + + +/* + * JSON_READ_PRIORITY turns on libjson's reading capabilties. Changing the value of the reader + * changes how libjson compiles, and how fast it will go when writing + */ +#define JSON_READ_PRIORITY HIGH + + +/* + * JSON_NEWLINE affects how libjson writes. If this option is turned on, libjson + * will use whatever it's defined as for the newline signifier, otherwise, it will use + * standard unix \n. + */ +//#define JSON_NEWLINE "\r\n" //\r\n is standard for most windows and dos programs + + +/* + * JSON_INDENT affects how libjson writes. If this option is turned on, libjson + * will use \t to indent formatted json, otherwise it will use the number of characters + * that you specify. If this is not turned on, then it will use the tab (\t) character + */ +//#define JSON_INDENT " " + + +/* + * JSON_ESCAPE_WRITES tells the libjson engine to escape special characters when it writes + * out. If this option is turned off, the json it outputs may not adhere to JSON standards + */ +#define JSON_ESCAPE_WRITES + + +/* + * JSON_COMMENTS tells libjson to store and write comments. libjson always supports + * parsing json that has comments in it as it simply ignores them, but with this option + * it keeps the comments and allows you to insert further comments + */ +#define JSON_COMMENTS + + +/* + * JSON_WRITE_BASH_COMMENTS will cause libjson to write all comments in bash (#) style + * if this option is not turned on, then it will use C-style comments. Bash comments are + * all single line + */ +//#define JSON_WRITE_BASH_COMMENTS + + +/* + * JSON_WRITE_SINGLE_LINE_COMMENTS will cause libjson to write all comments in using // + * notation, or (#) if that option is on. Some parsers do not support multiline C comments + * although, this option is not needed for bash comments, as they are all single line anyway + */ +//#define JSON_WRITE_SINGLE_LINE_COMMENTS + + +/* + * JSON_ARRAY_SIZE_ON_ON_LINE allows you to put small arrays of primitives all on one line + * in a write_formatted. This is common for tuples, like coordinates. If must be defined + * as an integer + */ +//#define JSON_ARRAY_SIZE_ON_ONE_LINE 2 + + +/* + * JSON_VALIDATE turns on validation features of libjson. + */ +#define JSON_VALIDATE + + +/* + * JSON_CASE_INSENSITIVE_FUNCTIONS turns on funtions for finding child nodes in a case- + * insenititve way + */ +#define JSON_CASE_INSENSITIVE_FUNCTIONS + + +/* + * JSON_INDEX_TYPE allows you th change the size type for the children functions. If this + * option is not used then unsigned int is used. This option is useful for cutting down + * on memory, or using huge numbers of child nodes (over 4 billion) + */ +//#define JSON_INDEX_TYPE unsigned int + + +/* + * JSON_BOOL_TYPE lets you change the bool type for the C interface. Because before C99 there + * was no bool, and even then it's just a typedef, you may want to use something else. If this + * is not defined, it will revert to int + */ +//#define JSON_BOOL_TYPE char + + +/* + * JSON_INT_TYPE lets you change the int type for as_int. If you ommit this option, the default + * long will be used + */ +//#define JSON_INT_TYPE long + + +/* + * JSON_NUMBER_TYPE lets you change the number type for as_float as well as the internal storage for the + * number. If you omit this option, the default double will be used for most cases and float for JSON_LESS_MEMORY + */ +//#define JSON_NUMBER_TYPE double + + +/* + * JSON_STRING_HEADER allows you to change the type of string that libjson uses both for the + * interface and internally. It must implement most of the STL string interface, but not all + * of it. Things like wxString or QString should wourk without much trouble + */ +//#define JSON_STRING_HEADER "../TestSuite/StringTest.h" + + +/* + * JSON_UNIT_TEST is used to maintain and debug the libjson. It makes all private + * members and functions public so that tests can do checks of the inner workings + * of libjson. This should not be turned on by end users. + */ +//#define JSON_UNIT_TEST + + +/* + * JSON_NO_EXCEPTIONS turns off any exception throwing by the library. It may still use exceptions + * internally, but the interface will never throw anything. + */ +//#define JSON_NO_EXCEPTIONS + + +/* + * JSON_DEPRECATED_FUNCTIONS turns on functions that have been deprecated, this is for backwards + * compatibility between major releases. It is highly recommended that you move your functions + * over to the new equivalents + */ +#define JSON_DEPRECATED_FUNCTIONS + + +/* + * JSON_CASTABLE allows you to call as_bool on a number and have it do the 0 or not 0 check, + * it also allows you to ask for a string from a number, or boolean, and have it return the right thing. + * Without this option, those types of requests are undefined. It also exposes the as_array, as_node, and cast + * functions + */ +#define JSON_CASTABLE + + +/* + * JSON_SECURITY_MAX_NEST_LEVEL is a security measure added to make prevent against DoS attacks + * This only affects validation, as if you are worried about security attacks, then you are + * most certainly validating json before sending it to be parsed. This option allows you to limitl how many + * levels deep a JSON Node can go. 128 is a good depth to start with + */ +#define JSON_SECURITY_MAX_NEST_LEVEL 128 + + +/* + * JSON_SECURITY_MAX_STRING_LENGTH is another security measure, preventing DoS attacks with very long + * strings of JSON. 32MB is the default value for this, this allows large images to be embedded + */ +#define JSON_SECURITY_MAX_STRING_LENGTH 33554432 + + +/* + * JSON_SECURITY_MAX_STREAM_OBJECTS is a security measure for streams. It prevents DoS attacks with + * large number of objects hitting the stream all at once. 128 is a lot of objects, but not out of + * the question for high speed systems. + */ +#define JSON_SECURITY_MAX_STREAM_OBJECTS 128 + +#endif + diff --git a/libjson/License.txt b/libjson/License.txt new file mode 100644 index 0000000..8c0347f --- /dev/null +++ b/libjson/License.txt @@ -0,0 +1,13 @@ +This license is also available in Documentation.pdf + +Copyright 2010 Jonathan Wallace. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY JONATHAN WALLACE ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JONATHAN WALLACE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Jonathan Wallace. \ No newline at end of file diff --git a/libjson/_internal/Dependencies/._libbase64++ b/libjson/_internal/Dependencies/._libbase64++ new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Dependencies/._libbase64++ differ diff --git a/libjson/_internal/Dependencies/._mempool++ b/libjson/_internal/Dependencies/._mempool++ new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Dependencies/._mempool++ differ diff --git a/libjson/_internal/Dependencies/libbase64++/._libbase64++.h b/libjson/_internal/Dependencies/libbase64++/._libbase64++.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Dependencies/libbase64++/._libbase64++.h differ diff --git a/libjson/_internal/Dependencies/libbase64++/libbase64++.h b/libjson/_internal/Dependencies/libbase64++/libbase64++.h new file mode 100644 index 0000000..3d02640 --- /dev/null +++ b/libjson/_internal/Dependencies/libbase64++/libbase64++.h @@ -0,0 +1,270 @@ +#ifndef LIBBASE64_CPP_H +#define LIBBASE64_CPP_H + +#include +//#define LIBBASE64_THROW_STD_INVALID_ARGUMENT + +//version info +#define __LIBBASE64_MAJOR__ 1 +#define __LIBBASE64_MINOR__ 1 +#define __LIBBASE64_PATCH__ 0 +#define __LIBBASE64_VERSION__ (__LIBBASE64_MAJOR__ * 10000 + __LIBBASE64_MINOR__ * 100 + __LIBBASE64_PATCH__) + +//code coverage and asserts +#ifdef NDEBUG + #define LIBBASE64_ASSERT(cond, msg) (void)0 + #define CREATEBOUNDCHECKER(type, name, ubound, lbound) (void)0 + #define GETITEM_BOUNDCHECK(loc, name) (*(loc)) +#else + #include + #define LIBBASE64_ASSERT(cond, msg) if (!(cond)){ std::cerr << msg << std::endl; throw false; } + + template + class libbase64_boundChecker { + public: + libbase64_boundChecker(const T * lbound, const T * ubound) : upperbound(ubound), lowerbound(lbound){}; + T getLocation(const T * loc){ + LIBBASE64_ASSERT(loc < upperbound, "Array index above bounds"); + LIBBASE64_ASSERT(loc >= lowerbound, "Array index below bounds"); + return *loc; + } + private: + const T * lowerbound; + const T * upperbound; + }; + #define CREATEBOUNDCHECKER(type, name, ubound, lbound) libbase64_boundChecker name(ubound, lbound) + #define GETITEM_BOUNDCHECK(loc, name) name.getLocation(loc) + + #ifdef LIBBASE64CODECOVERAGE + #define LIBBASE64CODECOVERAGEBRANCH { static bool f_codeCoverage_ = false; if (f_codeCoverage_ == false){ libbase64::getCoverageHits(true); f_codeCoverage_ = true; } } + #endif +#endif +#ifndef LIBBASE64CODECOVERAGE + #define LIBBASE64CODECOVERAGEBRANCH (void)0 +#endif + +//predictive branching optimizations +#ifdef __GNUC__ + #define LIBBASE64_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) + #if (LIBBASE64_GCC_VERSION >= 29600) + #define libbase64_likely(x) __builtin_expect((long)((bool)(x)),1) + #define libbase64_unlikely(x) __builtin_expect((long)((bool)(x)),0) + #endif +#endif +#ifndef libbase64_likely + #define libbase64_likely(x) x + #define libbase64_unlikely(x) x +#endif + + +namespace libbase64 { + #ifdef LIBBASE64CODECOVERAGE //Gets the number of branches that has been made + template + static size_t getCoverageHits(bool inc){ + static size_t hits = 0; + if (inc) ++hits; + return hits; + } + #endif + + //characters used in convertions + namespace libbase64_characters { + template + inline static const T * getChar64(void){ + static const T char64s[64] = { + (T)'A', (T)'B', (T)'C', (T)'D', (T)'E', (T)'F', (T)'G', (T)'H', (T)'I', (T)'J', (T)'K', (T)'L', (T)'M', + (T)'N', (T)'O', (T)'P', (T)'Q', (T)'R', (T)'S', (T)'T', (T)'U', (T)'V', (T)'W', (T)'X', (T)'Y', (T)'Z', + (T)'a', (T)'b', (T)'c', (T)'d', (T)'e', (T)'f', (T)'g', (T)'h', (T)'i', (T)'j', (T)'k', (T)'l', (T)'m', + (T)'n', (T)'o', (T)'p', (T)'q', (T)'r', (T)'s', (T)'t', (T)'u', (T)'v', (T)'w', (T)'x', (T)'y', (T)'z', + (T)'0', (T)'1', (T)'2', (T)'3', (T)'4', (T)'5', (T)'6', (T)'7', (T)'8', (T)'9', (T)'+', (T)'/' + }; + return char64s; + } + + template + inline static T getChar(unsigned char bin){ + CREATEBOUNDCHECKER(T, char64bounds, getChar64(), getChar64() + 64); + return GETITEM_BOUNDCHECK(getChar64() + bin, char64bounds); + } + + template + inline static T toBinary(T c) { + static T binaryConvert[80] = {62,48,49,50,63,52,53,54,55,56,57,58,59,60,61,249,250,251,252,253,254,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}; + CREATEBOUNDCHECKER(T, binaryConvertsbounds, binaryConvert, binaryConvert + 80); + return GETITEM_BOUNDCHECK(binaryConvert + c - 43, binaryConvertsbounds); + } + + template + static inline T & emptyString(void){ + static T t; + return t; + } + } + + namespace libbase64_Calculator { + inline static size_t getEncodingSize(size_t bytes){ + return (bytes + 2 - ((bytes + 2) % 3)) / 3 * 4; + } + inline static size_t getDecodingSize(size_t res){ + return res * 3 / 4; + } + } + + + /** + * Encodes data into a base64 string of STRINGTYPE + */ + template + static STRINGTYPE encode(const unsigned char * binary, size_t bytes){ + CREATEBOUNDCHECKER(unsigned char, binarybounds, binary, binary + bytes); + + //make sure that there is actually something to encode + if (SAFETY){ + if (libbase64_unlikely(bytes == 0)){ + LIBBASE64CODECOVERAGEBRANCH; + return libbase64_characters::emptyString(); + } + } + + //calculate length and how misaligned it is + size_t misaligned = bytes % 3; + STRINGTYPE result; + result.reserve(libbase64_Calculator::getEncodingSize(bytes)); + + //do all of the ones that are 3 byte aligned + for (size_t i = 0, aligned((bytes - misaligned) / 3); i < aligned; ++i){ + LIBBASE64CODECOVERAGEBRANCH; + result += libbase64_characters::getChar((GETITEM_BOUNDCHECK(binary, binarybounds) & 0xFC) >> 2); + result += libbase64_characters::getChar(((GETITEM_BOUNDCHECK(binary, binarybounds) & 0x03) << 4) + ((GETITEM_BOUNDCHECK(binary + 1, binarybounds) & 0xF0) >> 4)); + result += libbase64_characters::getChar(((GETITEM_BOUNDCHECK(binary + 1, binarybounds) & 0x0F) << 2) + ((GETITEM_BOUNDCHECK(binary + 2, binarybounds) & 0xC0) >> 6)); + result += libbase64_characters::getChar(GETITEM_BOUNDCHECK(binary + 2, binarybounds) & 0x3F); + binary += 3; + } + + //handle any additional characters at the end of it + if (libbase64_likely(misaligned != 0)){ + LIBBASE64CODECOVERAGEBRANCH; + //copy the rest into a temporary buffer, need it for the null terminators + unsigned char temp[3] = { '\0', '\0', '\0' }; + for (unsigned char i = 0; i < (unsigned char)misaligned; ++i){ + LIBBASE64CODECOVERAGEBRANCH; + temp[i] = GETITEM_BOUNDCHECK(binary++, binarybounds); + } + + //now do the final three bytes + result += libbase64_characters::getChar((temp[0] & 0xFC) >> 2); + result += libbase64_characters::getChar(((temp[0] & 0x03) << 4) + ((temp[1] & 0xF0) >> 4)); + if (misaligned == 2){ + LIBBASE64CODECOVERAGEBRANCH; + result += libbase64_characters::getChar(((temp[1] & 0x0F) << 2) + ((temp[2] & 0xC0) >> 6)); + } else { + LIBBASE64CODECOVERAGEBRANCH; + result += (CHARTYPE)'='; + } + result += (CHARTYPE)'='; + } else { + LIBBASE64CODECOVERAGEBRANCH; + } + + LIBBASE64_ASSERT(libbase64_Calculator::getEncodingSize(bytes) == result.length(), "Reserve wasn't the correct guess"); + return result; + } + + template + static std::string decode(const STRINGTYPE & encoded){ + //check length to be sure its acceptable for base64 + const size_t length = encoded.length(); + + if (SAFETY){ + if (libbase64_unlikely((length % 4) != 0)){ + LIBBASE64CODECOVERAGEBRANCH; + return libbase64_characters::emptyString(); + } + if (libbase64_unlikely(length == 0)){ + LIBBASE64CODECOVERAGEBRANCH; + return libbase64_characters::emptyString(); + } + + //check to be sure there aren't odd characters or characters in the wrong places + size_t pos = encoded.find_first_not_of(libbase64_characters::getChar64()); + if (libbase64_unlikely(pos != STRINGTYPE::npos)){ + LIBBASE64CODECOVERAGEBRANCH; + if (libbase64_unlikely(encoded[pos] != (CHARTYPE)'=')){ + LIBBASE64CODECOVERAGEBRANCH; //INVALID_CHAR + #ifdef LIBBASE64_THROW_STD_INVALID_ARGUMENT + throw std::invalid_argument("invalid character in base64"); + #else + return libbase64_characters::emptyString(); + #endif + } + if (pos != length - 1){ + LIBBASE64CODECOVERAGEBRANCH; + if (libbase64_unlikely(pos != length - 2)){ + LIBBASE64CODECOVERAGEBRANCH; //EQUAL_WRONG_PLACE + #ifdef LIBBASE64_THROW_STD_INVALID_ARGUMENT + throw std::invalid_argument("equal sign in wrong place in base64"); + #else + return libbase64_characters::emptyString(); + #endif + } + if (libbase64_unlikely(encoded[pos + 1] != (CHARTYPE)'=')){ + LIBBASE64CODECOVERAGEBRANCH; //EQUAL_NOT_LAST + #ifdef LIBBASE64_THROW_STD_INVALID_ARGUMENT + throw std::invalid_argument("invalid character in base64"); + #else + return libbase64_characters::emptyString(); + #endif + } + LIBBASE64CODECOVERAGEBRANCH; + } else { + LIBBASE64CODECOVERAGEBRANCH; + } + } else { + LIBBASE64CODECOVERAGEBRANCH; + } + } + + const CHARTYPE * runner = encoded.data(); + const CHARTYPE * end = runner + encoded.length(); + CREATEBOUNDCHECKER(CHARTYPE, encodedbounds, runner, end); + size_t aligned = length / 4; //don't do the last ones as they might be = padding + std::string result; + --aligned; + result.reserve(libbase64_Calculator::getDecodingSize(length)); + + //first do the ones that can not have any padding + for (unsigned int i = 0; i < aligned; ++i){ + const CHARTYPE second = libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner + 1, encodedbounds)); + const CHARTYPE third = libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner + 2, encodedbounds)); + result += (libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner, encodedbounds)) << 2) + ((second & 0x30) >> 4); + result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2); + result += ((third & 0x3) << 6) + libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner + 3, encodedbounds)); + runner += 4; + } + + //now do the ones that might have padding, the first two characters can not be padding, so do them quickly + const CHARTYPE second = libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner + 1, encodedbounds)); + result += (libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner + 0, encodedbounds)) << 2) + ((second & 0x30) >> 4); + runner += 2; + if ((runner != end) && (*runner != (CHARTYPE)'=')){ //not two = pads + LIBBASE64CODECOVERAGEBRANCH; + const CHARTYPE third = libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner, encodedbounds)); + result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2); + ++runner; + if ((runner != end) && (*runner != (CHARTYPE)'=')){ //no padding + LIBBASE64CODECOVERAGEBRANCH; + result += ((third & 0x3) << 6) + libbase64_characters::toBinary(GETITEM_BOUNDCHECK(runner, encodedbounds)); + } else { + LIBBASE64CODECOVERAGEBRANCH; + } + } else { + LIBBASE64CODECOVERAGEBRANCH; + } + + LIBBASE64_ASSERT(libbase64_Calculator::getDecodingSize(length) >= result.length(), "Reserve wasn't the correct guess, too small"); + LIBBASE64_ASSERT((result.length() <= 3) || (libbase64_Calculator::getDecodingSize(length) > result.length() - 3), "Reserve wasn't the correct guess, too big"); + return result; + } +} + +#endif diff --git a/libjson/_internal/Dependencies/mempool++/._mempool.h b/libjson/_internal/Dependencies/mempool++/._mempool.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Dependencies/mempool++/._mempool.h differ diff --git a/libjson/_internal/Dependencies/mempool++/mempool.h b/libjson/_internal/Dependencies/mempool++/mempool.h new file mode 100644 index 0000000..1a10540 --- /dev/null +++ b/libjson/_internal/Dependencies/mempool++/mempool.h @@ -0,0 +1,1088 @@ +#ifndef mempool___mempool_h +#define mempool___mempool_h + + +/* + * This is where you may alter options to give mempool++ + */ + +//#define MEMPOOL_DEBUGGING //Causes mempool++ to spit out what it's doing to the console +//#define MEMPOOL_ASSERTS //Causes mempool++ to check what it's doing and look for impossible cases +#define MEMPOOL_OVERFLOW 3.0f / 4.0f //Changes how full a pool is before going to fallbacks +//#define MEMPOOL_DETERMINE_DISTRIBUTION //Allows mempool++ to automatically give you the best distribution +#define MEMPOOL_DETERMINE_SCALAR 5.0f / 3.0f //Gives you this times the max number at any given time from distribution +#define MEMPOOL_FALLBACK_DEPTH 3 +//#define MEMPOOL_PERFORMANCE_DEBUGGING +//#define private public + + +//version info +#define __MEMPOOL_MAJOR__ 1 +#define __MEMPOOL_MINOR__ 2 +#define __MEMPOOL_PATCH__ 0 +#define __MEMPOOL_VERSION__ (__MEMPOOL_MAJOR__ * 10000 + __MEMPOOL_MINOR__ * 100 + __MEMPOOL_PATCH__) + +/* + * This is where special function / macro for special options are + */ + +#ifdef MEMPOOL_DEBUGGING + #include + #define MEMPOOL_DEBUG(x) std::cout << x << std::endl; +#else + #define MEMPOOL_DEBUG(x) +#endif + +#ifdef MEMPOOL_ASSERTS + #include + #define MEMPOOL_ASSERT(condition) if (pool_unlikely(!(condition))){ std::cout << #condition << " isn't true" << std::endl; } + #define MEMPOOL_ASSERT2(condition, out) if (pool_unlikely(!(condition))){ std::cout << out << std::endl; } +#else + #define MEMPOOL_ASSERT(condition) + #define MEMPOOL_ASSERT2(condition, out) +#endif + +#ifdef MEMPOOL_PERFORMANCE_DEBUGGING + #include + #include + #include + #define MEMPOOL_PERFORMANCE_DEBUG(x) std::cout << x << std::endl; +#else + #define MEMPOOL_PERFORMANCE_DEBUG(x) +#endif + + + +/* + * This is where compiler-specific code goes + */ +#ifdef __GNUC__ + #if (__GNUC__ >= 3) + #define POOL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + #else + #define POOL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) + #endif + + #if (POOL_GCC_VERSION >= 40300) + #define pool_hot pool_nothrow __attribute__ ((hot)) + #else + #define pool_hot pool_nothrow + #endif + + #if (POOL_GCC_VERSION >= 29600) + #define pool_likely(x) __builtin_expect((long)((bool)(x)),1) + #define pool_unlikely(x) __builtin_expect((long)((bool)(x)),0) + #else + #define pool_likely(x) x + #define pool_unlikely(x) x + #endif + + #define pool_nothrow throw() +#else + #define pool_hot pool_nothrow + #define pool_likely(x) x + #define pool_unlikely(x) x + #define pool_nothrow +#endif + +#include + +/* + * This is where the classes are + */ + +//Callbacks for fallback if the pool is out of space +class mempool_callbacks { +public: + typedef void * (*mallocer_t)(size_t); + typedef void(*freer_t)(void *); + typedef void * (*reallocer_t)(void *, size_t); + + //Allows the user to alter where the fallbacks point to + static inline void set(mallocer_t mallocer, reallocer_t reallocer, freer_t freer) pool_nothrow { + get_instance()._malloc = mallocer; + get_instance()._free = freer; + get_instance()._realloc = reallocer; + } + + //allocates memory + static inline void * allocate(size_t size) pool_nothrow { + MEMPOOL_DEBUG("Returing malloced memory:" << size << " bytes"); + return get_instance()._malloc(size); + } + + //frees memory + static inline void deallocate(void * ptr) pool_nothrow { + MEMPOOL_DEBUG("Freeing malloced memory: " << ptr); + get_instance()._free(ptr); + } + + static inline void * reallocate(void * ptr, size_t size) pool_nothrow { + MEMPOOL_DEBUG("Reallocating memory: " << ptr << " to " << size << " bytes"); + return get_instance()._realloc(ptr, size); + } +private: + //Retrieves a Meyers singleton + static inline mempool_callbacks & get_instance(void) pool_nothrow { + static mempool_callbacks _single(std::malloc, std::realloc, std::free); + return _single; + } + + //The constructor + inline mempool_callbacks(mallocer_t mallocer, reallocer_t reallocer, freer_t freer) : + _malloc(mallocer), + _free(freer), + _realloc(reallocer){ + } + + //not copyable + mempool_callbacks & operator = (const mempool_callbacks & other); + mempool_callbacks(const mempool_callbacks & other); + + //member callbacks + mallocer_t _malloc; + reallocer_t _realloc; + freer_t _free; +}; + +//The workhorse of the templates library, a class that holds a pool that it allocates memory from +template +class object_memory_pool; //forward declaration + +template +class memory_pool_no_fullflag { //forward declaration +public: + memory_pool_no_fullflag(): + _link(NULL), + current(0), + depth(0), + threshold((size_t)((float)size * (MEMPOOL_OVERFLOW))), + memoryPool_end(memoryPool_start + (size * bytes)), + used_end(used_start + size), + runningPointer(used_start) + { + std::memset(used_start, 0, size * sizeof(bool)); + } + + virtual ~memory_pool_no_fullflag(void){ + if (_link){ + _link -> ~memory_pool_no_fullflag(); + mempool_callbacks::deallocate(_link); + } + } + + inline size_t load(void) const pool_nothrow { + return current; + } + + inline void * allocate(void) pool_hot { + if (void * res = allocate_nofallback()){ + return res; + } + return _link_allocate(); + } + + inline void deallocate(void * ptr) pool_hot { + if (memory_pool_no_fullflag * container = contains(ptr)){ + container -> deallocate_nofallback(ptr); + } else { + mempool_callbacks::deallocate(ptr); + } + } + + void * allocate_nofallback() pool_hot { + if (!(*runningPointer)) return _return_current(); + if (++runningPointer >= used_end) runningPointer = used_start; + if (current < threshold){ + //make sure it doesnt loop around infinity so point it to itself + const bool * position = runningPointer; + do { + if (!(*runningPointer)) return _return_current(); + if (++runningPointer >= used_end) runningPointer = used_start; + } while (position != runningPointer); + MEMPOOL_ASSERT2(false, "Got to impossible code location"); + } + + MEMPOOL_DEBUG("Returing null"); + return NULL; + } + + void deallocate_nofallback(void * ptr) pool_hot { + MEMPOOL_ASSERT2(current, "current not positive"); + --current; + MEMPOOL_DEBUG("Freeing slot " << ((char*)ptr - memoryPool_start) / bytes); + MEMPOOL_DEBUG(" pointer=" << ptr); + MEMPOOL_ASSERT2((((char*)ptr - memoryPool_start) / bytes) < size, "Freeing slot " << (((char*)ptr - memoryPool_start) / bytes) << " in a pool with only " << size << " items"); + MEMPOOL_ASSERT2(used_start[((char*)ptr - memoryPool_start) / bytes], "Freeing " << ptr << " and it's already been freed"); + used_start[(((char*)ptr - memoryPool_start) / bytes)] = false; + } + + inline memory_pool_no_fullflag * contains(void * ptr) pool_hot { + if ((ptr >= memoryPool_start) && (ptr < memoryPool_end)) return this; + return (_link) ? _link -> contains(ptr) : NULL; + } + + #ifdef MEMPOOL_PERFORMANCE_DEBUGGING + const char * const getName(void){ return "memory_pool_no_fullflag"; } + + const char * getDepth(){ + static const char * depths[15] = { + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "- ", + }; + if (depth > 14) return depths[14]; + return depths[depth]; + } + + std::string dump(void){ + std::stringstream output; + output << getDepth() << getName() << "<" << bytes << ", " << size << ">: " << (void*)this << std::endl; + output << getDepth() << "Currently holding: " << current << " items." << std::endl; + //_____ + output << getDepth() << "+"; + for(int i = 0; i < 78; ++i){ + output << "_"; + } + output << "+" << std::endl << getDepth() << "|"; + + //Fill in + int i; + for(i = 0; i < size; ++i){ + if ((i % 80 == 0) && (i != 0)){ + output << "|" << std::endl << getDepth() << "|"; + } + if (i == (runningPointer - used_start)){ + if (used_start[i]){ + output << "R"; + } else { + output << "P"; + } + } else if (used_start[i]){ + output << "X"; + } else { + output << " "; + } + } + + for(; (i % 80) != 0; ++i){ + output << "+"; + } + + //------- + output << getDepth() << "+"; + for(i = 0; i < 78; ++i){ + output << "-"; + } + output << "+"; + if (_link){ + output << "----+" << std::endl; + } + return output.str(); + } + #endif +protected: + //copy ctors and assignment operator + memory_pool_no_fullflag & operator = (const memory_pool_no_fullflag & other); + memory_pool_no_fullflag(const memory_pool_no_fullflag & other); + + inline void * _return_current(void) pool_hot { + *runningPointer = true; + ++current; + MEMPOOL_DEBUG("Returning slot " << runningPointer - used_start << " at depth " << depth); + MEMPOOL_DEBUG(" memoryPool_start=" << (void*)memoryPool_start); + MEMPOOL_DEBUG(" memoryPool_end =" << (void*)memoryPool_end); + MEMPOOL_DEBUG(" return value =" << (void*)(memoryPool_start + ((runningPointer - used_start) * bytes))); + MEMPOOL_ASSERT2(((memoryPool_start + ((runningPointer - used_start) * bytes))) < memoryPool_end, "Returning pointer outside the high end of the pool"); + MEMPOOL_ASSERT2(((memoryPool_start + ((runningPointer - used_start) * bytes))) >= memoryPool_start, "Returning pointer outside the low end of the pool"); + const bool * const pre = runningPointer; + if (++runningPointer >= used_end) runningPointer = used_start; + return memoryPool_start + ((pre - used_start) * bytes); + } + + void * _link_allocate(void) pool_nothrow { + if (depth >= MEMPOOL_FALLBACK_DEPTH) return mempool_callbacks::allocate(bytes); + if (!_link){ + _link = new(mempool_callbacks::allocate(sizeof(memory_pool_no_fullflag))) memory_pool_no_fullflag(); + _link -> depth = depth + 1; + } + return _link -> allocate(); + } + + size_t current; //The current number of items in the pool + size_t threshold; //The number of items in the pool before it starts using fallback + char memoryPool_start[size * bytes]; //The memory pool + char * memoryPool_end; //The end of the memory pool + bool used_start[size]; //A pool to know whether or not an item is currently used + bool * used_end; //The end of the boolean flags + bool * runningPointer; //A pointer that loops, keeping an eye on what is taken and what isn't + memory_pool_no_fullflag * _link; //Creates a linked list when expanding + size_t depth; +}; + +template +class memory_pool : public memory_pool_no_fullflag { +public: + memory_pool() : + memory_pool_no_fullflag(), + _full(false){} + + virtual ~memory_pool(void){} + + inline void * allocate(void) pool_hot { + if (_full) return mempool_callbacks::allocate(bytes); + return memory_pool_no_fullflag::allocate(); + } + + inline void deallocate(void * ptr) pool_hot { + _full = false; + return memory_pool_no_fullflag::deallocate(ptr); + } + + #ifdef MEMPOOL_PERFORMANCE_DEBUGGING + const char * const getName(void){ return "memory_pool"; } + #endif +private: + //copy ctors and assignment operator + memory_pool & operator = (const memory_pool & other); + memory_pool(const memory_pool & other); + + bool _full; + + template friend class object_memory_pool; +}; + + +//A memory pool for a specific type of object +#define new_object(pool, ctor) new (pool.allocate_noctor()) ctor //allows user to call a specific ctor on the object [ new_object(mypool, T(x, y)) ] +template +class object_memory_pool { +public: + inline size_t load(void) const pool_nothrow { + return _pool.load(); + } + + virtual ~object_memory_pool() pool_nothrow { } //so that it can be overloaded + + inline T * allocate(void) pool_hot { return new (_pool.allocate()) T(); } + inline void * allocate_noctor(void) pool_nothrow { return _pool.allocate(); } + + inline void deallocate(T * ptr) pool_hot { + ptr -> ~T(); + _pool.deallocate(ptr); + } + + inline memory_pool * contains(T * ptr) const pool_hot { + return _pool.contains((void*)ptr); + } + + inline T * alloc_nofallback() pool_hot { + if (void * res = _pool.allocate_nofallback()){ + return new (res) T(); + } + return NULL; + } + + inline void deallocate_nofallback(T * ptr) pool_hot { + ptr -> ~T(); + _pool.deallocate_nofallback(ptr); + } + #ifdef MEMPOOL_PERFORMANCE_DEBUGGING + const std::string dump(void){ return _pool.dump(); } + #endif +private: + memory_pool _pool; +}; + + +#define MEMPOOL_TEMPLATE_PAIR(x) size_t bytes ## x , size_t count ## x +#define MEMPOOL_ALLOC_CHECK(x) if (bytes <= bytes ## x ){ if (void * res = (_pool ## x).allocate_nofallback()) return res; } +#define MEMPOOL_DEALLOC_CHECK(x) if (memory_pool_no_fullflag< bytes ## x , count ## x > * container = (_pool ## x).contains(ptr)){ container -> deallocate_nofallback(ptr); return; } +#define MEMPOOL_MEMBER_POOL(x) memory_pool< bytes ## x , count ## x > _pool ## x; + +#define MEMPOOL_REALLOC_CHECK(x)\ + if (memory_pool_no_fullflag< bytes ## x , count ## x > * container = (_pool ## x).contains(ptr)){\ + if (bytes <= bytes ## x) return ptr;\ + void * newvalue = allocate(bytes);\ + std::memcpy(newvalue, ptr, bytes ## x);\ + container -> deallocate_nofallback(ptr);\ + return newvalue;\ + } + + +#ifdef MEMPOOL_DETERMINE_DISTRIBUTION + #include + #include + #define MEMPOOL_ALLOC_METHOD(number, code)\ + bucket_pool_ ## number (void) : _profile_on_delete(0) { }\ + ~bucket_pool_ ## number (void) { \ + if (_profile_on_delete){ \ + dump_atonce(_profile_on_delete, _profile_on_delete / 40); \ + dump_template(_profile_on_delete); \ + } \ + }\ + void * allocate(size_t bytes) pool_hot {\ + if (mapping.find(bytes) != mapping.end()){\ + ++mapping[bytes];\ + ++current_mapping[bytes];\ + if (current_mapping[bytes] > max_mapping[bytes]) max_mapping[bytes] = current_mapping[bytes];\ + } else {\ + mapping[bytes] = 1;\ + max_mapping[bytes] = 1;\ + current_mapping[bytes] = 1;\ + }\ + void * res = mempool_callbacks::allocate(bytes);\ + mem_mapping[res] = bytes;\ + return res;\ + } + #define MEMPOOL_DEALLOC_METHOD(code)\ + void deallocate(void * ptr) pool_hot {\ + --current_mapping[mem_mapping[ptr]];\ + mem_mapping.erase(ptr);\ + mempool_callbacks::deallocate(ptr);\ + } + + #define MEMPOOL_ANALYZERS(macro_count)\ + inline size_t _max(size_t one, size_t two){ return (one > two) ? one : two; }\ + void dump_total(size_t max, size_t sep = 16, size_t tlen = 30){\ + std::cout << "-------- Total --------" << std::endl;\ + size_t max_amount = 0;\ + for(size_t i = 0; i < max;){\ + size_t amount = 0;\ + for(size_t j = 0; j < sep; ++j, ++i){\ + if (mapping.find(i) != mapping.end()){\ + amount += mapping[i];\ + }\ + }\ + if (amount > max_amount) max_amount = amount;\ + }\ + float scalar = ((float)max_amount) / ((float)tlen);\ + \ + for(size_t i = 0; i < max;){\ + size_t amount = 0;\ + for(size_t j = 0; j < sep; ++j, ++i){\ + if (mapping.find(i) != mapping.end()){\ + amount += mapping[i];\ + }\ + }\ + \ + if (i < 10) std::cout << ' ';\ + if (i < 100) std::cout << ' ';\ + if (i < 1000) std::cout << ' ';\ + if (i < 10000) std::cout << ' ';\ + std::cout << i << ':';\ + \ + for(size_t j = 0; j < (size_t)((float)amount / scalar); ++j){\ + std::cout << '*';\ + }\ + std::cout << '(' << amount << ')' << std::endl;\ + }\ + }\ + \ + void dump_atonce(size_t max, size_t sep = 16, size_t tlen = 30){\ + std::cout << "------ Distribution for \"" << _str << "\" ------" << std::endl;\ + size_t max_amount = 0;\ + for(size_t i = 0; i < max;){\ + size_t amount = 0;\ + for(size_t j = 0; j < sep; ++j, ++i){\ + if (max_mapping.find(i) != max_mapping.end()){\ + amount += max_mapping[i];\ + }\ + }\ + if (amount > max_amount) max_amount = amount;\ + }\ + float scalar = ((float)max_amount) / ((float)tlen);\ + \ + for(size_t i = 0; i < max;){\ + size_t amount = 0;\ + for(size_t j = 0; j < sep; ++j, ++i){\ + if (max_mapping.find(i) != max_mapping.end()){\ + amount += max_mapping[i];\ + }\ + }\ + \ + if (i < 10) std::cout << ' ';\ + if (i < 100) std::cout << ' ';\ + if (i < 1000) std::cout << ' ';\ + if (i < 10000) std::cout << ' ';\ + std::cout << i << ':';\ + \ + for(size_t j = 0; j < (size_t)((float)amount / scalar); ++j){\ + std::cout << '*';\ + }\ + std::cout << '(' << amount << ')' << std::endl;\ + }\ + }\ + \ + void dump_template(size_t max){\ + std::cout << "Recommended Template for \"" << _str << "\" = ";\ + size_t total_at_once = 0;\ + size_t highest = 0;\ + for(size_t i = 0; i < max; ++i){\ + if (max_mapping.find(i) != max_mapping.end()){\ + total_at_once += max_mapping[i];\ + highest = i;\ + }\ + }\ + \ + size_t count = 0;\ + size_t total_at_once_part = total_at_once / macro_count;\ + size_t current = 0;\ + size_t totalsofar = 0;\ + std::cout << '<';\ + for(size_t i = 0; ((i < max) && (count < (macro_count -1))); ++i){\ + if (max_mapping.find(i) != max_mapping.end()){\ + current += max_mapping[i];\ + totalsofar += max_mapping[i];\ + if (current > total_at_once_part){\ + std::cout << (i - 1) << ", " << (size_t)(((float)current - max_mapping[i]) * (MEMPOOL_DETERMINE_SCALAR)) << ", ";\ + current = max_mapping[i];\ + ++count;\ + }\ + }\ + }\ + std::cout << max << ", " << _max((size_t)((float)(total_at_once - totalsofar) * (MEMPOOL_DETERMINE_SCALAR)), total_at_once_part / 2) << '>' << std::endl;\ + }\ + \ + inline void profile_on_delete(size_t var, const std::string & str){ _profile_on_delete = var; _str = str; } + + #define MEMPOOL_MEMBERS(code)\ + std::map mapping;\ + std::map current_mapping;\ + std::map max_mapping;\ + std::map mem_mapping;\ + size_t _profile_on_delete;\ + std::string _str; + #define MEMPOOL_LOAD(number, code) inline size_t * load(void) const pool_nothrow { static size_t _load[number] = {0}; return &_load[0]; } +#else + #define MEMPOOL_ALLOC_METHOD(number, code)\ + void * allocate(size_t bytes) pool_hot {\ + code\ + return mempool_callbacks::allocate(bytes);\ + } + #define MEMPOOL_DEALLOC_METHOD(code)\ + void deallocate(void * ptr) pool_hot {\ + code\ + mempool_callbacks::deallocate(ptr);\ + } + #define MEMPOOL_ANALYZERS(macro_count) + #define MEMPOOL_MEMBERS(code) code + #define MEMPOOL_LOAD(number, code) inline size_t * load(void) const pool_nothrow { static size_t _load[number]; code return &_load[0]; } +#endif + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2)> +class bucket_pool_2 { +public: + MEMPOOL_ALLOC_METHOD( + 2, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + } + MEMPOOL_LOAD( + 2, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + ) + MEMPOOL_ANALYZERS(2) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3)> +class bucket_pool_3 { +public: + MEMPOOL_ALLOC_METHOD( + 3, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 3, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + ) + MEMPOOL_ANALYZERS(3) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4)> +class bucket_pool_4 { +public: + MEMPOOL_ALLOC_METHOD( + 4, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 4, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + ) + MEMPOOL_ANALYZERS(4) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5)> +class bucket_pool_5 { +public: + MEMPOOL_ALLOC_METHOD( + 5, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 5, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + ) + MEMPOOL_ANALYZERS(5) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5), +MEMPOOL_TEMPLATE_PAIR(6)> +class bucket_pool_6 { +public: + MEMPOOL_ALLOC_METHOD( + 6, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + MEMPOOL_ALLOC_CHECK(6) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + MEMPOOL_REALLOC_CHECK(6) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 6, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + _load[5] = _pool6.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + MEMPOOL_DEALLOC_CHECK(6) + ) + MEMPOOL_ANALYZERS(6) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + MEMPOOL_MEMBER_POOL(6) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5), +MEMPOOL_TEMPLATE_PAIR(6), +MEMPOOL_TEMPLATE_PAIR(7)> +class bucket_pool_7 { +public: + MEMPOOL_ALLOC_METHOD( + 7, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + MEMPOOL_ALLOC_CHECK(6) + MEMPOOL_ALLOC_CHECK(7) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + MEMPOOL_REALLOC_CHECK(6) + MEMPOOL_REALLOC_CHECK(7) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 7, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + _load[5] = _pool6.load(); + _load[6] = _pool7.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + MEMPOOL_DEALLOC_CHECK(6) + MEMPOOL_DEALLOC_CHECK(7) + ) + MEMPOOL_ANALYZERS(7) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + MEMPOOL_MEMBER_POOL(6) + MEMPOOL_MEMBER_POOL(7) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5), +MEMPOOL_TEMPLATE_PAIR(6), +MEMPOOL_TEMPLATE_PAIR(7), +MEMPOOL_TEMPLATE_PAIR(8)> +class bucket_pool_8 { +public: + MEMPOOL_ALLOC_METHOD( + 8, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + MEMPOOL_ALLOC_CHECK(6) + MEMPOOL_ALLOC_CHECK(7) + MEMPOOL_ALLOC_CHECK(8) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + MEMPOOL_REALLOC_CHECK(6) + MEMPOOL_REALLOC_CHECK(7) + MEMPOOL_REALLOC_CHECK(8) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 8, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + _load[5] = _pool6.load(); + _load[6] = _pool7.load(); + _load[7] = _pool8.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + MEMPOOL_DEALLOC_CHECK(6) + MEMPOOL_DEALLOC_CHECK(7) + MEMPOOL_DEALLOC_CHECK(8) + ) + MEMPOOL_ANALYZERS(8) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + MEMPOOL_MEMBER_POOL(6) + MEMPOOL_MEMBER_POOL(7) + MEMPOOL_MEMBER_POOL(8) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5), +MEMPOOL_TEMPLATE_PAIR(6), +MEMPOOL_TEMPLATE_PAIR(7), +MEMPOOL_TEMPLATE_PAIR(8), +MEMPOOL_TEMPLATE_PAIR(9)> +class bucket_pool_9 { +public: + MEMPOOL_ALLOC_METHOD( + 9, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + MEMPOOL_ALLOC_CHECK(6) + MEMPOOL_ALLOC_CHECK(7) + MEMPOOL_ALLOC_CHECK(8) + MEMPOOL_ALLOC_CHECK(9) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + MEMPOOL_REALLOC_CHECK(6) + MEMPOOL_REALLOC_CHECK(7) + MEMPOOL_REALLOC_CHECK(8) + MEMPOOL_REALLOC_CHECK(9) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 9, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + _load[5] = _pool6.load(); + _load[6] = _pool7.load(); + _load[7] = _pool8.load(); + _load[8] = _pool9.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + MEMPOOL_DEALLOC_CHECK(6) + MEMPOOL_DEALLOC_CHECK(7) + MEMPOOL_DEALLOC_CHECK(8) + MEMPOOL_DEALLOC_CHECK(9) + ) + MEMPOOL_ANALYZERS(9) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + MEMPOOL_MEMBER_POOL(6) + MEMPOOL_MEMBER_POOL(7) + MEMPOOL_MEMBER_POOL(8) + MEMPOOL_MEMBER_POOL(9) + ) +}; + +template< +MEMPOOL_TEMPLATE_PAIR(1), +MEMPOOL_TEMPLATE_PAIR(2), +MEMPOOL_TEMPLATE_PAIR(3), +MEMPOOL_TEMPLATE_PAIR(4), +MEMPOOL_TEMPLATE_PAIR(5), +MEMPOOL_TEMPLATE_PAIR(6), +MEMPOOL_TEMPLATE_PAIR(7), +MEMPOOL_TEMPLATE_PAIR(8), +MEMPOOL_TEMPLATE_PAIR(9), +MEMPOOL_TEMPLATE_PAIR(10)> +class bucket_pool_10 { +public: + MEMPOOL_ALLOC_METHOD( + 10, + MEMPOOL_ALLOC_CHECK(1) + MEMPOOL_ALLOC_CHECK(2) + MEMPOOL_ALLOC_CHECK(3) + MEMPOOL_ALLOC_CHECK(4) + MEMPOOL_ALLOC_CHECK(5) + MEMPOOL_ALLOC_CHECK(6) + MEMPOOL_ALLOC_CHECK(7) + MEMPOOL_ALLOC_CHECK(8) + MEMPOOL_ALLOC_CHECK(9) + MEMPOOL_ALLOC_CHECK(10) + ) + void * reallocate(void * ptr, size_t bytes){ + MEMPOOL_REALLOC_CHECK(1) + MEMPOOL_REALLOC_CHECK(2) + MEMPOOL_REALLOC_CHECK(3) + MEMPOOL_REALLOC_CHECK(4) + MEMPOOL_REALLOC_CHECK(5) + MEMPOOL_REALLOC_CHECK(6) + MEMPOOL_REALLOC_CHECK(7) + MEMPOOL_REALLOC_CHECK(8) + MEMPOOL_REALLOC_CHECK(9) + MEMPOOL_REALLOC_CHECK(10) + return mempool_callbacks::reallocate(ptr, bytes); + } + MEMPOOL_LOAD( + 10, + _load[0] = _pool1.load(); + _load[1] = _pool2.load(); + _load[2] = _pool3.load(); + _load[3] = _pool4.load(); + _load[4] = _pool5.load(); + _load[5] = _pool6.load(); + _load[6] = _pool7.load(); + _load[7] = _pool8.load(); + _load[8] = _pool9.load(); + _load[9] = _pool10.load(); + ) + MEMPOOL_DEALLOC_METHOD( + MEMPOOL_DEALLOC_CHECK(1) + MEMPOOL_DEALLOC_CHECK(2) + MEMPOOL_DEALLOC_CHECK(3) + MEMPOOL_DEALLOC_CHECK(4) + MEMPOOL_DEALLOC_CHECK(5) + MEMPOOL_DEALLOC_CHECK(6) + MEMPOOL_DEALLOC_CHECK(7) + MEMPOOL_DEALLOC_CHECK(8) + MEMPOOL_DEALLOC_CHECK(9) + MEMPOOL_DEALLOC_CHECK(10) + ) + MEMPOOL_ANALYZERS(10) +private: + MEMPOOL_MEMBERS( + MEMPOOL_MEMBER_POOL(1) + MEMPOOL_MEMBER_POOL(2) + MEMPOOL_MEMBER_POOL(3) + MEMPOOL_MEMBER_POOL(4) + MEMPOOL_MEMBER_POOL(5) + MEMPOOL_MEMBER_POOL(6) + MEMPOOL_MEMBER_POOL(7) + MEMPOOL_MEMBER_POOL(8) + MEMPOOL_MEMBER_POOL(9) + MEMPOOL_MEMBER_POOL(10) + ) +}; + +#endif diff --git a/libjson/_internal/Source/._JSONAllocator.cpp b/libjson/_internal/Source/._JSONAllocator.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONAllocator.cpp differ diff --git a/libjson/_internal/Source/._JSONAllocator.h b/libjson/_internal/Source/._JSONAllocator.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONAllocator.h differ diff --git a/libjson/_internal/Source/._JSONChildren.cpp b/libjson/_internal/Source/._JSONChildren.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONChildren.cpp differ diff --git a/libjson/_internal/Source/._JSONChildren.h b/libjson/_internal/Source/._JSONChildren.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONChildren.h differ diff --git a/libjson/_internal/Source/._JSONDebug.cpp b/libjson/_internal/Source/._JSONDebug.cpp new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONDebug.cpp differ diff --git a/libjson/_internal/Source/._JSONDebug.h b/libjson/_internal/Source/._JSONDebug.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONDebug.h differ diff --git a/libjson/_internal/Source/._JSONDefs b/libjson/_internal/Source/._JSONDefs new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONDefs differ diff --git a/libjson/_internal/Source/._JSONDefs.h b/libjson/_internal/Source/._JSONDefs.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONDefs.h differ diff --git a/libjson/_internal/Source/._JSONGlobals.h b/libjson/_internal/Source/._JSONGlobals.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONGlobals.h differ diff --git a/libjson/_internal/Source/._JSONIterators.cpp b/libjson/_internal/Source/._JSONIterators.cpp new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONIterators.cpp differ diff --git a/libjson/_internal/Source/._JSONMemory.cpp b/libjson/_internal/Source/._JSONMemory.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONMemory.cpp differ diff --git a/libjson/_internal/Source/._JSONMemory.h b/libjson/_internal/Source/._JSONMemory.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONMemory.h differ diff --git a/libjson/_internal/Source/._JSONMemoryPool.h b/libjson/_internal/Source/._JSONMemoryPool.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONMemoryPool.h differ diff --git a/libjson/_internal/Source/._JSONNode.cpp b/libjson/_internal/Source/._JSONNode.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONNode.cpp differ diff --git a/libjson/_internal/Source/._JSONNode.h b/libjson/_internal/Source/._JSONNode.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONNode.h differ diff --git a/libjson/_internal/Source/._JSONNode_Mutex.cpp b/libjson/_internal/Source/._JSONNode_Mutex.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONNode_Mutex.cpp differ diff --git a/libjson/_internal/Source/._JSONPreparse.cpp b/libjson/_internal/Source/._JSONPreparse.cpp new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONPreparse.cpp differ diff --git a/libjson/_internal/Source/._JSONPreparse.h b/libjson/_internal/Source/._JSONPreparse.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONPreparse.h differ diff --git a/libjson/_internal/Source/._JSONSharedString.h b/libjson/_internal/Source/._JSONSharedString.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONSharedString.h differ diff --git a/libjson/_internal/Source/._JSONSingleton.h b/libjson/_internal/Source/._JSONSingleton.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONSingleton.h differ diff --git a/libjson/_internal/Source/._JSONStats.h b/libjson/_internal/Source/._JSONStats.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONStats.h differ diff --git a/libjson/_internal/Source/._JSONStream.cpp b/libjson/_internal/Source/._JSONStream.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONStream.cpp differ diff --git a/libjson/_internal/Source/._JSONStream.h b/libjson/_internal/Source/._JSONStream.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONStream.h differ diff --git a/libjson/_internal/Source/._JSONValidator.h b/libjson/_internal/Source/._JSONValidator.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONValidator.h differ diff --git a/libjson/_internal/Source/._JSONWorker.cpp b/libjson/_internal/Source/._JSONWorker.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONWorker.cpp differ diff --git a/libjson/_internal/Source/._JSONWorker.h b/libjson/_internal/Source/._JSONWorker.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._JSONWorker.h differ diff --git a/libjson/_internal/Source/._JSONWriter.cpp b/libjson/_internal/Source/._JSONWriter.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSONWriter.cpp differ diff --git a/libjson/_internal/Source/._JSON_Base64.h b/libjson/_internal/Source/._JSON_Base64.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._JSON_Base64.h differ diff --git a/libjson/_internal/Source/._NumberToString.h b/libjson/_internal/Source/._NumberToString.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/._NumberToString.h differ diff --git a/libjson/_internal/Source/._internalJSONNode.cpp b/libjson/_internal/Source/._internalJSONNode.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._internalJSONNode.cpp differ diff --git a/libjson/_internal/Source/._internalJSONNode.h b/libjson/_internal/Source/._internalJSONNode.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._internalJSONNode.h differ diff --git a/libjson/_internal/Source/._libjson.cpp b/libjson/_internal/Source/._libjson.cpp new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/._libjson.cpp differ diff --git a/libjson/_internal/Source/JSONAllocator.cpp b/libjson/_internal/Source/JSONAllocator.cpp new file mode 100644 index 0000000..f3ffc1f --- /dev/null +++ b/libjson/_internal/Source/JSONAllocator.cpp @@ -0,0 +1,13 @@ +#include "JSONAllocator.h" + +#if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) +#include "JSONMemory.h" + +void * JSONAllocatorRelayer::alloc(size_t bytes) json_nothrow { + return JSONMemory::json_malloc(bytes); +} + +void JSONAllocatorRelayer::dealloc(void * ptr) json_nothrow { + JSONMemory::json_free(ptr); +} +#endif diff --git a/libjson/_internal/Source/JSONAllocator.h b/libjson/_internal/Source/JSONAllocator.h new file mode 100644 index 0000000..2716736 --- /dev/null +++ b/libjson/_internal/Source/JSONAllocator.h @@ -0,0 +1,82 @@ +#ifndef JSON_ALLOCATOR_H +#define JSON_ALLOCATOR_H + +#include "JSONStats.h" +#if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + +#include + +//need these for the json_nothrow +#include "JSONDefs/Visual_C.h" +#include "JSONDefs/GNU_C.h" +#include "JSONDefs/Unknown_C.h" + +class JSONAllocatorRelayer { +public: + static void * alloc(size_t bytes) json_nothrow json_hot; + static void dealloc(void * ptr) json_nothrow json_hot; +}; + +template class json_allocator; + +// specialize for void: +template <> class json_allocator { +public: + typedef void* pointer; + typedef const void* const_pointer; + // reference to void members are impossible. + typedef void value_type; + template struct rebind { typedef json_allocator other; }; +}; + +template class json_allocator { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef T value_type; + template struct rebind { typedef json_allocator other; }; + + //LIBJSON_OBJECT(json_allocator); + + inline json_allocator() json_nothrow { + //LIBJSON_CTOR; + } + inline json_allocator(const json_allocator&) json_nothrow { + //LIBJSON_COPY_CTOR; + } + template inline json_allocator(const json_allocator&) json_nothrow { + //LIBJSON_COPY_CTOR; + } + inline ~json_allocator() json_nothrow { + //LIBJSON_DTOR; + } + + inline pointer address(reference x) const { return &x; } + inline const_pointer address(const_reference x) const { return &x; } + + inline pointer allocate(size_type n, json_allocator::const_pointer = 0) json_hot { + return (pointer)JSONAllocatorRelayer::alloc(n * sizeof(T)); + } + inline void deallocate(pointer p, size_type) json_hot { + JSONAllocatorRelayer::dealloc(p); + } + + inline size_type max_size() const json_nothrow { return 0xEFFFFFFF; } + + inline void construct(pointer p, const T& val){ + new(p)T(val); + }; + inline void destroy(pointer p){ + ((T*)p) -> ~T(); + } +}; + +template inline bool operator==(const json_allocator&, const json_allocator&) json_nothrow { return true; } +template inline bool operator!=(const json_allocator&, const json_allocator&) json_nothrow { return false; } + +#endif +#endif diff --git a/libjson/_internal/Source/JSONChildren.cpp b/libjson/_internal/Source/JSONChildren.cpp new file mode 100644 index 0000000..a5492d9 --- /dev/null +++ b/libjson/_internal/Source/JSONChildren.cpp @@ -0,0 +1,94 @@ +#include "JSONChildren.h" +#include "JSONNode.h" + +/* + * reserves a certain number of bytes, in memory saving mode it creates a special + * type of child container that will not autoshrink + */ +void jsonChildren::reserve2(jsonChildren *& mine, json_index_t amount) json_nothrow { + if (mine -> array != 0){ + if (mine -> mycapacity < amount){ + mine -> inc(amount - mine -> mycapacity); + #ifdef JSON_LESS_MEMORY + mine = jsonChildren_Reserved::newChildren_Reserved(mine, amount); + #endif + } + } else { + mine -> reserve(amount); + } +} + +void jsonChildren::inc(void) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null inc")); + if (json_unlikely(mysize == mycapacity)){ //it's full + if (json_unlikely(mycapacity == 0)){ //the array hasn't been created yet + JSON_ASSERT(!array, JSON_TEXT("Expanding a 0 capacity array, but not null")); + #ifdef JSON_LESS_MEMORY + array = json_malloc(1); + mycapacity = 1; + #else + array = json_malloc(8); //8 seems average for JSON, and it's only 64 bytes + mycapacity = 8; + #endif + } else { + #ifdef JSON_LESS_MEMORY + mycapacity += 1; //increment the size of the array + #else + mycapacity <<= 1; //double the size of the array + #endif + array = json_realloc(array, mycapacity); + } + } +} + + +void jsonChildren::inc(json_index_t amount) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null inc(amount)")); + if (json_unlikely(amount == 0)) return; + if (json_likely(mysize + amount >= mycapacity)){ //it's full + if (json_unlikely(mycapacity == 0)){ //the array hasn't been created yet + JSON_ASSERT(!array, JSON_TEXT("Expanding a 0 capacity array, but not null")); + #ifdef JSON_LESS_MEMORY + array = json_malloc(amount); + mycapacity = amount; + #else + array = json_malloc(amount > 8 ? amount : 8); //8 seems average for JSON, and it's only 64 bytes + mycapacity = amount > 8 ? amount : 8; + #endif + } else { + #ifdef JSON_LESS_MEMORY + mycapacity = mysize + amount; //increment the size of the array + #else + while(mysize + amount > mycapacity){ + mycapacity <<= 1; //double the size of the array + } + #endif + array = json_realloc(array, mycapacity); + } + } +} + +//actually deletes everything within the vector, this is safe to do on an empty or even a null array +void jsonChildren::deleteAll(void) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null deleteAll")); + json_foreach(this, runner){ + JSON_ASSERT(*runner != JSON_TEXT('\0'), JSON_TEXT("a null pointer within the children")); + JSONNode::deleteJSONNode(*runner); //this is why I can't do forward declaration + } +} + +void jsonChildren::doerase(JSONNode ** position, json_index_t number) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null doerase")); + JSON_ASSERT(array != 0, JSON_TEXT("erasing something from a null array 2")); + JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array 2")); + JSON_ASSERT(position + number <= array + mysize, JSON_TEXT("erasing out of bounds 2")); + if (position + number >= array + mysize){ + mysize = (json_index_t)(position - array); + #ifndef JSON_ISO_STRICT + JSON_ASSERT((long long)position - (long long)array >= 0, JSON_TEXT("doing negative allocation")); + #endif + } else { + std::memmove(position, position + number, (mysize - (position - array) - number) * sizeof(JSONNode *)); + mysize -= number; + } +} diff --git a/libjson/_internal/Source/JSONChildren.h b/libjson/_internal/Source/JSONChildren.h new file mode 100644 index 0000000..1069ad7 --- /dev/null +++ b/libjson/_internal/Source/JSONChildren.h @@ -0,0 +1,329 @@ +#ifndef JSONCHILDREN_H +#define JSONCHILDREN_H + +#include "JSONMemory.h" +#include "JSONDebug.h" //for JSON_ASSERT macro + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(push, 1) + #elif _MSC_VER + #pragma pack(push, jsonChildren, 1) + #endif +#endif + +#define json_foreach(chldrn, itrtr)\ + JSONNode ** itrtr = chldrn -> begin();\ + for(JSONNode ** itrtr##_end = chldrn -> end(); itrtr != itrtr##_end; ++itrtr) + +/* + This class is essentially a vector that has been heavily optimized for the specific purpose + of holding JSONNode children. It acts the same way as a vector, it has a automatically + expanding array. On destruction, this container automatically destroys everything contained + in it as well, so that you libjson doesn't have to do that. + + T is JSONNode*, I can't define it that way directly because JSONNode uses this container, and because + the container deletes the children automatically, forward declaration can't be used + */ + +class JSONNode; //forward declaration + +#ifdef JSON_LESS_MEMORY + #define childrenVirtual virtual +#else + #define childrenVirtual +#endif + +class jsonChildren { +public: + LIBJSON_OBJECT(jsonChildren); + //starts completely empty and the array is not allocated + jsonChildren(void) json_nothrow : array(0), mysize(0), mycapacity(0) { + LIBJSON_CTOR; + } + + #ifdef JSON_LESS_MEMORY + jsonChildren(JSONNode** ar, json_index_t si, json_index_t ca) json_nothrow : array(ar), mysize(si), mycapacity(ca) { + LIBJSON_CTOR; + } + #endif + + //deletes the array and everything that is contained within it (using delete) + childrenVirtual ~jsonChildren(void) json_nothrow { + if (json_unlikely(array != 0)){ //the following function calls are safe, but take more time than a check here + deleteAll(); + libjson_free(array); + } + LIBJSON_DTOR; + } + + //increase the size of the array + void inc(json_index_t amount) json_nothrow; + void inc(void) json_nothrow; + + //Adds something to the vector, doubling the array if necessary + void push_back(JSONNode * item) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_back")); + inc(); + array[mysize++] = item; + } + + //Adds something to the front of the vector, doubling the array if necessary + void push_front(JSONNode * item) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_front")); + inc(); + std::memmove(array + 1, array, mysize++ * sizeof(JSONNode *)); + array[0] = item; + } + + //gets an item out of the vector by it's position + inline JSONNode * operator[] (json_index_t position) const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null []")); + JSON_ASSERT(position < mysize, JSON_TEXT("Using [] out of bounds")); + JSON_ASSERT(position < mycapacity, JSON_TEXT("Using [] out of bounds")); + JSON_ASSERT(array != 0, JSON_TEXT("Array is null")); + return array[position]; + } + + //returns the allocated capacity, but keep in mind that some might not be valid + inline json_index_t capacity() const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null capacity")); + return mycapacity; + } + + //returns the number of valid objects within the vector + inline json_index_t size() const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null size")); + return mysize; + } + + //tests whether or not the vector is empty + inline bool empty() const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null empty")); + return mysize == 0; + } + + //clears (and deletes) everything from the vector and sets it's size to 0 + inline void clear() json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null clear")); + if (json_likely(array != 0)){ //don't bother clearing anything if there is nothing in it + JSON_ASSERT(mycapacity != 0, JSON_TEXT("mycapacity is not zero, but array is null")); + deleteAll(); + mysize = 0; + } + JSON_ASSERT(mysize == 0, JSON_TEXT("mysize is not zero after clear")); + } + + //returns the beginning of the array + inline JSONNode ** begin(void) const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null begin")); + return array; + } + + //returns the end of the array + inline JSONNode ** end(void) const json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null end")); + return array + mysize; + } + + //makes sure that even after shirnking and expanding, the iterator is in same relative position + template + struct iteratorKeeper { + public: + LIBJSON_OBJECT(jsonChildren::iteratorKeeper); + iteratorKeeper(jsonChildren * pthis, JSONNode ** & position) json_nothrow : + myRelativeOffset(reverse ? (json_index_t)(pthis -> array + (size_t)pthis -> mysize - position) : (json_index_t)(position - pthis -> array)), + myChildren(pthis), + myPos(position){ + LIBJSON_CTOR; + } + + ~iteratorKeeper(void) json_nothrow { + LIBJSON_DTOR; + if (reverse){ + myPos = myChildren -> array + myChildren -> mysize - myRelativeOffset; + } else { + myPos = myChildren -> array + myRelativeOffset; + } + } + private: + iteratorKeeper(const iteratorKeeper &); + iteratorKeeper & operator = (const iteratorKeeper &); + + json_index_t myRelativeOffset; + jsonChildren * myChildren; + JSONNode ** & myPos; + }; + + //This function DOES NOT delete the item it points to + inline void erase(JSONNode ** & position) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase")); + JSON_ASSERT(array != 0, JSON_TEXT("erasing something from a null array 1")); + JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array 1")); + JSON_ASSERT(position <= array + mysize, JSON_TEXT("erasing out of bounds 1")); + std::memmove(position, position + 1, (mysize-- - (position - array) - 1) * sizeof(JSONNode *)); + iteratorKeeper ik(this, position); + shrink(); + } + + //This function DOES NOT delete the item it points to + inline void erase(JSONNode ** & position, json_index_t number) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 2")); + doerase(position, number); + iteratorKeeper ik(this, position); + shrink(); + } + + + //This function DOES NOT delete the item it points to + inline void erase(JSONNode ** position, json_index_t number, JSONNode ** & starter) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 3")); + doerase(position, number); + iteratorKeeper ik(this, starter); + shrink(); + } + + #ifdef JSON_LIBRARY + void insert(JSONNode ** & position, JSONNode * item) json_nothrow{ + #else + void insert(JSONNode ** & position, JSONNode * item, bool reverse = false) json_nothrow { + #endif + JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert")); + //position isnt relative to array because of realloc + JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 1")); + JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 1")); + #ifndef JSON_LIBRARY + if (reverse){ + iteratorKeeper ik(this, position); + inc(); + } else + #endif + { + iteratorKeeper ik(this, position); + inc(); + } + + std::memmove(position + 1, position, (mysize++ - (position - array)) * sizeof(JSONNode *)); + *position = item; + } + + void insert(JSONNode ** & position, JSONNode ** items, json_index_t num) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert 2")); + JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 2")); + JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 2")); + { + iteratorKeeper ik(this, position); + inc(num); + } + const size_t ptrs = ((JSONNode **)(array + mysize)) - position; + std::memmove(position + num, position, ptrs * sizeof(JSONNode *)); + std::memcpy(position, items, num * sizeof(JSONNode *)); + mysize += num; + } + + inline void reserve(json_index_t amount) json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null reserve")); + JSON_ASSERT(array == 0, JSON_TEXT("reserve is not meant to expand a preexisting array")); + JSON_ASSERT(mycapacity == 0, JSON_TEXT("reservec is not meant to expand a preexisting array")); + JSON_ASSERT(mysize == 0, JSON_TEXT("reserves is not meant to expand a preexisting array")); + array = json_malloc(mycapacity = amount); + } + + //it is static because mine might change pointers entirely + static void reserve2(jsonChildren *& mine, json_index_t amount) json_nothrow; + + //shrinks the array to only as large as it needs to be to hold everything within it + inline childrenVirtual void shrink() json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null shrink")); + if (json_unlikely(mysize == 0)){ //size is zero, we should completely free the array + libjson_free(array); //free does checks for a null pointer, so don't bother checking + array = 0; + #ifdef JSON_LESS_MEMORY + } else { //need to shrink it, using realloc + JSON_ASSERT(array != 0, JSON_TEXT("shrinking a null array that is not size 0")); + array = json_realloc(array, mysize); + #endif + } + mycapacity = mysize; + } + + + inline static void deleteChildren(jsonChildren * ptr) json_nothrow { + #ifdef JSON_MEMORY_CALLBACKS + ptr -> ~jsonChildren(); + libjson_free(ptr); + #else + delete ptr; + #endif + } + + inline static jsonChildren * newChildren(void) { + #ifdef JSON_MEMORY_CALLBACKS + return new(json_malloc(1)) jsonChildren(); + #else + return new jsonChildren(); + #endif + } + + JSONNode ** array; //the expandable array + + json_index_t mysize; //the number of valid items + json_index_t mycapacity; //the number of possible items +JSON_PROTECTED + //to make sure it's not copyable + jsonChildren(const jsonChildren &); + jsonChildren & operator = (const jsonChildren &); + + void deleteAll(void) json_nothrow json_hot; //implemented in JSONNode.cpp + void doerase(JSONNode ** position, json_index_t number) json_nothrow; +}; + +#ifdef JSON_LESS_MEMORY + class jsonChildren_Reserved : public jsonChildren { + public: + LIBJSON_OBJECT(jsonChildren_Reserved); + jsonChildren_Reserved(jsonChildren * orig, json_index_t siz) json_nothrow : jsonChildren(orig -> array, orig -> mysize, orig -> mycapacity), myreserved(siz) { + orig -> array = 0; + deleteChildren(orig); + LIBJSON_CTOR; + } + jsonChildren_Reserved(const jsonChildren_Reserved & orig) json_nothrow : jsonChildren(orig.array, orig.mysize, orig.mycapacity), myreserved(orig.myreserved){ + LIBJSON_COPY_CTOR; + } + inline virtual ~jsonChildren_Reserved() json_nothrow { + LIBJSON_DTOR; + }; + inline virtual void shrink() json_nothrow { + JSON_ASSERT(this != 0, JSON_TEXT("Children is null shrink reserved")); + if (json_unlikely(mysize == 0)){ //size is zero, we should completely free the array + libjson_free(array); //free does checks for a null pointer, so don't bother checking + array = 0; + } else if (mysize > myreserved){ + JSON_ASSERT(array != 0, JSON_TEXT("shrinking a null array that is not size 0")); + array = json_realloc(array, mysize); + } + } + + #ifdef JSON_LESS_MEMORY + inline static jsonChildren * newChildren_Reserved(jsonChildren * orig, json_index_t siz) json_nothrow { + #ifdef JSON_MEMORY_CALLBACKS + return new(json_malloc(1)) jsonChildren_Reserved(orig, siz); + #else + return new jsonChildren_Reserved(orig, siz); + #endif + } + #endif + JSON_PRIVATE + jsonChildren_Reserved & operator = (const jsonChildren_Reserved &); + json_index_t myreserved; + }; +#endif + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(pop) + #elif _MSC_VER + #pragma pack(pop, jsonChildren) + #endif +#endif +#endif diff --git a/libjson/_internal/Source/JSONDebug.cpp b/libjson/_internal/Source/JSONDebug.cpp new file mode 100644 index 0000000..c9a166e --- /dev/null +++ b/libjson/_internal/Source/JSONDebug.cpp @@ -0,0 +1,42 @@ +#include "JSONDebug.h" +#ifdef JSON_DEBUG + +#ifdef JSON_STDERROR + #include //need std::cerr +#else + #include "JSONSingleton.h" + //otherwise, use a callback to tell the end user what happened + json_error_callback_t JSONDebug::register_callback(json_error_callback_t callback) json_nothrow { + json_error_callback_t res = JSONSingleton::get(); + JSONSingleton::set(callback); + return res; + } +#endif + +//Something went wrong or an assert failed +void JSONDebug::_JSON_FAIL(const json_string & msg) json_nothrow { + #ifdef JSON_STDERROR //no callback, just use stderror + #ifndef JSON_UNICODE + std::cerr << msg << std::endl; + #else + std::cerr << std::string(msg.begin(), msg.end()) << std::endl; + #endif + #else + if (json_error_callback_t ErrorCallback = JSONSingleton::get()){ //only do anything if the callback is registered + #ifdef JSON_LIBRARY + ErrorCallback(msg.c_str()); + #else + ErrorCallback(msg); + #endif + } + #endif +} + +//asserts that condition is true, more useful than cassert because it lets you keep going +void JSONDebug::_JSON_ASSERT(bool condition, const json_string & msg) json_nothrow { + if (json_unlikely(!condition)){ + _JSON_FAIL(msg); + } +} +#endif + diff --git a/libjson/_internal/Source/JSONDebug.h b/libjson/_internal/Source/JSONDebug.h new file mode 100644 index 0000000..470877e --- /dev/null +++ b/libjson/_internal/Source/JSONDebug.h @@ -0,0 +1,59 @@ +#ifndef LIBJSON_GUARD_DEBUG_H +#define LIBJSON_GUARD_DEBUG_H + +#include "JSONDefs.h" +#include "JSONStats.h" + +#ifdef JSON_DEBUG + #ifdef JSON_SAFE + #define JSON_ASSERT_SAFE(condition, msg, code)\ + {\ + if (json_unlikely(!(condition))){\ + JSON_FAIL(msg);\ + code\ + }\ + } + #define JSON_FAIL_SAFE(msg, code)\ + {\ + JSON_FAIL(msg);\ + code\ + } + #else + #define JSON_ASSERT_SAFE(condition, msg, code) JSON_ASSERT(condition, msg) + #define JSON_FAIL_SAFE(msg, code) JSON_FAIL(msg) + #endif + + #define JSON_FAIL(msg) JSONDebug::_JSON_FAIL(msg) + #define JSON_ASSERT(bo, msg) JSONDebug::_JSON_ASSERT(bo, msg) + + class JSONDebug { + public: + #ifndef JSON_STDERROR + static json_error_callback_t register_callback(json_error_callback_t callback) json_nothrow json_cold; + #endif + static void _JSON_FAIL(const json_string & msg) json_nothrow json_cold; + static void _JSON_ASSERT(bool condition, const json_string & msg) json_nothrow json_cold; + }; +#else + #ifdef JSON_SAFE + #define JSON_ASSERT_SAFE(condition, msg, code)\ + {\ + if (json_unlikely(!(condition))){\ + code\ + }\ + } + #define JSON_FAIL_SAFE(msg, code)\ + {\ + code\ + } + #else + #define JSON_ASSERT_SAFE(condition, msg, code) + #define JSON_FAIL_SAFE(msg, code) + #endif + + #define JSON_ASSERT(condition, msg) + #define JSON_FAIL(msg) +#endif + +#endif + diff --git a/libjson/_internal/Source/JSONDefs.h b/libjson/_internal/Source/JSONDefs.h new file mode 100644 index 0000000..eb7a918 --- /dev/null +++ b/libjson/_internal/Source/JSONDefs.h @@ -0,0 +1,184 @@ +#ifndef JSONDEFS_H +#define JSONDEFS_H + +/* + Defines all of the types of functions and various other definitions + that are used in C applications, this is very useful if dynamically loading + the library instead of linking. +*/ + +#include "../../JSONOptions.h" +#include "JSONDefs/Unknown_C.h" +#include "JSONDefs/GNU_C.h" +#include "JSONDefs/Visual_C.h" +#include "JSONDefs/Strings_Defs.h" + +#define __LIBJSON_MAJOR__ 7 +#define __LIBJSON_MINOR__ 6 +#define __LIBJSON_PATCH__ 1 +#define __LIBJSON_VERSION__ (__LIBJSON_MAJOR__ * 10000 + __LIBJSON_MINOR__ * 100 + __LIBJSON_PATCH__) + +#define JSON_NULL '\0' +#define JSON_STRING '\1' +#define JSON_NUMBER '\2' +#define JSON_BOOL '\3' +#define JSON_ARRAY '\4' +#define JSON_NODE '\5' + +#ifdef __cplusplus + #if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + #include "JSONAllocator.h" + #else + #define json_allocator std::allocator + #endif + + #ifdef JSON_STRING_HEADER + #include JSON_STRING_HEADER + #else + typedef std::basic_string, json_allocator > json_string; + #endif +#endif +#define JSON_MAP(x, y) std::map, json_allocator > > + +#ifdef JSON_NO_EXCEPTIONS + #define json_throw(x) + #define json_try + #define json_catch(exception, code) +#else + #define json_throw(x) throw(x) + #define json_try try + #define json_catch(exception, code) catch(exception){ code } +#endif + +#ifdef JSON_STRICT + #ifndef JSON_UNICODE + #error, JSON_UNICODE is required for JSON_STRICT + #endif + #ifdef JSON_COMMENTS + #error, JSON_COMMENTS is required to be off for JSON_STRICT + #endif +#endif + +#ifdef JSON_ISO_STRICT + #ifdef JSON_UNICODE + #error, You can not use unicode under ANSI Strict C++ + #endif +#else + #ifdef __GNUC__ + #ifdef __STRICT_ANSI__ + #warning, Using -ansi GCC option, but JSON_ISO_STRICT not on, turning it on for you + #define JSON_ISO_STRICT + #endif + #endif +#endif + + +#ifdef JSON_NUMBER_TYPE + typedef JSON_NUMBER_TYPE json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001 +#else + #ifdef JSON_LESS_MEMORY + typedef float json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001f + #else + typedef double json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001 + #endif +#endif + + +#ifdef JSON_LESS_MEMORY + /* PACKED and BITS stored in compiler specific headers */ + #define START_MEM_SCOPE { + #define END_MEM_SCOPE } +#else + #define PACKED(x) + #define BITS(x) + #define START_MEM_SCOPE + #define END_MEM_SCOPE +#endif + +#if defined JSON_DEBUG || defined JSON_SAFE + #ifdef JSON_LIBRARY + typedef void (*json_error_callback_t)(const json_char *); + #else + typedef void (*json_error_callback_t)(const json_string &); + #endif +#endif + +#ifdef JSON_INDEX_TYPE + typedef JSON_INDEX_TYPE json_index_t; +#else + typedef unsigned int json_index_t; +#endif + +#ifdef JSON_BOOL_TYPE + typedef JSON_BOOL_TYPE json_bool_t; +#else + typedef int json_bool_t; +#endif + +#ifdef JSON_INT_TYPE + typedef JSON_INT_TYPE json_int_t; +#else + typedef long json_int_t; +#endif + +#define JSONSTREAM_SELF (void*)-1 +typedef void (*json_stream_e_callback_t)(void * identifier); + +typedef void (*json_mutex_callback_t)(void *); +typedef void (*json_free_t)(void *); +#ifndef JSON_LIBRARY + typedef void * (*json_malloc_t)(size_t); + typedef void * (*json_realloc_t)(void *, size_t); +#else + #define JSONNODE void /* so that JSONNODE* is void* */ + typedef JSONNODE** JSONNODE_ITERATOR; + #ifdef JSON_STREAM + #define JSONSTREAM void + typedef void (*json_stream_callback_t)(JSONNODE *, void * identifier); + #endif + typedef void * (*json_malloc_t)(unsigned long); + typedef void * (*json_realloc_t)(void *, unsigned long); +#endif + +#ifdef JSON_DEBUG + #ifdef NDEBUG + #ifdef __GNUC__ + #warning, Have JSON_DEBUG on in a release build + #else + #error, Have JSON_DEBUG on in a release build + #endif + #endif +#else + #ifndef NDEBUG + #ifdef __GNUC__ + #warning, Release build of libjson, but NDEBUG is not on + #else + #error, Release build of libjson, but NDEBUG is not on + #endif + #endif +#endif + +#ifdef JSON_UNIT_TEST + #define JSON_PRIVATE public: + #define JSON_PROTECTED public: +#else + #define JSON_PRIVATE private: + #define JSON_PROTECTED protected: +#endif +#ifdef JSON_STREAM + #ifndef JSON_READ_PRIORITY + #error, JSON_STREAM also requires JSON_READ_PRIORITY + #endif +#endif +#ifdef JSON_VALIDATE + #ifndef JSON_READ_PRIORITY + #error, JSON_VALIDATE also requires JSON_READ_PRIORITY + #endif +#endif + +#define JSON_TEMP_COMMENT_IDENTIFIER JSON_TEXT('#') + +#endif diff --git a/libjson/_internal/Source/JSONDefs.h~ b/libjson/_internal/Source/JSONDefs.h~ new file mode 100644 index 0000000..3a68fad --- /dev/null +++ b/libjson/_internal/Source/JSONDefs.h~ @@ -0,0 +1,184 @@ +#ifndef JSONDEFS_H +#define JSONDEFS_H + +/* + Defines all of the types of functions and various other definitions + that are used in C applications, this is very useful if dynamically loading + the library instead of linking. +*/ + +#include "../../JSONOptions.h" +#include "JSONDefs/Unknown_C.h" +#include "JSONDefs/GNU_C.h" +#include "JSONDefs/Visual_C.h" +#include "JSONDefs/Strings_Defs.h" + +#define __LIBJSON_MAJOR__ 7 +#define __LIBJSON_MINOR__ 6 +#define __LIBJSON_PATCH__ 0 +#define __LIBJSON_VERSION__ (__LIBJSON_MAJOR__ * 10000 + __LIBJSON_MINOR__ * 100 + __LIBJSON_PATCH__) + +#define JSON_NULL '\0' +#define JSON_STRING '\1' +#define JSON_NUMBER '\2' +#define JSON_BOOL '\3' +#define JSON_ARRAY '\4' +#define JSON_NODE '\5' + +#ifdef __cplusplus + #if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + #include "JSONAllocator.h" + #else + #define json_allocator std::allocator + #endif + + #ifdef JSON_STRING_HEADER + #include JSON_STRING_HEADER + #else + typedef std::basic_string, json_allocator > json_string; + #endif +#endif +#define JSON_MAP(x, y) std::map, json_allocator > > + +#ifdef JSON_NO_EXCEPTIONS + #define json_throw(x) + #define json_try + #define json_catch(exception, code) +#else + #define json_throw(x) throw(x) + #define json_try try + #define json_catch(exception, code) catch(exception){ code } +#endif + +#ifdef JSON_STRICT + #ifndef JSON_UNICODE + #error, JSON_UNICODE is required for JSON_STRICT + #endif + #ifdef JSON_COMMENTS + #error, JSON_COMMENTS is required to be off for JSON_STRICT + #endif +#endif + +#ifdef JSON_ISO_STRICT + #ifdef JSON_UNICODE + #error, You can not use unicode under ANSI Strict C++ + #endif +#else + #ifdef __GNUC__ + #ifdef __STRICT_ANSI__ + #warning, Using -ansi GCC option, but JSON_ISO_STRICT not on, turning it on for you + #define JSON_ISO_STRICT + #endif + #endif +#endif + + +#ifdef JSON_NUMBER_TYPE + typedef JSON_NUMBER_TYPE json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001 +#else + #ifdef JSON_LESS_MEMORY + typedef float json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001f + #else + typedef double json_number; + #define JSON_FLOAT_THRESHHOLD 0.00001 + #endif +#endif + + +#ifdef JSON_LESS_MEMORY + /* PACKED and BITS stored in compiler specific headers */ + #define START_MEM_SCOPE { + #define END_MEM_SCOPE } +#else + #define PACKED(x) + #define BITS(x) + #define START_MEM_SCOPE + #define END_MEM_SCOPE +#endif + +#if defined JSON_DEBUG || defined JSON_SAFE + #ifdef JSON_LIBRARY + typedef void (*json_error_callback_t)(const json_char *); + #else + typedef void (*json_error_callback_t)(const json_string &); + #endif +#endif + +#ifdef JSON_INDEX_TYPE + typedef JSON_INDEX_TYPE json_index_t; +#else + typedef unsigned int json_index_t; +#endif + +#ifdef JSON_BOOL_TYPE + typedef JSON_BOOL_TYPE json_bool_t; +#else + typedef int json_bool_t; +#endif + +#ifdef JSON_INT_TYPE + typedef JSON_INT_TYPE json_int_t; +#else + typedef long json_int_t; +#endif + +#define JSONSTREAM_SELF (void*)-1 +typedef void (*json_stream_e_callback_t)(void * identifier); + +typedef void (*json_mutex_callback_t)(void *); +typedef void (*json_free_t)(void *); +#ifndef JSON_LIBRARY + typedef void * (*json_malloc_t)(size_t); + typedef void * (*json_realloc_t)(void *, size_t); +#else + #define JSONNODE void /* so that JSONNODE* is void* */ + typedef JSONNODE** JSONNODE_ITERATOR; + #ifdef JSON_STREAM + #define JSONSTREAM void + typedef void (*json_stream_callback_t)(JSONNODE *, void * identifier); + #endif + typedef void * (*json_malloc_t)(unsigned long); + typedef void * (*json_realloc_t)(void *, unsigned long); +#endif + +#ifdef JSON_DEBUG + #ifdef NDEBUG + #ifdef __GNUC__ + #warning, Have JSON_DEBUG on in a release build + #else + #error, Have JSON_DEBUG on in a release build + #endif + #endif +#else + #ifndef NDEBUG + #ifdef __GNUC__ + #warning, Release build of libjson, but NDEBUG is not on + #else + #error, Release build of libjson, but NDEBUG is not on + #endif + #endif +#endif + +#ifdef JSON_UNIT_TEST + #define JSON_PRIVATE public: + #define JSON_PROTECTED public: +#else + #define JSON_PRIVATE private: + #define JSON_PROTECTED protected: +#endif +#ifdef JSON_STREAM + #ifndef JSON_READ_PRIORITY + #error, JSON_STREAM also requires JSON_READ_PRIORITY + #endif +#endif +#ifdef JSON_VALIDATE + #ifndef JSON_READ_PRIORITY + #error, JSON_VALIDATE also requires JSON_READ_PRIORITY + #endif +#endif + +#define JSON_TEMP_COMMENT_IDENTIFIER JSON_TEXT('#') + +#endif diff --git a/libjson/_internal/Source/JSONDefs/._GNU_C.h b/libjson/_internal/Source/JSONDefs/._GNU_C.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/JSONDefs/._GNU_C.h differ diff --git a/libjson/_internal/Source/JSONDefs/._Strings_Defs.h b/libjson/_internal/Source/JSONDefs/._Strings_Defs.h new file mode 100644 index 0000000..a322a67 Binary files /dev/null and b/libjson/_internal/Source/JSONDefs/._Strings_Defs.h differ diff --git a/libjson/_internal/Source/JSONDefs/._Unknown_C.h b/libjson/_internal/Source/JSONDefs/._Unknown_C.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/JSONDefs/._Unknown_C.h differ diff --git a/libjson/_internal/Source/JSONDefs/._Visual_C.h b/libjson/_internal/Source/JSONDefs/._Visual_C.h new file mode 100644 index 0000000..b261334 Binary files /dev/null and b/libjson/_internal/Source/JSONDefs/._Visual_C.h differ diff --git a/libjson/_internal/Source/JSONDefs/GNU_C.h b/libjson/_internal/Source/JSONDefs/GNU_C.h new file mode 100644 index 0000000..252fa03 --- /dev/null +++ b/libjson/_internal/Source/JSONDefs/GNU_C.h @@ -0,0 +1,67 @@ +#ifndef JSON_GNU_C_HEADER +#define JSON_GUN_C_HEADER + +#ifdef __GNUC__ + + #define json_deprecated(method, warning) method __attribute__((deprecated)) + + #if (__GNUC__ >= 3) + #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + #else + #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) + #endif + + #if (JSON_GCC_VERSION >= 40300) + #define json_hot __attribute__ ((hot)) + #define json_cold __attribute__ ((cold)) + #define json_pure json_nothrow __attribute__ ((pure, hot)) + #define json_malloc_attr json_nothrow __attribute__ ((malloc, hot)) + + /* Can do priorities */ + #if (JSON_WRITE_PRIORITY == HIGH) + #define json_write_priority __attribute__ ((hot)) + #elif (JSON_WRITE_PRIORITY == LOW) + #define json_write_priority __attribute__ ((cold)) + #else + #define json_write_priority + #endif + + #if (JSON_READ_PRIORITY == HIGH) + #define json_read_priority __attribute__ ((hot)) + #elif (JSON_READ_PRIORITY == LOW) + #define json_read_priority __attribute__ ((cold)) + #else + #define json_read_priority + #endif + + #define json_likely(x) __builtin_expect((long)((bool)(x)),1) + #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0) + #else + #if (JSON_GCC_VERSION >= 29600) + #define json_pure json_nothrow __attribute__ ((pure)) + #define json_likely(x) __builtin_expect((long)((bool)(x)),1) + #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0) + #else + #define json_pure json_nothrow + #define json_likely(x) x + #define json_unlikely(x) x + #endif + + #define json_malloc_attr json_nothrow __attribute__ ((malloc)) + #define json_write_priority + #define json_read_priority + #define json_hot + #define json_cold + #endif + + #define json_nothrow throw() + #define json_throws(x) throw(x) + + #ifdef JSON_LESS_MEMORY + #define PACKED(x) :x __attribute__ ((packed)) + #define BITS(x) :x + #endif + +#endif + +#endif diff --git a/libjson/_internal/Source/JSONDefs/Strings_Defs.h b/libjson/_internal/Source/JSONDefs/Strings_Defs.h new file mode 100644 index 0000000..c9bca17 --- /dev/null +++ b/libjson/_internal/Source/JSONDefs/Strings_Defs.h @@ -0,0 +1,36 @@ +#ifndef STRINGS_DEFS_HEADER +#define STRINGS_DEFS_HEADER + +#include "../../../JSONOptions.h" + +#ifdef JSON_UNICODE + #define json_char wchar_t + #define json_uchar wchar_t + #ifdef __cplusplus + #include /* need wide characters */ + #ifndef JSON_STRING_HEADER + #include + #endif + #else + #include /* need wide characters */ + #endif + #define JSON_TEXT(s) L ## s + #define json_strlen wcslen + #define json_strcmp wcscmp +#else + #define json_char char + #define json_uchar unsigned char + #ifdef __cplusplus + #ifndef JSON_STRING_HEADER + #include + #endif + #else + #include /* still need it for strlen and such */ + #endif + #define JSON_TEXT(s) s + #define json_strlen strlen + #define json_strcmp strcmp +#endif + + +#endif diff --git a/libjson/_internal/Source/JSONDefs/Unknown_C.h b/libjson/_internal/Source/JSONDefs/Unknown_C.h new file mode 100644 index 0000000..64c4a72 --- /dev/null +++ b/libjson/_internal/Source/JSONDefs/Unknown_C.h @@ -0,0 +1,26 @@ +#ifndef JSON_UNKNOWN_C_HEADER +#define JSON_UNKNOWN_C_HEADER + +#if !defined(__GNUC__) && !defined(_MSC_VER) + + #define json_deprecated(method, warning) method + + #define json_nothrow + #define json_throws(x) + #define json_pure json_nothrow + #define json_read_priority + #define json_write_priority + #define json_malloc_attr json_nothrow + #define json_hot + #define json_cold + #define json_likely(x) x + #define json_unlikely(x) x + + #ifdef JSON_LESS_MEMORY + #define PACKED(x) :x + #define BITS(x) :x + #endif + +#endif + +#endif diff --git a/libjson/_internal/Source/JSONDefs/Visual_C.h b/libjson/_internal/Source/JSONDefs/Visual_C.h new file mode 100644 index 0000000..f208ae8 --- /dev/null +++ b/libjson/_internal/Source/JSONDefs/Visual_C.h @@ -0,0 +1,26 @@ +#ifndef JSON_VISUAL_C_HEADER +#define JSON_VISUAL_C_HEADER + +#ifdef _MSC_VER + + #define json_deprecated(method, warning) __declspec(deprecated(warning)) method + + #define json_nothrow + #define json_throws(x) + #define json_pure json_nothrow + #define json_read_priority + #define json_write_priority + #define json_malloc_attr json_nothrow + #define json_hot + #define json_cold + #define json_likely(x) x + #define json_unlikely(x) x + + #ifdef JSON_LESS_MEMORY + #define PACKED(x) :x + #define BITS(x) :x + #endif + +#endif + +#endif diff --git a/libjson/_internal/Source/JSONGlobals.h b/libjson/_internal/Source/JSONGlobals.h new file mode 100644 index 0000000..ace181a --- /dev/null +++ b/libjson/_internal/Source/JSONGlobals.h @@ -0,0 +1,95 @@ +#ifndef JSON_GLOBALS_H +#define JSON_GLOBALS_H + +#include "JSONDefs.h" + +/* + * The use of singletons for globals makes globals not + * actually be initialized until it is first needed, this + * makes the library faster to load, and have a smaller + * memory footprint + */ + +#define json_global_decl(TYPE, NAME, VALUE) \ +class jsonSingleton ## NAME { \ +public: \ + inline static TYPE & getValue() json_nothrow { \ + static jsonSingleton ## NAME single; \ + return single.val; \ + } \ +protected: \ + inline jsonSingleton ## NAME() json_nothrow : val(VALUE) {} \ + TYPE val; \ +} + +#define json_global_decl_strconfig(TYPE, NAME, VALUE) \ +class jsonSingleton ## NAME { \ +public: \ + inline static TYPE & getValue() json_nothrow { \ + static jsonSingleton ## NAME single; \ + return single.val; \ + } \ +protected: \ + inline jsonSingleton ## NAME() json_nothrow { \ + const std::string tmp = std::string(VALUE); \ + val = json_string(tmp.begin(), tmp.end()); \ + } \ + TYPE val; \ +} + +#define json_global(NAME) jsonSingleton ## NAME::getValue() + +#include +json_global_decl(json_string, EMPTY_JSON_STRING, ); +json_global_decl(std::string, EMPTY_STD_STRING, ); + +json_global_decl(json_string, CONST_TRUE, JSON_TEXT("true")); +json_global_decl(json_string, CONST_FALSE, JSON_TEXT("false")); +json_global_decl(json_string, CONST_NULL, JSON_TEXT("null")); + +#ifndef JSON_NEWLINE + json_global_decl(json_string, NEW_LINE, JSON_TEXT("\n")); +#else + json_global_decl_strconfig(json_string, NEW_LINE, JSON_NEWLINE); +#endif + +#ifdef JSON_WRITE_BASH_COMMENTS + json_global_decl(json_string, SINGLELINE_COMMENT, JSON_TEXT("#")); +#else + json_global_decl(json_string, SINGLELINE_COMMENT, JSON_TEXT("//")); +#endif + +#ifdef JSON_INDENT + json_global_decl_strconfig(json_string, INDENT, JSON_INDENT); +#endif + +#ifdef JSON_MUTEX_CALLBACKS + #include + json_global_decl(JSON_MAP(void *, unsigned int), MUTEX_MANAGER, ); + json_global_decl(JSON_MAP(int, JSON_MAP(void *, unsigned int) ), THREAD_LOCKS, ); +#endif + +#ifdef JSON_LIBRARY + #ifdef JSON_MEMORY_MANAGE + #include "JSONMemory.h" + json_global_decl(auto_expand, STRING_HANDLER, ); + json_global_decl(auto_expand_node, NODE_HANDLER, ); + #ifdef JSON_STREAM + json_global_decl(auto_expand_stream, STREAM_HANDLER, ); + #endif + #endif +#endif + +//These are common error responses +json_global_decl(json_string, ERROR_TOO_LONG, JSON_TEXT("Exceeding JSON_SECURITY_MAX_STRING_LENGTH")); +json_global_decl(json_string, ERROR_UNKNOWN_LITERAL, JSON_TEXT("Unknown JSON literal: ")); +json_global_decl(json_string, ERROR_NON_CONTAINER, JSON_TEXT("Calling container method on non-container: ")); +json_global_decl(json_string, ERROR_NON_ITERATABLE, JSON_TEXT("Calling iterator method on non-iteratable: ")); +json_global_decl(json_string, ERROR_NULL_IN_CHILDREN, JSON_TEXT("a null pointer within the children")); +json_global_decl(json_string, ERROR_UNDEFINED, JSON_TEXT("Undefined results: ")); +json_global_decl(json_string, ERROR_LOWER_RANGE, JSON_TEXT(" is outside the lower range of ")); +json_global_decl(json_string, ERROR_UPPER_RANGE, JSON_TEXT(" is outside the upper range of ")); +json_global_decl(json_string, ERROR_NOT_BASE64, JSON_TEXT("Not base64")); +json_global_decl(json_string, ERROR_OUT_OF_MEMORY, JSON_TEXT("Out of memory")); + +#endif diff --git a/libjson/_internal/Source/JSONIterators.cpp b/libjson/_internal/Source/JSONIterators.cpp new file mode 100644 index 0000000..28904bc --- /dev/null +++ b/libjson/_internal/Source/JSONIterators.cpp @@ -0,0 +1,214 @@ +#include "JSONNode.h" + +#ifdef JSON_ITERATORS + #ifdef JSON_REF_COUNT + #define JSON_ASSERT_UNIQUE(x) JSON_ASSERT(internal -> refcount == 1, json_string(JSON_TEXT(x)) + JSON_TEXT(" in non single reference")) + #else + #define JSON_ASSERT_UNIQUE(x) (void)0 + #endif + + #ifdef JSON_MUTEX_CALLBACKS + #define JSON_MUTEX_COPY2 ,internal -> mylock + #else + #define JSON_MUTEX_COPY2 + #endif + +JSONNode::json_iterator JSONNode::find(const json_string & name_t) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("find")); + makeUniqueInternal(); + if (JSONNode ** res = internal -> at(name_t)){ + return ptr_to_json_iterator(res); + } + return end(); +} + +#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode::json_iterator JSONNode::find_nocase(const json_string & name_t) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("find_nocase")); + makeUniqueInternal(); + if (JSONNode ** res = internal -> at_nocase(name_t)){ + return ptr_to_json_iterator(res); + } + return end(); + } +#endif + +JSONNode::json_iterator JSONNode::erase(json_iterator pos) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("erase")); + JSON_ASSERT_UNIQUE("erase 1"); + JSON_ASSERT_SAFE(pos < end(), JSON_TEXT("erase out of range"), return end();); + JSON_ASSERT_SAFE(pos >= begin(), JSON_TEXT("erase out of range"), return begin();); + deleteJSONNode(*(json_iterator_ptr(pos))); + internal -> CHILDREN -> erase(json_iterator_ptr(pos)); + return (empty()) ? end() : pos; +} + +JSONNode::json_iterator JSONNode::erase(json_iterator _start, const json_iterator & _end) json_nothrow { + if (_start == _end) return _start; + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("erase")); + JSON_ASSERT_UNIQUE("erase 3"); + JSON_ASSERT_SAFE(_start <= end(), JSON_TEXT("erase out of lo range"), return end();); + JSON_ASSERT_SAFE(_end <= end(), JSON_TEXT("erase out of hi range"), return end();); + JSON_ASSERT_SAFE(_start >= begin(), JSON_TEXT("erase out of lo range"), return begin();); + JSON_ASSERT_SAFE(_end >= begin(), JSON_TEXT("erase out of hi range"), return begin();); + for (JSONNode ** pos = json_iterator_ptr(_start); pos < json_iterator_ptr(_end); ++pos){ + deleteJSONNode(*pos); + } + + internal -> CHILDREN -> erase(json_iterator_ptr(_start), (json_index_t)(json_iterator_ptr(_end) - json_iterator_ptr(_start))); + return (empty()) ? end() : _start; +} + +#ifdef JSON_LIBRARY +JSONNode::json_iterator JSONNode::insert(json_iterator pos, JSONNode * x) json_nothrow { +#else +JSONNode::json_iterator JSONNode::insert(json_iterator pos, const JSONNode & x) json_nothrow { +#endif + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insert")); + JSON_ASSERT_UNIQUE("insert 1"); + if (json_iterator_ptr(pos) >= internal -> CHILDREN -> end()){ + internal -> push_back(x); + return end() - 1; + } + JSON_ASSERT_SAFE(pos >= begin(), JSON_TEXT("insert out of lo range"), return begin();); + #ifdef JSON_LIBRARY + internal -> CHILDREN -> insert(json_iterator_ptr(pos), x); + #else + internal -> CHILDREN -> insert(json_iterator_ptr(pos), newJSONNode(x)); + #endif + return pos; +} + +JSONNode::json_iterator JSONNode::insertFFF(json_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insertFFF")); + JSON_ASSERT_UNIQUE("insertFFF"); + JSON_ASSERT_SAFE(pos <= end(), JSON_TEXT("insert out of high range"), return end();); + JSON_ASSERT_SAFE(pos >= begin(), JSON_TEXT("insert out of low range"), return begin();); + const json_index_t num = (json_index_t)(_end - _start); + json_auto mem(num); + JSONNode ** runner = mem.ptr; + for (JSONNode ** po = _start; po < _end; ++po){ + *runner++ = newJSONNode(*(*po) JSON_MUTEX_COPY2); + } + internal -> CHILDREN -> insert(json_iterator_ptr(pos), mem.ptr, num); + return pos; +} + +#ifndef JSON_LIBRARY + JSONNode::const_iterator JSONNode::find(const json_string & name_t) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("find")); + if (JSONNode ** res = internal -> at(name_t)){ + return JSONNode::const_iterator(res); + } + return JSONNode::const_iterator(internal -> end()); + } + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode::const_iterator JSONNode::find_nocase(const json_string & name_t) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("find_nocase")); + if (JSONNode ** res = internal -> at_nocase(name_t)){ + return JSONNode::const_iterator(res); + } + return JSONNode::const_iterator(internal -> end()); + } + #endif + + JSONNode::reverse_iterator JSONNode::erase(reverse_iterator pos) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("erase")); + JSON_ASSERT_UNIQUE("erase 2"); + JSON_ASSERT_SAFE(pos < rend(), JSON_TEXT("erase out of range"), return rend();); + JSON_ASSERT_SAFE(pos >= rbegin(), JSON_TEXT("erase out of range"), return rbegin();); + deleteJSONNode(*(pos.it)); + internal -> CHILDREN -> erase(pos.it); + return (empty()) ? rend() : pos + 1; + } + + JSONNode::reverse_iterator JSONNode::erase(reverse_iterator _start, const reverse_iterator & _end) json_nothrow { + if (_start == _end) return _start; + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("erase")); + JSON_ASSERT_UNIQUE("erase 4"); + JSON_ASSERT_SAFE(_start <= rend(), JSON_TEXT("erase out of lo range"), return rend();); + JSON_ASSERT_SAFE(_end <= rend(), JSON_TEXT("erase out of hi range"), return rend();); + JSON_ASSERT_SAFE(_start >= rbegin(), JSON_TEXT("erase out of lo range"), return rbegin();); + JSON_ASSERT_SAFE(_end >= rbegin(), JSON_TEXT("erase out of hi range"), return rbegin();); + for (JSONNode ** pos = _start.it; pos > _end.it; --pos){ + deleteJSONNode(*pos); + } + const json_index_t num = (json_index_t)(_start.it - _end.it); + internal -> CHILDREN -> erase(_end.it + 1, num, _start.it); + return (empty()) ? rend() : _start + num; + } + + JSONNode::reverse_iterator JSONNode::insert(reverse_iterator pos, const JSONNode & x) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insert")); + JSON_ASSERT_UNIQUE("insert 1"); + if (pos.it < internal -> CHILDREN -> begin()){ + internal -> push_front(x); + return rend() - 1; + } + JSON_ASSERT_SAFE(pos >= rbegin(), JSON_TEXT("insert out of range"), return rbegin();); + internal -> CHILDREN -> insert(++pos.it, newJSONNode(x), true); + return pos; + } + + JSONNode::reverse_iterator JSONNode::insertRFF(reverse_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insertRFF")); + JSON_ASSERT_UNIQUE("insert RFF"); + JSON_ASSERT_SAFE(pos <= rend(), JSON_TEXT("insert out of range"), return rend();); + JSON_ASSERT_SAFE(pos >= rbegin(), JSON_TEXT("insert out of range"), return rbegin();); + const json_index_t num = (json_index_t)(_end - _start); + json_auto mem(num); + JSONNode ** runner = mem.ptr + num; + for (JSONNode ** po = _start; po < _end; ++po){ //fill it backwards + *(--runner) = newJSONNode(*(*po) JSON_MUTEX_COPY2); + } + internal -> CHILDREN -> insert(++pos.it, mem.ptr, num); + return pos - num + 1; + } + + JSONNode::iterator JSONNode::insertFRR(json_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insertFRR")); + JSON_ASSERT_UNIQUE("insert FRR"); + JSON_ASSERT_SAFE(pos <= end(), JSON_TEXT("insert out of range"), return end();); + JSON_ASSERT_SAFE(pos >= begin(), JSON_TEXT("insert out of range"), return begin();); + const json_index_t num = (json_index_t)(_start - _end); + json_auto mem(num); + JSONNode ** runner = mem.ptr; + for (JSONNode ** po = _start; po > _end; --po){ + *runner++ = newJSONNode(*(*po) JSON_MUTEX_COPY2); + } + internal -> CHILDREN -> insert(pos.it, mem.ptr, num); + return pos; + } + + JSONNode::reverse_iterator JSONNode::insertRRR(reverse_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("insertRRR")); + JSON_ASSERT_UNIQUE("insert RRR"); + JSON_ASSERT_SAFE(pos <= rend(), JSON_TEXT("insert out of range"), return rend();); + JSON_ASSERT_SAFE(pos >= rbegin(), JSON_TEXT("insert out of range"), return rbegin();); + const json_index_t num = (json_index_t)(_start - _end); + json_auto mem(num); + JSONNode ** runner = mem.ptr; + for (JSONNode ** po = _start; po > _end; --po){ + *runner++ = newJSONNode(*(*po) JSON_MUTEX_COPY2); + } + internal -> CHILDREN -> insert(++pos.it, mem.ptr, num); + return pos - num + 1; + } +#endif + +#endif diff --git a/libjson/_internal/Source/JSONMemory.cpp b/libjson/_internal/Source/JSONMemory.cpp new file mode 100644 index 0000000..74ed459 --- /dev/null +++ b/libjson/_internal/Source/JSONMemory.cpp @@ -0,0 +1,149 @@ +#include "JSONMemory.h" + +#ifdef JSON_MEMORY_MANAGE + #include "JSONNode.h" + void auto_expand::purge(void) json_nothrow { + for(JSON_MAP(void *, void *)::iterator i = mymap.begin(), en = mymap.end(); i != en; ++i){ + #if defined(JSON_DEBUG) || defined(JSON_SAFE) + void * temp = (void*)i -> first; //because its pass by reference + libjson_free(temp); + #else + libjson_free((void*)i -> first); + #endif + } + } + + void auto_expand_node::purge(void) json_nothrow { + for(JSON_MAP(void *, JSONNode *)::iterator i = mymap.begin(), en = mymap.end(); i != en; ++i){ + JSONNode::deleteJSONNode((JSONNode *)i -> second); + } + } + + #ifdef JSON_STREAM + #include "JSONStream.h" + void auto_expand_stream::purge(void) json_nothrow { + for(JSON_MAP(void *, JSONStream *)::iterator i = mymap.begin(), en = mymap.end(); i != en; ++i){ + JSONStream::deleteJSONStream((JSONStream *)i -> second); + } + } + #endif +#endif + +#if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + +#ifdef JSON_MEMORY_POOL + #include "JSONMemoryPool.h" + static bucket_pool_8 json_generic_mempool; + + //This class is only meant to initiate the mempool to start out using std::malloc/realloc/free + class mempool_callback_setter { + public: + LIBJSON_OBJECT(mempool_callback_setter); + inline mempool_callback_setter(void) json_nothrow { + ` LIBJSON_CTOR; + mempool_callbacks::set(std::malloc, std::realloc, std::free); + } + private: + inline mempool_callback_setter(const mempool_callback_setter & o); + inline mempool_callback_setter & operator = (const mempool_callback_setter & o); + }; + static mempool_callback_setter __mempoolcallbacksetter; +#endif + +#include "JSONSingleton.h" + +void * JSONMemory::json_malloc(size_t siz) json_nothrow { + #ifdef JSON_MEMORY_POOL + return json_generic_mempool.allocate(siz); + #else + if (json_malloc_t callback = JSONSingleton::get()){ + #if(defined(JSON_DEBUG) && (!defined(JSON_MEMORY_CALLBACKS))) //in debug mode without mem callback, see if the malloc was successful + void * result = callback(siz); + JSON_ASSERT(result, JSON_TEXT("Out of memory")); + return result; + #else + return callback(siz); + #endif + } + #if(defined(JSON_DEBUG) && (!defined(JSON_MEMORY_CALLBACKS))) //in debug mode without mem callback, see if the malloc was successful + void * result = std::malloc(siz); + JSON_ASSERT(result, JSON_TEXT("Out of memory")); + return result; + #else + return std::malloc(siz); + #endif + #endif +} + +void JSONMemory::json_free(void * ptr) json_nothrow { + #ifdef JSON_MEMORY_POOL + json_generic_mempool.deallocate(ptr); + #else + if (json_free_t callback = JSONSingleton::get()){ + callback(ptr); + } else { + std::free(ptr); + } + #endif +} + +void * JSONMemory::json_realloc(void * ptr, size_t siz) json_nothrow { + #ifdef JSON_MEMORY_POOL + return json_generic_mempool.reallocate(ptr, siz); + #else + if (json_realloc_t callback = JSONSingleton::get()){ + #if(defined(JSON_DEBUG) && (!defined(JSON_MEMORY_CALLBACKS))) //in debug mode without mem callback, see if the malloc was successful + void * result = callback(ptr, siz); + JSON_ASSERT(result, JSON_TEXT("Out of memory")); + return result; + #else + return callback(ptr, siz); + #endif + } + #if(defined(JSON_DEBUG) && (!defined(JSON_MEMORY_CALLBACKS))) //in debug mode without mem callback, see if the malloc was successful + void * result = std::realloc(ptr, siz); + JSON_ASSERT(result, JSON_TEXT("Out of memory")); + return result; + #else + return std::realloc(ptr, siz); + #endif + #endif +} + +#ifdef JSON_MEMORY_POOL + //it is okay to pass null to these callbacks, no make sure they function exists + static void * malloc_proxy(size_t siz) json_nothrow { + if (json_malloc_t callback = JSONSingleton::get()){ + return callback(siz); + } + return std::malloc(siz); + } + + static void * realloc_proxy(void * ptr, size_t siz) json_nothrow { + if (json_realloc_t callback = JSONSingleton::get()){ + return callback(ptr, siz); + } + return std::realloc(ptr, siz); + } + + static void free_proxy(void * ptr){ + if (json_free_t callback = JSONSingleton::get()){ + callback(ptr); + } else { + std::free(ptr); + } + } +#endif + + +void JSONMemory::registerMemoryCallbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre) json_nothrow { + JSONSingleton::set(mal); + JSONSingleton::set(real); + JSONSingleton::set(fre); + #ifdef JSON_MEMORY_POOL + mempool_callbacks::set(malloc_proxy, realloc_proxy, free_proxy); + #endif +} + + +#endif diff --git a/libjson/_internal/Source/JSONMemory.h b/libjson/_internal/Source/JSONMemory.h new file mode 100644 index 0000000..fd3afdb --- /dev/null +++ b/libjson/_internal/Source/JSONMemory.h @@ -0,0 +1,175 @@ +#ifndef JSON_MEMORY_H +#define JSON_MEMORY_H + +#include //for malloc, realloc, and free +#include //for memmove +#include "JSONDebug.h" + +#if defined(JSON_DEBUG) || defined(JSON_SAFE) + #define JSON_FREE_PASSTYPE & +#else + #define JSON_FREE_PASSTYPE +#endif + +#if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + class JSONMemory { + public: + static void * json_malloc(size_t siz) json_malloc_attr; + static void * json_realloc(void * ptr, size_t siz) json_malloc_attr; + static void json_free(void * ptr) json_nothrow; + static void registerMemoryCallbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre) json_nothrow json_cold; + private: + JSONMemory(void); + }; + + template static inline T * json_malloc(size_t count) json_malloc_attr; + template static inline T * json_malloc(size_t count) json_nothrow { + return (T *)JSONMemory::json_malloc(sizeof(T) * count); + } + + template static inline T * json_realloc(T * ptr, size_t count) json_malloc_attr; + template static inline T * json_realloc(T * ptr, size_t count) json_nothrow { + return (T *)JSONMemory::json_realloc(ptr, sizeof(T) * count); + } + + template static inline void libjson_free(T * JSON_FREE_PASSTYPE ptr) json_nothrow { + JSONMemory::json_free(ptr); + #if defined(JSON_DEBUG) || defined(JSON_SAFE) //in debug or safe mode, set the pointer to 0 so that it can't be used again + ptr = 0; + #endif + } +#else + + template static inline T * json_malloc(size_t count) json_malloc_attr; + template static inline T * json_malloc(size_t count) json_nothrow { + #ifdef JSON_DEBUG //in debug mode, see if the malloc was successful + void * result = std::malloc(count * sizeof(T)); + JSON_ASSERT(result != 0, JSON_TEXT("Out of memory")); + #ifdef JSON_NULL_MEMORY + std::memset(result, '\0', count * sizeof(T)); + #endif + return (T *)result; + #else + return (T *)std::malloc(count * sizeof(T)); + #endif + } + + template static inline void libjson_free(T * JSON_FREE_PASSTYPE ptr) json_nothrow { + std::free(ptr); + #if defined(JSON_DEBUG) || defined(JSON_SAFE) //in debug or safe mode, set the pointer to 0 so that it can't be used again + ptr = 0; + #endif + } + + template static inline T * json_realloc(T * ptr, size_t count) json_malloc_attr; + template static inline T * json_realloc(T * ptr, size_t count) json_nothrow { + #ifdef JSON_DEBUG //in debug mode, check the results of realloc to be sure it was successful + void * result = std::realloc(ptr, count * sizeof(T)); + JSON_ASSERT(result != 0, JSON_TEXT("Out of memory")); + return (T *)result; + #else + return (T *)std::realloc(ptr, count * sizeof(T)); + #endif + } +#endif + +#ifdef JSON_MEMORY_MANAGE + #include + class JSONNode; + struct auto_expand { + public: + LIBJSON_OBJECT(auto_expand); + auto_expand(void) json_nothrow : mymap(){ LIBJSON_CTOR;} + ~auto_expand(void) json_nothrow { purge(); LIBJSON_DTOR; } + void purge(void) json_nothrow; + inline void clear(void) json_nothrow { purge(); mymap.clear(); } + inline void * insert(void * ptr) json_nothrow { mymap[ptr] = ptr; return ptr; } + inline void remove(void * ptr) json_nothrow { + JSON_MAP(void *, void *)::iterator i = mymap.find(ptr); + JSON_ASSERT(i != mymap.end(), JSON_TEXT("Removing a non-managed item")); + mymap.erase(i); + } + JSON_MAP(void *, void *) mymap; + private: + auto_expand(const auto_expand &); + auto_expand & operator = (const auto_expand &); + }; + + struct auto_expand_node { + public: + LIBJSON_OBJECT(auto_expand_node); + auto_expand_node(void) json_nothrow : mymap(){ LIBJSON_CTOR; } + ~auto_expand_node(void) json_nothrow { purge(); LIBJSON_DTOR; } + void purge(void) json_nothrow ; + inline void clear(void) json_nothrow { purge(); mymap.clear(); } + inline JSONNode * insert(JSONNode * ptr) json_nothrow { mymap[ptr] = ptr; return ptr; } + inline void remove(void * ptr) json_nothrow { + JSON_MAP(void *, JSONNode *)::iterator i = mymap.find(ptr); + if(json_likely(i != mymap.end())) mymap.erase(i); + } + JSON_MAP(void *, JSONNode *) mymap; + private: + auto_expand_node(const auto_expand_node &); + auto_expand_node & operator = (const auto_expand_node &); + }; + + #ifdef JSON_STREAM + class JSONStream; + struct auto_expand_stream { + public: + LIBJSON_OBJECT(auto_expand_stream); + auto_expand_stream(void) json_nothrow : mymap(){ LIBJSON_CTOR; } + ~auto_expand_stream(void) json_nothrow { purge(); LIBJSON_DTOR; } + void purge(void) json_nothrow ; + inline void clear(void) json_nothrow { purge(); mymap.clear(); } + inline JSONStream * insert(JSONStream * ptr) json_nothrow { mymap[ptr] = ptr; return ptr; } + inline void remove(void * ptr) json_nothrow { + JSON_MAP(void *, JSONStream *)::iterator i = mymap.find(ptr); + if(json_likely(i != mymap.end())) mymap.erase(i); + } + JSON_MAP(void *, JSONStream *) mymap; + private: + auto_expand_stream(const auto_expand_stream &); + auto_expand_stream & operator = (const auto_expand_stream &); + }; + #endif +#endif + +//The C++ way, use an self-deleting pointer and let the optimizer decide when it gets destroyed +template +class json_auto { + public: + LIBJSON_OBJECT(json_auto); + json_auto(void) json_nothrow : ptr(0){ LIBJSON_CTOR; } + json_auto(size_t count) json_nothrow : ptr(json_malloc(count)){ LIBJSON_CTOR; } + json_auto(T * arg) json_nothrow : ptr(arg){ LIBJSON_CTOR; } + ~json_auto(void) json_nothrow { + libjson_free(ptr); + LIBJSON_DTOR; + } + inline void set(T * p) json_nothrow{ + ptr = p; + } + T * ptr; + private: + json_auto(const json_auto &); + json_auto & operator =(const json_auto &); +}; + +//Clears a string, if required, frees the memory +static inline void clearString(json_string & str) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_string().swap(str); + #else + str.clear(); + #endif +} + +//Shrinks a string +static inline void shrinkString(json_string & str) json_nothrow { + #ifdef JSON_LESS_MEMORY + if (str.capacity() != str.length()) str = json_string(str.begin(), str.end()); + #endif +} + +#endif diff --git a/libjson/_internal/Source/JSONMemoryPool.h b/libjson/_internal/Source/JSONMemoryPool.h new file mode 100644 index 0000000..18020a8 --- /dev/null +++ b/libjson/_internal/Source/JSONMemoryPool.h @@ -0,0 +1,38 @@ +#ifndef LIBJSON_GUARD_MEMORY_POOL_H +#define LIBJSON_GUARD_MEMORY_POOL_H + +#ifdef JSON_MEMORY_POOL + +#include "../Dependencies/mempool++/mempool.h" + +//this macro expands to the number of bytes a pool gets based on block size and number of 32s of the total pool it gets +#define jsonPoolPart(bytes_per_block, thirty_seconds_of_mem) bytes_per_block, ((thirty_seconds_of_mem * JSON_MEMORY_POOL / 32) / bytes_per_block) + +#ifdef JSON_PREPARSE + #define NODEPOOL jsonPoolPart(sizeof(JSONNode), 1) + #define INTERNALNODEPOOL jsonPoolPart(sizeof(internalJSONNode), 3) + #define MEMPOOL_1 jsonPoolPart(8, 2) + #define MEMPOOL_2 jsonPoolPart(16, 2) + #define MEMPOOL_3 jsonPoolPart(32, 2) + #define MEMPOOL_4 jsonPoolPart(64, 2) + #define MEMPOOL_5 jsonPoolPart(128, 3) + #define MEMPOOL_6 jsonPoolPart(256, 4) + #define MEMPOOL_7 jsonPoolPart(512, 5) + #define MEMPOOL_8 jsonPoolPart(4096, 8) +#else + #define NODEPOOL jsonPoolPart(sizeof(JSONNode), 2) + #define INTERNALNODEPOOL jsonPoolPart(sizeof(internalJSONNode), 7) + #define MEMPOOL_1 jsonPoolPart(8, 1) + #define MEMPOOL_2 jsonPoolPart(16, 1) + #define MEMPOOL_3 jsonPoolPart(32, 1) + #define MEMPOOL_4 jsonPoolPart(64, 1) + #define MEMPOOL_5 jsonPoolPart(128, 3) + #define MEMPOOL_6 jsonPoolPart(256, 3) + #define MEMPOOL_7 jsonPoolPart(512, 5) + #define MEMPOOL_8 jsonPoolPart(4096, 8) +#endif + +#endif + +#endif + diff --git a/libjson/_internal/Source/JSONNode.cpp b/libjson/_internal/Source/JSONNode.cpp new file mode 100644 index 0000000..e5ee31c --- /dev/null +++ b/libjson/_internal/Source/JSONNode.cpp @@ -0,0 +1,356 @@ +#include "JSONNode.h" + +#define IMPLEMENT_CTOR(type)\ + JSONNode::JSONNode(const json_string & name_t, type value_t) json_nothrow : internal(internalJSONNode::newInternal()){\ + internal -> Set(value_t);\ + internal -> setname(name_t);\ + LIBJSON_CTOR;\ + } +IMPLEMENT_FOR_ALL_TYPES(IMPLEMENT_CTOR) + +#ifndef JSON_LIBRARY + JSONNode::JSONNode(const json_string & name_t, const json_char * value_t) json_nothrow : internal(internalJSONNode::newInternal()){ + internal -> Set(json_string(value_t)); + internal -> setname(name_t); + LIBJSON_CTOR; + } +#endif + +#if (defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)) + #include "JSONWorker.h" + JSONNode JSONNode::stringType(const json_string & str){ + JSONNode res; + res.set_name(json_global(EMPTY_JSON_STRING)); + #ifdef JSON_LESS_MEMORY + res = JSONWorker::FixString(str, res.internal, false); + #else + res = JSONWorker::FixString(str, res.internal -> _string_encoded); + #endif + return res; + } + + void JSONNode::set_name_(const json_string & newname) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_string _newname = JSONWorker::FixString(newname, internal, true); + #else + json_string _newname = JSONWorker::FixString(newname, internal -> _name_encoded); + #endif + set_name(_newname); + } +#endif + +#ifdef JSON_CASTABLE + JSONNode JSONNode::as_node(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + if (type() == JSON_NODE){ + return *this; + } else if (type() == JSON_ARRAY){ + JSONNode res(duplicate()); + res.internal -> _type = JSON_NODE; + return res; + } + #ifdef JSON_MUTEX_CALLBACKS + if (internal -> mylock != 0){ + JSONNode res(JSON_NODE); + res.set_mutex(internal -> mylock); + return res; + } + #endif + return JSONNode(JSON_NODE); + } + + JSONNode JSONNode::as_array(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + if (type() == JSON_ARRAY){ + return *this; + } else if (type() == JSON_NODE){ + JSONNode res(duplicate()); + res.internal -> _type = JSON_ARRAY; + json_foreach(res.internal -> CHILDREN, runner){ + (*runner) -> clear_name(); + } + return res; + } + #ifdef JSON_MUTEX_CALLBACKS + if (internal -> mylock != 0){ + JSONNode res(JSON_ARRAY); + res.set_mutex(internal -> mylock); + return res; + } + #endif + return JSONNode(JSON_ARRAY); + } + + void JSONNode::cast(char newtype) json_nothrow { + JSON_CHECK_INTERNAL(); + if (newtype == type()) return; + + switch(newtype){ + case JSON_NULL: + nullify(); + return; + case JSON_STRING: + *this = as_string(); + return; + case JSON_NUMBER: + *this = as_float(); + return; + case JSON_BOOL: + *this = as_bool(); + return; + case JSON_ARRAY: + *this = as_array(); + return; + case JSON_NODE: + *this = as_node(); + return; + } + JSON_FAIL(JSON_TEXT("cast to unknown type")); + } +#endif + +//different just to supress the warning +#ifdef JSON_REF_COUNT +void JSONNode::merge(JSONNode & other) json_nothrow { +#else +void JSONNode::merge(JSONNode &) json_nothrow { +#endif + JSON_CHECK_INTERNAL(); + #ifdef JSON_REF_COUNT + if (internal == other.internal) return; + JSON_ASSERT(*this == other, JSON_TEXT("merging two nodes that aren't equal")); + if (internal -> refcount < other.internal -> refcount){ + *this = other; + } else { + other = *this; + } + #endif +} + +#ifdef JSON_REF_COUNT + void JSONNode::merge(JSONNode * other) json_nothrow { + JSON_CHECK_INTERNAL(); + if (internal == other -> internal) return; + *other = *this; + } + + //different just to supress the warning + void JSONNode::merge(unsigned int num, ...) json_nothrow { +#else + void JSONNode::merge(unsigned int, ...) json_nothrow { +#endif + JSON_CHECK_INTERNAL(); + #ifdef JSON_REF_COUNT + va_list args; + va_start(args, num); + for(unsigned int i = 0; i < num; ++i){ + merge(va_arg(args, JSONNode*)); + } + va_end(args); + #endif +} + +JSONNode JSONNode::duplicate(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSONNode mycopy(*this); + #ifdef JSON_REF_COUNT + JSON_ASSERT(internal == mycopy.internal, JSON_TEXT("copy ctor failed to ref count correctly")); + mycopy.makeUniqueInternal(); + #endif + JSON_ASSERT(internal != mycopy.internal, JSON_TEXT("makeUniqueInternal failed")); + return mycopy; +} + +JSONNode & JSONNode::at(json_index_t pos) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + if (json_unlikely(pos >= internal -> size())){ + JSON_FAIL(JSON_TEXT("at() out of bounds")); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + } + return (*this)[pos]; +} + +const JSONNode & JSONNode::at(json_index_t pos) const json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + if (json_unlikely(pos >= internal -> size())){ + JSON_FAIL(JSON_TEXT("at() const out of bounds")); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + } + return (*this)[pos]; +} + +JSONNode & JSONNode::operator[](json_index_t pos) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(pos < internal -> size(), JSON_TEXT("[] out of bounds")); + makeUniqueInternal(); + return *(internal -> at(pos)); +} + +const JSONNode & JSONNode::operator[](json_index_t pos) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(pos < internal -> size(), JSON_TEXT("[] const out of bounds")); + return *(internal -> at(pos)); +} + +JSONNode & JSONNode::at(const json_string & name_t) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("at")); + makeUniqueInternal(); + if (JSONNode ** res = internal -> at(name_t)){ + return *(*res); + } + JSON_FAIL(json_string(JSON_TEXT("at could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); +} + +const JSONNode & JSONNode::at(const json_string & name_t) const json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("at")); + if (JSONNode ** res = internal -> at(name_t)){ + return *(*res); + } + JSON_FAIL(json_string(JSON_TEXT("at const could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); +} + +#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode & JSONNode::at_nocase(const json_string & name_t) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("at_nocase")); + makeUniqueInternal(); + if (JSONNode ** res = internal -> at_nocase(name_t)){ + return *(*res); + } + JSON_FAIL(json_string(JSON_TEXT("at_nocase could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + } + + const JSONNode & JSONNode::at_nocase(const json_string & name_t) const json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("at_nocase")); + if (JSONNode ** res = internal -> at_nocase(name_t)){ + return *(*res); + } + JSON_FAIL(json_string(JSON_TEXT("at_nocase const could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + } +#endif + +#ifndef JSON_LIBRARY + struct auto_delete { + public: + auto_delete(JSONNode * node) json_nothrow : mynode(node){}; + ~auto_delete(void) json_nothrow { JSONNode::deleteJSONNode(mynode); }; + JSONNode * mynode; + private: + auto_delete(const auto_delete &); + auto_delete & operator = (const auto_delete &); + }; +#endif + +JSONNode JSON_PTR_LIB JSONNode::pop_back(json_index_t pos) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + if (json_unlikely(pos >= internal -> size())){ + JSON_FAIL(JSON_TEXT("pop_back out of bounds")); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + } + makeUniqueInternal(); + #ifdef JSON_LIBRARY + return internal -> pop_back(pos); + #else + auto_delete temp(internal -> pop_back(pos)); + return *temp.mynode; + #endif +} + +JSONNode JSON_PTR_LIB JSONNode::pop_back(const json_string & name_t) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("pop_back")); + #ifdef JSON_LIBRARY + return internal -> pop_back(name_t); + #else + if (JSONNode * res = internal -> pop_back(name_t)){ + auto_delete temp(res); + return *(temp.mynode); + } + JSON_FAIL(json_string(JSON_TEXT("pop_back const could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + #endif +} + +#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode JSON_PTR_LIB JSONNode::pop_back_nocase(const json_string & name_t) json_throws(std::out_of_range) { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("pop_back_no_case")); + #ifdef JSON_LIBRARY + return internal -> pop_back_nocase(name_t); + #else + if (JSONNode * res = internal -> pop_back_nocase(name_t)){ + auto_delete temp(res); + return *(temp.mynode); + } + JSON_FAIL(json_string(JSON_TEXT("pop_back_nocase could not find child by name: ")) + name_t); + json_throw(std::out_of_range(json_global(EMPTY_STD_STRING))); + #endif + } +#endif + +#ifdef JSON_MEMORY_POOL + #include "JSONMemoryPool.h" + memory_pool json_node_mempool; +#endif + +void JSONNode::deleteJSONNode(JSONNode * ptr) json_nothrow { + #ifdef JSON_MEMORY_POOL + ptr -> ~JSONNode(); + json_node_mempool.deallocate((void*)ptr); + #elif defined(JSON_MEMORY_CALLBACKS) + ptr -> ~JSONNode(); + libjson_free(ptr); + #else + delete ptr; + #endif +} + +inline JSONNode * _newJSONNode(const JSONNode & orig) { + #ifdef JSON_MEMORY_POOL + return new((JSONNode*)json_node_mempool.allocate()) JSONNode(orig); + #elif defined(JSON_MEMORY_CALLBACKS) + return new(json_malloc(1)) JSONNode(orig); + #else + return new JSONNode(orig); + #endif +} + +JSONNode * JSONNode::newJSONNode(const JSONNode & orig JSON_MUTEX_COPY_DECL) { + #ifdef JSON_MUTEX_CALLBACKS + if (parentMutex != 0){ + JSONNode * temp = _newJSONNode(orig); + temp -> set_mutex(parentMutex); + return temp; + } + #endif + return _newJSONNode(orig); +} + +JSONNode * JSONNode::newJSONNode(internalJSONNode * internal_t) { + #ifdef JSON_MEMORY_POOL + return new((JSONNode*)json_node_mempool.allocate()) JSONNode(internal_t); + #elif defined(JSON_MEMORY_CALLBACKS) + return new(json_malloc(1)) JSONNode(internal_t); + #else + return new JSONNode(internal_t); + #endif +} + +JSONNode * JSONNode::newJSONNode_Shallow(const JSONNode & orig) { + #ifdef JSON_MEMORY_POOL + return new((JSONNode*)json_node_mempool.allocate()) JSONNode(true, const_cast(orig)); + #elif defined(JSON_MEMORY_CALLBACKS) + return new(json_malloc(1)) JSONNode(true, const_cast(orig)); + #else + return new JSONNode(true, const_cast(orig)); + #endif +} + + diff --git a/libjson/_internal/Source/JSONNode.h b/libjson/_internal/Source/JSONNode.h new file mode 100644 index 0000000..4ced605 --- /dev/null +++ b/libjson/_internal/Source/JSONNode.h @@ -0,0 +1,985 @@ +#ifndef JSONNODE_H +#define JSONNODE_H + +#include "JSONDebug.h" //for string type +#include "internalJSONNode.h" //internal structure for json value +#include +#include //for the ... parameter + +#ifdef JSON_BINARY + #include "JSON_Base64.h" +#endif + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(push, 1) + #elif _MSC_VER + #pragma pack(push, JSONNode_pack, 1) + #endif +#endif + +#ifndef JSON_REF_COUNT + #define makeUniqueInternal() (void)0 +#endif + +#define JSON_CHECK_INTERNAL() JSON_ASSERT(internal != 0, JSON_TEXT("no internal")) + +#ifdef JSON_MUTEX_CALLBACKS + #define JSON_MUTEX_COPY_DECL ,void * parentMutex + #define JSON_MUTEX_COPY_DECL2 ,void * parentMutex = 0 +#else + #define JSON_MUTEX_COPY_DECL + #define JSON_MUTEX_COPY_DECL2 +#endif + +#ifdef JSON_LIBRARY + #define JSON_PTR_LIB * + #define JSON_NEW(x) JSONNode::newJSONNode_Shallow(x) + + + #define DECLARE_FOR_ALL_TYPES(foo)\ + foo(json_int_t)json_nothrow;\ + foo(json_number) json_nothrow;\ + foo(bool) json_nothrow;\ + foo(const json_string &) json_nothrow; + + #define DECLARE_FOR_ALL_CAST_TYPES_CONST(foo)\ + foo(json_int_t) const json_nothrow;\ + foo(json_number) const json_nothrow;\ + foo(bool) const json_nothrow;\ + foo(const json_string &) const json_nothrow;\ + + #define DECLARE_FOR_ALL_TYPES_CONST(foo)\ + DECLARE_FOR_ALL_CAST_TYPES_CONST(foo)\ + foo(const JSONNode &) const json_nothrow; + + #define IMPLEMENT_FOR_ALL_NUMBERS(foo)\ + foo(json_int_t)\ + foo(json_number) + + +#else + #define JSON_PTR_LIB + #define JSON_NEW(x) x + + #ifdef JSON_ISO_STRICT + #define DECLARE_FOR_LONG_LONG(foo) + #define DECLARE_FOR_LONG_LONG_CONST(foo) + #define IMPLEMENT_FOR_LONG_LONG(foo) + #define DECLARE_FOR_LONG_DOUBLE(foo) + #define DECLARE_FOR_LONG_DOUBLE_CONST(foo) + #define IMPLEMENT_FOR_LONG_DOUBLE(foo) + #else + #define DECLARE_FOR_LONG_LONG(foo) foo(long long) json_nothrow; foo(unsigned long long) json_nothrow; + #define DECLARE_FOR_LONG_LONG_CONST(foo) foo(long long) const json_nothrow; foo(unsigned long long) const json_nothrow; + #define IMPLEMENT_FOR_LONG_LONG(foo) foo(long long) foo(unsigned long long) + #define DECLARE_FOR_LONG_DOUBLE(foo) foo(long double) json_nothrow; + #define DECLARE_FOR_LONG_DOUBLE_CONST(foo) foo(long double) const json_nothrow; + #define IMPLEMENT_FOR_LONG_DOUBLE(foo) foo(long double) + #endif + + #define DECLARE_FOR_ALL_TYPES(foo)\ + foo(char) json_nothrow; foo(unsigned char) json_nothrow;\ + foo(short) json_nothrow; foo(unsigned short) json_nothrow;\ + foo(int) json_nothrow; foo(unsigned int) json_nothrow;\ + foo(long) json_nothrow; foo(unsigned long) json_nothrow;\ + foo(float) json_nothrow; foo(double) json_nothrow;\ + foo(bool) json_nothrow;\ + foo(const json_string &) json_nothrow;\ + foo(const json_char *) json_nothrow;\ + DECLARE_FOR_LONG_LONG(foo)\ + DECLARE_FOR_LONG_DOUBLE(foo) + + #define DECLARE_FOR_ALL_CAST_TYPES_CONST(foo)\ + foo(char) const json_nothrow; foo(unsigned char) const json_nothrow;\ + foo(short) const json_nothrow; foo(unsigned short) const json_nothrow;\ + foo(int) const json_nothrow; foo(unsigned int) const json_nothrow;\ + foo(long) const json_nothrow; foo(unsigned long) const json_nothrow;\ + foo(float) const json_nothrow; foo(double) const json_nothrow;\ + foo(bool) const json_nothrow;\ + foo(const json_string &) const json_nothrow;\ + DECLARE_FOR_LONG_LONG_CONST(foo)\ + DECLARE_FOR_LONG_DOUBLE_CONST(foo) + + #define DECLARE_FOR_ALL_TYPES_CONST(foo)\ + DECLARE_FOR_ALL_CAST_TYPES_CONST(foo)\ + foo(const JSONNode &) const json_nothrow;\ + foo(const json_char *) const json_nothrow; + + #define IMPLEMENT_FOR_ALL_NUMBERS(foo)\ + foo(char) foo(unsigned char)\ + foo(short) foo(unsigned short)\ + foo(int) foo(unsigned int)\ + foo(long) foo(unsigned long)\ + foo(float) foo(double)\ + IMPLEMENT_FOR_LONG_LONG(foo)\ + IMPLEMENT_FOR_LONG_DOUBLE(foo) + +#endif + +#define IMPLEMENT_FOR_ALL_TYPES(foo)\ + IMPLEMENT_FOR_ALL_NUMBERS(foo)\ + foo(const json_string &)\ + foo(bool) + +/* + This class is mostly just a wrapper class around internalJSONNode, this class keeps + the reference count and handles copy on write and such. This class is also responsible + for argument checking and throwing exceptions if needed. +*/ + + +class JSONNode { +public: + LIBJSON_OBJECT(JSONNode); + explicit JSONNode(char mytype = JSON_NODE) json_nothrow json_hot; + #define DECLARE_CTOR(type) explicit JSONNode(const json_string & name_t, type value_t) + DECLARE_FOR_ALL_TYPES(DECLARE_CTOR) + + JSONNode(const JSONNode & orig) json_nothrow json_hot; + ~JSONNode(void) json_nothrow json_hot; + + #if (defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)) + static JSONNode stringType(const json_string & str); + void set_name_(const json_string & newname) json_nothrow json_write_priority; + #endif + + json_index_t size(void) const json_nothrow json_read_priority; + bool empty(void) const json_nothrow json_read_priority; + void clear(void) json_nothrow json_cold; + unsigned char type(void) const json_nothrow json_read_priority; + + json_string name(void) const json_nothrow json_read_priority; + void set_name(const json_string & newname) json_nothrow json_write_priority; + #ifdef JSON_COMMENTS + void set_comment(const json_string & comment) json_nothrow; + json_string get_comment(void) const json_nothrow; + #endif + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void preparse(void) json_nothrow json_read_priority; + #endif + + + json_string as_string(void) const json_nothrow json_read_priority; + json_int_t as_int(void) const json_nothrow json_read_priority; + json_number as_float(void) const json_nothrow json_read_priority; + bool as_bool(void) const json_nothrow json_read_priority; + + #ifdef JSON_CASTABLE + JSONNode as_node(void) const json_nothrow json_read_priority; + JSONNode as_array(void) const json_nothrow json_read_priority; + void cast(char newtype) json_nothrow; + #endif + + #ifdef JSON_BINARY + std::string as_binary(void) const json_nothrow json_cold; + void set_binary(const unsigned char * bin, size_t bytes) json_nothrow json_cold; + #endif + + JSONNode & at(json_index_t pos) json_throws(std::out_of_range); + const JSONNode & at(json_index_t pos) const json_throws(std::out_of_range); + + JSONNode & operator[](json_index_t pos) json_nothrow; + const JSONNode & operator[](json_index_t pos) const json_nothrow; + + JSONNode & at(const json_string & name_t) json_throws(std::out_of_range); + const JSONNode & at(const json_string & name_t) const json_throws(std::out_of_range); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode & at_nocase(const json_string & name_t) json_throws(std::out_of_range); + const JSONNode & at_nocase(const json_string & name_t) const json_throws(std::out_of_range); + #endif + JSONNode & operator[](const json_string & name_t) json_nothrow; + const JSONNode & operator[](const json_string & name_t) const json_nothrow; + + #ifdef JSON_LIBRARY + void push_back(JSONNode * node) json_nothrow; + #else + void push_back(const JSONNode & node) json_nothrow; + #endif + void reserve(json_index_t siz) json_nothrow; + JSONNode JSON_PTR_LIB pop_back(json_index_t pos) json_throws(std::out_of_range); + JSONNode JSON_PTR_LIB pop_back(const json_string & name_t) json_throws(std::out_of_range); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode JSON_PTR_LIB pop_back_nocase(const json_string & name_t) json_throws(std::out_of_range); + #endif + + DECLARE_FOR_ALL_TYPES(JSONNode & operator =) + JSONNode & operator = (const JSONNode &) json_nothrow; + + DECLARE_FOR_ALL_TYPES_CONST(bool operator ==) + DECLARE_FOR_ALL_TYPES_CONST(bool operator !=) + + + void nullify(void) json_nothrow; + void swap(JSONNode & other) json_nothrow; + void merge(JSONNode & other) json_nothrow json_cold; + void merge(unsigned int num, ...) json_nothrow json_cold; + JSONNode duplicate(void) const json_nothrow; + + + //iterator + #ifdef JSON_ITERATORS + #ifndef JSON_LIBRARY + #define json_iterator_ptr(iter) iter.it + #define ptr_to_json_iterator(iter) json_iterator(iter) + + struct iterator; + struct const_iterator { + inline const_iterator& operator ++(void) json_nothrow { ++it; return *this; } + inline const_iterator& operator --(void) json_nothrow { --it; return *this; } + inline const_iterator& operator +=(long i) json_nothrow { it += i; return *this; } + inline const_iterator& operator -=(long i) json_nothrow { it -= i; return *this; } + inline const_iterator operator ++(int) json_nothrow { + const_iterator result(*this); + ++it; + return result; + } + inline const_iterator operator --(int) json_nothrow { + const_iterator result(*this); + --it; + return result; + } + inline const_iterator operator +(long i) const json_nothrow { + const_iterator result(*this); + result.it += i; + return result; + } + inline const_iterator operator -(long i) const json_nothrow { + const_iterator result(*this); + result.it -= i; + return result; + } + inline const JSONNode& operator [](size_t pos) const json_nothrow { return const_cast(*it[pos]); }; + inline const JSONNode& operator *(void) const json_nothrow { return const_cast(*(*it)); } + inline const JSONNode* operator ->(void) const json_nothrow { return const_cast(*it); } + inline bool operator == (const const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const const_iterator & other) const json_nothrow { return it <= other.it; } + + inline bool operator == (const iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const iterator & other) const json_nothrow { return it <= other.it; } + + inline const_iterator & operator =(const const_iterator & orig) json_nothrow { it = orig.it; return *this; } + const_iterator (const const_iterator & orig) json_nothrow : it(orig.it) {} + private: + JSONNode ** it; + const_iterator(JSONNode ** starter) : it(starter) {} + friend class JSONNode; + friend struct iterator; + }; + const_iterator begin(void) const json_nothrow; + const_iterator end(void) const json_nothrow; + + struct iterator { + inline iterator& operator ++(void) json_nothrow { ++it; return *this; } + inline iterator& operator --(void) json_nothrow { --it; return *this; } + inline iterator& operator +=(long i) json_nothrow { it += i; return *this; } + inline iterator& operator -=(long i) json_nothrow { it -= i; return *this; } + inline iterator operator ++(int) json_nothrow { + iterator result(*this); + ++it; + return result; + } + inline iterator operator --(int) json_nothrow { + iterator result(*this); + --it; + return result; + } + inline iterator operator +(long i) const json_nothrow { + iterator result(*this); + result.it += i; + return result; + } + inline iterator operator -(long i) const json_nothrow { + iterator result(*this); + result.it -= i; + return result; + } + inline JSONNode& operator [](size_t pos) const json_nothrow { return *it[pos]; }; + inline JSONNode& operator *(void) const json_nothrow { return *(*it); } + inline JSONNode* operator ->(void) const json_nothrow { return *it; } + inline bool operator == (const iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const iterator & other) const json_nothrow { return it <= other.it; } + inline iterator & operator = (const iterator & orig) json_nothrow { it = orig.it; return *this; } + + inline bool operator == (const const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const const_iterator & other) const json_nothrow { return it <= other.it; } + inline iterator & operator = (const const_iterator & orig) json_nothrow { it = orig.it; return *this; } + + iterator (const iterator & orig) json_nothrow : it(orig.it) {} + inline operator const_iterator() const json_nothrow { return const_iterator(it); } + private: + JSONNode ** it; + iterator(JSONNode ** starter) json_nothrow : it(starter) {} + friend class JSONNode; + friend struct const_iterator; + }; + typedef iterator json_iterator; + + struct reverse_iterator; + struct reverse_const_iterator { + inline reverse_const_iterator& operator ++(void) json_nothrow{ --it; return *this; } + inline reverse_const_iterator& operator --(void) json_nothrow{ ++it; return *this; } + inline reverse_const_iterator& operator +=(long i) json_nothrow{ it -= i; return *this; } + inline reverse_const_iterator& operator -=(long i) json_nothrow{ it += i; return *this; } + inline reverse_const_iterator operator ++(int) json_nothrow{ + reverse_const_iterator result(*this); + --it; + return result; + } + inline reverse_const_iterator operator --(int) json_nothrow{ + reverse_const_iterator result(*this); + ++it; + return result; + } + inline reverse_const_iterator operator +(long i) const json_nothrow { + reverse_const_iterator result(*this); + result.it -= i; + return result; + } + inline reverse_const_iterator operator -(long i) const json_nothrow { + reverse_const_iterator result(*this); + result.it += i; + return result; + } + inline const JSONNode& operator [](size_t pos) const json_nothrow { return const_cast(*it[pos]); }; + inline const JSONNode& operator *(void) const json_nothrow { return const_cast(*(*it)); } + inline const JSONNode* operator ->(void) const json_nothrow { return const_cast(*it); } + inline bool operator == (const reverse_const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const reverse_const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator < (const reverse_const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator <= (const reverse_const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator > (const reverse_const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator >= (const reverse_const_iterator & other) const json_nothrow { return it <= other.it; } + + inline bool operator == (const reverse_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const reverse_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator < (const reverse_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator <= (const reverse_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator > (const reverse_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator >= (const reverse_iterator & other) const json_nothrow { return it <= other.it; } + + inline reverse_const_iterator & operator = (const reverse_const_iterator & orig) json_nothrow { it = orig.it; return *this; } + reverse_const_iterator (const reverse_const_iterator & orig) json_nothrow : it(orig.it) {} + private: + JSONNode ** it; + reverse_const_iterator(JSONNode ** starter) json_nothrow : it(starter) {} + friend class JSONNode; + friend struct reverse_iterator; + }; + reverse_const_iterator rbegin(void) const json_nothrow; + reverse_const_iterator rend(void) const json_nothrow; + + struct reverse_iterator { + inline reverse_iterator& operator ++(void) json_nothrow { --it; return *this; } + inline reverse_iterator& operator --(void) json_nothrow { ++it; return *this; } + inline reverse_iterator& operator +=(long i) json_nothrow { it -= i; return *this; } + inline reverse_iterator& operator -=(long i) json_nothrow { it += i; return *this; } + inline reverse_iterator operator ++(int) json_nothrow { + reverse_iterator result(*this); + --it; + return result; + } + inline reverse_iterator operator --(int) json_nothrow { + reverse_iterator result(*this); + ++it; + return result; + } + inline reverse_iterator operator +(long i) const json_nothrow { + reverse_iterator result(*this); + result.it -= i; + return result; + } + inline reverse_iterator operator -(long i) const json_nothrow { + reverse_iterator result(*this); + result.it += i; + return result; + } + inline JSONNode& operator [](size_t pos) const json_nothrow { return *it[pos]; }; + inline JSONNode& operator *(void) const json_nothrow { return *(*it); } + inline JSONNode* operator ->(void) const json_nothrow { return *it; } + inline bool operator == (const reverse_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const reverse_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator < (const reverse_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator <= (const reverse_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator > (const reverse_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator >= (const reverse_iterator & other) const json_nothrow { return it <= other.it; } + + inline bool operator == (const reverse_const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const reverse_const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator < (const reverse_const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator <= (const reverse_const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator > (const reverse_const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator >= (const reverse_const_iterator & other) const json_nothrow { return it <= other.it; } + + inline reverse_iterator & operator = (const reverse_iterator & orig) json_nothrow { it = orig.it; return *this; } + reverse_iterator (const reverse_iterator & orig) json_nothrow : it(orig.it) {} + inline operator reverse_const_iterator() const json_nothrow { return reverse_const_iterator(it); } + private: + JSONNode ** it; + reverse_iterator(JSONNode ** starter) json_nothrow : it(starter) {} + friend class JSONNode; + friend struct reverse_const_iterator; + }; + reverse_iterator rbegin(void) json_nothrow; + reverse_iterator rend(void) json_nothrow; + + const_iterator find(const json_string & name_t) const json_nothrow; + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + const_iterator find_nocase(const json_string & name_t) const json_nothrow; + #endif + + reverse_iterator erase(reverse_iterator pos) json_nothrow; + reverse_iterator erase(reverse_iterator start, const reverse_iterator & end) json_nothrow; + + iterator insert(iterator pos, const JSONNode & x) json_nothrow; + reverse_iterator insert(reverse_iterator pos, const JSONNode & x) json_nothrow; + iterator insert(iterator pos, const reverse_iterator & _start, const reverse_iterator & _end) json_nothrow; + reverse_iterator insert(reverse_iterator pos, const iterator & _start, const iterator & _end) json_nothrow; + reverse_iterator insert(reverse_iterator pos, const reverse_iterator & _start, const reverse_iterator & _end) json_nothrow; + + json_iterator insert(json_iterator pos, const const_iterator & _start, const const_iterator & _end) json_nothrow; + reverse_iterator insert(reverse_iterator pos, const const_iterator & _start, const const_iterator & _end) json_nothrow; + json_iterator insert(json_iterator pos, const reverse_const_iterator & _start, const reverse_const_iterator & _end) json_nothrow; + reverse_iterator insert(reverse_iterator pos, const reverse_const_iterator & _start, const reverse_const_iterator & _end) json_nothrow; + #else + typedef JSONNode** json_iterator; + #define json_iterator_ptr(iter) iter + #define ptr_to_json_iterator(iter) iter + json_iterator insert(json_iterator pos, JSONNode * x) json_nothrow; + #endif + + json_iterator begin(void) json_nothrow; + json_iterator end(void) json_nothrow; + + json_iterator find(const json_string & name_t) json_nothrow; + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + json_iterator find_nocase(const json_string & name_t) json_nothrow; + #endif + json_iterator erase(json_iterator pos) json_nothrow; + json_iterator erase(json_iterator start, const json_iterator & end) json_nothrow; + json_iterator insert(json_iterator pos, const json_iterator & _start, const json_iterator & _end) json_nothrow; + #endif + + + #ifdef JSON_MUTEX_CALLBACKS + static void register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock) json_nothrow json_cold; + #ifdef JSON_MUTEX_MANAGE + static void register_mutex_destructor(json_mutex_callback_t destroy) json_nothrow json_cold; + #endif + static void set_global_mutex(void * mutex) json_nothrow json_cold; + void set_mutex(void * mutex) json_nothrow json_cold; + void lock(int thread) json_nothrow json_cold; + void unlock(int thread) json_nothrow json_cold; + struct auto_lock { + public: + auto_lock(JSONNode & node, int thread) json_nothrow: mynode(&node), mythread(thread){ + mynode -> lock(mythread); + } + auto_lock(JSONNode * node, int thread) json_nothrow: mynode(node), mythread(thread){ + mynode -> lock(mythread); + } + ~auto_lock(void) json_nothrow{ + mynode -> unlock(mythread); + } + private: + auto_lock & operator = (const auto_lock &); + auto_lock(const auto_lock &); + JSONNode * mynode; + int mythread; + }; + static void * getThisLock(JSONNode * pthis) json_nothrow json_cold; + #endif + + #ifdef JSON_WRITE_PRIORITY + #ifdef JSON_LESS_MEMORY + #define DEFAULT_APPROX_SIZE 8 + #define DEFAULT_APPROX_SIZE_FORMATTED 16 + #else + #define DEFAULT_APPROX_SIZE 1024 + #define DEFAULT_APPROX_SIZE_FORMATTED 2048 + #endif + json_string write(size_t approxsize = DEFAULT_APPROX_SIZE) const json_nothrow json_write_priority; + json_string write_formatted(size_t approxsize = DEFAULT_APPROX_SIZE_FORMATTED) const json_nothrow json_write_priority; + #endif + + #ifdef JSON_DEBUG + #ifndef JSON_LIBRARY + JSONNode dump(void) const json_nothrow; + #endif + #endif + static void deleteJSONNode(JSONNode * ptr) json_nothrow json_hot; + static JSONNode * newJSONNode_Shallow(const JSONNode & orig) json_hot; + + #define DECLARE_CAST_OP(type) operator type() + //DECLARE_FOR_ALL_CAST_TYPES_CONST(DECLARE_CAST_OP) +JSON_PRIVATE + static JSONNode * newJSONNode(const JSONNode & orig JSON_MUTEX_COPY_DECL2) json_hot; + static JSONNode * newJSONNode(internalJSONNode * internal_t) json_hot; + #ifdef JSON_READ_PRIORITY + //used by JSONWorker + JSONNode(const json_string & unparsed) json_nothrow : internal(internalJSONNode::newInternal(unparsed)){ //root, specialized because it can only be array or node + LIBJSON_CTOR; + } + #endif + JSONNode(internalJSONNode * internal_t) json_nothrow : internal(internal_t){ //do not increment anything, this is only used in one case and it's already taken care of + LIBJSON_CTOR; + } + JSONNode(bool, JSONNode & orig) json_nothrow json_hot; + + void decRef(void) json_nothrow json_hot; //decrements internal's counter, deletes it if needed + #ifdef JSON_REF_COUNT + void makeUniqueInternal(void) json_nothrow; //makes internal it's own + void merge(JSONNode * other) json_nothrow json_cold; + #endif + + #ifdef JSON_DEBUG + #ifndef JSON_LIBRARY + JSONNode dump(size_t & totalmemory) json_nothrow; + #endif + #endif + + #ifdef JSON_ITERATORS + #ifndef JSON_LIBRARY + json_iterator insertFRR(json_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow; + reverse_iterator insertRRR(reverse_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow; + reverse_iterator insertRFF(reverse_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow; + #endif + json_iterator insertFFF(json_iterator pos, JSONNode ** const _start, JSONNode ** const _end) json_nothrow; + #endif + + inline void clear_name(void) json_nothrow { + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + internal -> clearname(); + } + + mutable internalJSONNode * internal; + friend class JSONWorker; + friend class internalJSONNode; +}; + + + +/* + Implementations are here to keep the class declaration cleaner. They can't be placed in a different + file because they are inlined. +*/ + +#define CAST_OP(type)\ + inline JSONNode::operator type() const json_nothrow {\ + return static_cast(*internal);\ + } +//IMPLEMENT_FOR_ALL_TYPES(CAST_OP) + + +inline JSONNode::JSONNode(char mytype) json_nothrow : internal(internalJSONNode::newInternal(mytype)){ + JSON_ASSERT((mytype == JSON_NULL) || + (mytype == JSON_STRING) || + (mytype == JSON_NUMBER) || + (mytype == JSON_BOOL) || + (mytype == JSON_ARRAY) || + (mytype == JSON_NODE), JSON_TEXT("Not a proper JSON type")); + LIBJSON_CTOR; +} + +inline JSONNode::JSONNode(const JSONNode & orig) json_nothrow : internal(orig.internal -> incRef()){ + LIBJSON_COPY_CTOR; +} + +//this allows a temp node to simply transfer its contents, even with ref counting off +inline JSONNode::JSONNode(bool, JSONNode & orig) json_nothrow : internal(orig.internal){ + orig.internal = 0; + LIBJSON_CTOR; +} + +inline JSONNode::~JSONNode(void) json_nothrow{ + if (internal != 0) decRef(); + LIBJSON_DTOR; +} + +inline json_index_t JSONNode::size(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> size(); +} + +inline bool JSONNode::empty(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> empty(); +} + +inline void JSONNode::clear(void) json_nothrow { + JSON_CHECK_INTERNAL(); + if (!empty()){ + makeUniqueInternal(); + internal -> CHILDREN -> clear(); + } +} + +inline unsigned char JSONNode::type(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> type(); +} + +inline json_string JSONNode::name(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> name(); +} + +inline void JSONNode::set_name(const json_string & newname) json_nothrow{ + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + internal -> setname(newname); +} + +#ifdef JSON_COMMENTS + inline void JSONNode::set_comment(const json_string & newname) json_nothrow{ + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + internal -> setcomment(newname); + } + + inline json_string JSONNode::get_comment(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> getcomment(); + } +#endif + +//#ifdef JSON_DEPRECATED_FUNCTIONS + inline json_string JSONNode::as_string(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return static_cast(*internal); + } + + inline json_int_t JSONNode::as_int(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return static_cast(*internal); + } + + inline json_number JSONNode::as_float(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return static_cast(*internal); + } + + inline bool JSONNode::as_bool(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + return static_cast(*internal); + } +//#endif + +#ifdef JSON_BINARY + inline void JSONNode::set_binary(const unsigned char * bin, size_t bytes) json_nothrow{ + JSON_CHECK_INTERNAL(); + *this = JSONBase64::json_encode64(bin, bytes); + } + + inline std::string JSONNode::as_binary(void) const json_nothrow { + JSON_ASSERT_SAFE(type() == JSON_STRING, JSON_TEXT("using as_binary for a non-string type"), return json_global(EMPTY_STD_STRING);); + JSON_CHECK_INTERNAL(); + return JSONBase64::json_decode64(as_string()); + } +#endif + +inline JSONNode & JSONNode::operator[](const json_string & name_t) json_nothrow { + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + return *(*(internal -> at(name_t))); +} + +inline const JSONNode & JSONNode::operator[](const json_string & name_t) const json_nothrow { + JSON_CHECK_INTERNAL(); + return *(*(internal -> at(name_t))); +} + +#ifdef JSON_LIBRARY +inline void JSONNode::push_back(JSONNode * child) json_nothrow{ +#else +inline void JSONNode::push_back(const JSONNode & child) json_nothrow{ +#endif + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + internal -> push_back(child); +} + +inline void JSONNode::reserve(json_index_t siz) json_nothrow{ + makeUniqueInternal(); + internal -> reserve(siz); +} + +inline JSONNode & JSONNode::operator = (const JSONNode & orig) json_nothrow { + JSON_CHECK_INTERNAL(); + #ifdef JSON_REF_COUNT + if (internal == orig.internal) return *this; //don't want it accidentally deleting itself + #endif + decRef(); //dereference my current one + internal = orig.internal -> incRef(); //increase reference of original + return *this; +} + +#ifndef JSON_LIBRARY + inline JSONNode & JSONNode::operator = (const json_char * val) json_nothrow { + JSON_CHECK_INTERNAL(); + *this = json_string(val); + return *this; + } +#endif + +#define NODE_SET_TYPED(type)\ + inline JSONNode & JSONNode::operator = (type val) json_nothrow {\ + LIBJSON_ASSIGNMENT;\ + JSON_CHECK_INTERNAL();\ + makeUniqueInternal();\ + internal -> Set(val);\ + return *this;\ + } +IMPLEMENT_FOR_ALL_TYPES(NODE_SET_TYPED) + + +/* + This section is the equality operators +*/ + +#define NODE_CHECK_EQUALITY(type)\ + inline bool JSONNode::operator == (type val) const json_nothrow {\ + JSON_CHECK_INTERNAL();\ + return internal -> IsEqualToNum(val);\ + } + +IMPLEMENT_FOR_ALL_NUMBERS(NODE_CHECK_EQUALITY) + +inline bool JSONNode::operator == (const json_string & val) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> IsEqualTo(val); +} + +#ifndef JSON_LIBRARY + inline bool JSONNode::operator == (const json_char * val) const json_nothrow { + JSON_CHECK_INTERNAL(); + return *this == json_string(val); + } +#endif + +inline bool JSONNode::operator == (bool val) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> IsEqualTo(val); +} +inline bool JSONNode::operator == (const JSONNode & val) const json_nothrow { + JSON_CHECK_INTERNAL(); + return internal -> IsEqualTo(val.internal); +} + + +/* + This section is the inequality operators +*/ + + +#define NODE_CHECK_INEQUALITY(type)\ + inline bool JSONNode::operator != (type val) const json_nothrow {\ + JSON_CHECK_INTERNAL();\ + return !(*this == val);\ + } + +IMPLEMENT_FOR_ALL_TYPES(NODE_CHECK_INEQUALITY) +NODE_CHECK_INEQUALITY(const JSONNode &) +#ifndef JSON_LIBRARY + NODE_CHECK_INEQUALITY(const json_char * ) +#endif + +inline void JSONNode::nullify(void) json_nothrow { + JSON_CHECK_INTERNAL(); + makeUniqueInternal(); + internal -> Nullify(); +} + +inline void JSONNode::swap(JSONNode & other) json_nothrow { + JSON_CHECK_INTERNAL(); + internalJSONNode * temp = other.internal; + other.internal = internal; + internal = temp; + JSON_CHECK_INTERNAL(); +} + +inline void JSONNode::decRef(void) json_nothrow { //decrements internal's counter, deletes it if needed + JSON_CHECK_INTERNAL(); + #ifdef JSON_REF_COUNT + internal -> decRef(); + if (internal -> hasNoReferences()){ + internalJSONNode::deleteInternal(internal); + } + #else + internalJSONNode::deleteInternal(internal); + #endif +} + +#ifdef JSON_REF_COUNT + inline void JSONNode::makeUniqueInternal() json_nothrow { //makes internal it's own + JSON_CHECK_INTERNAL(); + internal = internal -> makeUnique(); //might return itself or a new one that's exactly the same + } +#endif + +#ifdef JSON_ITERATORS + inline JSONNode::json_iterator JSONNode::begin(void) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("begin")); + makeUniqueInternal(); + return json_iterator(internal -> begin()); + } + + inline JSONNode::json_iterator JSONNode::end(void) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("end")); + makeUniqueInternal(); + return json_iterator(internal -> end()); + } + + #ifndef JSON_LIBRARY + inline JSONNode::const_iterator JSONNode::begin(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("begin")); + return JSONNode::const_iterator(internal -> begin()); + } + + inline JSONNode::const_iterator JSONNode::end(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("end")); + return JSONNode::const_iterator(internal -> end()); + } + + inline JSONNode::reverse_iterator JSONNode::rbegin(void) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("rbegin")); + makeUniqueInternal(); + return JSONNode::reverse_iterator(internal -> end() - 1); + } + + inline JSONNode::reverse_iterator JSONNode::rend(void) json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("rend")); + makeUniqueInternal(); + return JSONNode::reverse_iterator(internal -> begin() - 1); + } + + inline JSONNode::reverse_const_iterator JSONNode::rbegin(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("rbegin")); + return JSONNode::reverse_const_iterator(internal -> end() - 1); + } + + inline JSONNode::reverse_const_iterator JSONNode::rend(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, json_global(ERROR_NON_ITERATABLE) + JSON_TEXT("rend")); + return JSONNode::reverse_const_iterator(internal -> begin() - 1); + } + + inline JSONNode::iterator JSONNode::insert(json_iterator pos, const const_iterator & _start, const const_iterator & _end) json_nothrow { + return insertFFF(pos, _start.it, _end.it); + } + + inline JSONNode::reverse_iterator JSONNode::insert(reverse_iterator pos, const const_iterator & _start, const const_iterator & _end) json_nothrow { + return insertRFF(pos, _start.it, _end.it); + } + + inline JSONNode::reverse_iterator JSONNode::insert(reverse_iterator pos, const iterator & _start, const iterator & _end) json_nothrow { + return insertRFF(pos, _start.it, _end.it); + } + + inline JSONNode::reverse_iterator JSONNode::insert(reverse_iterator pos, const reverse_const_iterator & _start, const reverse_const_iterator & _end) json_nothrow { + return insertRRR(pos, _start.it, _end.it); + } + + inline JSONNode::reverse_iterator JSONNode::insert(reverse_iterator pos, const reverse_iterator & _start, const reverse_iterator & _end) json_nothrow { + return insertRRR(pos, _start.it, _end.it); + } + + inline JSONNode::iterator JSONNode::insert(json_iterator pos, const reverse_const_iterator & _start, const reverse_const_iterator & _end) json_nothrow { + return insertFRR(pos, _start.it, _end.it); + } + + inline JSONNode::iterator JSONNode::insert(iterator pos, const reverse_iterator & _start, const reverse_iterator & _end) json_nothrow { + return insertFRR(pos, _start.it, _end.it); + } + #endif + + inline JSONNode::json_iterator JSONNode::insert(json_iterator pos, const json_iterator & _start, const json_iterator & _end) json_nothrow { + return insertFFF(pos, json_iterator_ptr(_start), json_iterator_ptr(_end)); + } +#endif + +#ifdef JSON_WRITE_PRIORITY + inline json_string JSONNode::write(size_t approxsize) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT_SAFE(type() == JSON_NODE || type() == JSON_ARRAY, JSON_TEXT("Writing a non-writable node"), return json_global(EMPTY_JSON_STRING);); + json_string result; + result.reserve(approxsize); + internal -> Write(0xFFFFFFFF, true, result); + return result; + } + + inline json_string JSONNode::write_formatted(size_t approxsize) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSON_ASSERT_SAFE(type() == JSON_NODE || type() == JSON_ARRAY, JSON_TEXT("Writing a non-writable node"), return json_global(EMPTY_JSON_STRING);); + json_string result; + result.reserve(approxsize); + internal -> Write(0, true, result); + return result; + } + +#endif + +#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + inline void JSONNode::preparse(void) json_nothrow { + JSON_CHECK_INTERNAL(); + internal -> preparse(); + } +#endif + +#ifdef JSON_DEBUG + #ifndef JSON_LIBRARY + inline JSONNode JSONNode::dump(void) const json_nothrow { + JSON_CHECK_INTERNAL(); + JSONNode dumpage(JSON_NODE); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("this"), (long)this))); + size_t total = 0; + JSONNode node(internal -> Dump(total)); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("total bytes used"), total))); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("bytes used"), sizeof(JSONNode)))); + dumpage.push_back(JSON_NEW(node)); + return dumpage; + } + + inline JSONNode JSONNode::dump(size_t & totalmemory) json_nothrow { + JSON_CHECK_INTERNAL(); + JSONNode dumpage(JSON_NODE); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("this"), (long)this))); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("bytes used"), sizeof(JSONNode)))); + dumpage.push_back(JSON_NEW(internal -> Dump(totalmemory))); + return dumpage; + } + #endif +#endif + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(pop) + #elif _MSC_VER + #pragma pack(pop, JSONNode_pack) + #endif +#endif +#endif diff --git a/libjson/_internal/Source/JSONNode_Mutex.cpp b/libjson/_internal/Source/JSONNode_Mutex.cpp new file mode 100644 index 0000000..04ec869 --- /dev/null +++ b/libjson/_internal/Source/JSONNode_Mutex.cpp @@ -0,0 +1,203 @@ +#include "JSONNode.h" +#include "JSONGlobals.h" + +#ifdef JSON_MUTEX_CALLBACKS + +json_mutex_callback_t json_lock_callback = 0; +json_mutex_callback_t json_unlock_callback = 0; +void * global_mutex = 0; +void * manager_mutex = 0; + +struct AutoLock { +public: + LIBJSON_OBJECT(AutoLock); + AutoLock(void) json_nothrow { + LIBJSON_CTOR; + json_lock_callback(manager_mutex); + } + ~AutoLock(void) json_nothrow { + LIBJSON_DTOR; + json_unlock_callback(manager_mutex); + } +private: + AutoLock(const AutoLock &); + AutoLock & operator = (const AutoLock &); +}; + +#ifdef JSON_MUTEX_MANAGE + json_mutex_callback_t json_destroy = 0; + + //make sure that the global mutex is taken care of too + struct auto_global { + public: + LIBJSON_OBJECT(auto_global;) + auto_global(void) json_nothrow { LIBJSON_CTOR; } + ~auto_global(void) json_nothrow { + LIBJSON_DTOR; + if (global_mutex){ + JSON_ASSERT_SAFE(json_destroy != 0, JSON_TEXT("No json_destroy in mutex managed mode"), return;); + json_destroy(global_mutex); + } + } + private: + auto_global(const auto_global &); + auto_global & operator = (const auto_global &); + }; + auto_global cleanupGlobal; +#endif + +void JSONNode::register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock) json_nothrow { + json_lock_callback = lock; + json_unlock_callback = unlock; + manager_mutex = manager_lock; +} + +void JSONNode::set_global_mutex(void * mutex) json_nothrow { + global_mutex = mutex; +} + +void JSONNode::set_mutex(void * mutex) json_nothrow { + makeUniqueInternal(); + internal -> _set_mutex(mutex); +} + +void * JSONNode::getThisLock(JSONNode * pthis) json_nothrow { + if (pthis -> internal -> mylock != 0){ + return pthis -> internal -> mylock; + } + JSON_ASSERT(global_mutex != 0, JSON_TEXT("No global_mutex")); //this is safe, because it's just goingi to return 0 anyway + return global_mutex; +} + +void JSONNode::lock(int thread) json_nothrow { + JSON_ASSERT_SAFE(json_lock_callback != 0, JSON_TEXT("No locking callback"), return;); + + AutoLock lockControl; + + //first, figure out what needs to be locked + void * thislock = getThisLock(this); + #ifdef JSON_SAFE + if (json_unlikely(thislock == 0)) return; + #endif + + //make sure that the same thread isn't locking it more than once (possible due to complex ref counting) + JSON_MAP(int, JSON_MAP(void *, unsigned int) )::iterator it = json_global(THREAD_LOCKS).find(thread); + if (it == json_global(THREAD_LOCKS).end()){ + JSON_MAP(void *, unsigned int) newthread; + newthread[thislock] = 1; + json_global(THREAD_LOCKS).insert(std::pair(thread, newthread)); + } else { //this thread already has some things locked, check if the current mutex is + JSON_MAP(void *, unsigned int) & newthread = it -> second; + JSON_MAP(void *, unsigned int)::iterator locker(newthread.find(thislock)); + if (locker == newthread.end()){ //current mutex is not locked, set it to locked + newthread.insert(std::pair(thislock, 1)); + } else { //it's already locked, don't relock it + ++(locker -> second); + return; //don't try to relock, it will deadlock the program + } + } + + //if I need to, lock it + json_lock_callback(thislock); +} + +void JSONNode::unlock(int thread) json_nothrow{ + JSON_ASSERT_SAFE(json_unlock_callback != 0, JSON_TEXT("No unlocking callback"), return;); + + AutoLock lockControl; + + //first, figure out what needs to be locked + void * thislock = getThisLock(this); + #ifdef JSON_SAFE + if (thislock == 0) return; + #endif + + //get it out of the map + JSON_MAP(int, JSON_MAP(void *, unsigned int) )::iterator it = json_global(THREAD_LOCKS).find(thread); + JSON_ASSERT_SAFE(it != json_global(THREAD_LOCKS).end(), JSON_TEXT("thread unlocking something it didn't lock"), return;); + + //get the mutex out of the thread + JSON_MAP(void *, unsigned int) & newthread = it -> second; + JSON_MAP(void *, unsigned int)::iterator locker = newthread.find(thislock); + JSON_ASSERT_SAFE(locker != newthread.end(), JSON_TEXT("thread unlocking mutex it didn't lock"), return;); + + //unlock it + if (--(locker -> second)) return; //other nodes is this same thread still have a lock on it + + //if I need to, unlock it + newthread.erase(locker); + json_unlock_callback(thislock); + +} + +#ifdef JSON_MUTEX_MANAGE + void JSONNode::register_mutex_destructor(json_mutex_callback_t destroy) json_nothrow { + json_destroy = destroy; + } +#endif + + +void internalJSONNode::_set_mutex(void * mutex, bool unset) json_nothrow { + if (unset) _unset_mutex(); //for reference counting + mylock = mutex; + if (mutex != 0){ + #ifdef JSON_MUTEX_MANAGE + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find(mutex); + if (it == json_global(MUTEX_MANAGER).end()){ + json_global(MUTEX_MANAGER).insert(std::pair(mutex, 1)); + } else { + ++it -> second; + } + #endif + if (isContainer()){ + json_foreach(CHILDREN, myrunner){ + (*myrunner) -> set_mutex(mutex); + } + } + } +} + +void internalJSONNode::_unset_mutex(void) json_nothrow { + #ifdef JSON_MUTEX_MANAGE + if (mylock != 0){ + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find(mylock); + JSON_ASSERT_SAFE(it != json_global(MUTEX_MANAGER).end(), JSON_TEXT("Mutex not managed"), return;); + --it -> second; + if (it -> second == 0){ + JSON_ASSERT_SAFE(json_destroy, JSON_TEXT("You didn't register a destructor for mutexes"), return;); + json_global(MUTEX_MANAGER).erase(it); + } + } + #endif +} + +#ifdef JSON_DEBUG + #ifndef JSON_LIBRARY + JSONNode internalJSONNode::DumpMutex(void) const json_nothrow { + JSONNode mut(JSON_NODE); + mut.set_name(JSON_TEXT("mylock")); + #ifdef JSON_MUTEX_MANAGE + if (mylock != 0){ + mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("this"), (long)mylock))); + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find(mylock); + if (it == json_global(MUTEX_MANAGER).end()){ + mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("references"), JSON_TEXT("error")))); + } else { + mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("references"), it -> second))); + } + } else { + mut = (long)mylock; + } + #else + mut = (long)mylock; + #endif + return mut; + } + #endif +#endif + +#else + #ifdef JSON_MUTEX_MANAGE + #error You can not have JSON_MUTEX_MANAGE on without JSON_MUTEX_CALLBACKS + #endif +#endif diff --git a/libjson/_internal/Source/JSONPreparse.cpp b/libjson/_internal/Source/JSONPreparse.cpp new file mode 100644 index 0000000..3dfda87 --- /dev/null +++ b/libjson/_internal/Source/JSONPreparse.cpp @@ -0,0 +1,499 @@ +/* + * JSONPreparse.cpp + * TestSuite + * + * Created by Wallace on 4/13/11. + * Copyright 2011 Streamwide. All rights reserved. + * + */ + +#include "JSONPreparse.h" + +#if (defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)) + +#ifdef JSON_COMMENTS + json_string extractComment(json_string::const_iterator & ptr, json_string::const_iterator & end); + json_string extractComment(json_string::const_iterator & ptr, json_string::const_iterator & end){ + json_string::const_iterator start; + json_string result; +looplabel: + if (json_unlikely(((ptr != end) && (*ptr == JSON_TEMP_COMMENT_IDENTIFIER)))){ + start = ++ptr; + for(; (ptr != end) && (*(ptr) != JSON_TEMP_COMMENT_IDENTIFIER); ++ptr){} + result += json_string(start, ptr); + if (json_unlikely(ptr == end)) return result; + ++ptr; + if (json_unlikely(((ptr != end) && (*ptr == JSON_TEMP_COMMENT_IDENTIFIER)))){ + result += JSON_TEXT('\n'); + goto looplabel; + } + } + return result; + } + #define GET_COMMENT(x, y, name) json_string name = extractComment(x, y) + #define RETURN_NODE(node, name){\ + JSONNode res = node;\ + res.set_comment(name);\ + return res;\ + } + #define RETURN_NODE_NOCOPY(node, name){\ + node.set_comment(name);\ + return node;\ + } + #define SET_COMMENT(node, name) node.set_comment(name) + #define COMMENT_ARG(name) ,name +#else + #define GET_COMMENT(x, y, name) (void)0 + #define RETURN_NODE(node, name) return node + #define RETURN_NODE_NOCOPY(node, name) return node + #define SET_COMMENT(node, name) (void)0 + #define COMMENT_ARG(name) +#endif + +inline bool isHex(json_char c) json_pure; +inline bool isHex(json_char c) json_nothrow { + return (((c >= JSON_TEXT('0')) && (c <= JSON_TEXT('9'))) || + ((c >= JSON_TEXT('A')) && (c <= JSON_TEXT('F'))) || + ((c >= JSON_TEXT('a')) && (c <= JSON_TEXT('f')))); +} + +#ifdef JSON_STRICT + #include "NumberToString.h" +#endif + +json_number FetchNumber(const json_string & _string) json_nothrow; +json_number FetchNumber(const json_string & _string) json_nothrow { + #ifdef JSON_STRICT + return NumberToString::_atof(_string.c_str()); + #else + #ifdef JSON_UNICODE + const size_t len = _string.length(); + #if defined(_MSC_VER) && defined(JSON_SAFE) + const size_t bytes = (len * (sizeof(json_char) / sizeof(char))) + 1; + json_auto temp(bytes); + size_t res; + errno_t err = std::wcstombs_s(&res, temp.ptr, bytes, _string.c_str(), len); + if (err != 0){ + return (json_number)0.0; + } + #elif defined(JSON_SAFE) + const size_t bytes = (len * (sizeof(json_char) / sizeof(char))) + 1; + json_auto temp(bytes); + size_t res = std::wcstombs(temp.ptr, _string.c_str(), len); + if (res == (size_t)-1){ //-1 is error code for this function + return (json_number)0.0; + } + #else + json_auto temp(len + 1); + size_t res = std::wcstombs(temp.ptr, _string.c_str(), len); + #endif + temp.ptr[res] = JSON_TEXT('\0'); + return (json_number)std::atof(temp.ptr); + #else + return (json_number)std::atof(_string.c_str()); + #endif + #endif +} + +JSONNode JSONPreparse::isValidNumber(json_string::const_iterator & ptr, json_string::const_iterator & end){ + //ptr points at the first character in the number + //ptr will end up past the last character + json_string::const_iterator start = ptr; + bool decimal = false; + bool scientific = false; + + //first letter is weird + switch(*ptr){ + #ifndef JSON_STRICT + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('+'): + #endif + + case JSON_TEXT('-'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + case JSON_TEXT('0'): + ++ptr; + switch(*ptr){ + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + scientific = true; + ++ptr; + if (ptr == end) throw false; + switch(*ptr){ + case JSON_TEXT('-'): + case JSON_TEXT('+'): + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + throw false; + } + break; + + #ifndef JSON_STRICT + case JSON_TEXT('x'): + while(isHex(*++ptr)){}; + return JSONNode(json_global(EMPTY_JSON_STRING), FetchNumber(json_string(start, end - 1))); + #ifdef JSON_OCTAL + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('7'): //octal + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + #endif + while((*++ptr >= JSON_TEXT('0')) && (*ptr <= JSON_TEXT('7'))){}; + if ((*ptr != JSON_TEXT('8')) && (*ptr != JSON_TEXT('9'))){ + return JSONNode(json_global(EMPTY_JSON_STRING), FetchNumber(json_string(start, ptr - 1))); + } + throw false; + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + #else + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + #endif + #else + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + #endif + default: //just a 0 + return JSONNode(json_global(EMPTY_JSON_STRING), FetchNumber(json_string(start, ptr - 1)));; + } + break; + default: + throw false; + } + ++ptr; + + //next digits + while (true){ + switch(*ptr){ + case JSON_TEXT('.'): + if (json_unlikely(decimal)) throw false; //multiple decimals + if (json_unlikely(scientific)) throw false; + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + if (json_likely(scientific)) throw false; + scientific = true; + ++ptr; + switch(*ptr){ + case JSON_TEXT('-'): + case JSON_TEXT('+'): + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + default: + throw false; + } + break; + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + default: + return JSONNode(json_global(EMPTY_JSON_STRING), FetchNumber(json_string(start, ptr)));; + } + ++ptr; + } + throw false; +} + +#ifndef JSON_STRICT + #define LETTERCASE(x, y)\ + case JSON_TEXT(x):\ + case JSON_TEXT(y) + #define LETTERCHECK(x, y)\ + if (json_unlikely((*++ptr != JSON_TEXT(x)) && (*ptr != JSON_TEXT(y)))) throw false +#else + #define LETTERCASE(x, y)\ + case JSON_TEXT(x) + #define LETTERCHECK(x, y)\ + if (json_unlikely(*++ptr != JSON_TEXT(x))) throw false +#endif +JSONNode JSONPreparse::isValidMember(json_string::const_iterator & ptr, json_string::const_iterator & end){ + //ptr is on the first character of the member + //ptr will end up immediately after the last character in the member + if (ptr == end) throw false; + + switch(*ptr){ + case JSON_TEXT('\"'):{ + return JSONNode::stringType(isValidString(++ptr, end)); + } + case JSON_TEXT('{'): + return isValidObject(++ptr, end); + case JSON_TEXT('['): + return isValidArray(++ptr, end); + LETTERCASE('t', 'T'): + LETTERCHECK('r', 'R'); + LETTERCHECK('u', 'U'); + LETTERCHECK('e', 'E'); + ++ptr; + return JSONNode(json_global(EMPTY_JSON_STRING), true); + LETTERCASE('f', 'F'): + LETTERCHECK('a', 'A'); + LETTERCHECK('l', 'L'); + LETTERCHECK('s', 'S'); + LETTERCHECK('e', 'E'); + ++ptr; + return JSONNode(json_global(EMPTY_JSON_STRING), false); + LETTERCASE('n', 'N'): + LETTERCHECK('u', 'U'); + LETTERCHECK('l', 'L'); + LETTERCHECK('l', 'L'); + ++ptr; + return JSONNode(JSON_NULL); + #ifndef JSON_STRICT + case JSON_TEXT('}'): //null in libjson + case JSON_TEXT(']'): //null in libjson + case JSON_TEXT(','): //null in libjson + return JSONNode(JSON_NULL); + #endif + } + //a number + return isValidNumber(ptr, end); +} + +json_string JSONPreparse::isValidString(json_string::const_iterator & ptr, json_string::const_iterator & end){ + //ptr is pointing to the first character after the quote + //ptr will end up behind the closing " + json_string::const_iterator start = ptr; + + while(ptr != end){ + switch(*ptr){ + case JSON_TEXT('\\'): + switch(*(++ptr)){ + case JSON_TEXT('\"'): + case JSON_TEXT('\\'): + case JSON_TEXT('/'): + case JSON_TEXT('b'): + case JSON_TEXT('f'): + case JSON_TEXT('n'): + case JSON_TEXT('r'): + case JSON_TEXT('t'): + break; + case JSON_TEXT('u'): + if (json_unlikely(!isHex(*++ptr))) throw false; + if (json_unlikely(!isHex(*++ptr))) throw false; + //fallthrough to \x + #ifndef JSON_STRICT + case JSON_TEXT('x'): //hex + #endif + if (json_unlikely(!isHex(*++ptr))) throw false; + if (json_unlikely(!isHex(*++ptr))) throw false; + break; + #ifndef JSON_OCTAL + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('7'): //octal + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + #endif + if (json_unlikely((*++ptr < JSON_TEXT('0')) || (*ptr > JSON_TEXT('7')))) throw false; + if (json_unlikely((*++ptr < JSON_TEXT('0')) || (*ptr > JSON_TEXT('7')))) throw false; + break; + #endif + default: + throw false; + } + break; + case JSON_TEXT('\"'): + return json_string(start, ptr++); + } + ++ptr; + } + throw false; +} + +void JSONPreparse::isValidNamedObject(json_string::const_iterator & ptr, json_string::const_iterator & end, JSONNode & parent COMMENT_PARAM(comment)) { + //ptr should be right before the string name + { + json_string _name = isValidString(++ptr, end); + if (json_unlikely(*ptr++ != JSON_TEXT(':'))) throw false; + JSONNode res = isValidMember(ptr, end); + res.set_name_(_name); + SET_COMMENT(res, comment); + #ifdef JSON_LIBRARY + parent.push_back(&res); + #else + parent.push_back(res); + #endif + } + if (ptr == end) throw false; + switch(*ptr){ + case JSON_TEXT(','): + ++ptr; + { + GET_COMMENT(ptr, end, nextcomment); + isValidNamedObject(ptr, end, parent COMMENT_ARG(nextcomment)); //will handle all of them + } + return; + case JSON_TEXT('}'): + ++ptr; + return; + default: + throw false; + } +} + +JSONNode JSONPreparse::isValidObject(json_string::const_iterator & ptr, json_string::const_iterator & end) { + //ptr should currently be pointing past the {, so this must be the start of a name, or the closing } + //ptr will end up past the last } + JSONNode res(JSON_NODE); + GET_COMMENT(ptr, end, comment); + switch(*ptr){ + case JSON_TEXT('\"'): + isValidNamedObject(ptr, end, res COMMENT_ARG(comment)); + return res; + case JSON_TEXT('}'): + ++ptr; + return res; + default: + throw false; + } +} + +void pushArrayMember(JSONNode & res, json_string::const_iterator & ptr, json_string::const_iterator & end); +void pushArrayMember(JSONNode & res, json_string::const_iterator & ptr, json_string::const_iterator & end){ + GET_COMMENT(ptr, end, comment); + JSONNode temp = JSONPreparse::isValidMember(ptr, end); + SET_COMMENT(temp, comment); + #ifdef JSON_LIBRARY + res.push_back(&temp); + #else + res.push_back(temp); + #endif +} + +JSONNode JSONPreparse::isValidArray(json_string::const_iterator & ptr, json_string::const_iterator & end) { + //ptr should currently be pointing past the [, so this must be the start of a member, or the closing ] + //ptr will end up past the last ] + JSONNode res(JSON_ARRAY); + do{ + switch(*ptr){ + case JSON_TEXT(']'): + ++ptr; + return res; + default: + pushArrayMember(res, ptr, end); + switch(*ptr){ + case JSON_TEXT(','): + break; + case JSON_TEXT(']'): + ++ptr; + return res; + default: + throw false; + } + break; + } + } while (++ptr != end); + throw false; +} + +JSONNode JSONPreparse::isValidRoot(const json_string & json) json_throws(std::invalid_argument) { + json_string::const_iterator it = json.begin(); + json_string::const_iterator end = json.end(); + try { + GET_COMMENT(it, end, comment); + switch(*it){ + case JSON_TEXT('{'): + RETURN_NODE(isValidObject(++it, end), comment); + case JSON_TEXT('['): + RETURN_NODE(isValidArray(++it, end), comment); + } + } catch (...){} + + #ifndef JSON_NO_EXCEPTIONS + throw std::invalid_argument(json_global(EMPTY_STD_STRING)); + #else + return JSONNode(JSON_NULL); + #endif +} + +#endif diff --git a/libjson/_internal/Source/JSONPreparse.h b/libjson/_internal/Source/JSONPreparse.h new file mode 100644 index 0000000..743d89e --- /dev/null +++ b/libjson/_internal/Source/JSONPreparse.h @@ -0,0 +1,28 @@ +#ifndef LIBJSON_GUARD_PREPARSE_H +#define LIBJSON_GUARD_PREPARSE_H + +#include "JSONDebug.h" +#include "JSONNode.h" + +#if (defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)) + +#ifdef JSON_COMMENTS + #define COMMENT_PARAM(name) ,const json_string & name +#else + #define COMMENT_PARAM(name) +#endif + +class JSONPreparse { +public: + static JSONNode isValidNumber(json_string::const_iterator & ptr, json_string::const_iterator & end) json_read_priority; + static JSONNode isValidMember(json_string::const_iterator & ptr, json_string::const_iterator & end) json_read_priority; + static json_string isValidString(json_string::const_iterator & ptr, json_string::const_iterator & end) json_read_priority; + static void isValidNamedObject(json_string::const_iterator & ptr, json_string::const_iterator & end, JSONNode & parent COMMENT_PARAM(comment)) json_read_priority; + static JSONNode isValidObject(json_string::const_iterator & ptr, json_string::const_iterator & end) json_read_priority; + static JSONNode isValidArray(json_string::const_iterator & ptr, json_string::const_iterator & end) json_read_priority; + static JSONNode isValidRoot(const json_string & json) json_throws(std::invalid_argument) json_read_priority; +}; + +#endif + +#endif diff --git a/libjson/_internal/Source/JSONSharedString.h b/libjson/_internal/Source/JSONSharedString.h new file mode 100644 index 0000000..2394b41 --- /dev/null +++ b/libjson/_internal/Source/JSONSharedString.h @@ -0,0 +1,308 @@ +#ifndef JSON_SHARED_STRING_H +#define JSON_SHARED_STRING_H + +/* + * This class allows json objects to share string + * Since libjson is a parser, it does a lot of substrings, but since + * a string with all of the information already exists, those substrings + * can be infered by an offset and length and a pointer to the master + * string + * + * EXPERIMENTAL, Not used yet + */ + +#include "JSONDebug.h" +#include "JSONGlobals.h" +#include "JSONMemory.h" + +/* +mallocs: 3351 +frees: 3351 +reallocs: 3 +bytes: 298751 (291 KB) +max bytes at once: 3624 (3 KB) +avg bytes at once: 970 (0 KB) +*/ + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(push, 1) + #elif _MSC_VER + #pragma pack(push, json_shared_string_pack, 1) + #endif +#endif + +class json_shared_string { +public: + + + struct iterator; + struct const_iterator { + const_iterator(const json_char * p, const json_shared_string * pa) : parent(pa), it(p){} + + inline const_iterator& operator ++(void) json_nothrow { ++it; return *this; } + inline const_iterator& operator --(void) json_nothrow { --it; return *this; } + inline const_iterator& operator +=(long i) json_nothrow { it += i; return *this; } + inline const_iterator& operator -=(long i) json_nothrow { it -= i; return *this; } + inline const_iterator operator ++(int) json_nothrow { + const_iterator result(*this); + ++it; + return result; + } + inline const_iterator operator --(int) json_nothrow { + const_iterator result(*this); + --it; + return result; + } + inline const_iterator operator +(long i) const json_nothrow { + const_iterator result(*this); + result.it += i; + return result; + } + inline const_iterator operator -(long i) const json_nothrow { + const_iterator result(*this); + result.it -= i; + return result; + } + inline const json_char & operator [](size_t pos) const json_nothrow { return it[pos]; }; + inline const json_char & operator *(void) const json_nothrow { return *it; } + inline const json_char * operator ->(void) const json_nothrow { return it; } + inline bool operator == (const const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const const_iterator & other) const json_nothrow { return it <= other.it; } + + inline bool operator == (const iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const iterator & other) const json_nothrow { return it <= other.it; } + + inline const_iterator & operator =(const const_iterator & orig) json_nothrow { it = orig.it; return *this; } + const_iterator (const const_iterator & orig) json_nothrow : it(orig.it) {} + private: + const json_shared_string * parent; + const json_char * it; + friend class json_shared_string; + friend struct iterator; + }; + + struct iterator { + iterator(const json_char * p, const json_shared_string * pa) : parent(pa), it(p){} + + inline iterator& operator ++(void) json_nothrow { ++it; return *this; } + inline iterator& operator --(void) json_nothrow { --it; return *this; } + inline iterator& operator +=(long i) json_nothrow { it += i; return *this; } + inline iterator& operator -=(long i) json_nothrow { it -= i; return *this; } + inline iterator operator ++(int) json_nothrow { + iterator result(*this); + ++it; + return result; + } + inline iterator operator --(int) json_nothrow { + iterator result(*this); + --it; + return result; + } + inline iterator operator +(long i) const json_nothrow { + iterator result(*this); + result.it += i; + return result; + } + inline iterator operator -(long i) const json_nothrow { + iterator result(*this); + result.it -= i; + return result; + } + inline const json_char & operator [](size_t pos) const json_nothrow { return it[pos]; }; + inline const json_char & operator *(void) const json_nothrow { return *it; } + inline const json_char * operator ->(void) const json_nothrow { return it; } + inline bool operator == (const const_iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const const_iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const const_iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const const_iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const const_iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const const_iterator & other) const json_nothrow { return it <= other.it; } + + inline bool operator == (const iterator & other) const json_nothrow { return it == other.it; } + inline bool operator != (const iterator & other) const json_nothrow { return it != other.it; } + inline bool operator > (const iterator & other) const json_nothrow { return it > other.it; } + inline bool operator >= (const iterator & other) const json_nothrow { return it >= other.it; } + inline bool operator < (const iterator & other) const json_nothrow { return it < other.it; } + inline bool operator <= (const iterator & other) const json_nothrow { return it <= other.it; } + + inline iterator & operator =(const iterator & orig) json_nothrow { it = orig.it; return *this; } + iterator (const iterator & orig) json_nothrow : it(orig.it) {} + private: + const json_shared_string * parent; + const json_char * it; + friend class json_shared_string; + friend struct const_iterator; + }; + + + + inline json_shared_string::iterator begin(void){ + iterator res = iterator(data(), this); + return res; + } + inline json_shared_string::iterator end(void){ + iterator res = iterator(data() + len, this); + return res; + } + inline json_shared_string::const_iterator begin(void) const { + const_iterator res = const_iterator(data(), this); + return res; + } + inline json_shared_string::const_iterator end(void) const { + const_iterator res = const_iterator(data() + len, this); + return res; + } + + + inline json_string::iterator std_begin(void){ + return _str -> mystring.begin() + offset; + } + inline json_string::iterator std_end(void){ + return std_begin() + len; + } + + inline json_string::const_iterator std_begin(void) const{ + return _str -> mystring.begin() + offset; + } + inline json_string::const_iterator std_end(void) const{ + return std_begin() + len; + } + + inline json_shared_string(void) : offset(0), len(0), _str(new(json_malloc(1)) json_shared_string_internal(json_global(EMPTY_JSON_STRING))) {} + + inline json_shared_string(const json_string & str) : offset(0), len(str.length()), _str(new(json_malloc(1)) json_shared_string_internal(str)) {} + + inline json_shared_string(const json_shared_string & str, size_t _offset, size_t _len) : _str(str._str), offset(str.offset + _offset), len(_len) { + ++_str -> refCount; + } + + inline json_shared_string(const json_shared_string & str, size_t _offset) : _str(str._str), offset(str.offset + _offset), len(str.len - _offset) { + ++_str -> refCount; + } + + inline json_shared_string(const iterator & s, const iterator & e) : _str(s.parent -> _str), offset(s.it - s.parent -> _str -> mystring.data()), len(e.it - s.it){ + ++_str -> refCount; + } + + inline ~json_shared_string(void){ + deref(); + } + + inline bool empty(void) const { return len == 0; } + + size_t find(json_char ch, size_t pos = 0) const { + if (_str -> refCount == 1) return _str -> mystring.find(ch, pos); + json_string::const_iterator e = std_end(); + for(json_string::const_iterator b = std_begin() + pos; b != e; ++b){ + if (*b == ch) return b - std_begin(); + } + return json_string::npos; + } + + inline json_char & operator[] (size_t loc){ + return _str -> mystring[loc + offset]; + } + inline json_char operator[] (size_t loc) const { + return _str -> mystring[loc + offset]; + } + inline void clear(){ len = 0; } + inline size_t length() const { return len; } + inline const json_char * c_str() const { return toString().c_str(); } + inline const json_char * data() const { return _str -> mystring.data() + offset; } + + inline bool operator != (const json_shared_string & other) const { + if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return false; + return other.toString() != toString(); + } + + inline bool operator == (const json_shared_string & other) const { + if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return true; + return other.toString() == toString(); + } + + inline bool operator == (const json_string & other) const { + return other == toString(); + } + + json_string & toString(void) const { + //gonna have to do a real substring now anyway, so do it completely + if (_str -> refCount == 1){ + if (offset || len != _str -> mystring.length()){ + _str -> mystring = json_string(std_begin(), std_end()); + } + } else if (offset || len != _str -> mystring.length()){ + --_str -> refCount; //dont use deref because I know its not going to be deleted + _str = new(json_malloc(1)) json_shared_string_internal(json_string(std_begin(), std_end())); + } + offset = 0; + return _str -> mystring; + } + + + inline void assign(const json_shared_string & other, size_t _offset, size_t _len){ + if (other._str != _str){ + deref(); + _str = other._str; + } + ++_str -> refCount; + offset = other.offset + _offset; + len = _len; + } + + json_shared_string(const json_shared_string & other) : _str(other._str), offset(other.offset), len(other.len){ + ++_str -> refCount; + } + + json_shared_string & operator =(const json_shared_string & other){ + if (other._str != _str){ + deref(); + _str = other._str; + ++_str -> refCount; + } + offset = other.offset; + len = other.len; + return *this; + } + + json_shared_string & operator += (const json_char c){ + toString() += c; + ++len; + return *this; + } + + //when doing a plus equal of another string, see if it shares the string and starts where this one left off, in which case just increase len +JSON_PRIVATE + struct json_shared_string_internal { + inline json_shared_string_internal(const json_string & _mystring) : mystring(_mystring), refCount(1) {} + json_string mystring; + size_t refCount PACKED(20); + }; + inline void deref(void){ + if (--_str -> refCount == 0){ + _str -> ~json_shared_string_internal(); + libjson_free(_str); + } + } + mutable json_shared_string_internal * _str; + mutable size_t offset PACKED(20); + mutable size_t len PACKED(20); +}; + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(pop) + #elif _MSC_VER + #pragma pack(pop, json_shared_string_pack,) + #endif +#endif + +#endif diff --git a/libjson/_internal/Source/JSONSingleton.h b/libjson/_internal/Source/JSONSingleton.h new file mode 100644 index 0000000..4fae713 --- /dev/null +++ b/libjson/_internal/Source/JSONSingleton.h @@ -0,0 +1,23 @@ +#ifndef JSONSINGLETON_H +#define JSONSINGLETON_H + +template class JSONSingleton { +public: + static inline T get(void){ + return get_singleton() -> ptr; + } + static inline void set(T p){ + get_singleton() -> ptr = p; + } +private: + inline JSONSingleton() : ptr(NULL) { } + JSONSingleton(const JSONSingleton &); + JSONSingleton operator = (const JSONSingleton &); + static inline JSONSingleton * get_singleton(void){ + static JSONSingleton instance; + return &instance; + } + T ptr; +}; + +#endif diff --git a/libjson/_internal/Source/JSONStats.h b/libjson/_internal/Source/JSONStats.h new file mode 100644 index 0000000..31c9c2c --- /dev/null +++ b/libjson/_internal/Source/JSONStats.h @@ -0,0 +1,83 @@ +#ifndef TestSuite_JSONStats_h +#define TestSuite_JSONStats_h + +#include "../../JSONOptions.h" + +#if defined(JSON_UNIT_TEST) || defined(JSON_DEBUG) + #define LIBJSON_OBJECT(name)\ + static size_t & getCtorCounter(void){\ + static size_t count = 0;\ + static int i = JSONStats::setCallbacks(getCtorCounter, getCopyCtorCounter, getAssignmentCounter, getDtorCounter, #name);\ + return count;\ + }\ + static size_t & getCopyCtorCounter(void){\ + static size_t count = 0;\ + static int i = JSONStats::setCallbacks(getCtorCounter, getCopyCtorCounter, getAssignmentCounter, getDtorCounter, #name);\ + return count;\ + }\ + static size_t & getAssignmentCounter(void){\ + static size_t count = 0;\ + static int i = JSONStats::setCallbacks(getCtorCounter, getCopyCtorCounter, getAssignmentCounter, getDtorCounter, #name);\ + return count;\ + }\ + static size_t & getDtorCounter(void){\ + static size_t count = 0;\ + static int i = JSONStats::setCallbacks(getCtorCounter, getCopyCtorCounter, getAssignmentCounter, getDtorCounter, #name);\ + return count;\ + } + #define LIBJSON_CTOR getCtorCounter() += 1 + #define LIBJSON_COPY_CTOR getCopyCtorCounter() += 1 + #define LIBJSON_ASSIGNMENT getAssignmentCounter() += 1 + #define LIBJSON_DTOR getDtorCounter() += 1 + + #include + #include + #include + #include + class JSONStats { + public: + ~JSONStats(void){ + std::map & mymap = getMapper(); + std::map::iterator b = mymap.begin(); + std::map::iterator e = mymap.end(); + std::cout << "Counters for libjson:" << std::endl; + for(; b != e; ++b){ + std::cout << " " << b -> second -> _name << std::endl; + std::cout << " Constructor: " << b -> second -> _cTor() << std::endl; + std::cout << " Copy Constructor: " << b -> second -> _ccTor() << std::endl; + std::cout << " Assignment: " << b -> second -> _assign() << std::endl; + std::cout << " Destructor: " << b -> second -> _dTor() << std::endl; + delete b -> second; + } + } + + typedef size_t & (*getCounter_m)(void); + struct objectStructure { + objectStructure(getCounter_m cTor, getCounter_m ccTor, getCounter_m assign, getCounter_m dTor, const std::string & name): + _cTor(cTor), _ccTor(ccTor), _assign(assign), _dTor(dTor), _name(name){} + std::string _name; + getCounter_m _cTor; + getCounter_m _ccTor; + getCounter_m _assign; + getCounter_m _dTor; + }; + static int setCallbacks(getCounter_m cTor, getCounter_m ccTor, getCounter_m assign, getCounter_m dtor, const std::string & name){ + getMapper()[cTor] = new objectStructure (cTor, ccTor, assign, dtor, name); + return 0; + } + + static std::map & getMapper(void) { + static std::map mymap; + return mymap; + } + }; +#else + #define LIBJSON_OBJECT(name) + #define LIBJSON_CTOR (void)0 + #define LIBJSON_DTOR (void)0 + #define LIBJSON_COPY_CTOR (void)0 + #define LIBJSON_ASSIGNMENT (void)0 + typedef int JSONStats; +#endif + +#endif diff --git a/libjson/_internal/Source/JSONStream.cpp b/libjson/_internal/Source/JSONStream.cpp new file mode 100644 index 0000000..9630d90 --- /dev/null +++ b/libjson/_internal/Source/JSONStream.cpp @@ -0,0 +1,143 @@ +#include "JSONStream.h" + +#ifdef JSON_STREAM +#include "JSONWorker.h" +#include "JSONValidator.h" + + +JSONStream::JSONStream(json_stream_callback_t call_p, json_stream_e_callback_t call_e, void * callbackIdentifier) json_nothrow : state(true), call(call_p), err_call(call_e), buffer(), callback_identifier(callbackIdentifier) { + LIBJSON_CTOR; +} + +JSONStream::JSONStream(const JSONStream & orig) json_nothrow : state(orig.state), call(orig.call), err_call(orig.err_call), buffer(orig.buffer), callback_identifier(orig.callback_identifier){ + LIBJSON_COPY_CTOR; +} + +JSONStream & JSONStream::operator =(const JSONStream & orig) json_nothrow { + LIBJSON_ASSIGNMENT; + err_call = orig.err_call; + call = orig.call; + state = orig.state; + buffer = orig.buffer; + callback_identifier = orig.callback_identifier; + return *this; +} + +#ifdef JSON_LIBRARY + JSONStream & JSONStream::operator << (const json_char * str) json_nothrow { +#else + JSONStream & JSONStream::operator << (const json_string & str) json_nothrow { +#endif + if (state){ + buffer += str; + parse(); + } + return *this; +} + + +#define QUOTECASE_STREAM()\ + case JSON_TEXT('\"'):\ + while (*(++p) != JSON_TEXT('\"')){\ + if (json_unlikely(*p == JSON_TEXT('\0'))) return json_string::npos;\ + }\ + break; + + +#define NULLCASE_STREAM()\ + case JSON_TEXT('\0'):\ + return json_string::npos;\ + + +#define BRACKET_STREAM(left, right)\ + case left: {\ + size_t brac = 1;\ + while (brac){\ + switch (*(++p)){\ + case right:\ + --brac;\ + break;\ + case left:\ + ++brac;\ + break;\ + QUOTECASE_STREAM()\ + NULLCASE_STREAM()\ + }\ + }\ + break;}\ + case right:\ + return json_string::npos; + +#if (JSON_READ_PRIORITY == HIGH) && (!(defined(JSON_LESS_MEMORY))) + #define STREAM_FIND_NEXT_RELEVANT(ch, vt, po) FindNextRelevant(vt, po) + template + size_t JSONStream::FindNextRelevant(const json_string & value_t, const size_t pos) json_nothrow { +#else + #define STREAM_FIND_NEXT_RELEVANT(ch, vt, po) FindNextRelevant(ch, vt, po) + size_t JSONStream::FindNextRelevant(json_char ch, const json_string & value_t, const size_t pos) json_nothrow { +#endif + const json_char * start = value_t.c_str(); + for (const json_char * p = start + pos; *p; ++p){ + if (json_unlikely(*p == ch)) return p - start; + switch (*p){ + BRACKET_STREAM(JSON_TEXT('['), JSON_TEXT(']')) + BRACKET_STREAM(JSON_TEXT('{'), JSON_TEXT('}')) + QUOTECASE_STREAM() + } + }; + return json_string::npos; +} + +void JSONStream::parse(void) json_nothrow { + #ifdef JSON_SECURITY_MAX_STREAM_OBJECTS + size_t objects = 0; + #endif + for(;;){ + size_t pos = buffer.find_first_of(JSON_TEXT("{[")); + if (json_likely(pos != json_string::npos)){ + size_t end = (buffer[pos] == JSON_TEXT('[')) ? STREAM_FIND_NEXT_RELEVANT(JSON_TEXT(']'), buffer, pos + 1) : STREAM_FIND_NEXT_RELEVANT(JSON_TEXT('}'), buffer, pos + 1); + if (end != json_string::npos){ + #ifdef JSON_SECURITY_MAX_STREAM_OBJECTS + if (++objects > JSON_SECURITY_MAX_STREAM_OBJECTS){ + JSON_FAIL(JSON_TEXT("Maximum number of json objects for a stream at once has been reached")); + if (err_call) err_call(getIdentifier()); + state = false; + return; + } + #endif + START_MEM_SCOPE + JSONNode temp(JSONWorker::parse(buffer.substr(pos, end - pos + 1))); + #ifndef JSON_LIBRARY + call(temp, getIdentifier()); + #else + call(&temp, getIdentifier()); + #endif + END_MEM_SCOPE + json_string::iterator beginning = buffer.begin(); + buffer.erase(beginning, beginning + end); + continue; //parse(); //parse the next object too + } + #ifdef JSON_SAFE + else { + //verify that what's in there is at least valid so far + #ifndef JSON_VALIDATE + #error In order to use safe mode and streams, JSON_VALIDATE needs to be defined + #endif + + json_auto s; + size_t len; + s.set(JSONWorker::RemoveWhiteSpace(json_string(buffer.c_str() + pos), len, false)); + + + if (!JSONValidator::isValidPartialRoot(s.ptr)){ + if (err_call) err_call(getIdentifier()); + state = false; + } + } + #endif + } + break; + } +} + +#endif diff --git a/libjson/_internal/Source/JSONStream.h b/libjson/_internal/Source/JSONStream.h new file mode 100644 index 0000000..cfdbe2a --- /dev/null +++ b/libjson/_internal/Source/JSONStream.h @@ -0,0 +1,93 @@ +#ifndef LIBJSON_GUARD_STREAM_H +#define LIBJSON_GUARD_STREAM_H + +#include "JSONDebug.h" + +#ifdef JSON_STREAM + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(push, 1) + #elif _MSC_VER + #pragma pack(push, JSONStream_pack, 1) + #endif +#endif + +#ifdef JSON_MEMORY_CALLBACKS +#include "JSONMemory.h" +#endif + +#ifndef JSON_LIBRARY +class JSONNode; //foreward declaration +typedef void (*json_stream_callback_t)(JSONNode &, void *); +#endif + +class JSONStream { +public: + LIBJSON_OBJECT(JSONStream); + JSONStream(json_stream_callback_t call_p, json_stream_e_callback_t call_e = NULL, void * callbackIdentifier = JSONSTREAM_SELF) json_nothrow; + JSONStream(const JSONStream & orig) json_nothrow; + JSONStream & operator =(const JSONStream & orig) json_nothrow; + ~JSONStream(void) json_nothrow { LIBJSON_DTOR; } +#ifdef JSON_LIBRARY + JSONStream & operator << (const json_char * str) json_nothrow; +#else + JSONStream & operator << (const json_string & str) json_nothrow; +#endif + + static void deleteJSONStream(JSONStream * stream) json_nothrow { +#ifdef JSON_MEMORY_CALLBACKS + stream -> ~JSONStream(); + libjson_free(stream); +#else + delete stream; +#endif + } + + static JSONStream * newJSONStream(json_stream_callback_t callback, json_stream_e_callback_t call_e, void * callbackIdentifier) json_nothrow { +#ifdef JSON_MEMORY_CALLBACKS + return new(json_malloc(1)) JSONStream(callback, call_e, callbackIdentifier); +#else + return new JSONStream(callback, call_e, callbackIdentifier); +#endif + } + + inline void reset() json_nothrow { + state = true; + buffer.clear(); + } +JSON_PRIVATE + inline void * getIdentifier(void) json_nothrow { + if (callback_identifier == JSONSTREAM_SELF){ + return (void*)this; + } + return callback_identifier; + } + + #if (JSON_READ_PRIORITY == HIGH) && (!(defined(JSON_LESS_MEMORY))) + template + static size_t FindNextRelevant(const json_string & value_t, const size_t pos) json_nothrow json_read_priority; + #else + static size_t FindNextRelevant(json_char ch, const json_string & value_t, const size_t pos) json_nothrow json_read_priority; + #endif + + void parse(void) json_nothrow; + json_string buffer; + json_stream_callback_t call; + json_stream_e_callback_t err_call; + void * callback_identifier; + bool state BITS(1); +}; + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(pop) + #elif _MSC_VER + #pragma pack(pop, JSONStream_pack) + #endif +#endif + +#endif + +#endif + diff --git a/libjson/_internal/Source/JSONValidator.cpp b/libjson/_internal/Source/JSONValidator.cpp new file mode 100644 index 0000000..fd770ca --- /dev/null +++ b/libjson/_internal/Source/JSONValidator.cpp @@ -0,0 +1,404 @@ +#include "JSONValidator.h" + +#ifdef JSON_VALIDATE + +inline bool isHex(json_char c) json_pure; +inline bool isHex(json_char c) json_nothrow { + return (((c >= JSON_TEXT('0')) && (c <= JSON_TEXT('9'))) || + ((c >= JSON_TEXT('A')) && (c <= JSON_TEXT('F'))) || + ((c >= JSON_TEXT('a')) && (c <= JSON_TEXT('f')))); +} + +bool JSONValidator::isValidNumber(const json_char * & ptr) json_nothrow { + //ptr points at the first character in the number + //ptr will end up past the last character + bool decimal = false; + bool scientific = false; + + //first letter is weird + switch(*ptr){ + #ifndef JSON_STRICT + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('+'): + #endif + case JSON_TEXT('-'): + #ifdef JSON_STRICT + switch(*(ptr + 1)){ + case '.': + case 'e': + case 'E': + case '\0': + return false; + } + break; + #endif + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + case JSON_TEXT('0'): + ++ptr; + switch(*ptr){ + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + scientific = true; + ++ptr; + switch(*ptr){ + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('-'): + case JSON_TEXT('+'): + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + break; + #ifndef JSON_STRICT + case JSON_TEXT('x'): + while(isHex(*++ptr)){}; + return true; + #ifdef JSON_OCTAL + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('7'): //octal + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + #endif + while((*++ptr >= JSON_TEXT('0')) && (*ptr <= JSON_TEXT('7'))){}; + return ((*ptr != JSON_TEXT('8')) && (*ptr != JSON_TEXT('9'))); + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + #else + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + #endif + #else + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + #endif + default: //just a 0 + return true; + } + break; + default: + return false; + } + ++ptr; + + //next digits + while (true){ + switch(*ptr){ + case JSON_TEXT('.'): + if (json_unlikely(decimal)) return false; //multiple decimals + if (json_unlikely(scientific)) return false; + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + if (json_likely(scientific)) return false; + scientific = true; + ++ptr; + switch(*ptr){ + case JSON_TEXT('-'): + case JSON_TEXT('+'): + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + default: + return false; + } + break; + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('9'): + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + #endif + break; + default: + return true; + } + ++ptr; + } + return false; +} + +#ifndef JSON_STRICT + #define LETTERCASE(x, y)\ + case JSON_TEXT(x):\ + case JSON_TEXT(y) + #define LETTERCHECK(x, y)\ + if (json_unlikely((*++ptr != JSON_TEXT(x)) && (*ptr != JSON_TEXT(y)))) return false +#else + #define LETTERCASE(x, y)\ + case JSON_TEXT(x) + #define LETTERCHECK(x, y)\ + if (json_unlikely(*++ptr != JSON_TEXT(x))) return false +#endif +bool JSONValidator::isValidMember(const json_char * & ptr DEPTH_PARAM) json_nothrow { + //ptr is on the first character of the member + //ptr will end up immediately after the last character in the member + switch(*ptr){ + case JSON_TEXT('\"'): + return isValidString(++ptr); + case JSON_TEXT('{'): + INC_DEPTH(); + return isValidObject(++ptr DEPTH_ARG(depth_param)); + case JSON_TEXT('['): + INC_DEPTH(); + return isValidArray(++ptr DEPTH_ARG(depth_param)); + LETTERCASE('t', 'T'): + LETTERCHECK('r', 'R'); + LETTERCHECK('u', 'U'); + LETTERCHECK('e', 'E'); + ++ptr; + return true; + LETTERCASE('f', 'F'): + LETTERCHECK('a', 'A'); + LETTERCHECK('l', 'L'); + LETTERCHECK('s', 'S'); + LETTERCHECK('e', 'E'); + ++ptr; + return true; + LETTERCASE('n', 'N'): + LETTERCHECK('u', 'U'); + LETTERCHECK('l', 'L'); + LETTERCHECK('l', 'L'); + ++ptr; + return true; + #ifndef JSON_STRICT + case JSON_TEXT('}'): //null in libjson + case JSON_TEXT(']'): //null in libjson + case JSON_TEXT(','): //null in libjson + return true; + #endif + case JSON_TEXT('\0'): + return false; + } + //a number + return isValidNumber(ptr); +} + +bool JSONValidator::isValidString(const json_char * & ptr) json_nothrow { + //ptr is pointing to the first character after the quote + //ptr will end up behind the closing " + while(true){ + switch(*ptr){ + case JSON_TEXT('\\'): + switch(*(++ptr)){ + case JSON_TEXT('\"'): + case JSON_TEXT('\\'): + case JSON_TEXT('/'): + case JSON_TEXT('b'): + case JSON_TEXT('f'): + case JSON_TEXT('n'): + case JSON_TEXT('r'): + case JSON_TEXT('t'): + break; + case JSON_TEXT('u'): + if (json_unlikely(!isHex(*++ptr))) return false; + if (json_unlikely(!isHex(*++ptr))) return false; + //fallthrough to \x + #ifndef JSON_STRICT + case JSON_TEXT('x'): //hex + #endif + if (json_unlikely(!isHex(*++ptr))) return false; + if (json_unlikely(!isHex(*++ptr))) return false; + break; + #ifdef JSON_OCTAL + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('7'): //octal + #else + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + #endif + if (json_unlikely((*++ptr < JSON_TEXT('0')) || (*ptr > JSON_TEXT('7')))) return false; + if (json_unlikely((*++ptr < JSON_TEXT('0')) || (*ptr > JSON_TEXT('7')))) return false; + break; + #endif + default: + return false; + } + break; + case JSON_TEXT('\"'): + ++ptr; + return true; + case JSON_TEXT('\0'): + return false; + } + ++ptr; + } + return false; +} + +bool JSONValidator::isValidNamedObject(const json_char * &ptr DEPTH_PARAM) json_nothrow { + if (json_unlikely(!isValidString(++ptr))) return false; + if (json_unlikely(*ptr++ != JSON_TEXT(':'))) return false; + if (json_unlikely(!isValidMember(ptr DEPTH_ARG(depth_param)))) return false; + switch(*ptr){ + case JSON_TEXT(','): + return isValidNamedObject(++ptr DEPTH_ARG(depth_param)); + case JSON_TEXT('}'): + ++ptr; + return true; + default: + return false; + } +} + +bool JSONValidator::isValidObject(const json_char * & ptr DEPTH_PARAM) json_nothrow { + //ptr should currently be pointing past the {, so this must be the start of a name, or the closing } + //ptr will end up past the last } + do{ + switch(*ptr){ + case JSON_TEXT('\"'): + return isValidNamedObject(ptr DEPTH_ARG(depth_param)); + case JSON_TEXT('}'): + ++ptr; + return true; + default: + return false; + } + } while (*++ptr); + return false; +} + +bool JSONValidator::isValidArray(const json_char * & ptr DEPTH_PARAM) json_nothrow { + //ptr should currently be pointing past the [, so this must be the start of a member, or the closing ] + //ptr will end up past the last ] + do{ + switch(*ptr){ + case JSON_TEXT(']'): + ++ptr; + return true; + default: + if (json_unlikely(!isValidMember(ptr DEPTH_ARG(depth_param)))) return false; + switch(*ptr){ + case JSON_TEXT(','): + break; + case JSON_TEXT(']'): + ++ptr; + return true; + default: + return false; + } + break; + } + } while (*++ptr); + return false; +} + +bool JSONValidator::isValidRoot(const json_char * json) json_nothrow { + const json_char * ptr = json; + switch(*ptr){ + case JSON_TEXT('{'): + if (json_likely(isValidObject(++ptr DEPTH_ARG(1)))){ + return *ptr == JSON_TEXT('\0'); + } + return false; + case JSON_TEXT('['): + if (json_likely(isValidArray(++ptr DEPTH_ARG(1)))){ + return *ptr == JSON_TEXT('\0'); + } + return false; + } + return false; +} + +#ifdef JSON_STREAM +//It has already been checked for a complete structure, so we know it's not complete +bool JSONValidator::isValidPartialRoot(const json_char * json) json_nothrow { + const json_char * ptr = json; + switch(*ptr){ + case JSON_TEXT('{'): + JSON_ASSERT_SAFE(!isValidObject(++ptr DEPTH_ARG(1)), JSON_TEXT("Partial Object seems to be valid"), ); + return *ptr == JSON_TEXT('\0'); + case JSON_TEXT('['): + JSON_ASSERT_SAFE(!isValidArray(++ptr DEPTH_ARG(1)), JSON_TEXT("Partial Object seems to be valid"), ); + return *ptr == JSON_TEXT('\0'); + } + return false; +} +#endif + +#endif diff --git a/libjson/_internal/Source/JSONValidator.h b/libjson/_internal/Source/JSONValidator.h new file mode 100644 index 0000000..37f58dc --- /dev/null +++ b/libjson/_internal/Source/JSONValidator.h @@ -0,0 +1,40 @@ +#ifndef JSON_VALIDATOR_H +#define JSON_VALIDATOR_H + +#include "JSONDebug.h" + +#ifdef JSON_VALIDATE + +#ifdef JSON_SECURITY_MAX_NEST_LEVEL + #define DEPTH_PARAM ,size_t depth_param + #define DEPTH_ARG(arg) ,arg + #define INC_DEPTH()\ + if (++depth_param > JSON_SECURITY_MAX_NEST_LEVEL){\ + JSON_FAIL(JSON_TEXT("Exceeded JSON_SECURITY_MAX_NEST_LEVEL"));\ + return false;\ + } +#else + #define DEPTH_PARAM + #define DEPTH_ARG(arg) + #define INC_DEPTH() (void)0 +#endif + +class JSONValidator { + public: + static bool isValidNumber(const json_char * & ptr) json_nothrow json_read_priority; + static bool isValidMember(const json_char * & ptr DEPTH_PARAM) json_nothrow json_read_priority; + static bool isValidString(const json_char * & ptr) json_nothrow json_read_priority; + static bool isValidNamedObject(const json_char * & ptr DEPTH_PARAM) json_nothrow json_read_priority; + static bool isValidObject(const json_char * & ptr DEPTH_PARAM) json_nothrow json_read_priority; + static bool isValidArray(const json_char * & ptr DEPTH_PARAM) json_nothrow json_read_priority; + static bool isValidRoot(const json_char * json) json_nothrow json_read_priority; + #ifdef JSON_STREAM + static bool isValidPartialRoot(const json_char * json) json_nothrow json_read_priority; + #endif + private: + JSONValidator(void); +}; + +#endif + +#endif diff --git a/libjson/_internal/Source/JSONWorker.cpp b/libjson/_internal/Source/JSONWorker.cpp new file mode 100644 index 0000000..2f781bd --- /dev/null +++ b/libjson/_internal/Source/JSONWorker.cpp @@ -0,0 +1,674 @@ +#include "JSONWorker.h" + +bool used_ascii_one = false; //used to know whether or not to check for intermediates when writing, once flipped, can't be unflipped +inline json_char ascii_one(void) json_nothrow { + used_ascii_one = true; + return JSON_TEXT('\1'); +} + +#ifdef JSON_READ_PRIORITY + +JSONNode JSONWorker::parse(const json_string & json) json_throws(std::invalid_argument) { + json_auto s; + size_t len; + s.set(RemoveWhiteSpace(json, len, true)); + return _parse_unformatted(s.ptr, s.ptr + len); +} + +JSONNode JSONWorker::parse_unformatted(const json_string & json) json_throws(std::invalid_argument) { + #if defined JSON_DEBUG || defined JSON_SAFE + #ifndef JSON_NO_EXCEPTIONS + JSON_ASSERT_SAFE((json[0] == JSON_TEXT('{')) || (json[0] == JSON_TEXT('[')), JSON_TEXT("Not JSON!"), throw std::invalid_argument(json_global(EMPTY_STD_STRING));); + #else + JSON_ASSERT_SAFE((json[0] == JSON_TEXT('{')) || (json[0] == JSON_TEXT('[')), JSON_TEXT("Not JSON!"), return JSONNode(JSON_NULL);); + #endif + #endif + return _parse_unformatted(json.data(), json.data() + json.length()); +} + +JSONNode JSONWorker::_parse_unformatted(const json_char * json, const json_char * const end) json_throws(std::invalid_argument) { + #ifdef JSON_COMMENTS + json_char firstchar = *json; + json_string _comment; + json_char * runner = (json_char*)json; + if (json_unlikely(firstchar == JSON_TEMP_COMMENT_IDENTIFIER)){ //multiple comments will be consolidated into one + newcomment: + while(*(++runner) != JSON_TEMP_COMMENT_IDENTIFIER){ + JSON_ASSERT(runner != end, JSON_TEXT("Removing white space failed")); + _comment += *runner; + } + firstchar = *(++runner); //step past the trailing tag + if (json_unlikely(firstchar == JSON_TEMP_COMMENT_IDENTIFIER)){ + _comment += JSON_TEXT('\n'); + goto newcomment; + } + } + #else + const json_char firstchar = *json; + #endif + + switch (firstchar){ + case JSON_TEXT('{'): + case JSON_TEXT('['): + #if defined JSON_DEBUG || defined JSON_SAFE + if (firstchar == JSON_TEXT('[')){ + if (json_unlikely(*(end - 1) != JSON_TEXT(']'))){ + JSON_FAIL(JSON_TEXT("Missing final ]")); + break; + } + } else { + if (json_unlikely(*(end - 1) != JSON_TEXT('}'))){ + JSON_FAIL(JSON_TEXT("Missing final }")); + break; + } + } + #endif + #ifdef JSON_COMMENTS + JSONNode foo(json_string(runner, end - runner)); + foo.set_comment(_comment); + return JSONNode(true, foo); //forces it to simply return the original interal, even with ref counting off + #else + return JSONNode(json_string(json, end - json)); + #endif + } + + JSON_FAIL(JSON_TEXT("Not JSON!")); + #ifndef JSON_NO_EXCEPTIONS + throw std::invalid_argument(json_global(EMPTY_STD_STRING)); + #else + return JSONNode(JSON_NULL); + #endif +} +#endif + +#define QUOTECASE()\ + case JSON_TEXT('\"'):\ + while (*(++p) != JSON_TEXT('\"')){\ + JSON_ASSERT_SAFE(*p, JSON_TEXT("Null terminator inside of a quotation"), return json_string::npos;);\ + }\ + break; + +#if defined(JSON_DEBUG) || defined(JSON_SAFE) + #define NULLCASE(error)\ + case JSON_TEXT('\0'):\ + JSON_FAIL_SAFE(error, return json_string::npos;);\ + break; +#else + #define NULLCASE(error) +#endif + +#define BRACKET(left, right)\ + case left: {\ + size_t brac = 1;\ + while (brac){\ + switch (*(++p)){\ + case right:\ + --brac;\ + break;\ + case left:\ + ++brac;\ + break;\ + QUOTECASE()\ + NULLCASE(JSON_TEXT("Null terminator inside of a bracket"))\ + }\ + }\ + break;}\ + case right:\ + return json_string::npos; + + + +#if defined(JSON_READ_PRIORITY) || defined(JSON_STREAM) + #if (JSON_READ_PRIORITY == HIGH) && (!(defined(JSON_LESS_MEMORY))) + #define FIND_NEXT_RELEVANT(ch, vt, po) JSONWorker::FindNextRelevant(vt, po) + template + size_t JSONWorker::FindNextRelevant(const json_string & value_t, const size_t pos) json_nothrow { + #else + #define FIND_NEXT_RELEVANT(ch, vt, po) JSONWorker::FindNextRelevant(ch, vt, po) + size_t JSONWorker::FindNextRelevant(json_char ch, const json_string & value_t, const size_t pos) json_nothrow { + #endif + json_string::const_iterator start = value_t.begin(); + json_string::const_iterator e = value_t.end(); + for (json_string::const_iterator p = value_t.begin() + pos; p != e; ++p){ + if (json_unlikely(*p == ch)) return p - start; + switch (*p){ + BRACKET(JSON_TEXT('['), JSON_TEXT(']')) + BRACKET(JSON_TEXT('{'), JSON_TEXT('}')) + QUOTECASE() + } + }; + return json_string::npos; + } +#endif + +#ifdef JSON_COMMENTS + #define COMMENT_DELIMITER() *runner++ = JSON_TEMP_COMMENT_IDENTIFIER + #define AND_RUNNER ,runner + inline void SingleLineComment(const json_char * & p, const json_char * const end, json_char * & runner) json_nothrow { + //It is okay to add two '\5' characters here because at minimun the # and '\n' are replaced, so it's at most the same size + COMMENT_DELIMITER(); + while((++p != end) && (*p != JSON_TEXT('\n'))){ + *runner++ = *p; + } + COMMENT_DELIMITER(); + } +#else + #define COMMENT_DELIMITER() (void)0 + #define AND_RUNNER +#endif + +#ifndef JSON_STRICT +inline void SingleLineComment(const json_char * & p, const json_char * const end) json_nothrow { + while((++p != end) && (*p != JSON_TEXT('\n'))); +} +#endif + +#if defined(JSON_LESS_MEMORY) && defined(JSON_READ_PRIORITY) + #define PRIVATE_REMOVEWHITESPACE(T, value_t, escapeQuotes, len) private_RemoveWhiteSpace(T, value_t, escapeQuotes, len) + json_char * private_RemoveWhiteSpace(bool T, const json_string & value_t, bool escapeQuotes, size_t & len) json_nothrow { +#else + #define PRIVATE_REMOVEWHITESPACE(T, value_t, escapeQuotes, len) private_RemoveWhiteSpace(value_t, escapeQuotes, len) + template + json_char * private_RemoveWhiteSpace(const json_string & value_t, bool escapeQuotes, size_t & len) json_nothrow { +#endif + json_char * result; + json_char * runner = result = json_malloc(value_t.length() + 1); //dealing with raw memory is faster than adding to a json_string + JSON_ASSERT(result != 0, json_global(ERROR_OUT_OF_MEMORY)); + const json_char * const end = value_t.data() + value_t.length(); + for(const json_char * p = value_t.data(); p != end; ++p){ + switch(*p){ + case JSON_TEXT(' '): //defined as white space + case JSON_TEXT('\t'): //defined as white space + case JSON_TEXT('\n'): //defined as white space + case JSON_TEXT('\r'): //defined as white space + break; + #ifndef JSON_STRICT + case JSON_TEXT('/'): //a C comment + if (*(++p) == JSON_TEXT('*')){ //a multiline comment + if (T) COMMENT_DELIMITER(); + while ((*(++p) != JSON_TEXT('*')) || (*(p + 1) != JSON_TEXT('/'))){ + if(p == end){ + COMMENT_DELIMITER(); + goto endofrunner; + } + if (T) *runner++ = *p; + } + ++p; + if (T) COMMENT_DELIMITER(); + break; + } + //Should be a single line C comment, so let it fall through to use the bash comment stripper + JSON_ASSERT_SAFE(*p == JSON_TEXT('/'), JSON_TEXT("stray / character, not quoted, or a comment"), goto endofrunner;); + case JSON_TEXT('#'): //a bash comment + if (T){ + SingleLineComment(p, end AND_RUNNER); + } else { + SingleLineComment(p, end); + } + break; + #endif + case JSON_TEXT('\"'): //a quote + *runner++ = JSON_TEXT('\"'); + while(*(++p) != JSON_TEXT('\"')){ //find the end of the quotation, as white space is preserved within it + if(p == end) goto endofrunner; + switch(*p){ + case JSON_TEXT('\\'): + *runner++ = JSON_TEXT('\\'); + if (escapeQuotes){ + *runner++ = (*++p == JSON_TEXT('\"')) ? ascii_one() : *p; //an escaped quote will reak havoc will all of my searching functions, so change it into an illegal character in JSON for convertion later on + } else { + *runner++ = *++p; + } + break; + default: + *runner++ = *p; + break; + } + } + //no break, let it fall through so that the trailing quote gets added + default: + JSON_ASSERT_SAFE((json_uchar)*p >= 32, JSON_TEXT("Invalid JSON character detected (lo)"), goto endofrunner;); + JSON_ASSERT_SAFE((json_uchar)*p <= 126, JSON_TEXT("Invalid JSON character detected (hi)"), goto endofrunner;); + *runner++ = *p; + break; + } + } + endofrunner: + len = runner - result; + return result; +} + +#ifdef JSON_READ_PRIORITY + json_char * JSONWorker::RemoveWhiteSpace(const json_string & value_t, size_t & len, bool escapeQuotes) json_nothrow { + json_char * result = PRIVATE_REMOVEWHITESPACE(true, value_t, escapeQuotes, len); + result[len] = JSON_TEXT('\0'); + return result; + } +#endif + +json_char * JSONWorker::RemoveWhiteSpaceAndCommentsC(const json_string & value_t, bool escapeQuotes) json_nothrow { + size_t len; + json_char * result = PRIVATE_REMOVEWHITESPACE(false, value_t, escapeQuotes, len); + result[len] = JSON_TEXT('\0'); + return result; +} + +json_string JSONWorker::RemoveWhiteSpaceAndComments(const json_string & value_t, bool escapeQuotes) json_nothrow { + json_auto s; + size_t len; + s.set(PRIVATE_REMOVEWHITESPACE(false, value_t, escapeQuotes, len)); + return json_string(s.ptr, len); +} + +#ifdef JSON_READ_PRIORITY +/* + These three functions analyze json_string literals and convert them into std::strings + This includes dealing with special characters and utf characters + */ +#ifdef JSON_UNICODE + inline json_uchar SurrogatePair(const json_uchar hi, const json_uchar lo) json_pure; + inline json_uchar SurrogatePair(const json_uchar hi, const json_uchar lo) json_nothrow { + JSON_ASSERT(sizeof(unsigned int) == 4, JSON_TEXT("size of unsigned int is not 32-bit")); + JSON_ASSERT(sizeof(json_uchar) == 4, JSON_TEXT("size of json_char is not 32-bit")); + return (((hi << 10) & 0x1FFC00) + 0x10000) | lo & 0x3FF; + } + + void JSONWorker::UTF(const json_char * & pos, json_string & result, const json_char * const end) json_nothrow { + JSON_ASSERT_SAFE(((long)end - (long)pos) > 4, JSON_TEXT("UTF will go out of bounds"), return;); + json_uchar first = UTF8(pos, end); + if (json_unlikely((first > 0xD800) && (first < 0xDBFF) && + (*(pos + 1) == '\\') && (*(pos + 2) == 'u'))){ + const json_char * original_pos = pos; //if the 2nd character is not correct I need to roll back the iterator + pos += 2; + json_uchar second = UTF8(pos, end); + //surrogate pair, not two characters + if (json_unlikely((second > 0xDC00) && (second < 0xDFFF))){ + result += SurrogatePair(first, second); + } else { + pos = original_pos; + } + } else { + result += first; + } + } +#endif + +json_uchar JSONWorker::UTF8(const json_char * & pos, const json_char * const end) json_nothrow { + JSON_ASSERT_SAFE(((long)end - (long)pos) > 4, JSON_TEXT("UTF will go out of bounds"), return JSON_TEXT('\0');); + #ifdef JSON_UNICODE + ++pos; + json_uchar temp = Hex(pos) << 8; + ++pos; + return temp | Hex(pos); + #else + JSON_ASSERT(*(pos + 1) == JSON_TEXT('0'), JSON_TEXT("wide utf character (hihi)")); + JSON_ASSERT(*(pos + 2) == JSON_TEXT('0'), JSON_TEXT("wide utf character (hilo)")); + pos += 3; + return Hex(pos); + #endif +} + + +json_char JSONWorker::Hex(const json_char * & pos) json_nothrow { + /* + takes the numeric value of the next two characters and convert them + \u0058 becomes 0x58 + + In case of \u, it's SpecialChar's responsibility to move past the first two chars + as this method is also used for \x + */ + //First character + json_uchar hi = *pos++ - 48; + if (hi > 48){ //A-F don't immediately follow 0-9, so have to pull them down a little + hi -= 39; + } else if (hi > 9){ //neither do a-f + hi -= 7; + } + //second character + json_uchar lo = *pos - 48; + if (lo > 48){ //A-F don't immediately follow 0-9, so have to pull them down a little + lo -= 39; + } else if (lo > 9){ //neither do a-f + lo -= 7; + } + //combine them + return (json_char)((hi << 4) | lo); +} + +#ifndef JSON_STRICT + inline json_char FromOctal(const json_char * & str, const json_char * const end) json_nothrow { + JSON_ASSERT_SAFE(((long)end - (long)str) > 3, JSON_TEXT("Octal will go out of bounds"), return JSON_TEXT('\0');); + str += 2; + return (json_char)(((((json_uchar)(*(str - 2) - 48))) << 6) | (((json_uchar)(*(str - 1) - 48)) << 3) | ((json_uchar)(*str - 48))); + } +#endif + +void JSONWorker::SpecialChar(const json_char * & pos, const json_char * const end, json_string & res) json_nothrow { + JSON_ASSERT_SAFE(pos != end, JSON_TEXT("Special char termantion"), return;); + /* + Since JSON uses forward slash escaping for special characters within strings, I have to + convert these escaped characters into C characters + */ + switch(*pos){ + case JSON_TEXT('\1'): //quote character (altered by RemoveWhiteSpace) + res += JSON_TEXT('\"'); + break; + case JSON_TEXT('t'): //tab character + res += JSON_TEXT('\t'); + break; + case JSON_TEXT('n'): //newline character + res += JSON_TEXT('\n'); + break; + case JSON_TEXT('r'): //return character + res += JSON_TEXT('\r'); + break; + case JSON_TEXT('\\'): //backslash + res += JSON_TEXT('\\'); + break; + case JSON_TEXT('/'): //forward slash + res += JSON_TEXT('/'); + break; + case JSON_TEXT('b'): //backspace + res += JSON_TEXT('\b'); + break; + case JSON_TEXT('f'): //formfeed + res += JSON_TEXT('\f'); + break; + case JSON_TEXT('v'): //vertical tab + res += JSON_TEXT('\v'); + break; + case JSON_TEXT('u'): //utf character + #ifdef JSON_UNICODE + UTF(pos, res, end); + #else + res += UTF8(pos, end); + #endif + break; + #ifndef JSON_STRICT + case JSON_TEXT('x'): //hexidecimal ascii code + JSON_ASSERT_SAFE(((long)end - (long)pos) > 3, JSON_TEXT("Hex will go out of bounds"), res += JSON_TEXT('\0'); return;); + res += Hex(++pos); + break; + + #ifdef __GNUC__ + case JSON_TEXT('0') ... JSON_TEXT('7'): + #else + //octal encoding + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + #endif + res += FromOctal(pos, end); + break; + default: + res += *pos; + break; + #elif defined(JSON_DEBUG) + default: + JSON_FAIL(JSON_TEXT("Unsupported escaped character")); + break; + #endif + } +} + +#ifdef JSON_LESS_MEMORY + inline void doflag(const internalJSONNode * flag, bool which, bool x) json_nothrow { + if (json_likely(which)){ + flag -> _name_encoded = x; + } else { + flag -> _string_encoded = x; + } + } + + json_string JSONWorker::FixString(const json_string & value_t, const internalJSONNode * flag, bool which) json_nothrow { + #define setflag(x) doflag(flag, which, x) +#else + json_string JSONWorker::FixString(const json_string & value_t, bool & flag) json_nothrow { + #define setflag(x) flag = x +#endif + + //Do things like unescaping + setflag(false); + json_string res; + res.reserve(value_t.length()); //since it goes one character at a time, want to reserve it first so that it doens't have to reallocating + const json_char * const end = value_t.data() + value_t.length(); + for(const json_char * p = value_t.data(); p != end; ++p){ + switch (*p){ + case JSON_TEXT('\\'): + setflag(true); + SpecialChar(++p, end, res); + break; + default: + res += *p; + break; + } + } + shrinkString(res); //because this is actually setting something to be stored, shrink it it need be + return res; +} +#endif + +#ifdef JSON_UNICODE + #ifdef JSON_ESCAPE_WRITES + json_string JSONWorker::toSurrogatePair(json_uchar C) json_nothrow { + JSON_ASSERT(sizeof(unsigned int) == 4, JSON_TEXT("size of unsigned int is not 32-bit")); + JSON_ASSERT(sizeof(unsigned short) == 2, JSON_TEXT("size of unsigned short is not 16-bit")); + JSON_ASSERT(sizeof(json_uchar) == 4, JSON_TEXT("json_char is not 32-bit")); + + //Compute the high surrogate + unsigned short HiSurrogate = 0xD800 | (((unsigned short)((unsigned int)((C >> 16) & 31)) - 1) << 6) | ((unsigned short)C) >> 10; + + //compute the low surrogate + unsigned short LoSurrogate = (unsigned short) (0xDC00 | ((unsigned short)C & 1023)); + + json_string res; + res += toUTF8(HiSurrogate); + res += toUTF8(LoSurrogate); + return res; + } + #endif +#endif + +#ifdef JSON_ESCAPE_WRITES + json_string JSONWorker::toUTF8(json_uchar p) json_nothrow { + #ifdef JSON_UNICODE + if (json_unlikely(p > 0xFFFF)) return toSurrogatePair(p); + #endif + json_string res(JSON_TEXT("\\u")); + #ifdef JSON_UNICODE + START_MEM_SCOPE + json_uchar hihi = ((p & 0xF000) >> 12) + 48; + if (hihi > 57) hihi += 7; //A-F don't immediately follow 0-9, so have to further adjust those + json_uchar hilo = ((p & 0x0F00) >> 8) + 48; + if (hilo > 57) hilo += 7; //A-F don't immediately follow 0-9, so have to further adjust those + res += hihi; + res += hilo; + END_MEM_SCOPE + json_uchar hi = ((p & 0x00F0) >> 4) + 48; + #else + res += JSON_TEXT("00"); + json_uchar hi = (p >> 4) + 48; + #endif + //convert the character to be escaped into two digits between 0 and 15 + if (hi > 57) hi += 7; //A-F don't immediately follow 0-9, so have to further adjust those + json_uchar lo = (p & 0x000F) + 48; + if (lo > 57) lo += 7; //A-F don't immediately follow 0-9, so have to further adjust those + res += hi; + res += lo; + return res; + } +#endif + +void JSONWorker::UnfixString(const json_string & value_t, bool flag, json_string & res) json_nothrow { + if (!flag){ + res += value_t; + return; + } + //Re-escapes a json_string so that it can be written out into a JSON file + const json_char * const end = value_t.data() + value_t.length(); + for(const json_char * p = value_t.data(); p != end; ++p){ + switch(*p){ + case JSON_TEXT('\"'): //quote character + res += JSON_TEXT("\\\""); + break; + case JSON_TEXT('\\'): //backslash + res += JSON_TEXT("\\\\"); + break; + #ifdef JSON_ESCAPE_WRITES + case JSON_TEXT('\t'): //tab character + res += JSON_TEXT("\\t"); + break; + case JSON_TEXT('\n'): //newline character + res += JSON_TEXT("\\n"); + break; + case JSON_TEXT('\r'): //return character + res += JSON_TEXT("\\r"); + break; + case JSON_TEXT('/'): //forward slash + res += JSON_TEXT("\\/"); + break; + case JSON_TEXT('\b'): //backspace + res += JSON_TEXT("\\b"); + break; + case JSON_TEXT('\f'): //formfeed + res += JSON_TEXT("\\f"); + break; + default: + { + if (json_unlikely(((json_uchar)(*p) < 32) || ((json_uchar)(*p) > 126))){ + res += toUTF8((json_uchar)(*p)); + } else { + res += *p; + } + } + break; + #else + default: + res += *p; + break; + #endif + } + } +} + +#ifdef JSON_READ_PRIORITY +//Create a childnode +#ifdef JSON_COMMENTS + #define ARRAY_PARAM bool array //Just to supress warnings +#else + #define ARRAY_PARAM bool +#endif +inline void JSONWorker::NewNode(const internalJSONNode * parent, const json_string & name, const json_string & value, ARRAY_PARAM) json_nothrow { + #ifdef JSON_COMMENTS + JSONNode * child; + START_MEM_SCOPE + json_string _comment; + START_MEM_SCOPE + const json_char * runner = ((array) ? value.data() : name.data()); + #ifdef JSON_DEBUG + const json_char * const end = runner + value.length(); + #endif + if (json_unlikely(*runner == JSON_TEMP_COMMENT_IDENTIFIER)){ //multiple comments will be consolidated into one + size_t count; + const json_char * start; + newcomment: + count = 0; + start = runner + 1; + while(*(++runner) != JSON_TEMP_COMMENT_IDENTIFIER){ + JSON_ASSERT(runner != end, JSON_TEXT("Removing white space failed")); + ++count; + } + if (count) _comment += json_string(start, count); + if (json_unlikely(*(++runner) == JSON_TEMP_COMMENT_IDENTIFIER)){ //step past the trailing tag + _comment += JSON_TEXT('\n'); + goto newcomment; + } + } + internalJSONNode * myinternal; + if (array){ + myinternal = internalJSONNode::newInternal(name, runner); + } else { + myinternal = internalJSONNode::newInternal(++runner, value); + } + child = JSONNode::newJSONNode(myinternal); + END_MEM_SCOPE + child -> set_comment(_comment); + END_MEM_SCOPE + const_cast(parent) -> CHILDREN -> push_back(child); //attach it to the parent node + #else + if (name.empty()){ + const_cast(parent) -> CHILDREN -> push_back(JSONNode::newJSONNode(internalJSONNode::newInternal(name, value))); //attach it to the parent node + } else { + const_cast(parent) -> CHILDREN -> push_back(JSONNode::newJSONNode(internalJSONNode::newInternal(json_string(name.begin() + 1, name.end()), value))); //attach it to the parent node + } + #endif +} + +//Create a subarray +void JSONWorker::DoArray(const internalJSONNode * parent, const json_string & value_t) json_nothrow { + //This takes an array and creates nodes out of them + JSON_ASSERT(!value_t.empty(), JSON_TEXT("DoArray is empty")); + JSON_ASSERT_SAFE(value_t[0] == JSON_TEXT('['), JSON_TEXT("DoArray is not an array"), parent -> Nullify(); return;); + if (json_unlikely(value_t.length() <= 2)) return; // just a [] (blank array) + + #ifdef JSON_SAFE + json_string newValue; //share this so it has a reserved buffer + #endif + size_t starting = 1; //ignore the [ + + //Not sure what's in the array, so we have to use commas + for(size_t ending = FIND_NEXT_RELEVANT(JSON_TEXT(','), value_t, 1); + ending != json_string::npos; + ending = FIND_NEXT_RELEVANT(JSON_TEXT(','), value_t, starting)){ + + #ifdef JSON_SAFE + newValue.assign(value_t.begin() + starting, value_t.begin() + ending); + JSON_ASSERT_SAFE(FIND_NEXT_RELEVANT(JSON_TEXT(':'), newValue, 0) == json_string::npos, JSON_TEXT("Key/Value pairs are not allowed in arrays"), parent -> Nullify(); return;); + NewNode(parent, json_global(EMPTY_JSON_STRING), newValue, true); + #else + NewNode(parent, json_global(EMPTY_JSON_STRING), json_string(value_t.begin() + starting, value_t.begin() + ending), true); + #endif + starting = ending + 1; + } + //since the last one will not find the comma, we have to add it here, but ignore the final ] + + #ifdef JSON_SAFE + newValue.assign(value_t.begin() + starting, value_t.end() - 1); + JSON_ASSERT_SAFE(FIND_NEXT_RELEVANT(JSON_TEXT(':'), newValue, 0) == json_string::npos, JSON_TEXT("Key/Value pairs are not allowed in arrays"), parent -> Nullify(); return;); + NewNode(parent, json_global(EMPTY_JSON_STRING), newValue, true); + #else + NewNode(parent, json_global(EMPTY_JSON_STRING), json_string(value_t.begin() + starting, value_t.end() - 1), true); + #endif +} + + +//Create all child nodes +void JSONWorker::DoNode(const internalJSONNode * parent, const json_string & value_t) json_nothrow { + //This take a node and creates its members and such + JSON_ASSERT(!value_t.empty(), JSON_TEXT("DoNode is empty")); + JSON_ASSERT_SAFE(value_t[0] == JSON_TEXT('{'), JSON_TEXT("DoNode is not an node"), parent -> Nullify(); return;); + if (json_unlikely(value_t.length() <= 2)) return; // just a {} (blank node) + + size_t name_ending = FIND_NEXT_RELEVANT(JSON_TEXT(':'), value_t, 1); //find where the name ends + JSON_ASSERT_SAFE(name_ending != json_string::npos, JSON_TEXT("Missing :"), parent -> Nullify(); return;); + json_string name(value_t.begin() + 1, value_t.begin() + name_ending - 1); //pull the name out + for (size_t value_ending = FIND_NEXT_RELEVANT(JSON_TEXT(','), value_t, name_ending), //find the end of the value + name_starting = 1; //ignore the { + value_ending != json_string::npos; + value_ending = FIND_NEXT_RELEVANT(JSON_TEXT(','), value_t, name_ending)){ + + NewNode(parent, name, json_string(value_t.begin() + name_ending + 1, value_t.begin() + value_ending), false); + name_starting = value_ending + 1; + name_ending = FIND_NEXT_RELEVANT(JSON_TEXT(':'), value_t, name_starting); + JSON_ASSERT_SAFE(name_ending != json_string::npos, JSON_TEXT("Missing :"), parent -> Nullify(); return;); + name.assign(value_t.begin() + name_starting, value_t.begin() + name_ending - 1); + } + //since the last one will not find the comma, we have to add it here + NewNode(parent, name, json_string(value_t.begin() + name_ending + 1, value_t.end() - 1), false); +} +#endif diff --git a/libjson/_internal/Source/JSONWorker.h b/libjson/_internal/Source/JSONWorker.h new file mode 100644 index 0000000..b8e46c5 --- /dev/null +++ b/libjson/_internal/Source/JSONWorker.h @@ -0,0 +1,65 @@ +#ifndef JSON_WORKER_H +#define JSON_WORKER_H + +#include "JSONNode.h" +#include "JSONSharedString.h" + +class JSONWorker { +public: + static json_string RemoveWhiteSpaceAndComments(const json_string & value_t, bool escapeQuotes) json_nothrow json_read_priority; + static json_char * RemoveWhiteSpaceAndCommentsC(const json_string & value_t, bool escapeQuotes) json_nothrow json_read_priority; + + #ifdef JSON_READ_PRIORITY + static JSONNode parse(const json_string & json) json_throws(std::invalid_argument) json_read_priority; + static JSONNode parse_unformatted(const json_string & json) json_throws(std::invalid_argument) json_read_priority; + + static JSONNode _parse_unformatted(const json_char * json, const json_char * const end) json_throws(std::invalid_argument) json_read_priority; + + static json_char * RemoveWhiteSpace(const json_string & value_t, size_t & len, bool escapeQuotes) json_nothrow json_read_priority; + + static void DoArray(const internalJSONNode * parent, const json_string & value_t) json_nothrow json_read_priority; + static void DoNode(const internalJSONNode * parent, const json_string & value_t) json_nothrow json_read_priority; + + #ifdef JSON_LESS_MEMORY + #define NAME_ENCODED this, true + #define STRING_ENCODED this, false + static json_string FixString(const json_string & value_t, const internalJSONNode * flag, bool which) json_nothrow json_read_priority; + #else + #define NAME_ENCODED _name_encoded + #define STRING_ENCODED _string_encoded + static json_string FixString(const json_string & value_t, bool & flag) json_nothrow json_read_priority; + #endif + #endif + + #if defined(JSON_READ_PRIORITY) || defined(JSON_STREAM) + #if (JSON_READ_PRIORITY == HIGH) && (!(defined(JSON_LESS_MEMORY))) + template + static size_t FindNextRelevant(const json_string & value_t, const size_t pos) json_nothrow json_read_priority; + #else + static size_t FindNextRelevant(json_char ch, const json_string & value_t, const size_t pos) json_nothrow json_read_priority; + #endif + #endif + static void UnfixString(const json_string & value_t, bool flag, json_string & res) json_nothrow; +JSON_PRIVATE + #ifdef JSON_READ_PRIORITY + static json_char Hex(const json_char * & pos) json_nothrow; + static json_uchar UTF8(const json_char * & pos, const json_char * const end) json_nothrow; + #endif + #ifdef JSON_ESCAPE_WRITES + static json_string toUTF8(json_uchar p) json_nothrow; + #endif + #ifdef JSON_UNICODE + static void UTF(const json_char * & pos, json_string & result, const json_char * const end) json_nothrow; + #ifdef JSON_ESCAPE_WRITES + static json_string toSurrogatePair(json_uchar pos) json_nothrow; + #endif + #endif + #ifdef JSON_READ_PRIORITY + static void SpecialChar(const json_char * & pos, const json_char * const end, json_string & res) json_nothrow; + static void NewNode(const internalJSONNode * parent, const json_string & name, const json_string & value, bool array) json_nothrow; + #endif +private: + JSONWorker(void); +}; + +#endif diff --git a/libjson/_internal/Source/JSONWriter.cpp b/libjson/_internal/Source/JSONWriter.cpp new file mode 100644 index 0000000..2933ee4 --- /dev/null +++ b/libjson/_internal/Source/JSONWriter.cpp @@ -0,0 +1,252 @@ +#include "JSONNode.h" +#ifdef JSON_WRITE_PRIORITY +#include "JSONWorker.h" +#include "JSONGlobals.h" + +extern bool used_ascii_one; + +#ifdef JSON_INDENT + inline json_string makeIndent(unsigned int amount) json_nothrow json_write_priority; + inline json_string makeIndent(unsigned int amount) json_nothrow { + if (amount == 0xFFFFFFFF) return json_global(EMPTY_JSON_STRING); + json_string result; + result.reserve(amount * json_global(INDENT).length()); + for(unsigned int i = 0; i < amount; ++i){ + result += json_global(INDENT); + } + JSON_ASSERT(result.capacity() == amount * json_global(INDENT).length(), JSON_TEXT("makeIndent made a string too big")); + return result; + } +#else + inline json_string makeIndent(unsigned int amount) json_nothrow { + if (amount == 0xFFFFFFFF) return json_global(EMPTY_JSON_STRING); + if (json_likely(amount < 8)){ + static const json_string cache[] = { + json_string(), + json_string(JSON_TEXT("\t")), + json_string(JSON_TEXT("\t\t")), + json_string(JSON_TEXT("\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t")) + }; + return cache[amount]; + } + #ifndef JSON_LESS_MEMORY + if (json_likely(amount < 16)){ + static const json_string cache[] = { + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")) + }; + return cache[amount - 8]; + } + #if JSON_WRITE_PRIORITY == HIGH + if (json_likely(amount < 24)){ + static const json_string cache[] = { + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")), + json_string(JSON_TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t")) + }; + return cache[amount - 16]; + } + #endif + #endif + return json_string(amount, JSON_TEXT('\t')); + } +#endif + +void internalJSONNode::WriteName(bool formatted, bool arrayChild, json_string & output) const json_nothrow { + if (!arrayChild){ + output += JSON_TEXT("\""); + JSONWorker::UnfixString(_name, _name_encoded, output); + output += ((formatted) ? JSON_TEXT("\" : ") : JSON_TEXT("\":")); + } +} + +void internalJSONNode::WriteChildren(unsigned int indent, json_string & output) const json_nothrow { + //Iterate through the children and write them + if (json_likely(CHILDREN -> empty())) return; + + json_string indent_plus_one; + //handle whether or not it's formatted JSON + if (indent != 0xFFFFFFFF){ //it's formatted, make the indentation strings + indent_plus_one = json_global(NEW_LINE) + makeIndent(++indent); + } + + //else it's not formatted, leave the indentation strings empty + const size_t size_minus_one = CHILDREN -> size() - 1; + size_t i = 0; + JSONNode ** it = CHILDREN -> begin(); + for(JSONNode ** it_end = CHILDREN -> end(); it != it_end; ++it, ++i){ + + output += indent_plus_one; + (*it) -> internal -> Write(indent, type() == JSON_ARRAY, output); + if (json_likely(i < size_minus_one)) output += JSON_TEXT(','); //the last one does not get a comma, but all of the others do + } + if (indent != 0xFFFFFFFF){ + output += json_global(NEW_LINE); + output += makeIndent(indent - 1); + } +} + +#ifdef JSON_ARRAY_SIZE_ON_ONE_LINE + void internalJSONNode::WriteChildrenOneLine(unsigned int indent, json_string & output) const json_nothrow { + //Iterate through the children and write them + if (json_likely(CHILDREN -> empty())) return; + if ((*CHILDREN -> begin()) -> internal -> isContainer()) return WriteChildren(indent, output); + + json_string comma(JSON_TEXT(",")); + if (indent != 0xFFFFFFFF){ + comma += JSON_TEXT(' '); + } + + //else it's not formatted, leave the indentation strings empty + const size_t size_minus_one = CHILDREN -> size() - 1; + size_t i = 0; + JSONNode ** it = CHILDREN -> begin(); + for(JSONNode ** it_end = CHILDREN -> end(); it != it_end; ++it, ++i){ + (*it) -> internal -> Write(indent, type() == JSON_ARRAY, output); + if (json_likely(i < size_minus_one)) output += comma; //the last one does not get a comma, but all of the others do + } + } +#endif + +#ifdef JSON_COMMENTS + void internalJSONNode::WriteComment(unsigned int indent, json_string & output) const json_nothrow { + if (indent == 0xFFFFFFFF) return; + if (json_likely(_comment.empty())) return; + size_t pos = _comment.find(JSON_TEXT('\n')); + + const json_string current_indent(json_global(NEW_LINE) + makeIndent(indent)); + + if (json_likely(pos == json_string::npos)){ //Single line comment + output += current_indent; + output += json_global(SINGLELINE_COMMENT); + output.append(_comment.begin(), _comment.end()); + output += current_indent; + return; + } + + /* + Multiline comments + */ + output += current_indent; + #if !(defined(JSON_WRITE_BASH_COMMENTS) || defined(JSON_WRITE_SINGLE_LINE_COMMENTS)) + const json_string current_indent_plus_one(json_global(NEW_LINE) + makeIndent(indent + 1)); + output += JSON_TEXT("/*"); + output += current_indent_plus_one; + #endif + size_t old = 0; + while(pos != json_string::npos){ + if (json_unlikely(pos && _comment[pos - 1] == JSON_TEXT('\r'))) --pos; + #if defined(JSON_WRITE_BASH_COMMENTS) || defined(JSON_WRITE_SINGLE_LINE_COMMENTS) + output += json_global(SINGLELINE_COMMENT); + #endif + output.append(_comment.begin() + old, _comment.begin() + pos); + + #if defined(JSON_WRITE_BASH_COMMENTS) || defined(JSON_WRITE_SINGLE_LINE_COMMENTS) + output += current_indent; + #else + output += current_indent_plus_one; + #endif + old = (_comment[pos] == JSON_TEXT('\r')) ? pos + 2 : pos + 1; + pos = _comment.find(JSON_TEXT('\n'), old); + } + #if defined(JSON_WRITE_BASH_COMMENTS) || defined(JSON_WRITE_SINGLE_LINE_COMMENTS) + output += json_global(SINGLELINE_COMMENT); + #endif + output.append(_comment.begin() + old, _comment.end()); + output += current_indent; + #if !(defined(JSON_WRITE_BASH_COMMENTS) || defined(JSON_WRITE_SINGLE_LINE_COMMENTS)) + output += JSON_TEXT("*/"); + output += current_indent; + #endif + } +#else + inline void internalJSONNode::WriteComment(unsigned int, json_string &) const json_nothrow {} +#endif + +void internalJSONNode::DumpRawString(json_string & output) const json_nothrow { + //first remove the \1 characters + if (used_ascii_one){ //if it hasn't been used yet, don't bother checking + json_string result(_string.begin(), _string.end()); + for(json_string::iterator beg = result.begin(), en = result.end(); beg != en; ++beg){ + if (*beg == JSON_TEXT('\1')) *beg = JSON_TEXT('\"'); + } + output += result; + return; + } else { + output.append(_string.begin(), _string.end()); + } +} + +void internalJSONNode::Write(unsigned int indent, bool arrayChild, json_string & output) const json_nothrow { + const bool formatted = indent != 0xFFFFFFFF; + WriteComment(indent, output); + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + if (!(formatted || fetched)){ //It's not formatted or fetched, just do a raw dump + WriteName(false, arrayChild, output); + //first remove the \1 characters + DumpRawString(output); + return; + } + #endif + + WriteName(formatted, arrayChild, output); + //It's either formatted or fetched + switch (_type){ + case JSON_NODE: //got members, write the members + Fetch(); + output += JSON_TEXT("{"); + WriteChildren(indent, output); + output += JSON_TEXT("}"); + return; + case JSON_ARRAY: //write out the child nodes int he array + Fetch(); + output += JSON_TEXT("["); + #ifdef JSON_ARRAY_SIZE_ON_ONE_LINE + if (size() <= JSON_ARRAY_SIZE_ON_ONE_LINE){ + WriteChildrenOneLine(indent, output); + } else { + #endif + WriteChildren(indent, output); + #ifdef JSON_ARRAY_SIZE_ON_ONE_LINE + } + #endif + output += JSON_TEXT("]"); + return; + case JSON_NUMBER: //write out a literal, without quotes + case JSON_NULL: + case JSON_BOOL: + output.append(_string.begin(), _string.end()); + return; + } + + JSON_ASSERT(_type == JSON_STRING, JSON_TEXT("Unknown json node type")); + //If it go here, then it's a json_string + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + if (json_likely(fetched)){ + #endif + output += JSON_TEXT("\""); + JSONWorker::UnfixString(_string, _string_encoded, output); //It's already been fetched, meaning that it's unescaped + output += JSON_TEXT("\""); + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + } else { + DumpRawString(output); //it hasn't yet been fetched, so it's already unescaped, just do a dump + } + #endif +} +#endif diff --git a/libjson/_internal/Source/JSON_Base64.h b/libjson/_internal/Source/JSON_Base64.h new file mode 100644 index 0000000..721fa32 --- /dev/null +++ b/libjson/_internal/Source/JSON_Base64.h @@ -0,0 +1,35 @@ +#ifndef LIBJSON_GUARD_BASE64_H +#define LIBJSON_GUARD_BASE64_H + +#include "JSONDebug.h" +#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) //if this is not needed, don't waste space compiling it + +#include "../Dependencies/libbase64++/libbase64++.h" + +class JSONBase64 { +public: + inline static json_string json_encode64(const unsigned char * binary, size_t bytes) json_nothrow json_cold; + inline static std::string json_decode64(const json_string & encoded) json_nothrow json_cold; +private: + JSONBase64(void); +}; + +json_string JSONBase64::json_encode64(const unsigned char * binary, size_t bytes) json_nothrow { + #if defined JSON_DEBUG || defined JSON_SAFE + return libbase64::encode(binary, bytes); + #else + return libbase64::encode(binary, bytes); + #endif +} + +std::string JSONBase64::json_decode64(const json_string & encoded) json_nothrow { + #if defined JSON_DEBUG || defined JSON_SAFE + return libbase64::decode(encoded); + #else + return libbase64::decode(encoded); + #endif +} + + +#endif +#endif diff --git a/libjson/_internal/Source/NumberToString.h b/libjson/_internal/Source/NumberToString.h new file mode 100644 index 0000000..913be63 --- /dev/null +++ b/libjson/_internal/Source/NumberToString.h @@ -0,0 +1,450 @@ +#ifndef NUMBERTOSTRING_H +#define NUMBERTOSTRING_H + +#include +#include "JSONDebug.h" +#ifdef JSON_LESS_MEMORY + #include "JSONMemory.h" +#endif +#include "JSONSharedString.h" +#include +#ifdef JSON_STRICT + #include +#endif +template +struct getLenSize{ + char tmp[GETLENSIZE == 16]; // compile time assertion + enum {GETLEN = 41}; +}; + +template<> +struct getLenSize<1>{ + enum {GETLEN = 5}; +}; + +template <> +struct getLenSize<2>{ + enum {GETLEN = 7}; +}; + +template <> +struct getLenSize<4>{ + enum {GETLEN = 12}; +}; + +template <> +struct getLenSize<8>{ + enum {GETLEN = 22}; +}; + +static inline bool _floatsAreEqual(const json_number & one, const json_number & two) json_pure; +static inline bool _floatsAreEqual(const json_number & one, const json_number & two) json_nothrow { + return (one > two) ? (one - two) < JSON_FLOAT_THRESHHOLD : (one - two) > -JSON_FLOAT_THRESHHOLD; +} + +#ifdef JSON_LESS_MEMORY + #define num_str_result s.ptr +#endif + +class NumberToString { +public: + template + static json_string _itoa(T val) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_auto s(getLenSize::GETLEN); + #else + json_char num_str_result[getLenSize::GETLEN]; + #endif + num_str_result[getLenSize::GETLEN - 1] = JSON_TEXT('\0'); //null terminator + json_char * runner = &num_str_result[getLenSize::GETLEN - 2]; + bool negative; + + START_MEM_SCOPE + long value = (long)val; + //first thing, check if it's negative, if so, make it positive + if (value < 0){ + value = -value; + negative = true; + } else { + negative = false; + } + + //create the string + do { + *runner-- = (json_char)(value % 10) + JSON_TEXT('0'); + } while(value /= 10); + END_MEM_SCOPE + + //if it's negative, add the negation + if (negative){ + *runner = JSON_TEXT('-'); + return json_string(runner); + } + return json_string(runner + 1); + } + + #ifndef JSON_LIBRARY + template + static json_string _uitoa(T val) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_auto s(getLenSize::GETLEN); + #else + json_char num_str_result[getLenSize::GETLEN]; + #endif + num_str_result[getLenSize::GETLEN - 1] = JSON_TEXT('\0'); //null terminator + json_char * runner = &num_str_result[getLenSize::GETLEN - 2]; + + //create the string + START_MEM_SCOPE + unsigned long value = (unsigned long)val; + do { + *runner-- = (json_char)(value % 10) + JSON_TEXT('0'); + } while(value /= 10); + END_MEM_SCOPE + + return json_string(runner + 1); + } + #endif + + #ifdef JSON_ISO_STRICT + #define EXTRA_LONG + #define FLOAT_STRING "%f" + #define LFLOAT_STRING L"%f" + #else + #define EXTRA_LONG long + #define FLOAT_STRING "%Lf" + #define LFLOAT_STRING L"%Lf" + #endif + + static json_string _ftoa(json_number value) json_nothrow { + #ifndef JSON_LIBRARY + //ScopeCoverage(_ftoa_coverage, 6); + if (json_unlikely(value >= 0.0 && _floatsAreEqual(value, (json_number)((unsigned EXTRA_LONG long)value)))){ + return _uitoa((unsigned EXTRA_LONG long)value); + } else + #else + //ScopeCoverage(_ftoa_coverage, 5); + #endif + if (json_unlikely(_floatsAreEqual(value, (json_number)((long EXTRA_LONG)value)))){ + return _itoa((long EXTRA_LONG)value); + } + + #ifdef JSON_LESS_MEMORY + json_auto s(64); + #else + json_char num_str_result[64]; + #endif + #ifdef JSON_UNICODE + std::swprintf(num_str_result, 63, LFLOAT_STRING, (EXTRA_LONG double)value); + #else + //Thanks to Salvor Hardin for this Visual C++ fix + #ifdef _MSC_VER + _snprintf_s(num_str_result, 63, 63, FLOAT_STRING, (EXTRA_LONG double)value); //yes, 63 appears twice using _snprintf_s() + #else + snprintf(num_str_result, 63, FLOAT_STRING, (EXTRA_LONG double)value); + #endif + #endif + //strip the trailing zeros + for(json_char * pos = &num_str_result[0]; *pos; ++pos){ + if (json_unlikely(*pos == '.')){ //only care about after the decimal + for(json_char * runner = pos + 1; *runner; ++runner){ + if (json_likely(*runner != JSON_TEXT('0'))){ + pos = runner + 1; //have to go to the end 1.0001 + } + } + *pos = JSON_TEXT('\0'); + break; + } + } + return json_string(num_str_result); + } + + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + static bool isNumeric(const json_string & str) json_nothrow { + const json_char * p = str.c_str(); + bool decimal = false; + bool scientific = false; + + #ifdef JSON_STRICT + bool leadingzero = false; + #endif + + //first letter is weird + switch(*p){ + case JSON_TEXT('\0'): + return false; + #ifndef JSON_STRICT + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('+'): + #endif + case JSON_TEXT('-'): + switch (*(p + 1)){ + case JSON_TEXT('.'): + case JSON_TEXT('e'): + case JSON_TEXT('E'): + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('0'): + #ifdef JSON_STRICT + switch(*(p + 2)){ + case JSON_TEXT('.'): + case JSON_TEXT('e'): + case JSON_TEXT('E'): + leadingzero = false; + break; + case JSON_TEXT('\0'): + return true; + default: + leadingzero = true; + break; + } + #endif + ++p; + break; + default: + break; + } + break; + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + case JSON_TEXT('0'): + ++p; + #ifdef JSON_STRICT + leadingzero = true; + #endif + switch(*p){ + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + #ifdef JSON_STRICT + leadingzero = false; //not leading, just a zero + #endif + scientific = true; + ++p; + switch(*p){ + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('-'): + case JSON_TEXT('+'): + #ifndef JSON_STRICT + case JSON_TEXT('0'): //cant have a leading zero in scrict + #endif + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + break; + #ifndef JSON_STRICT + case JSON_TEXT('x'): + return (str.find_first_not_of(JSON_TEXT("0123456789ABCDEFabcdef"), 2) == json_string::npos); + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + return (str.find_first_not_of(JSON_TEXT("01234567"), 1) == json_string::npos); + #endif + case JSON_TEXT('\0'): //just 0 + return true; + default: + return false; + } + break; + default: + return false; + } + ++p; + + //next digits + while (*p){ + switch(*p){ + case JSON_TEXT('.'): + if (json_unlikely(decimal)){ + return false; //multiple decimals + } + + if (json_unlikely(scientific)){ + return false; + } + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + if (json_unlikely(scientific)){ + return false; + } + scientific = true; + ++p; + switch(*p){ + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('-'): + case JSON_TEXT('+'): + if (!isdigit(*(p + 1))){ + return false; + } + + #ifdef JSON_STRICT + if (*(p + 1) == JSON_TEXT('0')){ //no leading zeros on scientific notations + return false; + } + #endif + break; + #ifndef JSON_STRICT + case JSON_TEXT('0'): //cant have a leading zero in scrict + #endif + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + break; + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + ++p; + } + #ifdef JSON_STRICT + if (leadingzero && !decimal){ + return false; + } + #endif + return true; + } + #endif + + #ifdef JSON_STRICT + //much faster because no octal or hex support + static json_number _atof (const json_char * num){ + json_number sign = (json_number)1.0; + + //sign + if (*num==JSON_TEXT('-')){ + sign = -1.0; + ++num; + } else { + } + + //skip leading zero if one + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + bool _leadingzeros = *num == JSON_TEXT('0'); + bool _leadingdigits = false; + #endif + if (*num == JSON_TEXT('0')){ + ++num; + } + #ifdef JSON_STRICT + else if (json_likely(*num < JSON_TEXT('1') || *num > JSON_TEXT('9'))){ + return std::numeric_limits::signaling_NaN(); + } + #endif + + JSON_ASSERT_SAFE(*num != JSON_TEXT('0'), JSON_TEXT("multiple leading zeros"), return std::numeric_limits::signaling_NaN(); ); + + // Number + json_number n = (json_number)0.0; + if (json_likely(*num >= JSON_TEXT('1') && *num <= JSON_TEXT('9'))){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + _leadingdigits = true; + #endif + do { + n = (n * 10.0) + (*num++ - JSON_TEXT('0')); + } while (*num >= JSON_TEXT('0') && *num <= JSON_TEXT('9')); + } else { + JSON_ASSERT_SAFE( + (*num) == JSON_TEXT('.') || //.xxx + (*num) == JSON_TEXT('e') || //0Exxx + (*num) == JSON_TEXT('E') || //0exxx + (*num) == JSON_TEXT('\0') //end of the number, just zero + , JSON_TEXT("first digit not a number, e, period, or terminator"), return std::numeric_limits::signaling_NaN(); ); + } + + // Fractional part + json_number scale = (json_number)0.0; + if (*num == JSON_TEXT('.')) { + JSON_ASSERT_SAFE(_leadingzeros || _leadingdigits, JSON_TEXT("period without leading anything"), return std::numeric_limits::signaling_NaN(); ); + ++num; + for(; *num >= JSON_TEXT('0') && *num <= JSON_TEXT('9');){ + n = (n * 10.0) + (*num++ - JSON_TEXT('0')); + --scale; + }; + } else { + JSON_ASSERT_SAFE(!_leadingzeros || n == 0, JSON_TEXT("leading zero on an int"), return std::numeric_limits::signaling_NaN(); ); + JSON_ASSERT_SAFE( + (*num) == JSON_TEXT('e') || //0Exxx + (*num) == JSON_TEXT('E') || //0exxx + (*num) == JSON_TEXT('\0') //end of the number, just zero + , JSON_TEXT("next char not an e or terminator"), return std::numeric_limits::signaling_NaN(); ); + } + + // Exponent + int subscale = 0, signsubscale = 1; + if (json_unlikely(*num == JSON_TEXT('e') || *num == JSON_TEXT('E'))){ + ++num; + switch(*num){ + case JSON_TEXT('+'): + ++num; + break; + case JSON_TEXT('-'): + signsubscale = -1; + ++num; + JSON_ASSERT_SAFE(*num != JSON_TEXT('0'), JSON_TEXT("negative cant be followed by leading zero even after E"), return std::numeric_limits::signaling_NaN(); ); + break; + default: + break; + } + JSON_ASSERT_SAFE(*num != JSON_TEXT('\0'), JSON_TEXT("no exponent for scientific notation"), return std::numeric_limits::signaling_NaN(); ); + while (*num >= JSON_TEXT('0') && *num <= JSON_TEXT('9')){ + subscale=(subscale * 10) + (*num++ - JSON_TEXT('0')); + } + } + + JSON_ASSERT_SAFE(*num == JSON_TEXT('\0'), JSON_TEXT("done with number, not at terminator"), return std::numeric_limits::signaling_NaN(); ); + return sign * n * pow((json_number)10.0, scale + subscale * signsubscale); // number = +/- number.fraction * 10^+/- exponent + } + #endif +}; + +#endif diff --git a/libjson/_internal/Source/NumberToString.h~ b/libjson/_internal/Source/NumberToString.h~ new file mode 100644 index 0000000..c7ceabd --- /dev/null +++ b/libjson/_internal/Source/NumberToString.h~ @@ -0,0 +1,450 @@ +#ifndef NUMBERTOSTRING_H +#define NUMBERTOSTRING_H + +#include +#include "JSONDebug.h" +#ifdef JSON_LESS_MEMORY + #include "JSONMemory.h" +#endif +#include "JSONSharedString.h" +#include +#ifdef JSON_STRICT + #include +#endif +template +struct getLenSize{ + char tmp[GETLENSIZE == 16]; // compile time assertion + enum {GETLEN = 41}; +}; + +template<> +struct getLenSize<1>{ + enum {GETLEN = 5}; +}; + +template <> +struct getLenSize<2>{ + enum {GETLEN = 7}; +}; + +template <> +struct getLenSize<4>{ + enum {GETLEN = 12}; +}; + +template <> +struct getLenSize<8>{ + enum {GETLEN = 22}; +}; + +static inline bool _floatsAreEqual(const json_number & one, const json_number & two) json_pure; +static inline bool _floatsAreEqual(const json_number & one, const json_number & two) json_nothrow { + return (one > two) ? (one - two) < JSON_FLOAT_THRESHHOLD : (one - two) > -JSON_FLOAT_THRESHHOLD; +} + +#ifdef JSON_LESS_MEMORY + #define num_str_result s.ptr +#endif + +class NumberToString { +public: + template + static json_string _itoa(T val) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_auto s(getLenSize::GETLEN); + #else + json_char num_str_result[getLenSize::GETLEN]; + #endif + num_str_result[getLenSize::GETLEN - 1] = JSON_TEXT('\0'); //null terminator + json_char * runner = &num_str_result[getLenSize::GETLEN - 2]; + bool negative; + + START_MEM_SCOPE + long value = (long)val; + //first thing, check if it's negative, if so, make it positive + if (value < 0){ + value = -value; + negative = true; + } else { + negative = false; + } + + //create the string + do { + *runner-- = (json_char)(value % 10) + JSON_TEXT('0'); + } while(value /= 10); + END_MEM_SCOPE + + //if it's negative, add the negation + if (negative){ + *runner = JSON_TEXT('-'); + return json_string(runner); + } + return json_string(runner + 1); + } + + #ifndef JSON_LIBRARY + template + static json_string _uitoa(T val) json_nothrow { + #ifdef JSON_LESS_MEMORY + json_auto s(getLenSize::GETLEN); + #else + json_char num_str_result[getLenSize::GETLEN]; + #endif + num_str_result[getLenSize::GETLEN - 1] = JSON_TEXT('\0'); //null terminator + json_char * runner = &num_str_result[getLenSize::GETLEN - 2]; + + //create the string + START_MEM_SCOPE + unsigned long value = (unsigned long)val; + do { + *runner-- = (json_char)(value % 10) + JSON_TEXT('0'); + } while(value /= 10); + END_MEM_SCOPE + + return json_string(runner + 1); + } + #endif + + #ifdef JSON_ISO_STRICT + #define EXTRA_LONG + #define FLOAT_STRING "%f" + #define LFLOAT_STRING L"%f" + #else + #define EXTRA_LONG long + #define FLOAT_STRING "%Lf" + #define LFLOAT_STRING L"%Lf" + #endif + + static json_string _ftoa(json_number value) json_nothrow { + #ifndef JSON_LIBRARY + //ScopeCoverage(_ftoa_coverage, 6); + if (json_unlikely(value >= 0.0 && _floatsAreEqual(value, (json_number)((unsigned EXTRA_LONG long)value)))){ + return _uitoa((unsigned EXTRA_LONG long)value); + } else + #else + //ScopeCoverage(_ftoa_coverage, 5); + #endif + if (json_unlikely(_floatsAreEqual(value, (json_number)((long EXTRA_LONG)value)))){ + return _itoa((long EXTRA_LONG)value); + } + + #ifdef JSON_LESS_MEMORY + json_auto s(64); + #else + json_char num_str_result[64]; + #endif + #ifdef JSON_UNICODE + std::swprintf(num_str_result, 63, LFLOAT_STRING, (EXTRA_LONG double)value); + #else + //Thanks to Salvor Hardin for this Visual C++ fix + #ifdef _MSC_VER + _snprintf_s(num_str_result, 63, 63, FLOAT_STRING, (EXTRA_LONG double)value); //yes, 63 appears twice using _snprintf_s() + #else + std::snprintf(num_str_result, 63, FLOAT_STRING, (EXTRA_LONG double)value); + #endif + #endif + //strip the trailing zeros + for(json_char * pos = &num_str_result[0]; *pos; ++pos){ + if (json_unlikely(*pos == '.')){ //only care about after the decimal + for(json_char * runner = pos + 1; *runner; ++runner){ + if (json_likely(*runner != JSON_TEXT('0'))){ + pos = runner + 1; //have to go to the end 1.0001 + } + } + *pos = JSON_TEXT('\0'); + break; + } + } + return json_string(num_str_result); + } + + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + static bool isNumeric(const json_string & str) json_nothrow { + const json_char * p = str.c_str(); + bool decimal = false; + bool scientific = false; + + #ifdef JSON_STRICT + bool leadingzero = false; + #endif + + //first letter is weird + switch(*p){ + case JSON_TEXT('\0'): + return false; + #ifndef JSON_STRICT + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('+'): + #endif + case JSON_TEXT('-'): + switch (*(p + 1)){ + case JSON_TEXT('.'): + case JSON_TEXT('e'): + case JSON_TEXT('E'): + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('0'): + #ifdef JSON_STRICT + switch(*(p + 2)){ + case JSON_TEXT('.'): + case JSON_TEXT('e'): + case JSON_TEXT('E'): + leadingzero = false; + break; + case JSON_TEXT('\0'): + return true; + default: + leadingzero = true; + break; + } + #endif + ++p; + break; + default: + break; + } + break; + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + case JSON_TEXT('0'): + ++p; + #ifdef JSON_STRICT + leadingzero = true; + #endif + switch(*p){ + case JSON_TEXT('.'): + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + #ifdef JSON_STRICT + leadingzero = false; //not leading, just a zero + #endif + scientific = true; + ++p; + switch(*p){ + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('-'): + case JSON_TEXT('+'): + #ifndef JSON_STRICT + case JSON_TEXT('0'): //cant have a leading zero in scrict + #endif + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + break; + #ifndef JSON_STRICT + case JSON_TEXT('x'): + return (str.find_first_not_of(JSON_TEXT("0123456789ABCDEFabcdef"), 2) == json_string::npos); + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + return (str.find_first_not_of(JSON_TEXT("01234567"), 1) == json_string::npos); + #endif + case JSON_TEXT('\0'): //just 0 + return true; + default: + return false; + } + break; + default: + return false; + } + ++p; + + //next digits + while (*p){ + switch(*p){ + case JSON_TEXT('.'): + if (json_unlikely(decimal)){ + return false; //multiple decimals + } + + if (json_unlikely(scientific)){ + return false; + } + decimal = true; + break; + case JSON_TEXT('e'): + case JSON_TEXT('E'): + if (json_unlikely(scientific)){ + return false; + } + scientific = true; + ++p; + switch(*p){ + case JSON_TEXT('\0'): + return false; + case JSON_TEXT('-'): + case JSON_TEXT('+'): + if (!isdigit(*(p + 1))){ + return false; + } + + #ifdef JSON_STRICT + if (*(p + 1) == JSON_TEXT('0')){ //no leading zeros on scientific notations + return false; + } + #endif + break; + #ifndef JSON_STRICT + case JSON_TEXT('0'): //cant have a leading zero in scrict + #endif + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + break; + case JSON_TEXT('0'): + case JSON_TEXT('1'): + case JSON_TEXT('2'): + case JSON_TEXT('3'): + case JSON_TEXT('4'): + case JSON_TEXT('5'): + case JSON_TEXT('6'): + case JSON_TEXT('7'): + case JSON_TEXT('8'): + case JSON_TEXT('9'): + break; + default: + return false; + } + ++p; + } + #ifdef JSON_STRICT + if (leadingzero && !decimal){ + return false; + } + #endif + return true; + } + #endif + + #ifdef JSON_STRICT + //much faster because no octal or hex support + static json_number _atof (const json_char * num){ + json_number sign = (json_number)1.0; + + //sign + if (*num==JSON_TEXT('-')){ + sign = -1.0; + ++num; + } else { + } + + //skip leading zero if one + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + bool _leadingzeros = *num == JSON_TEXT('0'); + bool _leadingdigits = false; + #endif + if (*num == JSON_TEXT('0')){ + ++num; + } + #ifdef JSON_STRICT + else if (json_likely(*num < JSON_TEXT('1') || *num > JSON_TEXT('9'))){ + return std::numeric_limits::signaling_NaN(); + } + #endif + + JSON_ASSERT_SAFE(*num != JSON_TEXT('0'), JSON_TEXT("multiple leading zeros"), return std::numeric_limits::signaling_NaN(); ); + + // Number + json_number n = (json_number)0.0; + if (json_likely(*num >= JSON_TEXT('1') && *num <= JSON_TEXT('9'))){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + _leadingdigits = true; + #endif + do { + n = (n * 10.0) + (*num++ - JSON_TEXT('0')); + } while (*num >= JSON_TEXT('0') && *num <= JSON_TEXT('9')); + } else { + JSON_ASSERT_SAFE( + (*num) == JSON_TEXT('.') || //.xxx + (*num) == JSON_TEXT('e') || //0Exxx + (*num) == JSON_TEXT('E') || //0exxx + (*num) == JSON_TEXT('\0') //end of the number, just zero + , JSON_TEXT("first digit not a number, e, period, or terminator"), return std::numeric_limits::signaling_NaN(); ); + } + + // Fractional part + json_number scale = (json_number)0.0; + if (*num == JSON_TEXT('.')) { + JSON_ASSERT_SAFE(_leadingzeros || _leadingdigits, JSON_TEXT("period without leading anything"), return std::numeric_limits::signaling_NaN(); ); + ++num; + for(; *num >= JSON_TEXT('0') && *num <= JSON_TEXT('9');){ + n = (n * 10.0) + (*num++ - JSON_TEXT('0')); + --scale; + }; + } else { + JSON_ASSERT_SAFE(!_leadingzeros || n == 0, JSON_TEXT("leading zero on an int"), return std::numeric_limits::signaling_NaN(); ); + JSON_ASSERT_SAFE( + (*num) == JSON_TEXT('e') || //0Exxx + (*num) == JSON_TEXT('E') || //0exxx + (*num) == JSON_TEXT('\0') //end of the number, just zero + , JSON_TEXT("next char not an e or terminator"), return std::numeric_limits::signaling_NaN(); ); + } + + // Exponent + int subscale = 0, signsubscale = 1; + if (json_unlikely(*num == JSON_TEXT('e') || *num == JSON_TEXT('E'))){ + ++num; + switch(*num){ + case JSON_TEXT('+'): + ++num; + break; + case JSON_TEXT('-'): + signsubscale = -1; + ++num; + JSON_ASSERT_SAFE(*num != JSON_TEXT('0'), JSON_TEXT("negative cant be followed by leading zero even after E"), return std::numeric_limits::signaling_NaN(); ); + break; + default: + break; + } + JSON_ASSERT_SAFE(*num != JSON_TEXT('\0'), JSON_TEXT("no exponent for scientific notation"), return std::numeric_limits::signaling_NaN(); ); + while (*num >= JSON_TEXT('0') && *num <= JSON_TEXT('9')){ + subscale=(subscale * 10) + (*num++ - JSON_TEXT('0')); + } + } + + JSON_ASSERT_SAFE(*num == JSON_TEXT('\0'), JSON_TEXT("done with number, not at terminator"), return std::numeric_limits::signaling_NaN(); ); + return sign * n * pow((json_number)10.0, scale + subscale * signsubscale); // number = +/- number.fraction * 10^+/- exponent + } + #endif +}; + +#endif diff --git a/libjson/_internal/Source/internalJSONNode.cpp b/libjson/_internal/Source/internalJSONNode.cpp new file mode 100644 index 0000000..de919ef --- /dev/null +++ b/libjson/_internal/Source/internalJSONNode.cpp @@ -0,0 +1,828 @@ +#include "internalJSONNode.h" +#include "NumberToString.h" //So that I can convert numbers into strings +#include "JSONNode.h" //To fill in the foreward declaration +#include "JSONWorker.h" //For fetching and parsing and such +#include "JSONGlobals.h" + +internalJSONNode::internalJSONNode(const internalJSONNode & orig) json_nothrow : + _type(orig._type), _name(orig._name), _name_encoded(orig._name_encoded), + _string(orig._string), _string_encoded(orig._string_encoded), _value(orig._value) + initializeMutex(0) + initializeRefCount(1) + initializeFetch(orig.fetched) + initializeComment(orig._comment) + initializeChildren(0){ + + + LIBJSON_COPY_CTOR; + if (isContainer()){ + CHILDREN = jsonChildren::newChildren(); + if (json_likely(!orig.CHILDREN -> empty())){ + CHILDREN -> reserve(orig.CHILDREN -> size()); + json_foreach(orig.CHILDREN, myrunner){ + CHILDREN -> push_back(JSONNode::newJSONNode((*myrunner) -> duplicate())); + } + } + } + #ifdef JSON_MUTEX_CALLBACKS /*-> JSON_MUTEX_CALLBACKS */ + _set_mutex(orig.mylock, false); + #endif /*<- */ +} + +#ifdef JSON_PREPARSE /*-> JSON_PREPARSE */ + #define SetFetchedFalseOrDo(code) code +#else /*<- else */ + #define SetFetchedFalseOrDo(code) SetFetched(false) +#endif /*<- */ + +//this one is specialized because the root can only be array or node +#ifdef JSON_READ_PRIORITY /*-> JSON_READ_PRIORITY */ +internalJSONNode::internalJSONNode(const json_string & unparsed) json_nothrow : _type(), _name(),_name_encoded(false), _string(unparsed), _string_encoded(), _value() + initializeMutex(0) + initializeRefCount(1) + initializeFetch(false) + initializeComment(json_global(EMPTY_JSON_STRING)) + initializeChildren(0){ + + LIBJSON_CTOR; + switch (unparsed[0]){ + case JSON_TEXT('{'): //node + _type = JSON_NODE; + CHILDREN = jsonChildren::newChildren(); + #ifdef JSON_PREPARSE + FetchNode(); + #endif + break; + case JSON_TEXT('['): //array + _type = JSON_ARRAY; + CHILDREN = jsonChildren::newChildren(); + #ifdef JSON_PREPARSE + FetchArray(); + #endif + break; + default: + JSON_FAIL_SAFE(JSON_TEXT("root not starting with either { or ["), Nullify();); + break; + } +} + +#ifndef JSON_STRICT + #define LETTERCASE(x, y)\ + case JSON_TEXT(x):\ + case JSON_TEXT(y) +#else + #define LETTERCASE(x, y)\ + case JSON_TEXT(x) +#endif + +internalJSONNode::internalJSONNode(const json_string & name_t, const json_string & value_t) json_nothrow : _type(), _name_encoded(), _name(JSONWorker::FixString(name_t, NAME_ENCODED)), _string(), _string_encoded(), _value() + initializeMutex(0) + initializeRefCount(1) + initializeFetch(false) + initializeComment(json_global(EMPTY_JSON_STRING)) + initializeChildren(0){ + + LIBJSON_CTOR; + + #ifdef JSON_STRICT + JSON_ASSERT_SAFE(!value_t.empty(), JSON_TEXT("empty node"), Nullify(); return;); + #else + if (json_unlikely(value_t.empty())){ + _type = JSON_NULL; + SetFetched(true); + return; + } + #endif + + _string = value_t; + + const json_char firstchar = value_t[0]; + #if defined JSON_DEBUG || defined JSON_SAFE + const json_char lastchar = value_t[value_t.length() - 1]; + #endif + + switch (firstchar){ + case JSON_TEXT('\"'): //a json_string literal, still escaped and with leading and trailing quotes + JSON_ASSERT_SAFE(lastchar == JSON_TEXT('\"'), JSON_TEXT("Unterminated quote"), Nullify(); return;); + _type = JSON_STRING; + SetFetchedFalseOrDo(FetchString()); + break; + case JSON_TEXT('{'): //a child node, or set of children + JSON_ASSERT_SAFE(lastchar == JSON_TEXT('}'), JSON_TEXT("Missing }"), Nullify(); return;); + _type = JSON_NODE; + CHILDREN = jsonChildren::newChildren(); + SetFetchedFalseOrDo(FetchNode()); + break; + case JSON_TEXT('['): //an array + JSON_ASSERT_SAFE(lastchar == JSON_TEXT(']'), JSON_TEXT("Missing ]"), Nullify(); return;); + _type = JSON_ARRAY; + CHILDREN = jsonChildren::newChildren(); + SetFetchedFalseOrDo(FetchArray()); + break; + LETTERCASE('t', 'T'): + JSON_ASSERT_SAFE(value_t == json_global(CONST_TRUE), json_string(json_global(ERROR_UNKNOWN_LITERAL) + value_t).c_str(), Nullify(); return;); + _value._bool = true; + _type = JSON_BOOL; + SetFetched(true); + break; + LETTERCASE('f', 'F'): + JSON_ASSERT_SAFE(value_t == json_global(CONST_FALSE), json_string(json_global(ERROR_UNKNOWN_LITERAL) + value_t).c_str(), Nullify(); return;); + _value._bool = false; + _type = JSON_BOOL; + SetFetched(true); + break; + LETTERCASE('n', 'N'): + JSON_ASSERT_SAFE(value_t == json_global(CONST_NULL), json_string(json_global(ERROR_UNKNOWN_LITERAL) + value_t).c_str(), Nullify(); return;); + _type = JSON_NULL; + SetFetched(true); + break; + default: + JSON_ASSERT_SAFE(NumberToString::isNumeric(value_t), json_string(json_global(ERROR_UNKNOWN_LITERAL) + value_t).c_str(), Nullify(); return;); + _type = JSON_NUMBER; + SetFetchedFalseOrDo(FetchNumber()); + break; + } +} + +#endif /*<- */ + + +internalJSONNode::~internalJSONNode(void) json_nothrow { + LIBJSON_DTOR; + #ifdef JSON_MUTEX_CALLBACKS + _unset_mutex(); + #endif /*<- */ + DELETE_CHILDREN(); +} + +#ifdef JSON_READ_PRIORITY + void internalJSONNode::FetchString(void) const json_nothrow { + JSON_ASSERT_SAFE(!_string.empty(), JSON_TEXT("JSON json_string type is empty?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[0] == JSON_TEXT('\"'), JSON_TEXT("JSON json_string type doesn't start with a quotation?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[_string.length() - 1] == JSON_TEXT('\"'), JSON_TEXT("JSON json_string type doesn't end with a quotation?"), Nullify(); return;); + _string = JSONWorker::FixString(json_string(_string.begin() + 1, _string.end() - 1), STRING_ENCODED); + #ifdef JSON_LESS_MEMORY + JSON_ASSERT(_string.capacity() == _string.length(), JSON_TEXT("_string object too large 2")); + #endif + } + + void internalJSONNode::FetchNode(void) const json_nothrow { + JSON_ASSERT_SAFE(!_string.empty(), JSON_TEXT("JSON node type is empty?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[0] == JSON_TEXT('{'), JSON_TEXT("JSON node type doesn't start with a bracket?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[_string.length() - 1] == JSON_TEXT('}'), JSON_TEXT("JSON node type doesn't end with a bracket?"), Nullify(); return;); + JSONWorker::DoNode(this, _string); + clearString(_string); + } + + void internalJSONNode::FetchArray(void) const json_nothrow { + JSON_ASSERT_SAFE(!_string.empty(), JSON_TEXT("JSON node type is empty?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[0] == JSON_TEXT('['), JSON_TEXT("JSON node type doesn't start with a square bracket?"), Nullify(); return;); + JSON_ASSERT_SAFE(_string[_string.length() - 1] == JSON_TEXT(']'), JSON_TEXT("JSON node type doesn't end with a square bracket?"), Nullify(); return;); + JSONWorker::DoArray(this, _string); + clearString(_string); + } + +#endif + +//This one is used by as_int and as_float, so even non-readers need it +void internalJSONNode::FetchNumber(void) const json_nothrow { + #ifdef JSON_STRICT + _value._number = NumberToString::_atof(_string.c_str()); + #else + #ifdef JSON_UNICODE + const size_t len = _string.length(); + #if defined(_MSC_VER) && defined(JSON_SAFE) + const size_t bytes = (len * (sizeof(json_char) / sizeof(char))) + 1; + json_auto temp(bytes); + size_t res; + errno_t err = wcstombs_s(&res, temp.ptr, bytes, _string.c_str(), len); + if (err != 0){ + _value._number = (json_number)0.0; + return; + } + #elif defined(JSON_SAFE) + const size_t bytes = (len * (sizeof(json_char) / sizeof(char))) + 1; + json_auto temp(bytes); + size_t res = std::wcstombs(temp.ptr, _string.c_str(), len); + if (res == (size_t)-1){ + _value._number = (json_number)0.0; + return; + } + #else + json_auto temp(len + 1); + size_t res = std::wcstombs(temp.ptr, _string.c_str(), len); + #endif + temp.ptr[res] = '\0'; + _value._number = (json_number)std::atof(temp.ptr); + #else + _value._number = (json_number)std::atof(_string.c_str()); + #endif + #endif + #if((!defined(JSON_CASTABLE) && defined(JSON_LESS_MEMORY)) && !defined(JSON_WRITE_PRIORITY)) + clearString(_string); + #endif +} + +#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void internalJSONNode::Fetch(void) const json_nothrow { + if (fetched) return; + switch (type()){ + case JSON_STRING: + FetchString(); + break; + case JSON_NODE: + FetchNode(); + break; + case JSON_ARRAY: + FetchArray(); + break; + case JSON_NUMBER: + FetchNumber(); + break; + #if defined JSON_DEBUG || defined JSON_SAFE + default: + JSON_FAIL(JSON_TEXT("Fetching an unknown type")); + Nullify(); + #endif + } + fetched = true; + } +#endif + +void internalJSONNode::Set(const json_string & val) json_nothrow { + makeNotContainer(); + _type = JSON_STRING; + _string = val; + shrinkString(_string); + _string_encoded = true; + SetFetched(true); +} + +#ifdef JSON_LIBRARY + void internalJSONNode::Set(json_int_t val) json_nothrow { + makeNotContainer(); + _type = JSON_NUMBER; + _value._number = (json_number)val; + #if(defined(JSON_CASTABLE) || !defined(JSON_LESS_MEMORY) || defined(JSON_WRITE_PRIORITY)) + _string = NumberToString::_itoa(val); + #else + clearString(_string); + #endif + SetFetched(true); + } + + void internalJSONNode::Set(json_number val) json_nothrow { + makeNotContainer(); + _type = JSON_NUMBER; + _value._number = val; + #if(defined(JSON_CASTABLE) || !defined(JSON_LESS_MEMORY) || defined(JSON_WRITE_PRIORITY)) + _string = NumberToString::_ftoa(val); + #else + clearString(_string); + #endif + SetFetched(true); + } +#else + #if(defined(JSON_CASTABLE) || !defined(JSON_LESS_MEMORY) || defined(JSON_WRITE_PRIORITY)) + #define SET(converter, type)\ + void internalJSONNode::Set(type val) json_nothrow {\ + makeNotContainer();\ + _type = JSON_NUMBER;\ + _value._number = (json_number)val;\ + _string = NumberToString::converter(val);\ + SetFetched(true);\ + } + #define SET_FLOAT(type) \ + void internalJSONNode::Set(type val) json_nothrow {\ + makeNotContainer();\ + _type = JSON_NUMBER;\ + _value._number = (json_number)val;\ + _string = NumberToString::_ftoa(_value._number);\ + SetFetched(true);\ + } + #else /*<- else */ + #define SET(converter, type)\ + void internalJSONNode::Set(type val) json_nothrow {\ + makeNotContainer();\ + _type = JSON_NUMBER;\ + _value._number = (json_number)val;\ + clearString(_string);\ + SetFetched(true);\ + } + #define SET_FLOAT(type) \ + void internalJSONNode::Set(type val) json_nothrow {\ + makeNotContainer();\ + _type = JSON_NUMBER;\ + _value._number = (json_number)val;\ + clearString(_string);\ + SetFetched(true);\ + } + #endif + #define SET_INTEGER(type) SET(_itoa, type) SET(_uitoa, unsigned type) + + SET_INTEGER(char) + SET_INTEGER(short) + SET_INTEGER(int) + SET_INTEGER(long) + #ifndef JSON_ISO_STRICT + SET_INTEGER(long long) + SET_FLOAT(long double) + #endif + + SET_FLOAT(float) + SET_FLOAT(double) +#endif + +void internalJSONNode::Set(bool val) json_nothrow { + makeNotContainer(); + _type = JSON_BOOL; + _value._bool = val; + #if(defined(JSON_CASTABLE) || !defined(JSON_LESS_MEMORY) || defined(JSON_WRITE_PRIORITY)) + _string = val ? json_global(CONST_TRUE) : json_global(CONST_FALSE); + #endif + SetFetched(true); +} + +bool internalJSONNode::IsEqualTo(const internalJSONNode * val) const json_nothrow { + if (this == val) return true; //same internal object, so they must be equal (not only for ref counting) + if (type() != val -> type()) return false; //aren't even same type + if (_name != val -> _name) return false; //names aren't the same + if (type() == JSON_NULL) return true; //both null, can't be different + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + Fetch(); + val -> Fetch(); + #endif + switch (type()){ + case JSON_STRING: + return val -> _string == _string; + case JSON_NUMBER: + return _floatsAreEqual(val -> _value._number, _value._number); + case JSON_BOOL: + return val -> _value._bool == _value._bool; + }; + + JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, JSON_TEXT("Checking for equality, not sure what type")); + if (CHILDREN -> size() != val -> CHILDREN -> size()) return false; //if they arne't he same size then they certainly aren't equal + + //make sure each children is the same + JSONNode ** valrunner = val -> CHILDREN -> begin(); + json_foreach(CHILDREN, myrunner){ + JSON_ASSERT(*myrunner != NULL, json_global(ERROR_NULL_IN_CHILDREN)); + JSON_ASSERT(*valrunner != NULL, json_global(ERROR_NULL_IN_CHILDREN)); + JSON_ASSERT(valrunner != val -> CHILDREN -> end(), JSON_TEXT("at the end of other one's children, but they're the same size?")); + if (**myrunner != **valrunner) return false; + ++valrunner; + } + return true; +} + +void internalJSONNode::Nullify(void) const json_nothrow { + _type = JSON_NULL; + #if(defined(JSON_CASTABLE) || !defined(JSON_LESS_MEMORY) || defined(JSON_WRITE_PRIORITY)) /*-> JSON_CASTABLE || !JSON_LESS_MEMORY || JSON_WRITE_PRIORITY */ + _string = json_global(CONST_NULL); + #else /*<- else */ + clearString(_string); + #endif /*<- */ + SetFetched(true); +} + +#ifdef JSON_MUTEX_CALLBACKS /*-> JSON_MUTEX_CALLBACKS */ + #define JSON_MUTEX_COPY ,mylock +#else /*<- else */ + #define JSON_MUTEX_COPY +#endif /*<- */ + +#ifdef JSON_LIBRARY /*-> JSON_LIBRARY */ +void internalJSONNode::push_back(JSONNode * node) json_nothrow { +#else /*<- else */ +void internalJSONNode::push_back(const JSONNode & node) json_nothrow { +#endif /*<- */ + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("push_back"), return;); + #ifdef JSON_LIBRARY /*-> JSON_LIBRARY */ + #ifdef JSON_MUTEX_CALLBACKS /*-> JSON_MUTEX_CALLBACKS */ + if (mylock != 0) node -> set_mutex(mylock); + #endif /*<- */ + CHILDREN -> push_back(node); + #else /*<- else */ + CHILDREN -> push_back(JSONNode::newJSONNode(node JSON_MUTEX_COPY)); + #endif /*<- */ +} + +void internalJSONNode::push_front(const JSONNode & node) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("push_front"), return;); + CHILDREN -> push_front(JSONNode::newJSONNode(node JSON_MUTEX_COPY)); +} + +JSONNode * internalJSONNode::pop_back(json_index_t pos) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("pop_back"), return 0;); + JSONNode * result = (*CHILDREN)[pos]; + JSONNode ** temp = CHILDREN -> begin() + pos; + CHILDREN -> erase(temp); + return result; +} + +JSONNode * internalJSONNode::pop_back(const json_string & name_t) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("pop_back(str)"), return 0;); + if (JSONNode ** res = at(name_t)){ + JSONNode * result = *res; + CHILDREN -> erase(res); + return result; + } + return 0; +} + +#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS /*-> JSON_CASE_INSENSITIVE_FUNCTIONS */ + JSONNode * internalJSONNode::pop_back_nocase(const json_string & name_t) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("pop_back_nocase"), return 0;); + if (JSONNode ** res = at_nocase(name_t)){ + JSONNode * result = *res; + CHILDREN -> erase(res); + return result; + } + return 0; + } +#endif /*<- */ + +JSONNode ** internalJSONNode::at(const json_string & name_t) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("at"), return 0;); + Fetch(); + json_foreach(CHILDREN, myrunner){ + JSON_ASSERT(*myrunner != NULL, json_global(ERROR_NULL_IN_CHILDREN)); + if (json_unlikely((*myrunner) -> name() == name_t)) return myrunner; + } + return 0; +} + +#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS /*-> JSON_CASE_INSENSITIVE_FUNCTIONS */ + bool internalJSONNode::AreEqualNoCase(const json_char * ch_one, const json_char * ch_two) json_nothrow { + while (*ch_one){ //only need to check one, if the other one terminates early, the check will cause it to fail + const json_char c_one = *ch_one; + const json_char c_two = *ch_two; + if (c_one != c_two){ + if ((c_two > 64) && (c_two < 91)){ //A - Z + if (c_one != (json_char)(c_two + 32)) return false; + } else if ((c_two > 96) && (c_two < 123)){ //a - z + if (c_one != (json_char)(c_two - 32)) return false; + } else { //not a letter, so return false + return false; + } + } + ++ch_one; + ++ch_two; + + } + return *ch_two == '\0'; //this one has to be null terminated too, or else json_string two is longer, hence, not equal + } + + JSONNode ** internalJSONNode::at_nocase(const json_string & name_t) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("at_nocase"), return 0;); + Fetch(); + json_foreach(CHILDREN, myrunner){ + JSON_ASSERT(*myrunner, json_global(ERROR_NULL_IN_CHILDREN)); + if (json_unlikely(AreEqualNoCase((*myrunner) -> name().c_str(), name_t.c_str()))) return myrunner; + } + return 0; + } +#endif /*<- */ + +#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) /*-> JSON_PREPARSE && JSON_READ_PRIORITY */ + void internalJSONNode::preparse(void) json_nothrow { + Fetch(); + if (isContainer()){ + json_foreach(CHILDREN, myrunner){ + (*myrunner) -> preparse(); + } + } + } +#endif /*<- */ + +internalJSONNode::operator bool() const json_nothrow { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NUMBER: + return !_floatsAreEqual(_value._number, (json_number)0.0); + case JSON_NULL: + return false; + } + #endif /*<- */ + JSON_ASSERT(type() == JSON_BOOL, json_global(ERROR_UNDEFINED) + JSON_TEXT("(bool)")); + return _value._bool; +} + +#ifdef JSON_LIBRARY /*-> JSON_LIBRARY */ + internalJSONNode::operator json_number() const json_nothrow { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return (json_number)0.0; + case JSON_BOOL: + return (json_number)(_value._bool ? 1.0 : 0.0); + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("as_float")); + return (json_number)_value._number; + } + + internalJSONNode::operator json_int_t() const json_nothrow { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return 0; + case JSON_BOOL: + return _value._bool ? 1 : 0; + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("as_int")); + JSON_ASSERT(_value._number == (json_number)((json_int_t)_value._number), json_string(JSON_TEXT("as_int will truncate ")) + _string); + return (json_int_t)_value._number; + } +#else /*<- else */ + #ifndef JSON_ISO_STRICT /*-> !JSON_ISO_STRICT */ + internalJSONNode::operator long double() const json_nothrow { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return (long double)0.0; + case JSON_BOOL: + return (long double)(_value._bool ? 1.0 : 0.0); + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(long double)")); + return (long double)_value._number; + } + #else /*<- else */ + internalJSONNode::operator double() const json_nothrow { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return (double)0.0; + case JSON_BOOL: + return (double)(_value._bool ? 1.0 : 0.0); + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(double)")); + return (double)_value._number; + } + #endif /*<- */ + + //do whichever one is longer, because it's easy to cast down + #ifdef JSON_ISO_STRICT /*-> JSON_ISO_STRICT */ + internalJSONNode::operator long() const json_nothrow + #else /*<- else */ + internalJSONNode::operator long long() const json_nothrow + #endif /*<- */ + { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return 0; + case JSON_BOOL: + return _value._bool ? 1 : 0; + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + #ifdef JSON_ISO_STRICT /*-> JSON_ISO_STRICT */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(long)")); + JSON_ASSERT(_value._number > LONG_MIN, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT("long")); + JSON_ASSERT(_value._number < LONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("long")); + JSON_ASSERT(_value._number == (json_number)((long)_value._number), json_string(JSON_TEXT("(long) will truncate ")) + _string); + return (long)_value._number; + #else /*<- else */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(long long)")); + #ifdef LONG_LONG_MAX + JSON_ASSERT(_value._number < LONG_LONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("long long")); + #elif defined(LLONG_MAX) + JSON_ASSERT(_value._number < LLONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("long long")); + #endif + #ifdef LONG_LONG_MIN + JSON_ASSERT(_value._number > LONG_LONG_MIN, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT("long long")); + #elif defined(LLONG_MAX) + JSON_ASSERT(_value._number > LLONG_MIN, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT("long long")); + #endif + + JSON_ASSERT(_value._number == (json_number)((long long)_value._number), json_string(JSON_TEXT("(long long) will truncate ")) + _string); + return (long long)_value._number; + #endif /*<- */ + } + + #ifdef JSON_ISO_STRICT /*-> JSON_ISO_STRICT */ + internalJSONNode::operator unsigned long() const json_nothrow + #else /*<- else */ + internalJSONNode::operator unsigned long long() const json_nothrow + #endif /*<- */ + { + Fetch(); + #ifdef JSON_CASTABLE /*-> JSON_CASTABLE */ + switch(type()){ + case JSON_NULL: + return 0; + case JSON_BOOL: + return _value._bool ? 1 : 0; + case JSON_STRING: + FetchNumber(); + } + #endif /*<- */ + #ifdef JSON_ISO_STRICT /*-> JSON_ISO_STRICT */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(unsigned long)")); + JSON_ASSERT(_value._number > 0, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT("unsigned long")); + JSON_ASSERT(_value._number < ULONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("unsigned long")); + JSON_ASSERT(_value._number == (json_number)((unsigned long)_value._number), json_string(JSON_TEXT("(unsigend long) will truncate ")) + _string); + return (unsigned long)_value._number; + #else /*<- else */ + JSON_ASSERT(type() == JSON_NUMBER, json_global(ERROR_UNDEFINED) + JSON_TEXT("(unsigned long long)")); + JSON_ASSERT(_value._number > 0, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT("unsigned long long")); + #ifdef ULONG_LONG_MAX + JSON_ASSERT(_value._number < ULONG_LONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("unsigned long long")); + #elif defined(ULLONG_MAX) + JSON_ASSERT(_value._number < ULLONG_MAX, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT("unsigned long long")); + #endif + JSON_ASSERT(_value._number == (json_number)((unsigned long long)_value._number), json_string(JSON_TEXT("(unsigned long long) will truncate ")) + _string); + return (unsigned long long)_value._number; + #endif /*<- */ + } +#endif /*<- */ + + /* + These functions are to allow allocation to be completely controlled by the callbacks + */ + +#ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + #include "JSONMemoryPool.h" + static memory_pool json_internal_mempool; +#endif /*<- */ + +void internalJSONNode::deleteInternal(internalJSONNode * ptr) json_nothrow { + #ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + ptr -> ~internalJSONNode(); + json_internal_mempool.deallocate((void*)ptr); + #elif defined(JSON_MEMORY_CALLBACKS) /*<- else JSON_MEMORY_CALLBACKS */ + ptr -> ~internalJSONNode(); + libjson_free(ptr); + #else /*<- else */ + delete ptr; + #endif /*<- */ +} + +internalJSONNode * internalJSONNode::newInternal(char mytype) { + #ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + return new((internalJSONNode*)json_internal_mempool.allocate()) internalJSONNode(mytype); + #elif defined(JSON_MEMORY_CALLBACKS) /*<- else JSON_MEMORY_CALLBACKS */ + return new(json_malloc(1)) internalJSONNode(mytype); + #else /*<- else */ + return new internalJSONNode(mytype); + #endif /*<- */ +} + +#ifdef JSON_READ_PRIORITY /*-> JSON_READ_PRIORITY */ +internalJSONNode * internalJSONNode::newInternal(const json_string & unparsed) { + #ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + return new((internalJSONNode*)json_internal_mempool.allocate()) internalJSONNode(unparsed); + #elif defined(JSON_MEMORY_CALLBACKS) /*<- else JSON_MEMORY_CALLBACKS */ + return new(json_malloc(1)) internalJSONNode(unparsed); + #else /*<- else */ + return new internalJSONNode(unparsed); + #endif /*<- */ +} + +internalJSONNode * internalJSONNode::newInternal(const json_string & name_t, const json_string & value_t) { + #ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + return new((internalJSONNode*)json_internal_mempool.allocate()) internalJSONNode(name_t, value_t); + #elif defined(JSON_MEMORY_CALLBACKS) /*<- else JSON_MEMORY_CALLBACKS */ + return new(json_malloc(1)) internalJSONNode(name_t, value_t); + #else /*<- else */ + return new internalJSONNode(name_t, value_t); + #endif /*<- */ +} + +#endif /*<- */ + +internalJSONNode * internalJSONNode::newInternal(const internalJSONNode & orig) { + #ifdef JSON_MEMORY_POOL /*-> JSON_MEMORY_POOL */ + return new((internalJSONNode*)json_internal_mempool.allocate()) internalJSONNode(orig); + #elif defined(JSON_MEMORY_CALLBACKS) /*<- else JSON_MEMORY_CALLBACKS */ + return new(json_malloc(1)) internalJSONNode(orig); + #else /*<- else */ + return new internalJSONNode(orig); + #endif /*<- */ +} + +#ifdef JSON_DEBUG /*-> JSON_MEMORY_POOL */ + #ifndef JSON_LIBRARY /*-> JSON_MEMORY_POOL */ + JSONNode internalJSONNode::Dump(size_t & totalbytes) const json_nothrow { + JSONNode dumpage(JSON_NODE); + dumpage.set_name(JSON_TEXT("internalJSONNode")); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("this"), (long)this))); + + START_MEM_SCOPE + size_t memory = sizeof(internalJSONNode); + memory += _name.capacity() * sizeof(json_char); + memory += _string.capacity() * sizeof(json_char); + if (isContainer()){ + memory += sizeof(jsonChildren); + memory += CHILDREN -> capacity() * sizeof(JSONNode*); + } + #ifdef JSON_COMMENTS /*-> JSON_COMMENTS */ + memory += _comment.capacity() * sizeof(json_char); + #endif /*<- */ + totalbytes += memory; + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("bytes used"), memory))); + END_MEM_SCOPE + + + #ifdef JSON_REF_COUNT /*-> JSON_REF_COUNT */ + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("refcount"), refcount))); + #endif /*<- */ + #ifdef JSON_MUTEX_CALLBACKS /*-> JSON_MUTEX_CALLBACKS */ + dumpage.push_back(JSON_NEW(DumpMutex())); + #endif /*<- */ + + + #define DUMPCASE(ty)\ + case ty:\ + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("_type"), JSON_TEXT(#ty))));\ + break; + + switch(type()){ + DUMPCASE(JSON_NULL) + DUMPCASE(JSON_STRING) + DUMPCASE(JSON_NUMBER) + DUMPCASE(JSON_BOOL) + DUMPCASE(JSON_ARRAY) + DUMPCASE(JSON_NODE) + default: + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("_type"), JSON_TEXT("Unknown")))); + } + + JSONNode str(JSON_NODE); + str.set_name(JSON_TEXT("_name")); + str.push_back(JSON_NEW(JSONNode(json_string(JSON_TEXT("value")), _name))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("length"), _name.length()))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("capactiy"), _name.capacity()))); + + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("_name_encoded"), _name_encoded))); + dumpage.push_back(JSON_NEW(str)); + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("_string_encoded"), _string_encoded))); + str.clear(); + str.set_name(JSON_TEXT("_string")); + str.push_back(JSON_NEW(JSONNode(json_string(JSON_TEXT("value")), _string))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("length"), _string.length()))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("capactiy"), _string.capacity()))); + dumpage.push_back(JSON_NEW(str)); + + if ((type() == JSON_BOOL) || (type() == JSON_NUMBER)){ + JSONNode unio(JSON_NODE); + unio.set_name(JSON_TEXT("_value")); + if (type() == JSON_BOOL){ + unio.push_back(JSON_NEW(JSONNode(JSON_TEXT("_bool"), _value._bool))); + } else if (type() == JSON_NUMBER){ + unio.push_back(JSON_NEW(JSONNode(JSON_TEXT("_number"), _value._number))); + } + dumpage.push_back(JSON_NEW(unio)); + } + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) /*-> !JSON_PREPARSE && JSON_READ_PRIORITY */ + dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("fetched"), fetched))); + #endif /*<- */ + + #ifdef JSON_COMMENTS /*-> JSON_COMMENTS */ + str.clear(); + str.set_name(JSON_TEXT("_comment")); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("value"), _comment))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("length"), _comment.length()))); + str.push_back(JSON_NEW(JSONNode(JSON_TEXT("capactiy"), _comment.capacity()))); + dumpage.push_back(JSON_NEW(str)); + #endif /*<- */ + + if (isContainer()){ + JSONNode arra(JSON_NODE); + arra.set_name(JSON_TEXT("Children")); + arra.push_back(JSON_NEW(JSONNode(JSON_TEXT("size"), CHILDREN -> size()))); + arra.push_back(JSON_NEW(JSONNode(JSON_TEXT("capacity"), CHILDREN -> capacity()))); + JSONNode chil(JSON_ARRAY); + chil.set_name(JSON_TEXT("array")); + json_foreach(CHILDREN, it){ + chil.push_back(JSON_NEW((*it) -> dump(totalbytes))); + } + arra.push_back(JSON_NEW(chil)); + dumpage.push_back(JSON_NEW(arra)); + } + + return dumpage; + } + #endif /*<- */ +#endif /*<- */ diff --git a/libjson/_internal/Source/internalJSONNode.h b/libjson/_internal/Source/internalJSONNode.h new file mode 100644 index 0000000..2dd3a1e --- /dev/null +++ b/libjson/_internal/Source/internalJSONNode.h @@ -0,0 +1,504 @@ +#ifndef INTERNAL_JSONNODE_H +#define INTERNAL_JSONNODE_H + +#include "JSONDebug.h" +#include "JSONChildren.h" +#include "JSONMemory.h" +#include "JSONGlobals.h" +#ifdef JSON_DEBUG + #include //to check int value +#endif +#include "JSONSharedString.h" + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(push, 1) + #elif _MSC_VER + #pragma pack(push, internalJSONNode_pack, 1) + #endif +#endif + +/* + This class is the work horse of libjson, it handles all of the + functinality of JSONNode. This object is reference counted for + speed and memory reasons. + + If JSON_REF_COUNT is not on, this internal structure still has an important + purpose, as it can be passed around by JSONNoders that are flagged as temporary +*/ + +class JSONNode; //forward declaration + +#ifndef JSON_LIBRARY + #define DECL_SET_INTEGER(type) void Set(type) json_nothrow json_write_priority; void Set(unsigned type) json_nothrow json_write_priority; + #define DECL_CAST_OP(type) operator type() const json_nothrow; operator unsigned type() const json_nothrow; +#endif + +#ifdef JSON_MUTEX_CALLBACKS + #define initializeMutex(x) ,mylock(x) +#else + #define initializeMutex(x) +#endif + +#if defined(JSON_PREPARSE) || !defined(JSON_READ_PRIORITY) + #define SetFetched(b) (void)0 + #define Fetch() (void)0 + #define initializeFetch(x) +#else + #define initializeFetch(x) ,fetched(x) +#endif + +#ifdef JSON_REF_COUNT + #define initializeRefCount(x) ,refcount(x) +#else + #define initializeRefCount(x) +#endif + +#ifdef JSON_COMMENTS + #define initializeComment(x) ,_comment(x) +#else + #define initializeComment(x) +#endif + +#ifdef JSON_LESS_MEMORY + #define CHILDREN _value.Children + #define DELETE_CHILDREN()\ + if (isContainer()){\ + jsonChildren::deleteChildren(CHILDREN);\ + } + #define CHILDREN_TO_NULL() (void)0 + #define initializeChildren(x) +#else + #define CHILDREN Children + #define DELETE_CHILDREN()\ + if (CHILDREN != 0) jsonChildren::deleteChildren(CHILDREN); + #define CHILDREN_TO_NULL() CHILDREN = 0 + #define makeNotContainer() (void)0 + #define makeContainer() if (!CHILDREN) CHILDREN = jsonChildren::newChildren() + #define initializeChildren(x) ,CHILDREN(x) +#endif + +class internalJSONNode { +public: + LIBJSON_OBJECT(internalJSONNode); + internalJSONNode(char mytype = JSON_NULL) json_nothrow json_hot; + #ifdef JSON_READ_PRIORITY + internalJSONNode(const json_string & unparsed) json_nothrow json_hot; + internalJSONNode(const json_string & name_t, const json_string & value_t) json_nothrow json_read_priority; + #endif + internalJSONNode(const internalJSONNode & orig) json_nothrow json_hot; + internalJSONNode & operator = (const internalJSONNode &) json_nothrow json_hot; + ~internalJSONNode(void) json_nothrow json_hot; + + static internalJSONNode * newInternal(char mytype = JSON_NULL) json_hot; + #ifdef JSON_READ_PRIORITY + static internalJSONNode * newInternal(const json_string & unparsed) json_hot; + static internalJSONNode * newInternal(const json_string & name_t, const json_string & value_t) json_hot; + #endif + static internalJSONNode * newInternal(const internalJSONNode & orig) json_hot; //not copyable, only by this class + static void deleteInternal(internalJSONNode * ptr) json_nothrow json_hot; + + json_index_t size(void) const json_nothrow json_read_priority; + bool empty(void) const json_nothrow; + unsigned char type(void) const json_nothrow json_read_priority; + + json_string name(void) const json_nothrow json_read_priority; + void setname(const json_string & newname) json_nothrow json_write_priority; + #ifdef JSON_COMMENTS + void setcomment(const json_string & comment) json_nothrow; + json_string getcomment(void) const json_nothrow; + #endif + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void preparse(void) json_nothrow; + #endif + + #ifdef JSON_LIBRARY + void push_back(JSONNode * node) json_nothrow; + #else + void push_back(const JSONNode & node) json_nothrow; + #endif + void reserve(json_index_t siz) json_nothrow; + void push_front(const JSONNode & node) json_nothrow; + JSONNode * pop_back(json_index_t pos) json_nothrow; + JSONNode * pop_back(const json_string & name_t) json_nothrow; + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode * pop_back_nocase(const json_string & name_t) json_nothrow; + #endif + + JSONNode * at(json_index_t pos) json_nothrow; + //These return ** because pop_back needs them + JSONNode ** at(const json_string & name_t) json_nothrow; + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNode ** at_nocase(const json_string & name_t) json_nothrow; + #endif + + void Set(const json_string & val) json_nothrow json_write_priority; + #ifdef JSON_LIBRARY + void Set(json_number val) json_nothrow json_write_priority; + void Set(json_int_t val) json_nothrow json_write_priority; + operator json_int_t() const json_nothrow; + operator json_number() const json_nothrow; + #else + DECL_SET_INTEGER(char) + DECL_SET_INTEGER(short) + DECL_SET_INTEGER(int) + DECL_SET_INTEGER(long) + #ifndef JSON_ISO_STRICT + DECL_SET_INTEGER(long long) + void Set(long double val) json_nothrow json_write_priority; + #endif + void Set(float val) json_nothrow json_write_priority; + void Set(double val) json_nothrow json_write_priority; + + + DECL_CAST_OP(char) + DECL_CAST_OP(short) + DECL_CAST_OP(int) + DECL_CAST_OP(long) + #ifndef JSON_ISO_STRICT + DECL_CAST_OP(long long) + operator long double() const json_nothrow; + #endif + operator float() const json_nothrow; + operator double() const json_nothrow; + #endif + operator json_string()const json_nothrow; + operator bool() const json_nothrow; + void Set(bool val) json_nothrow; + + bool IsEqualTo(const json_string & val) const json_nothrow; + bool IsEqualTo(bool val) const json_nothrow; + bool IsEqualTo(const internalJSONNode * val) const json_nothrow; + + template + bool IsEqualToNum(T val) const json_nothrow; + + internalJSONNode * incRef(void) json_nothrow; + #ifdef JSON_REF_COUNT + void decRef(void) json_nothrow json_hot; + bool hasNoReferences(void) json_nothrow json_hot; + #endif + internalJSONNode * makeUnique(void) json_nothrow json_hot; + + JSONNode ** begin(void) const json_nothrow; + JSONNode ** end(void) const json_nothrow; + bool Fetched(void) const json_nothrow json_hot; + #ifdef JSON_MUTEX_CALLBACKS + void _set_mutex(void * mutex, bool unset = true) json_nothrow json_cold; + void _unset_mutex(void) json_nothrow json_cold; + #endif + + #ifdef JSON_WRITE_PRIORITY + void DumpRawString(json_string & output) const json_nothrow json_write_priority; + void WriteName(bool formatted, bool arrayChild, json_string & output) const json_nothrow json_write_priority; + #ifdef JSON_ARRAY_SIZE_ON_ONE_LINE + void WriteChildrenOneLine(unsigned int indent, json_string & output) const json_nothrow json_write_priority; + #endif + void WriteChildren(unsigned int indent, json_string & output) const json_nothrow json_write_priority; + void WriteComment(unsigned int indent, json_string & output) const json_nothrow json_write_priority; + void Write(unsigned int indent, bool arrayChild, json_string & output) const json_nothrow json_write_priority; + #endif + + + inline bool isContainer(void) const json_nothrow { + return (_type == JSON_NODE || _type == JSON_ARRAY); + } + inline bool isNotContainer(void) const json_nothrow { + return (_type != JSON_NODE && _type != JSON_ARRAY); + } + + #ifdef JSON_LESS_MEMORY + inline void makeNotContainer(void){ + if (isContainer()){ + jsonChildren::deleteChildren(CHILDREN); + } + } + inline void makeContainer(void){ + if (isNotContainer()){ + CHILDREN = jsonChildren::newChildren(); + } + } + #endif + + void Nullify(void) const json_nothrow; + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void SetFetched(bool val) const json_nothrow json_hot; + void Fetch(void) const json_nothrow json_hot; //it's const because it doesn't change the VALUE of the function + #endif + + #ifdef JSON_READ_PRIORITY + void FetchString(void) const json_nothrow json_read_priority; + void FetchNode(void) const json_nothrow json_read_priority; + void FetchArray(void) const json_nothrow json_read_priority; + #endif + void FetchNumber(void) const json_nothrow json_read_priority; + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + static bool AreEqualNoCase(const json_char * ch_one, const json_char * ch_two) json_nothrow json_read_priority; + #endif + + inline void clearname(void) json_nothrow { + clearString(_name); + } + + #ifdef JSON_DEBUG + #ifndef JSON_LIBRARY + JSONNode Dump(size_t & totalmemory) const json_nothrow; + JSONNode DumpMutex(void) const json_nothrow; + #endif + #endif + + + mutable unsigned char _type BITS(3); + + json_string _name; + mutable bool _name_encoded BITS(1); //must be above name due to initialization list order + + mutable json_string _string; //these are both mutable because the string can change when it's fetched + mutable bool _string_encoded BITS(1); + + //the value of the json + union value_union_t { + bool _bool BITS(1); + json_number _number; + #ifdef JSON_LESS_MEMORY + jsonChildren * Children; + #endif + }; + mutable value_union_t _value; //internal structure changes depending on type + + #ifdef JSON_MUTEX_CALLBACKS + void * mylock; + #endif + + #ifdef JSON_REF_COUNT + size_t refcount PACKED(20); + #endif + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + mutable bool fetched BITS(1); + #endif + + #ifdef JSON_COMMENTS + json_string _comment; + #endif + + #ifndef JSON_LESS_MEMORY + jsonChildren * CHILDREN; + #endif +}; + +inline internalJSONNode::internalJSONNode(char mytype) json_nothrow : _type(mytype), _name(), _name_encoded(), _string(), _string_encoded(), _value() + initializeMutex(0) + initializeRefCount(1) + initializeFetch(true) + initializeComment(json_global(EMPTY_JSON_STRING)) + initializeChildren((_type == JSON_NODE || _type == JSON_ARRAY) ? jsonChildren::newChildren() : 0){ + + LIBJSON_CTOR; + + #ifdef JSON_LESS_MEMORY + //if not less memory, its in the initialization list + if (isContainer()){ + CHILDREN = jsonChildren::newChildren(); + } + #endif +} + +inline internalJSONNode * internalJSONNode::incRef(void) json_nothrow { + #ifdef JSON_REF_COUNT + ++refcount; + return this; + #else + return makeUnique(); + #endif +} + +inline json_index_t internalJSONNode::size(void) const json_nothrow { + if (isNotContainer()) return 0; + Fetch(); + return CHILDREN -> size(); +} + +inline bool internalJSONNode::empty(void) const json_nothrow { + if (isNotContainer()) return true; + Fetch(); + return CHILDREN -> empty(); +} + +inline unsigned char internalJSONNode::type(void) const json_nothrow { + return _type; +} + +inline json_string internalJSONNode::name(void) const json_nothrow { + return _name; +} + +inline void internalJSONNode::setname(const json_string & newname) json_nothrow { + #ifdef JSON_LESS_MEMORY + JSON_ASSERT(newname.capacity() == newname.length(), JSON_TEXT("name object too large")); + #endif + _name = newname; + _name_encoded = true; +} + +#ifdef JSON_COMMENTS + inline void internalJSONNode::setcomment(const json_string & comment) json_nothrow { + _comment = comment; + } + + inline json_string internalJSONNode::getcomment(void) const json_nothrow { + return _comment; + } +#endif + +inline bool internalJSONNode::IsEqualTo(const json_string & val) const json_nothrow { + if (type() != JSON_STRING) return false; + Fetch(); + return _string == val; +} + +inline bool internalJSONNode::IsEqualTo(bool val) const json_nothrow { + if (type() != JSON_BOOL) return false; + Fetch(); + return val == _value._bool; +} + +template +inline bool internalJSONNode::IsEqualToNum(T val) const json_nothrow { + if (type() != JSON_NUMBER) return false; + Fetch(); + return (json_number)val == _value._number; +} + +#ifdef JSON_REF_COUNT + inline void internalJSONNode::decRef(void) json_nothrow { + JSON_ASSERT(refcount != 0, JSON_TEXT("decRef on a 0 refcount internal")); + --refcount; + } + + inline bool internalJSONNode::hasNoReferences(void) json_nothrow { + return refcount == 0; + } +#endif + +inline internalJSONNode * internalJSONNode::makeUnique(void) json_nothrow { + #ifdef JSON_REF_COUNT + if (refcount > 1){ + decRef(); + return newInternal(*this); + } + JSON_ASSERT(refcount == 1, JSON_TEXT("makeUnique on a 0 refcount internal")); + return this; + #else + return newInternal(*this); + #endif +} + +#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + inline void internalJSONNode::SetFetched(bool val) const json_nothrow { + fetched = val; + } +#endif + +inline bool internalJSONNode::Fetched(void) const json_nothrow { + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + return fetched; + #else + return true; + #endif +} + +inline JSONNode ** internalJSONNode::begin(void) const json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("begin"), return 0;); + Fetch(); + return CHILDREN -> begin(); +} + +inline JSONNode ** internalJSONNode::end(void) const json_nothrow { + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("end"), return 0;); + Fetch(); + return CHILDREN -> end(); +} + +inline JSONNode * internalJSONNode::at(json_index_t pos) json_nothrow { + JSON_ASSERT_SAFE(isContainer(), JSON_TEXT("calling at on non-container type"), return 0;); + Fetch(); + return (*CHILDREN)[pos]; +} + +#if defined(JSON_LESS_MEMORY) && defined(__GNUC__) + inline void internalJSONNode::reserve(json_index_t __attribute__((unused)) siz) json_nothrow +#else + inline void internalJSONNode::reserve(json_index_t siz) json_nothrow +#endif +{ + JSON_ASSERT_SAFE(isContainer(), json_global(ERROR_NON_CONTAINER) + JSON_TEXT("reserve"), return;); + Fetch(); + jsonChildren::reserve2(CHILDREN, siz); +} + + + +/* + cast operators +*/ +#ifndef JSON_LIBRARY + #ifdef JSON_ISO_STRICT + #define BASE_CONVERT_TYPE long + #else + #define BASE_CONVERT_TYPE long long + #endif + + #define IMP_SMALLER_INT_CAST_OP(_type, type_max, type_min)\ + inline internalJSONNode::operator _type() const json_nothrow {\ + JSON_ASSERT(_value._number > type_min, _string + json_global(ERROR_LOWER_RANGE) + JSON_TEXT(#_type));\ + JSON_ASSERT(_value._number < type_max, _string + json_global(ERROR_UPPER_RANGE) + JSON_TEXT(#_type));\ + JSON_ASSERT(_value._number == (json_number)((_type)(_value._number)), json_string(JSON_TEXT("(")) + json_string(JSON_TEXT(#_type)) + json_string(JSON_TEXT(") will truncate ")) + _string);\ + return (_type)static_cast(*this);\ + } + + IMP_SMALLER_INT_CAST_OP(char, CHAR_MAX, CHAR_MIN) + IMP_SMALLER_INT_CAST_OP(unsigned char, UCHAR_MAX, 0) + IMP_SMALLER_INT_CAST_OP(short, SHRT_MAX, SHRT_MIN) + IMP_SMALLER_INT_CAST_OP(unsigned short, USHRT_MAX, 0) + IMP_SMALLER_INT_CAST_OP(int, INT_MAX, INT_MIN) + IMP_SMALLER_INT_CAST_OP(unsigned int, UINT_MAX, 0) + + #ifndef JSON_ISO_STRICT + IMP_SMALLER_INT_CAST_OP(long, LONG_MAX, LONG_MIN) + IMP_SMALLER_INT_CAST_OP(unsigned long, ULONG_MAX, 0) + #endif +#endif + +inline internalJSONNode::operator json_string() const json_nothrow { + Fetch(); + return _string; +} + + +#ifndef JSON_LIBRARY + #ifndef JSON_ISO_STRICT + inline internalJSONNode::operator float() const json_nothrow { + return static_cast(static_cast(*this)); + } + inline internalJSONNode::operator double() const json_nothrow { + return static_cast(static_cast(*this)); + } + #else + inline internalJSONNode::operator float() const json_nothrow { + return static_cast(static_cast(*this)); + } + #endif +#endif + +#ifdef JSON_LESS_MEMORY + #ifdef __GNUC__ + #pragma pack(pop) + #elif _MSC_VER + #pragma pack(pop, internalJSONNode_pack,) + #endif +#endif +#endif diff --git a/libjson/_internal/Source/libjson.cpp b/libjson/_internal/Source/libjson.cpp new file mode 100644 index 0000000..d301bac --- /dev/null +++ b/libjson/_internal/Source/libjson.cpp @@ -0,0 +1,605 @@ +/* + This is the implementation of the C interface to libjson + This file may be included in any C++ application, but it will + be completely ignored if JSON_LIBRARY isn't defined. The + only reason JSON_LIBRARY should be defined is when compiling libjson + as a library +*/ +#include "../../libjson.h" +#ifdef JSON_LIBRARY + + #include "JSONNode.h" + #include "JSONWorker.h" + #include "JSONValidator.h" + #include "JSONStream.h" + #include "JSONGlobals.h" + #include //some methods throw exceptions + #ifdef JSON_MEMORY_MANAGE + #define MANAGER_INSERT(x) json_global(NODE_HANDLER).insert(x) + #define MANAGER_STREAM_INSERT(x) json_global(STREAM_HANDLER).insert(x) + #else + #define MANAGER_INSERT(x) x + #define MANAGER_STREAM_INSERT(x) x + #endif + + static const json_char * EMPTY_CSTRING(JSON_TEXT("")); + + #ifdef JSON_MEMORY_POOL + #include "JSONMemoryPool.h" + extern memory_pool json_node_mempool; + #endif + + inline json_char * toCString(const json_string & str) json_nothrow { + const size_t len = (str.length() + 1) * sizeof(json_char); + #ifdef JSON_MEMORY_MANAGE + return (json_char *)json_global(STRING_HANDLER).insert(std::memcpy(json_malloc(len), str.c_str(), len)); + #else + return (json_char *)std::memcpy(json_malloc(len), str.c_str(), len); + #endif + } + + inline json_char * alreadyCString(json_char * str) json_nothrow { + #ifdef JSON_MEMORY_MANAGE + return (json_char *)json_global(STRING_HANDLER).insert(str); + #else + return str; + #endif + } + + /* + stuff that's in namespace libjson + */ + void json_free(void * str){ + JSON_ASSERT_SAFE(str, JSON_TEXT("freeing null ptr"), return;); + #ifdef JSON_MEMORY_MANAGE + json_global(STRING_HANDLER).remove(str); + #endif + libjson_free(str); + } + + void json_delete(JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("deleting null ptr"), return;); + #ifdef JSON_MEMORY_MANAGE + json_global(NODE_HANDLER).remove(node); + #endif + JSONNode::deleteJSONNode((JSONNode *)node); + } + + #ifdef JSON_MEMORY_MANAGE + void json_free_all(void){ + json_global(STRING_HANDLER).clear(); + } + + void json_delete_all(void){ + json_global(NODE_HANDLER).clear(); + } + #endif + + #ifdef JSON_READ_PRIORITY + JSONNODE * json_parse(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_parse"), return 0;); + json_try { + //use this constructor to simply copy reference instead of copying the temp + return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::parse(TOCONST_CSTR(json)))); + } json_catch (std::invalid_argument, (void)0; ) + #ifndef JSON_NO_EXCEPTIONS + return 0; + #endif + } + + JSONNODE * json_parse_unformatted(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_parse"), return 0;); + json_try { + //use this constructor to simply copy reference instead of copying the temp + return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::parse_unformatted(TOCONST_CSTR(json)))); + } json_catch(std::invalid_argument, (void)0; ) + #ifndef JSON_NO_EXCEPTIONS + return 0; + #endif + } + #endif + + json_char * json_strip_white_space(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_strip_white_space"), return 0;); + return alreadyCString(JSONWorker::RemoveWhiteSpaceAndCommentsC(TOCONST_CSTR(json), false)); + } + + #ifdef JSON_VALIDATE + #ifdef JSON_DEPRECATED_FUNCTIONS + JSONNODE * json_validate(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_validate"), return 0;); + if (json_is_valid(json)){ + return json_parse(json); + } + return 0; + } + #endif + json_bool_t json_is_valid(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_is_valid"), return (json_bool_t)false;); + #ifdef JSON_SECURITY_MAX_STRING_LENGTH + if (json_unlikely(json_strlen(json) > JSON_SECURITY_MAX_STRING_LENGTH)){ + JSON_FAIL(JSON_TEXT("Exceeding JSON_SECURITY_MAX_STRING_LENGTH")); + return false; + } + #endif + json_auto s; + s.set(JSONWorker::RemoveWhiteSpaceAndCommentsC(json, false)); + return (json_bool_t)JSONValidator::isValidRoot(s.ptr); + } + + json_bool_t json_is_valid_unformatted(json_const json_char * json){ + JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_is_valid_unformatted"), return (json_bool_t)true;); + #ifdef JSON_SECURITY_MAX_STRING_LENGTH + if (json_unlikely(json_strlen(json) > JSON_SECURITY_MAX_STRING_LENGTH)){ + JSON_FAIL(JSON_TEXT("Exceeding JSON_SECURITY_MAX_STRING_LENGTH")); + return false; + } + #endif + return (json_bool_t)JSONValidator::isValidRoot(json); + } + #endif + + #if defined JSON_DEBUG && !defined JSON_STDERROR + //When libjson errors, a callback allows the user to know what went wrong + void json_register_debug_callback(json_error_callback_t callback){ + JSONDebug::register_callback(callback); + } + #endif + + #ifdef JSON_MUTEX_CALLBACKS + #ifdef JSON_MUTEX_MANAGE + void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock){ + JSONNode::register_mutex_callbacks(lock, unlock, manager_lock); + JSONNode::register_mutex_destructor(destroy); + } + + #else + void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock){ + JSONNode::register_mutex_callbacks(lock, unlock, manager_lock); + } + #endif + + void json_set_global_mutex(void * mutex){ + JSONNode::set_global_mutex(mutex); + } + + void json_set_mutex(JSONNODE * node, void * mutex){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_mutex"), return;); + ((JSONNode*)node) -> set_mutex(mutex); + } + + void json_lock(JSONNODE * node, int threadid){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_lock"), return;); + ((JSONNode*)node) -> lock(threadid); + } + + void json_unlock(JSONNODE * node, int threadid){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_unlock"), return;); + ((JSONNode*)node) -> unlock(threadid); + } + #endif + + #ifdef JSON_MEMORY_CALLBACKS + void json_register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre){ + JSONMemory::registerMemoryCallbacks(mal, real, fre); + } + #endif + + #ifdef JSON_STREAM + void json_stream_push(JSONSTREAM * stream, json_const json_char * addendum){ + (*((JSONStream*)stream)) << addendum; + } + + void json_delete_stream(JSONSTREAM * stream){ + JSON_ASSERT_SAFE(stream, JSON_TEXT("deleting null ptr"), return;); + #ifdef JSON_MEMORY_MANAGE + json_global(STREAM_HANDLER).remove(stream); + #endif + JSONStream::deleteJSONStream((JSONStream *)stream); + } + + JSONSTREAM * json_new_stream(json_stream_callback_t callback, json_stream_e_callback_t e_callback, void * identifier){ + return MANAGER_STREAM_INSERT(JSONStream::newJSONStream(callback, e_callback, identifier)); + } + + void json_stream_reset(JSONSTREAM * stream){ + JSON_ASSERT_SAFE(stream, JSON_TEXT("resetting null ptr"), return;); + ((JSONStream*)stream) -> reset(); + } + #endif + + + /* + stuff that's in class JSONNode + */ + //ctors + JSONNODE * json_new_a(json_const json_char * name, json_const json_char * value){ + if (!name) name = EMPTY_CSTRING; + JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_new_a"), value = EMPTY_CSTRING;); + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(TOCONST_CSTR(name), json_string(TOCONST_CSTR(value)))); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(TOCONST_CSTR(name), json_string(TOCONST_CSTR(value)))); + #else + return MANAGER_INSERT(new JSONNode(TOCONST_CSTR(name), json_string(TOCONST_CSTR(value)))); + #endif + } + + JSONNODE * json_new_i(json_const json_char * name, json_int_t value){ + if (!name) name = EMPTY_CSTRING; + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(TOCONST_CSTR(name), value)); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(TOCONST_CSTR(name), value)); + #else + return MANAGER_INSERT(new JSONNode(TOCONST_CSTR(name), value)); + #endif + } + + JSONNODE * json_new_f(json_const json_char * name, json_number value){ + if (!name) name = EMPTY_CSTRING; + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(TOCONST_CSTR(name), value)); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(TOCONST_CSTR(name), value)); + #else + return MANAGER_INSERT(new JSONNode(TOCONST_CSTR(name), value)); + #endif + } + + JSONNODE * json_new_b(json_const json_char * name, json_bool_t value){ + if (!name) name = EMPTY_CSTRING; + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(TOCONST_CSTR(name), static_cast(value))); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(TOCONST_CSTR(name), static_cast(value))); + #else + return MANAGER_INSERT(new JSONNode(TOCONST_CSTR(name), static_cast(value))); + #endif + } + + JSONNODE * json_new(char type){ + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(type)); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(type)); + #else + return MANAGER_INSERT(new JSONNode(type)); + #endif + } + + JSONNODE * json_copy(json_const JSONNODE * orig){ + JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_copy"), return 0;); + #ifdef JSON_MEMORY_POOL + return MANAGER_INSERT(new((JSONNode*)json_node_mempool.allocate()) JSONNode(*((JSONNode*)orig))); + #elif defined(JSON_MEMORY_CALLBACKS) + return MANAGER_INSERT(new(json_malloc(1)) JSONNode(*((JSONNode*)orig))); + #else + return MANAGER_INSERT(new JSONNode(*((JSONNode*)orig))); + #endif + } + + JSONNODE * json_duplicate(json_const JSONNODE * orig){ + JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_duplicate"), return 0;); + return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)orig) -> duplicate())); + } + + //assignment + void json_set_a(JSONNODE * node, json_const json_char * value){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_a"), return;); + JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_set_a"), value = EMPTY_CSTRING;); + *((JSONNode*)node) = json_string(TOCONST_CSTR(value)); + } + + void json_set_i(JSONNODE * node, json_int_t value){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_i"), return;); + *((JSONNode*)node) = value; + } + + void json_set_f(JSONNODE * node, json_number value){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_f"), return;); + *((JSONNode*)node) = value; + } + + void json_set_b(JSONNODE * node, json_bool_t value){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_b"), return;); + *((JSONNode*)node) = static_cast(value); + } + + void json_set_n(JSONNODE * node, json_const JSONNODE * orig){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_n"), return;); + JSON_ASSERT_SAFE(orig, JSON_TEXT("null node to json_set_n"), return;); + *((JSONNode*)node) = *((JSONNode*)orig); + } + + + //inspectors + char json_type(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_type"), return JSON_NULL;); + return ((JSONNode*)node) -> type(); + } + + json_index_t json_size(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_size"), return 0;); + return ((JSONNode*)node) -> size(); + } + + json_bool_t json_empty(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_empty"), return true;); + return (json_bool_t)(((JSONNode*)node) -> empty()); + } + + json_char * json_name(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_name"), return toCString(EMPTY_CSTRING);); + return toCString(((JSONNode*)node) -> name()); + } + + #ifdef JSON_COMMENTS + json_char * json_get_comment(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get_comment"), return toCString(EMPTY_CSTRING);); + return toCString(((JSONNode*)node) -> get_comment()); + } + #endif + + json_char * json_as_string(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_string"), return toCString(EMPTY_CSTRING);); + return toCString(((JSONNode*)node) -> as_string()); + //return toCString(static_cast(*((JSONNode*)node))); + } + + json_int_t json_as_int(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_int"), return 0;); + return ((JSONNode*)node) -> as_int(); + //return static_cast(*((JSONNode*)node)); + } + + json_number json_as_float(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_float"), return 0.0f;); + return ((JSONNode*)node) -> as_float(); + //return static_cast(*((JSONNode*)node)); + } + + json_bool_t json_as_bool(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_bool"), return false;); + return ((JSONNode*)node) -> as_bool(); + //return (json_bool_t)static_cast(*((JSONNode*)node)); + } + + #ifdef JSON_CASTABLE + JSONNODE * json_as_node(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_node"), return 0;); + return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_node())); + } + + JSONNODE * json_as_array(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_array"), return 0;); + return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_array())); + } + #endif + + #if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) + static void * returnDecode64(const std::string & result, unsigned long * size) json_nothrow json_cold; + static void * returnDecode64(const std::string & result, unsigned long * size) json_nothrow { + const size_t len = result.length(); + if (json_likely(size)) *size = (json_index_t)len; + #ifdef JSON_SAFE + if (json_unlikely(result.empty())) return 0; + #endif + #ifdef JSON_MEMORY_MANAGE + return json_global(STRING_HANDLER).insert(std::memcpy(json_malloc(len), result.data(), len)); + #else + return std::memcpy(json_malloc(len), result.data(), len); + #endif + } + #endif + + #ifdef JSON_BINARY + void * json_as_binary(json_const JSONNODE * node, unsigned long * size){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_binary"), if (size){*size = 0;} return 0;); + return returnDecode64(((JSONNode*)node) -> as_binary(), size); + + } + #endif + + #ifdef JSON_EXPOSE_BASE64 + #include "JSON_Base64.h" + json_char * json_encode64(json_const void * binary, json_index_t bytes){ + const json_string result(JSONBase64::json_encode64((const unsigned char *)binary, (size_t)bytes)); + #ifdef JSON_MEMORY_MANAGE + return (json_char*)json_global(STRING_HANDLER).insert((json_char*)std::memcpy(json_malloc(result.length() + 1), result.c_str(), (result.length() + 1) * sizeof(json_char))); + #else + return (json_char*)std::memcpy(json_malloc(result.length() + 1), result.c_str(), (result.length() + 1) * sizeof(json_char)); + #endif + } + + void * json_decode64(const json_char * text, unsigned long * size){ + return returnDecode64(JSONBase64::json_decode64(text), size); + } + #endif + + #ifdef JSON_WRITE_PRIORITY + json_char * json_write(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write"), return toCString(EMPTY_CSTRING);); + return toCString(((JSONNode*)node) -> write()); + } + + json_char * json_write_formatted(json_const JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write_formatted"), return toCString(EMPTY_CSTRING);); + return toCString(((JSONNode*)node) -> write_formatted()); + } + #endif + + //modifiers + void json_set_name(JSONNODE * node, json_const json_char * name){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_name"), return;); + JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_set_name"), name = EMPTY_CSTRING;); + ((JSONNode*)node) -> set_name(TOCONST_CSTR(name)); + } + + #ifdef JSON_COMMENTS + void json_set_comment(JSONNODE * node, json_const json_char * comment){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_comment"), return;); + JSON_ASSERT_SAFE(comment, JSON_TEXT("null name to json_set_comment"), comment = EMPTY_CSTRING;); + ((JSONNode*)node) -> set_comment(TOCONST_CSTR(comment)); + } + #endif + + void json_clear(JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_clear"), return;); + ((JSONNode*)node) -> clear(); + } + + void json_nullify(JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_nullify"), return;); + ((JSONNode*)node) -> nullify(); + } + + void json_swap(JSONNODE * node, JSONNODE * node2){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;); + JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_swap"), return;); + ((JSONNode*)node) -> swap(*(JSONNode*)node2); + } + + void json_merge(JSONNODE * node, JSONNODE * node2){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_merge"), return;); + JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_merge"), return;); + ((JSONNode*)node) -> merge(*(JSONNode*)node2); + } + + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void json_preparse(JSONNODE * node){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_preparse"), return;); + ((JSONNode*)node) -> preparse(); + } + #endif + + #ifdef JSON_BINARY + void json_set_binary(JSONNODE * node, json_const void * data, unsigned long length){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;); + JSON_ASSERT_SAFE(data, JSON_TEXT("null data to json_set_binary"), *((JSONNode*)node) = EMPTY_CSTRING; return;); + ((JSONNode*)node) -> set_binary((unsigned char *)data, (size_t)length); + } + #endif + + #ifdef JSON_CASTABLE + void json_cast(JSONNODE * node, char type){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_cast"), return;); + ((JSONNode*)node) -> cast(type); + } + #endif + + //children access + void json_reserve(JSONNODE * node, json_index_t siz){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_reserve"), return;); + ((JSONNode*)node) -> reserve(siz); + } + + JSONNODE * json_at(JSONNODE * node, unsigned int pos){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at"), return 0;); + json_try { + return &((JSONNode*)node) -> at(pos); + } json_catch (std::out_of_range, (void)0; ) + #ifndef JSON_NO_EXCEPTIONS + return 0; + #endif + } + + JSONNODE * json_get(JSONNODE * node, json_const json_char * name){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get"), return 0;); + JSON_ASSERT_SAFE(name, JSON_TEXT("null node to json_get. Did you mean to use json_at?"), return 0;); + json_try { + return &((JSONNode*)node) -> at(TOCONST_CSTR(name)); + } json_catch (std::out_of_range, (void)0; ) + #ifndef JSON_NO_EXCEPTIONS + return 0; + #endif + } + + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE * json_get_nocase(JSONNODE * node, json_const json_char * name){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at_nocase"), return 0;); + JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_at_nocase"), return 0;); + json_try { + return &((JSONNode*)node) -> at_nocase(TOCONST_CSTR(name)); + } json_catch (std::out_of_range, (void)0; ) + #ifndef JSON_NO_EXCEPTIONS + return 0; + #endif + } + + JSONNODE * json_pop_back_nocase(JSONNODE * node, json_const json_char * name){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_nocase"), return 0;); + JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back_nocase"), return 0;); + return MANAGER_INSERT(((JSONNode*)node) -> pop_back_nocase(TOCONST_CSTR(name))); + } + #endif + + void json_push_back(JSONNODE * node, JSONNODE * node2){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_push_back"), return;); + JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_push_back"), return;); + #ifdef JSON_MEMORY_MANAGE + json_global(NODE_HANDLER).remove(node2); + #endif + ((JSONNode*)node) -> push_back((JSONNode*)node2); + } + + JSONNODE * json_pop_back_at(JSONNODE * node, unsigned int pos){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_i"), return 0;); + return MANAGER_INSERT(((JSONNode*)node) -> pop_back(pos)); + } + + JSONNODE * json_pop_back(JSONNODE * node, json_const json_char * name){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back"), return 0;); + JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back. Did you mean to use json_pop_back_at?"), return 0;); + return MANAGER_INSERT(((JSONNode*)node) -> pop_back(TOCONST_CSTR(name))); + } + + #ifdef JSON_ITERATORS + JSONNODE_ITERATOR json_find(JSONNODE * node, json_const json_char * name){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> find(TOCONST_CSTR(name))); + } + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE_ITERATOR json_find_nocase(JSONNODE * node, json_const json_char * name){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> find_nocase(TOCONST_CSTR(name))); + } + #endif + + JSONNODE_ITERATOR json_erase(JSONNODE * node, JSONNODE_ITERATOR it){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> erase((JSONNode**)it)); + } + + JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> erase((JSONNode**)start, (JSONNode**)end)); + } + + JSONNODE_ITERATOR json_insert(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2){ + #ifdef JSON_MEMORY_MANAGE + json_global(NODE_HANDLER).remove(node2); + #endif + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> insert((JSONNode**)it, (JSONNode*)node2)); + } + + JSONNODE_ITERATOR json_insert_multi(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> insert((JSONNode**)it, (JSONNode**)start, (JSONNode**)end)); + } + + //iterator functions + JSONNODE_ITERATOR json_begin(JSONNODE * node){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> begin()); + } + + JSONNODE_ITERATOR json_end(JSONNODE * node){ + return (JSONNODE_ITERATOR)(((JSONNode*)node) -> end()); + } + #endif + + //comparison + json_bool_t json_equal(JSONNODE * node, JSONNODE * node2){ + JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_equal"), return false;); + JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_equal"), return false;); + return (json_bool_t)(*((JSONNode*)node) == *((JSONNode*)node2)); + } + +#endif //JSON_LIBRARY diff --git a/libjson/_internal/TestSuite/All/Options.txt b/libjson/_internal/TestSuite/All/Options.txt new file mode 100644 index 0000000..37e4e4a --- /dev/null +++ b/libjson/_internal/TestSuite/All/Options.txt @@ -0,0 +1,371 @@ +#unittesting + #library + #unicode + #standard set + STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS, STRICT + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, UNICODE, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + VALIDATE, STREAM, UNICODE, LIBRARY, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, UNICODE, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, UNICODE, LIBRARY, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #no unicode + #standard set + STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, CASTABLE, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + VALIDATE, STREAM, LIBRARY, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, STREAM, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, VALIDATE, STREAM, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, LIBRARY, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #embedded + #unicode + #standard set + STREAM, UNICODE, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, UNICODE, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + VALIDATE, STREAM, UNICODE, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, UNICODE, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, UNICODE, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #no unicode + #standard set + STREAM, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, CASTABLE, STREAM, UNIT_TEST, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + VALIDATE, STREAM, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, STREAM, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, VALIDATE, STREAM, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + CASTABLE, UNIT_TEST, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS +#no unittesting + #library + #unicode + #standard set + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #no unicode + #standard set + STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + STREAM, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #embedded + #unicode + #standard set + STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting + STREAM, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + STREAM, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, UNICODE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #no unicode + #standard set + STREAM, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref countingv + STREAM, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no preparse + STREAM, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no safe + STREAM, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + #string header + STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STRING_HEADER, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing + STREAM, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + STREAM, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, STREAM, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS + #no ref counting or preparsing or safety + STREAM, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS + BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + MEMORY_POOL, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS + STREAM, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS \ No newline at end of file diff --git a/libjson/_internal/TestSuite/All/main.cpp b/libjson/_internal/TestSuite/All/main.cpp new file mode 100644 index 0000000..d306f8a --- /dev/null +++ b/libjson/_internal/TestSuite/All/main.cpp @@ -0,0 +1,246 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../UnitTest.h" + +using namespace std; + +map options; +vector lines; +vector line_numbers; +size_t counter = 0; +string make; +string ArchivedOptions; +string makeStyle; + +string makeOptions[] = { + "single", + "debug", + "small" +}; + +void makeMap(void){ + options["LIBRARY"] = "#define JSON_LIBRARY"; + options["DEBUG"] = "#define JSON_DEBUG"; + options["STREAM"] = "#define JSON_STREAM"; + options["SAFE"] = "#define JSON_SAFE"; + options["STDERROR"] = "#define JSON_STDERROR"; + options["PREPARSE"] = "#define JSON_PREPARSE"; + options["LESS_MEMORY"] = "#define JSON_LESS_MEMORY"; + options["UNICODE"] = "#define JSON_UNICODE"; + options["REF_COUNT"] = "#define JSON_REF_COUNT"; + options["BINARY"] = "#define JSON_BINARY"; + options["MEMORY_CALLBACKS"] = "#define JSON_MEMORY_CALLBACKS"; + options["MEMORY_MANAGE"] = "#define JSON_MEMORY_MANAGE"; + options["MUTEX_CALLBACKS"] = "#define JSON_MUTEX_CALLBACKS"; + options["MUTEX_MANAGE"] = "#define JSON_MUTEX_MANAGE"; + options["ITERATORS"] = "#define JSON_ITERATORS"; + options["WRITER"] = "#define JSON_WRITE_PRIORITY MID"; + options["READER"] = "#define JSON_READ_PRIORITY HIGH"; + options["NEWLINE"] = "#define JSON_NEWLINE \"\\r\\n\""; + options["COMMENTS"] = "#define JSON_COMMENTS"; + options["INDENT"] = "#define JSON_INDENT \" \""; + options["WRITE_BASH_COMMENTS"] = "#define JSON_WRITE_BASH_COMMENTS"; + options["WRITE_SINGLE_LINE_COMMENTS"] = "#define JSON_WRITE_SINGLE_LINE_COMMENTS"; + options["VALIDATE"] = "#define JSON_VALIDATE"; + options["UNIT_TEST"] = "#define JSON_UNIT_TEST"; + options["INDEX_TYPE"] = "#define JSON_INDEX_TYPE unsigned int"; + options["CASE_INSENSITIVE_FUNCTIONS"] = "#define JSON_CASE_INSENSITIVE_FUNCTIONS"; + options["ESCAPE_WRITES"] = "#define JSON_ESCAPE_WRITES"; + options["STRINGU_HEADER"] = "#define JSON_STRING_HEADER \"../TestSuite/UStringTest.h\""; + options["STRING_HEADER"] = "#define JSON_STRING_HEADER \"../TestSuite/StringTest.h\""; + options["CASTABLE"] = "#define JSON_CASTABLE"; + options["STRICT"] = "#define JSON_STRICT"; + options["MEMORY_POOL"] = "#define JSON_MEMORY_POOL 524288"; +} + +void testRules(unsigned int i){ + remove("./testapp"); + int q = system(make.c_str()); + bool Archive = false; + if (FILE * fp = fopen("./testapp", "r")){ + fclose(fp); + + remove("./out.html"); + q = system("./testapp"); + if (FILE * fp = fopen("./out.html", "r")){ + char buffer[255]; + size_t qq = fread(&buffer[0], 255, 1, fp); + buffer[254] = '\0'; + fclose(fp); + string buf(&buffer[0]); + size_t pos = buf.find("Failed Tests: "); + if (pos == string::npos){ + FAIL("Something Wrong"); + } else { + if(buf[pos + 39] == '0'){ + PASS("GOOD"); + } else { + size_t pp = buf.find('<', pos + 39); + FAIL(string("Didn't pass ") + buf.substr(pos + 39, pp - pos - 39) + " tests"); + ArchivedOptions = std::string("Fail_") + ArchivedOptions; + Archive = true; + } + } + } else { + FAIL("Running crashed"); + ArchivedOptions = std::string("Crashed_") + ArchivedOptions; + Archive = true; + } + } else { + FAIL(string("Compilation failed - ") + lines[i]); + ArchivedOptions = std::string("Compile_") + ArchivedOptions; + Archive = true; + } + + //If something broke, make a copy of the options used to make the failure, so it can be easily retested + if (Archive){ + if (FILE * fp = fopen("../JSONOptions.h", "r")){ + ArchivedOptions = std::string("../") + ArchivedOptions; + if (FILE * ofp = fopen(ArchivedOptions.c_str(), "w")){ + char buffer[2048] = {'\0'}; + size_t qq = fread(&buffer[0], 2048, 1, fp); + fwrite(&buffer[0], strlen(&buffer[0]), 1, ofp); + fclose(ofp); + } + fclose(fp); + } + } +} + +bool makeTempOptions(unsigned int i){ + string & line = lines[i]; + + if (FILE * fp = fopen("../JSONOptions.h", "w")){ + string res("#ifndef JSON_OPTIONS_H\n#define JSON_OPTIONS_H\n"); + for ( + map::iterator runner = options.begin(), end = options.end(); + runner != end; + ++runner){ + + if (line.find(runner -> first) != string::npos){ + res += runner -> second + "\n"; + } + } + res += "#endif\n"; + + fwrite(res.c_str(), res.length(), 1, fp); + fclose(fp); + return true; + } + return false; +} + +bool hideGoodOptions(void){ + struct stat stFileInfo; + if (stat("../__JSONOptions.h", &stFileInfo)){ + remove("../JSONOptions.h"); + return true; + } + return (rename("../JSONOptions.h", "../__JSONOptions.h") == 0); +} + +bool loadTests(){ + ifstream infile("All/Options.txt"); + + if (!infile){ + return false; + } + + string line; + unsigned int iii = 0; + while (getline(infile, line)){ + ++iii; + size_t pos = line.find_first_not_of(' '); + if (pos != string::npos){ + line = line.substr(pos); + pos = line.find_first_not_of("\r\n\t "); + if ((line.length() > 5) && (line[0] != '#')){ + const string temp(line.substr(pos)); + lines.push_back(string("READER, ") + temp); + line_numbers.push_back(iii); + if ((temp.find("VALIDATE") == string::npos) && (temp.find("STREAM") == string::npos)){ + lines.push_back(temp); + line_numbers.push_back(iii); + } + } + } + } + infile.close(); + return true; +} + +void RunTest(const std::string & version, unsigned int i){ + if(makeTempOptions(i)){ + stringstream mystream; + mystream << version << " Line " << line_numbers[i]; + cout << "Compiling " << ++counter << " of " << line_numbers.size() * 3 << " - " << mystream.str() << endl; + cout << " " << lines[i] << endl; + UnitTest::SetPrefix(mystream.str()); + stringstream options_; + options_ << version << "_Line_" << line_numbers[i] << "_JSONOptions.h"; + ArchivedOptions = options_.str(); + testRules(i); + remove("../JSONOptions.h"); + UnitTest::SaveTo("progress.html"); + } +} + +void Go(const std::string & version, unsigned int test){ + echo(make); + if (makeStyle.empty() || (makeStyle == version)){ + makeStyle.clear(); + for (unsigned int i = test; i < lines.size(); ++i){ + RunTest(version, i); + } + } else { + echo("skipping"); + } +} + + +void RunTests(unsigned int test){ + if (hideGoodOptions()){ + if(loadTests()){ + makeMap(); + for(unsigned int i = 0; i < sizeof(makeOptions); ++i){ + make = "make -j4 " + makeOptions[i]; + Go(makeOptions[i], test); + } + } else { + FAIL("couldn't open options"); + } + rename("../__JSONOptions.h", "../JSONOptions.h"); + } else { + FAIL("Couldn't protect JSONOptions"); + } +} + +int main (int argc, char * const argv[]) { + UnitTest::StartTime(); + unsigned int test = 0; + if (argc == 3){ + test = atoi(argv[2]) - 1; + counter = test; + echo("starting on test " << test); + makeStyle = argv[1]; + echo("starting with make " << makeStyle); + } else if (argc == 2){ + test = 0; + counter = test; + echo("starting on test " << test); + makeStyle = argv[1]; + echo("starting with make " << makeStyle); + } + + RunTests(test); + + UnitTest::SaveTo("out.html"); + return 0; +} diff --git a/libjson/_internal/TestSuite/Benchmark/main.cpp b/libjson/_internal/TestSuite/Benchmark/main.cpp new file mode 100644 index 0000000..8266d9c --- /dev/null +++ b/libjson/_internal/TestSuite/Benchmark/main.cpp @@ -0,0 +1,311 @@ +/** + * + * This test suite should get run before releasing a new version of libjson, once all + * unit tests have passed. This asserts that the Options are in the default configuration, + * this prevents me from accidentally releasing libjson using options that I had been testing + * with. It also performs a speed benchmark, so I can keep track of how libjson is performing + * + */ + +#include +#include +#include +#include "../../libjson.h" + +using namespace std; + +#ifndef JSON_LIBRARY +#error, JSON_LIBRARY not on +#endif + +#ifdef JSON_STRICT +#error, JSON_STRICT on +#endif + +#ifdef JSON_DEBUG +#error, JSON_DEBUG on +#endif + +#ifdef JSON_ISO_STRICT +#error, JSON_ISO_STRICT on +#endif + +#ifndef JSON_SAFE +#error, JSON_SAFE not on +#endif + +#ifndef JSON_CASTABLE +#error, JSON_CASTABLE not on +#endif + +#ifdef JSON_STDERROR +#error, JSON_STDERROR on +#endif + +#ifdef JSON_PREPARSE +#error, JSON_PREPARSE on +#endif + +#ifdef JSON_LESS_MEMORY +#error, JSON_LESS_MEMORY on +#endif + +#ifdef JSON_UNICODE +#error, JSON_UNICODE on +#endif + +#ifndef JSON_REF_COUNT +#error, JSON_REF_COUNT not on +#endif + +#ifndef JSON_BINARY +#error, JSON_BINARY not on +#endif + +#ifndef JSON_EXPOSE_BASE64 +#error, JSON_EXPOSE_BASE64 not on +#endif + +#ifndef JSON_ITERATORS +#error, JSON_ITERATORS not on +#endif + +#ifndef JSON_STREAM +#error, JSON_STREAM not on +#endif + +#ifdef JSON_MEMORY_CALLBACKS +#error, JSON_MEMORY_CALLBACKS on +#endif + +#ifdef JSON_MEMORY_MANAGE +#error, JSON_MEMORY_MANAGE on +#endif + +#ifdef JSON_MUTEX_CALLBACKS +#error, JSON_MUTEX_CALLBACKS on +#endif + +#ifdef JSON_MUTEX_MANAGE +#error, JSON_MUTEX_MANAGE on +#endif + +#ifdef JSON_NO_C_CONSTS +#error, JSON_NO_C_CONSTS on +#endif + +#ifdef JSON_OCTAL +#error, JSON_OCTAL on +#endif + +#if (JSON_READ_PRIORITY != HIGH) +#error JSON_READ_PRIORITY not high +#endif + +#if (JSON_WRITE_PRIORITY != MED) +#error JSON_WRITE_PRIORITY not med +#endif + +#ifdef JSON_NEWLINE +#error, JSON_NEWLINE on +#endif + +#ifdef JSON_INDENT +#error, JSON_INDENT on +#endif + +#ifndef JSON_ESCAPE_WRITES +#error, JSON_ESCAPE_WRITES not on +#endif + +#ifndef JSON_COMMENTS +#error, JSON_COMMENTS not on +#endif + +#ifdef JSON_WRITE_BASH_COMMENTS +#error, JSON_WRITE_BASH_COMMENTS on +#endif + +#ifdef JSON_WRITE_SINGLE_LINE_COMMENTS +#error, JSON_WRITE_SINGLE_LINE_COMMENTS on +#endif + +#ifdef JSON_ARRAY_ON_ONE_LINE +#error, JSON_ARRAY_ON_ONE_LINE on +#endif + +#ifndef JSON_VALIDATE +#error, JSON_VALIDATE not on +#endif + +#ifndef JSON_CASE_INSENSITIVE_FUNCTIONS +#error, JSON_CASE_INSENSITIVE_FUNCTIONS not on +#endif + +#ifdef JSON_INDEX_TYPE +#error, JSON_INDEX_TYPE on +#endif + +#ifdef JSON_BOOL_TYPE +#error, JSON_BOOL_TYPE on +#endif + +#ifdef JSON_INT_TYPE +#error, JSON_INT_TYPE on +#endif + +#ifdef JSON_STRING_HEADER +#error, JSON_STRING_HEADER on +#endif + +#ifdef JSON_NO_EXCEPTIONS +#error, JSON_NO_EXCEPTIONS on +#endif + +#ifndef JSON_DEPRECATED_FUNCTIONS +#error, JSON_DEPRECATED_FUNCTIONS not on +#endif + +#if (JSON_SECURITY_MAX_NEST_LEVEL != 128) +#error JSON_SECURITY_MAX_NEST_LEVEL not 128 +#endif + +#if (JSON_SECURITY_MAX_STRING_LENGTH != 33554432) +#error JSON_SECURITY_MAX_STRING_LENGTH not 33554432 +#endif + +#if (JSON_SECURITY_MAX_STREAM_OBJECTS != 128) +#error JSON_SECURITY_MAX_STREAM_OBJECTS not 128 +#endif + +#ifdef JSON_MEMORY_POOL +#error JSON_MEMORY_POOL is on +#endif + +#ifdef JSON_UNIT_TEST +#error, JSON_UNIT_TEST on +#endif + +#define IT_COUNT 50000 +static string makeBigFormatted(){ + string json = "{\n"; + for(unsigned int i = 0; i < IT_COUNT; ++i){ + json += "\t//This is an object\r\n\t{\n\t\t\"name\" : 14.783,\n\t\t/* This is a multilen commenet */\n\t\t\"another\" : \"I am a stirng\"\n\t},"; + json += "\n\n\t//This is an array\r\n\t[4, 16, true, false, 78.98],\n"; + } + json += "\t\"number\" : null\n}"; + return json; +} + +static string makeBig(){ + string json = "{"; + for(unsigned int i = 0; i < IT_COUNT; ++i){ + json += "{\"name\":14.783,\"another\":\"I am a stirng\"},"; + json += "[4, 16, true, false, 78.98],"; + } + json += "\"number\":null}"; + return json; +} + +int main (int argc, char * const argv[]) { + JSONNODE * node; + string mystr = makeBigFormatted(); + clock_t start = clock(); + for(unsigned int i = 0; i < 100; ++i){ + node = json_parse(mystr.c_str()); + for (unsigned int j = 0; j < IT_COUNT; ++j){ + JSONNODE * meh = json_at(node, j * 2); + json_as_float(json_get(meh, "name")); + char * str = json_as_string(json_get(meh, "another")); + json_free(str); + + meh = json_at(node, j * 2 + 1); + json_as_int(json_at(meh, 0)); + json_as_int(json_at(meh, 1)); + json_as_bool(json_at(meh, 2)); + json_as_bool(json_at(meh, 3)); + json_as_int(json_at(meh, 4)); + } + json_delete(node); + } + cout << "Reading: " << clock() - start << endl; + + + + mystr = makeBig(); + start = clock(); + for(unsigned int i = 0; i < 100; ++i){ + node = json_parse(mystr.c_str()); + for (unsigned int j = 0; j < IT_COUNT; ++j){ + JSONNODE * meh = json_at(node, j * 2); + json_as_float(json_get(meh, "name")); + char * str = json_as_string(json_get(meh, "another")); + json_free(str); + + meh = json_at(node, j * 2 + 1); + json_as_int(json_at(meh, 0)); + json_as_int(json_at(meh, 1)); + json_as_bool(json_at(meh, 2)); + json_as_bool(json_at(meh, 3)); + json_as_int(json_at(meh, 4)); + } + json_delete(node); + } + cout << "Reading Unformatted: " << clock() - start << endl; + + + start = clock(); + for(unsigned int i = 0; i < 100; ++i){ + node = json_new(JSON_NODE); + for (unsigned int j = 0; j < IT_COUNT; ++j){ + JSONNODE * meh = json_new(JSON_NODE); + json_push_back(meh, json_new_f("name", 14.783)); + json_push_back(meh, json_new_a("another", "I am a string")); + json_push_back(node, meh); + + meh = json_new(JSON_ARRAY); + json_push_back(meh, json_new_i(NULL, 14)); + json_push_back(meh, json_new_i("", 1)); + json_push_back(meh, json_new_b(NULL, true)); + json_push_back(meh, json_new_b("", false)); + json_push_back(meh, json_new_f(NULL, 14.3243)); + json_push_back(node, meh); + } + json_delete(node); + } + cout << "Building: " << clock() - start << endl; + + + + node = json_new(JSON_NODE); + for (unsigned int j = 0; j < IT_COUNT; ++j){ + JSONNODE * meh = json_new(JSON_NODE); + json_push_back(meh, json_new_f("name", 14.783)); + json_push_back(meh, json_new_a("another", "I am a string")); + json_push_back(node, meh); + + meh = json_new(JSON_ARRAY); + json_push_back(meh, json_new_i(NULL, 14)); + json_push_back(meh, json_new_i("", 1)); + json_push_back(meh, json_new_b(NULL, true)); + json_push_back(meh, json_new_b("", false)); + json_push_back(meh, json_new_f(NULL, 14.3243)); + json_push_back(node, meh); + } + start = clock(); + for(unsigned int i = 0; i < 100; ++i){ + char * str = json_write_formatted(node); + json_free(str); + } + cout << "Writing: " << clock() - start << endl; + + start = clock(); + for(unsigned int i = 0; i < 100; ++i){ + char * str = json_write(node); + json_free(str); + } + cout << "Writing Unformatted: " << clock() - start << endl; + json_delete(node); + + return 0; +} diff --git a/libjson/_internal/TestSuite/Benchmark/makefile b/libjson/_internal/TestSuite/Benchmark/makefile new file mode 100644 index 0000000..81a017f --- /dev/null +++ b/libjson/_internal/TestSuite/Benchmark/makefile @@ -0,0 +1,42 @@ +OS=$(shell uname) +ifeq ($(OS), Darwin) + fastflag = -fast +else + fastflag = -O3 +endif + +single: + g++ main.cpp \ + ../../Source/internalJSONNode.cpp \ + ../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \ + ../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \ + ../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \ + ../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \ + ../../Source/libjson.cpp ../../Source/JSONValidator.cpp \ + ../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \ + ../../Source/JSONPreparse.cpp \ + -Wfatal-errors -DNDEBUG $(fastflag) -ffast-math -fexpensive-optimizations -o testapp + +debug: + g++ main.cpp \ + ../../Source/internalJSONNode.cpp \ + ../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \ + ../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \ + ../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \ + ../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \ + ../../Source/libjson.cpp ../../Source/JSONValidator.cpp \ + ../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \ + ../../Source/JSONPreparse.cpp \ + -Wfatal-errors -DJSON_DEBUG -o testapp + +small: + g++ main.cpp \ + ../../Source/internalJSONNode.cpp \ + ../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \ + ../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \ + ../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \ + ../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \ + ../../Source/libjson.cpp ../../Source/JSONValidator.cpp \ + ../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \ + ../../Source/JSONPreparse.cpp \ + -Wfatal-errors -DNDEBUG -Os -ffast-math -DJSON_LESS_MEMORY -o testapp diff --git a/libjson/_internal/TestSuite/Checklist.txt b/libjson/_internal/TestSuite/Checklist.txt new file mode 100644 index 0000000..fd24690 --- /dev/null +++ b/libjson/_internal/TestSuite/Checklist.txt @@ -0,0 +1,12 @@ +Update LIBJSON_VERSION values and values in makefile too +Strip all trailing white space +Run test in XCode using all options on +Export Documentation to PDF +Delete build folders +Run all tests on Mac +Run all tests on Linux +Run test in VC++ using all options on (if possible) +Run benchmark to assert options are all the default +Remove Hidden Finder files +Zip TestSuite +Zip on Linux diff --git a/libjson/_internal/TestSuite/RunTestSuite2.cpp b/libjson/_internal/TestSuite/RunTestSuite2.cpp new file mode 100644 index 0000000..a0f370e --- /dev/null +++ b/libjson/_internal/TestSuite/RunTestSuite2.cpp @@ -0,0 +1,155 @@ +#include "RunTestSuite2.h" +#include "../TestSuite2/BaseTest.h" +#include "../TestSuite2/JSON_Base64/json_decode64.h" +#include "../TestSuite2/JSON_Base64/json_encode64.h" +#include "../TestSuite2/JSONDebug/JSON_ASSERT.h" +#include "../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h" +#include "../TestSuite2/JSONDebug/JSON_FAIL.h" +#include "../TestSuite2/JSONDebug/JSON_FAIL_SAFE.h" +#include "../TestSuite2/JSONGlobals/jsonSingleton.h" +#include "../TestSuite2/JSONValidator/isValidArray.h" +#include "../TestSuite2/JSONValidator/isValidMember.h" +#include "../TestSuite2/JSONValidator/isValidNamedObject.h" +#include "../TestSuite2/JSONValidator/isValidNumber.h" +#include "../TestSuite2/JSONValidator/isValidObject.h" +#include "../TestSuite2/JSONValidator/isValidPartialRoot.h" +#include "../TestSuite2/JSONValidator/isValidRoot.h" +#include "../TestSuite2/JSONValidator/isValidString.h" +#include "../TestSuite2/JSONValidator/Resources/validyMacros.h" +#include "../TestSuite2/JSONValidator/securityTest.h" +#include "../TestSuite2/NumberToString/_areFloatsEqual.h" +#include "../TestSuite2/NumberToString/_atof.h" +#include "../TestSuite2/NumberToString/_ftoa.h" +#include "../TestSuite2/NumberToString/_itoa.h" +#include "../TestSuite2/NumberToString/_uitoa.h" +#include "../TestSuite2/NumberToString/getLenSize.h" +#include "../TestSuite2/NumberToString/isNumeric.h" + +#define RUNTEST(name) ttt.setUp(#name); ttt.name(); ttt.tearDown() + +void RunTestSuite2::RunTests(void){ + { + testJSON_Base64__json_decode64 ttt("testJSON_Base64__json_decode64"); + RUNTEST(testNotBase64); + } + { + testJSON_Base64__json_encode64 ttt("testJSON_Base64__json_encode64"); + RUNTEST(testReverseEachOther); + RUNTEST(testAllChars); + } + { + testJSONDebug_JSON_ASSERT ttt("testJSONDebug_JSON_ASSERT"); + RUNTEST(testPass); + RUNTEST(testFail); + } + { + testJSONDebug_JSON_ASSERT_SAFE ttt("testJSONDebug_JSON_ASSERT_SAFE"); + RUNTEST(testPass); + RUNTEST(testFail); + } + { + testJSONDebug_JSON_FAIL ttt("testJSONDebug_JSON_FAIL"); + RUNTEST(testFail); + } + { + testJSONDebug_JSON_FAIL_SAFE ttt("testJSONDebug_JSON_FAIL_SAFE"); + RUNTEST(testFail); + } + { + testJSONGlobals__jsonSingleton ttt("testJSONGlobals__jsonSingleton"); + RUNTEST(testValue); + RUNTEST(testNoValue); + } + { + testJSONValidator__isValidMember ttt("testJSONValidator__isValidMember"); + RUNTEST(testMembers); + RUNTEST(testStrict); + RUNTEST(testNotStrict); + RUNTEST(testNotMembers); + RUNTEST(testSuddenEnd); + } + { + testJSONValidator__isValidNumber ttt("testJSONValidator__isValidNumber"); + RUNTEST(testPositive); + RUNTEST(testNegative); + RUNTEST(testPositive_ScientificNotation); + RUNTEST(testNegative_ScientificNotation); + RUNTEST(testPositive_SignedScientificNotation); + RUNTEST(testNegative_SignedScientificNotation); + RUNTEST(testSuddenEnd); + } + { + testJSONValidator__isValidRoot ttt("testJSONValidator__isValidRoot"); + RUNTEST(testRoots); + RUNTEST(testNotRoots); + RUNTEST(testSuddenEnd); + } + { + testJSONValidator__isValidString ttt("testJSONValidator__isValidString"); + RUNTEST(testNormal); + RUNTEST(testUnicode); + RUNTEST(testStrict); + RUNTEST(testNotStrict); + RUNTEST(testNotString); + RUNTEST(testSuddenEnd); + } + { + testJSONValidator__securityTest ttt("testJSONValidator__securityTest"); + RUNTEST(testsecurity); + } + { + testNumberToString__areFloatsEqual ttt("testNumberToString__areFloatsEqual"); + RUNTEST(testEqual); + RUNTEST(testNotEqual); + RUNTEST(testCloseEnough); + } + + { + testNumberToString__atof ttt("testNumberToString__atof"); + RUNTEST(testPositive); + RUNTEST(testNegative); + RUNTEST(testPositive_ScientificNotation); + RUNTEST(testNegative_ScientificNotation); + RUNTEST(testPositive_SignedScientificNotation); + RUNTEST(testNegative_SignedScientificNotation); + RUNTEST(testStrict); + RUNTEST(testNotNumbers); + } + + { + testNumberToString__ftoa ttt("testNumberToString__ftoa"); + RUNTEST(testRandomNumbers); + RUNTEST(testSpecializedInts); + } + { + testNumberToString__itoa ttt("testNumberToString__itoa"); + RUNTEST(testChar); + RUNTEST(testShort); + RUNTEST(testInt); + RUNTEST(testLong); + RUNTEST(testLongLong); + } + { + testNumberToString__uitoa ttt("testNumberToString__uitoa"); + RUNTEST(testChar); + RUNTEST(testShort); + RUNTEST(testInt); + RUNTEST(testLong); + RUNTEST(testLongLong); + } + { + testNumberToString__getLenSize ttt("testNumberToString__getLenSize"); + RUNTEST(testStruct); + } + { + testNumberToString__isNumeric ttt("testNumberToString__isNumeric"); + RUNTEST(testPositive); + RUNTEST(testNegative); + RUNTEST(testPositive_ScientificNotation); + RUNTEST(testNegative_ScientificNotation); + RUNTEST(testPositive_SignedScientificNotation); + RUNTEST(testNegative_SignedScientificNotation); + RUNTEST(testNotNumbers); + } +} + diff --git a/libjson/_internal/TestSuite/RunTestSuite2.h b/libjson/_internal/TestSuite/RunTestSuite2.h new file mode 100644 index 0000000..86ba574 --- /dev/null +++ b/libjson/_internal/TestSuite/RunTestSuite2.h @@ -0,0 +1,9 @@ +#ifndef RUN_TEST_SUITE2_H +#define RUN_TEST_SUITE2_H + +class RunTestSuite2 { +public: + static void RunTests(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite/StringTest.h b/libjson/_internal/TestSuite/StringTest.h new file mode 100644 index 0000000..32d8f2c --- /dev/null +++ b/libjson/_internal/TestSuite/StringTest.h @@ -0,0 +1,297 @@ +#ifndef STRING_TEST_H +#define STRING_TEST_H + +/* + * Developer note: This is not a fully functionaly string and is not meant to be used as such. + * It is merely to serve as a testing module + */ + +#include +#include + +typedef char mychar; + +static size_t mystrlen(const mychar * str){ + unsigned int i = 0; + for(const mychar * it = str; *it; ++it, ++i){ + //dummy + } + return i; +} + +class json_string { +public: + struct const_iterator { + inline const_iterator& operator ++(void) { ++it; return *this; } + inline const_iterator& operator --(void) { --it; return *this; } + inline const_iterator& operator +=(long i) { it += i; return *this; } + inline const_iterator& operator -=(long i) { it -= i; return *this; } + inline const_iterator operator ++(int) { + const_iterator result(*this); + ++it; + return result; + } + inline const_iterator operator --(int) { + const_iterator result(*this); + --it; + return result; + } + inline const_iterator operator +(long i) const { + const_iterator result(*this); + result.it += i; + return result; + } + inline const_iterator operator -(long i) const { + const_iterator result(*this); + result.it -= i; + return result; + } + inline size_t operator -(const_iterator other) const { + return it - other.it; + } + inline mychar & operator [](size_t pos) const { return it[pos]; }; + inline mychar & operator *(void) const { return *it; } + inline bool operator == (const const_iterator & other) const { return it == other.it; } + inline bool operator != (const const_iterator & other) const { return it != other.it; } + inline bool operator > (const const_iterator & other) const { return it > other.it; } + inline bool operator >= (const const_iterator & other) const { return it >= other.it; } + inline bool operator < (const const_iterator & other) const { return it < other.it; } + inline bool operator <= (const const_iterator & other) const { return it <= other.it; } + inline const_iterator & operator = (const const_iterator & orig) { it = orig.it; return *this; } + const_iterator (const const_iterator & orig) : it(orig.it) {} + const_iterator (const mychar * place) : it((mychar*)place) {} + const_iterator(void) : it(0) {}; + + mychar * it; + }; + + struct iterator { + inline iterator& operator ++(void) { ++it; return *this; } + inline iterator& operator --(void) { --it; return *this; } + inline iterator& operator +=(long i) { it += i; return *this; } + inline iterator& operator -=(long i) { it -= i; return *this; } + inline iterator operator ++(int) { + iterator result(*this); + ++it; + return result; + } + inline iterator operator --(int) { + iterator result(*this); + --it; + return result; + } + inline iterator operator +(long i) const { + iterator result(*this); + result.it += i; + return result; + } + inline iterator operator -(long i) const { + iterator result(*this); + result.it -= i; + return result; + } + inline mychar & operator [](size_t pos) const { return it[pos]; }; + inline mychar & operator *(void) const { return *it; } + inline bool operator == (const iterator & other) const { return it == other.it; } + inline bool operator != (const iterator & other) const { return it != other.it; } + inline bool operator > (const iterator & other) const { return it > other.it; } + inline bool operator >= (const iterator & other) const { return it >= other.it; } + inline bool operator < (const iterator & other) const { return it < other.it; } + inline bool operator <= (const iterator & other) const { return it <= other.it; } + inline iterator & operator = (const iterator & orig) { it = orig.it; return *this; } + inline operator const_iterator() const json_nothrow { return const_iterator(it); } + iterator (const iterator & orig) : it(orig.it) {} + iterator (const mychar * place) : it((mychar*)place) {} + + mychar * it; + }; + + + + const static size_t npos = 0xFFFFFFFF; + json_string(void) : len(0), str(0){ + setToCStr("", 0); + } + + json_string(const mychar * meh) : len(0), str(0){ + setToCStr(meh, mystrlen(meh)); + } + + json_string(const mychar * meh, size_t l) : len(l), str(0){ + setToCStr(meh, l); + str[len] = '\0'; + } + + json_string(const iterator & beg, const iterator & en) : len(0), str(0){ + setToCStr(beg.it, en.it - beg.it); + str[len] = '\0'; + } + + json_string(const const_iterator & beg, const const_iterator & en) : len(0), str(0){ + setToCStr(beg.it, en.it - beg.it); + str[len] = '\0'; + } + + json_string(const json_string & meh) : len(0), str(0){ + setToCStr(meh.c_str(), meh.len); + } + + ~json_string(void){ std::free(str); }; + + json_string(unsigned int l, mychar meh) : len(0), str(0){ + str = (mychar*)std::malloc((l + 1) * sizeof(mychar)); + len = l; + for (unsigned int i = 0; i < l; ++i){ + str[i] = meh; + } + str[l] = '\0'; + } + + void swap(json_string & meh){ + size_t _len = len; + mychar * _str = str; + len = meh.len; + str = meh.str; + meh.len = _len; + meh.str = _str; + } + + iterator begin(void){ return iterator(str); }; + iterator end(void){ return iterator(str + length()); }; + const iterator begin(void) const { return iterator(str); }; + const iterator end(void) const { return iterator(str + length()); }; + void assign(const iterator & beg, const iterator & en){ + json_string(beg, en).swap(*this); + } + json_string & append(const iterator & beg, const iterator & en){ + json_string temp(beg, en); + return *this += temp; + } + + const mychar * c_str(void) const { return str; }; + const mychar * data(void) const { return str; }; + size_t length(void) const { return len; }; + size_t capacity(void) const { return len; }; + bool empty(void) const { return len == 0; }; + + bool operator ==(const json_string & other) const { + if (len != other.len) return false; + return memcmp(str, other.str, len * sizeof(mychar)) == 0; + } + + bool operator !=(const json_string & other) const { + return !(*this == other); + } + + const char & operator[] (size_t pos) const { return str[pos]; } + char & operator[] ( size_t pos ){ return str[pos]; } + + json_string & operator = (const json_string & meh) { + std::free(str); + setToCStr(meh.c_str(), meh.len); + return *this; + } + + json_string & operator = (const mychar * meh) { + std::free(str); + setToCStr(meh, mystrlen(meh)); + return *this; + } + + json_string & operator += (const json_string & other) { + size_t newlen = len + other.len; + mychar * newstr = (mychar*)std::malloc((newlen + 1) * sizeof(mychar)); + std::memcpy(newstr, str, len * sizeof(mychar)); + std::memcpy(newstr + len, other.str, (other.len + 1) * sizeof(mychar)); + len = newlen; + std::free(str); + str = newstr; + return *this; + } + + const json_string operator + (const json_string & other) const { + json_string result = *this; + result += other; + return result; + } + + json_string & operator += (const mychar other) { + mychar temp[2] = {other, '\0'}; + json_string temp_s(temp); + return (*this) += temp_s; + } + + const json_string operator + (const mychar other) const { + json_string result = *this; + result += other; + return result; + } + + void reserve(size_t){}; //noop, its just a test + void clear(void){setToCStr("", 0);} + + json_string substr(size_t pos = 0, size_t n = npos) const { + json_string res(false, false, false); + if (n > len) n = len; + if (n + pos > len) n = len - pos; + res.setToCStr(str + pos, n); + res.str[n] = L'\0'; + return res; + } + + + size_t find ( mychar c, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + if (*i == c) return i - str; + } + return npos; + } + + size_t find_first_not_of ( const mychar* s, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + bool found = false; + for(const mychar * k = s; *k; ++k){ + if (*i == *k){ + found = true; + break; + } + } + if (!found) return i - str; + } + return npos; + } + + size_t find_first_of ( const mychar* s, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + for(const mychar * k = s; *k; ++k){ + if (*i == *k){ + return i - str; + } + } + } + return npos; + } + + iterator erase(iterator it, iterator it2){ + size_t mov = it2.it - it.it; + std::memmove(str, it2.it, (len - mov + 1) * sizeof(mychar)); //+1 for null terminator + len -= mov; + return it; + } +private: + json_string(bool, bool, bool) : len(0), str(0){}; + + void setToCStr(const mychar * st, size_t l){ + len = l; + str = (mychar*)std::memcpy(std::malloc((len + 1) * sizeof(mychar)), st, (len + 1) * sizeof(mychar)); + } + + size_t len; + mychar * str; + +}; + +#endif diff --git a/libjson/_internal/TestSuite/TestAssign.cpp b/libjson/_internal/TestSuite/TestAssign.cpp new file mode 100644 index 0000000..5a12f38 --- /dev/null +++ b/libjson/_internal/TestSuite/TestAssign.cpp @@ -0,0 +1,155 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestAssigning(void){ + UnitTest::SetPrefix("TestAssign.cpp - Assigning"); + #ifdef JSON_LIBRARY + //check names + JSONNODE * test1 = json_new(JSON_NODE); + json_set_name(test1, JSON_TEXT("hello world")); + json_char * res = json_name(test1); + assertCStringSame(res, JSON_TEXT("hello world")); + json_free(res); + + //check strings + json_set_a(test1, JSON_TEXT("Hello world")); + assertEquals(json_type(test1), JSON_STRING); + res = json_as_string(test1); + assertCStringSame(res, JSON_TEXT("Hello world")); + json_free(res); + + //check ints + json_set_i(test1, 13); + assertEquals(json_type(test1), JSON_NUMBER); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("13")); + #endif + json_free(res); + assertEquals(json_as_int(test1), 13); + assertEquals(json_as_float(test1), 13.0f); + + //check doubles work + json_set_f(test1, 13.7f); + assertEquals(json_type(test1), JSON_NUMBER); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("13.7")); + #endif + json_free(res); + assertEquals(json_as_int(test1), 13); + assertEquals(json_as_float(test1), 13.7f); + + //test making sure stripping the trailing period works + json_set_f(test1, 13.0f); + assertEquals(json_type(test1), JSON_NUMBER); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("13")); + #endif + json_free(res); + assertEquals(json_as_int(test1), 13); + assertEquals(json_as_float(test1), 13.0f); + + //check boolean + json_set_b(test1, (int)true); + assertEquals(json_type(test1), JSON_BOOL); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("true")); + #endif + json_free(res); + assertEquals(json_as_bool(test1), true); + + //check boolean + json_set_b(test1, false); + assertEquals(json_type(test1), JSON_BOOL); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("false")); + #endif + json_free(res); + assertEquals(json_as_bool(test1), false); + + //check null + json_nullify(test1); + assertEquals(json_type(test1), JSON_NULL); + res = json_as_string(test1); + #ifdef JSON_CASTABLE + assertCStringSame(res, JSON_TEXT("null")); + #endif + json_free(res); + + json_delete(test1); + + #else + //check names + JSONNode test1; + test1.set_name(JSON_TEXT("hello world")); + assertEquals(test1.name(), JSON_TEXT("hello world")); + + //check strings + test1 = JSON_TEXT("Hello world"); + assertEquals(test1.type(), JSON_STRING); + assertEquals(test1.as_string(), JSON_TEXT("Hello world")); + + //test chars + test1 = JSON_TEXT('\0'); + assertEquals(test1.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("0")); + #endif + assertEquals(test1.as_int(), 0); + assertEquals(test1.as_float(), 0.0f); + + //check ints + test1 = 13; + assertEquals(test1.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("13")); + #endif + assertEquals(test1.as_int(), 13); + assertEquals(test1.as_float(), 13.0f); + + //check doubles work + test1 = 13.7f; + assertEquals(test1.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("13.7")); + #endif + assertEquals(test1.as_int(), 13); + assertEquals(test1.as_float(), 13.7f); + + //test making sure stripping hte trailing period works + test1 = 13.0f; + assertEquals(test1.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("13")); + #endif + assertEquals(test1.as_int(), 13); + assertEquals(test1.as_float(), 13.0f); + + //check boolean + test1 = true; + assertEquals(test1.type(), JSON_BOOL); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("true")); + #endif + assertEquals(test1.as_bool(), true); + + //check boolean + test1 = false; + assertEquals(test1.type(), JSON_BOOL); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("false")); + #endif + assertEquals(test1.as_bool(), false); + + //check null + test1.nullify(); + assertEquals(test1.type(), JSON_NULL); + #ifdef JSON_CASTABLE + assertEquals(test1.as_string(), JSON_TEXT("null")); + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestBinary.cpp b/libjson/_internal/TestSuite/TestBinary.cpp new file mode 100644 index 0000000..b4f881d --- /dev/null +++ b/libjson/_internal/TestSuite/TestBinary.cpp @@ -0,0 +1,40 @@ +#include "TestSuite.h" +#include "../Source/JSON_Base64.h" + +#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) + void TestSuite::TestBase64(void){ + UnitTest::SetPrefix("TestBinary.cpp - Base 64"); + + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"A", 1)), "A"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"AB", 2)), "AB"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABC", 3)), "ABC"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCD", 4)), "ABCD"); + #ifdef JSON_SAFE + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"", 0)), ""); + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123!abc")), ""); + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123=abc")), ""); + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123abc===")), ""); + #endif + + unsigned char temp[255]; + for(unsigned int i = 0; i < 255; ++i){ + temp[i] = (unsigned char)i; + } + json_string ts = JSONBase64::json_encode64(temp, 255); + std::string rs = JSONBase64::json_decode64(ts); + assertEquals(rs.size(), 255); + assertEquals(memcmp(rs.data(), temp, 255), 0); + + #if defined(JSON_LIBRARY) && defined(JSON_EXPOSE_BASE64) + json_char * test = json_encode64(temp, 255); + assertNotNull(test); + unsigned long _size; + void * bin = json_decode64(test, & _size); + assertNotNull(bin); + assertEquals(_size, 255); + assertEquals(memcmp(bin, temp, 255), 0); + json_free(test); + json_free(bin); + #endif + } +#endif diff --git a/libjson/_internal/TestSuite/TestChildren.cpp b/libjson/_internal/TestSuite/TestChildren.cpp new file mode 100644 index 0000000..5ebacdc --- /dev/null +++ b/libjson/_internal/TestSuite/TestChildren.cpp @@ -0,0 +1,340 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestChildren(void){ + UnitTest::SetPrefix("TestChildren.cpp - Children"); + #ifdef JSON_LIBRARY + #define assertChild(node, index, func, value)\ + if (JSONNODE * blabla = json_at(node, index)){\ + assertEquals(func(blabla), value);\ + } else {\ + FAIL("no child");\ + } + + JSONNODE * test1 = json_new(JSON_NODE); + JSONNODE * test2 = json_new(JSON_NODE); + + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + assertEquals(json_type(test1), JSON_NODE); + assertEquals(json_type(test2), JSON_NODE); + assertEquals(json_size(test1), 0); + assertEquals(json_size(test2), 0); + assertTrue(json_equal(test1, test2)); + + + json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + assertEquals(json_size(test1), 1); + assertFalse(json_equal(test1, test2)); + json_push_back(test2, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + assertEquals(json_size(test2), 1); + assertTrue(json_equal(test1, test2)); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + json_merge(test1, test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #else + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + #endif + + UnitTest::SetPrefix("TestChildren.cpp - Children 2"); + + if (JSONNODE * temp = json_at(test1, 0)){ + json_char * str = json_as_string(temp); + assertCStringSame(str, JSON_TEXT("world")); + json_free(str); + str = json_name(temp); + assertCStringSame(str, JSON_TEXT("hi")); + json_free(str); + } else { + FAIL("at failed"); + } + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + assertEquals(json_size(test1), 1); + if (JSONNODE * temp = json_pop_back_at(test1, 0)){ + json_char * str = json_as_string(temp); + assertCStringSame(str, JSON_TEXT("world")); + json_free(str); + assertEquals(json_size(test1), 0); + json_delete(temp); + } else { + FAIL("POP FAILED"); + } + + UnitTest::SetPrefix("TestChildren.cpp - Children 3"); + + json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("hi"))){ + json_char * str = json_as_string(temp); + assertCStringSame(str, JSON_TEXT("world")); + json_free(str); + assertEquals(json_size(test1), 0); + json_delete(temp); + } else { + FAIL("POP name FAILED"); + } + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + if (JSONNODE * temp = json_pop_back_nocase(test1, JSON_TEXT("HI"))){ + json_char * str = json_as_string(temp); + assertCStringSame(str, JSON_TEXT("world")); + json_free(str); + assertEquals(json_size(test1), 0); + json_delete(temp); + } else { + FAIL("POP name FAILED"); + } + #endif + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + UnitTest::SetPrefix("TestChildren.cpp - Children 4"); + + + assertEquals(json_size(test1), 0); + json_push_back(test1, json_new_i(JSON_TEXT("one"), 1)); + json_push_back(test1, json_new_i(JSON_TEXT("two"), 2)); + json_push_back(test1, json_new_i(JSON_TEXT("three"), 3)); + json_push_back(test1, json_new_i(JSON_TEXT("four"), 4)); + json_push_back(test1, json_new_i(JSON_TEXT("five"), 5)); + json_push_back(test1, json_new_i(JSON_TEXT("six"), 6)); + assertEquals(json_size(test1), 6); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + + if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("four"))){ + assertEquals(json_as_int(temp), 4); + assertChild(test1, 0, json_as_int, 1); + assertChild(test1, 1, json_as_int, 2); + assertChild(test1, 2, json_as_int, 3); + assertChild(test1, 3, json_as_int, 5); + assertChild(test1, 4, json_as_int, 6); + assertEquals(json_size(test1), 5); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + json_delete(temp); + } else { + FAIL("no pop"); + } + + UnitTest::SetPrefix("TestChildren.cpp - Children 5"); + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + if (JSONNODE * temp = json_pop_back_nocase(test1, JSON_TEXT("SIX"))){ + #else + if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("six"))){ + #endif + assertEquals(json_as_int(temp), 6); + assertChild(test1, 0, json_as_int, 1); + assertChild(test1, 1, json_as_int, 2); + assertChild(test1, 2, json_as_int, 3); + assertChild(test1, 3, json_as_int, 5); + assertEquals(json_size(test1), 4); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + json_delete(temp); + } else { + FAIL("no pop_nocase"); + } + + UnitTest::SetPrefix("TestChildren.cpp - Children 6"); + + if (JSONNODE * temp = json_pop_back_at(test1, 2)){ + assertEquals(json_as_int(temp), 3); + assertChild(test1, 0, json_as_int, 1); + assertChild(test1, 1, json_as_int, 2); + assertChild(test1, 2, json_as_int, 5); + assertEquals(json_size(test1), 3); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + json_delete(temp); + } else { + FAIL("no pop 2"); + } + + json_delete(test1); + json_delete(test2); + + #ifdef JSON_UNIT_TEST + JSONNODE * fresh = json_new(JSON_NODE); + json_reserve(fresh, 3); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 0); + json_push_back(fresh, json_new(JSON_NULL)); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 1); + json_push_back(fresh, json_new(JSON_NULL)); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 2); + json_push_back(fresh, json_new(JSON_NULL)); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3); + assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 3); + json_delete(fresh); + #endif + + + #else + JSONNode test1; + JSONNode test2; + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + assertEquals(test1.type(), JSON_NODE); + assertEquals(test2.type(), JSON_NODE); + assertEquals(test1.size(), 0); + assertEquals(test2.size(), 0); + assertEquals(test1, test2); + test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + assertEquals(test1.size(), 1); + assertNotEquals(test1, test2); + test2.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + assertEquals(test2.size(), 1); + assertEquals(test1, test2); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + test1.merge(test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + + try { + assertEquals(test1.at(0), JSON_TEXT("world")); + assertEquals(test1.at(0).name(), JSON_TEXT("hi")); + } catch (std::out_of_range){ + FAIL("exception caught"); + } + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + assertEquals(test1.size(), 1); + try { + JSONNode res = test1.pop_back(0); + assertEquals(res, JSON_TEXT("world")); + assertEquals(test1.size(), 0); + test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + res = test1.pop_back(JSON_TEXT("hi")); + assertEquals(res, JSON_TEXT("world")); + assertEquals(test1.size(), 0); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + res = test1.pop_back_nocase(JSON_TEXT("HI")); + assertEquals(res, JSON_TEXT("world")); + assertEquals(test1.size(), 0); + #endif + } catch (std::out_of_range){ + FAIL("exception caught 2"); + } + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + + assertEquals(test1.size(), 0); + test1.push_back(JSONNode(JSON_TEXT("one"), 1)); + test1.push_back(JSONNode(JSON_TEXT("two"), 2)); + test1.push_back(JSONNode(JSON_TEXT("three"), 3)); + test1.push_back(JSONNode(JSON_TEXT("four"), 4)); + test1.push_back(JSONNode(JSON_TEXT("five"), 5)); + test1.push_back(JSONNode(JSON_TEXT("six"), 6)); + assertEquals(test1.size(), 6); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + //echo(test1.dump().write_formatted()); + + JSONNode res; + + try { + res = test1.pop_back(JSON_TEXT("four")); + assertEquals(res, 4); + assertEquals(test1[0], 1); + assertEquals(test1[1], 2); + assertEquals(test1[2], 3); + assertEquals(test1[3], 5); + assertEquals(test1[4], 6); + assertEquals(test1.size(), 5); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + } catch (std::out_of_range){ + FAIL("exception caught pop"); + } + + try { + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + res = test1.pop_back_nocase(JSON_TEXT("SIX")); + #else + res = test1.pop_back(JSON_TEXT("six")); + #endif + assertEquals(res, 6); + assertEquals(test1[0], 1); + assertEquals(test1[1], 2); + assertEquals(test1[2], 3); + assertEquals(test1[3], 5); + assertEquals(test1.size(), 4); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + } catch (std::out_of_range){ + FAIL("exception caught pop_nocase"); + } + + try { + res = test1.pop_back(2); + assertEquals(res, 3); + assertEquals(test1[0], 1); + assertEquals(test1[1], 2); + assertEquals(test1[2], 5); + assertEquals(test1.size(), 3); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + } catch (std::out_of_range){ + FAIL("exception caught pop 2"); + } + + + #ifdef JSON_UNIT_TEST + JSONNode fresh(JSON_NODE); + fresh.reserve(3); + assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3); + + assertEquals(fresh.internal -> CHILDREN -> mysize, 0); + fresh.push_back(JSONNode(JSON_NULL)); + assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3); + + assertEquals(fresh.internal -> CHILDREN -> mysize, 1); + fresh.push_back(JSONNode(JSON_NULL)); + assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3); + assertEquals(fresh.internal -> CHILDREN -> mysize, 2); + fresh.push_back(JSONNode(JSON_NULL)); + assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3); + assertEquals(fresh.internal -> CHILDREN -> mysize, 3); + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestComments.cpp b/libjson/_internal/TestSuite/TestComments.cpp new file mode 100644 index 0000000..2ecbfa7 --- /dev/null +++ b/libjson/_internal/TestSuite/TestComments.cpp @@ -0,0 +1,435 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +#ifdef JSON_COMMENTS + void TestSuite::TestComments(void){ + UnitTest::SetPrefix("TestComments.cpp - Comments"); + #ifdef JSON_READ_PRIORITY + #ifdef JSON_LIBRARY + + JSONNODE * one = json_new(JSON_NULL); + json_set_i(one, 15); + JSONNODE * two = json_new(JSON_NULL); + json_set_i(two, 15); + assertTrue(json_equal(one, two)); + json_set_comment(one, JSON_TEXT("Number")); + assertTrue(json_equal(one, two)); + json_delete(one); + json_delete(two); + + JSONNODE * test = json_parse(JSON_TEXT("#one line comment\n{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + json_char * res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("//one line comment\n{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("/*one line comment*/{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("#one line comment\n#another\n{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("//one line comment\n//another\n{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("/*one line comment*//*another*/{\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("#one line comment\n{#comment\n\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("//one line comment\n{//comment\n\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("/*one line comment*/{/*comment*/\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment")); + json_free(res); + json_delete(test); + + + test = json_parse(JSON_TEXT("#one line comment\n#another\n{#comment\n#comment2\n\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment\ncomment2")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("//one line comment\n//another\n{//comment\n//comment2\n\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment\ncomment2")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment\ncomment2")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 2); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment\ncomment2")); + json_free(res); + res = json_as_string(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("mars")); + json_free(res); + res = json_name(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("hi")); + json_free(res); + res = json_get_comment(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("comment")); + json_free(res); + json_delete(test); + + + test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\", //comment 2\n\"and\" : \"pluto\"}")); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 3); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("one line comment\nanother")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("comment\ncomment2")); + json_free(res); + res = json_as_string(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("mars")); + json_free(res); + res = json_name(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("hi")); + json_free(res); + res = json_get_comment(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("comment")); + json_free(res); + res = json_as_string(json_at(test, 2)); + assertCStringSame(res, JSON_TEXT("pluto")); + json_free(res); + res = json_name(json_at(test, 2)); + assertCStringSame(res, JSON_TEXT("and")); + json_free(res); + res = json_get_comment(json_at(test, 2)); + assertCStringSame(res, JSON_TEXT("comment 2")); + json_free(res); + json_delete(test); + + test = json_parse(JSON_TEXT("#array\n [#one\n\"hello\", //two\n\"world\", /*three*/\"mars\"]\r\n")); + assertEquals(json_type(test), JSON_ARRAY); + assertEquals(json_size(test), 3); + res = json_get_comment(test); + assertCStringSame(res, JSON_TEXT("array")); + json_free(res); + res = json_as_string(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + res = json_get_comment(json_at(test, 0)); + assertCStringSame(res, JSON_TEXT("one")); + json_free(res); + res = json_as_string(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_get_comment(json_at(test, 1)); + assertCStringSame(res, JSON_TEXT("two")); + json_free(res); + res = json_as_string(json_at(test, 2)); + assertCStringSame(res, JSON_TEXT("mars")); + json_free(res); + res = json_get_comment(json_at(test, 2)); + assertCStringSame(res, JSON_TEXT("three")); + json_free(res); + json_delete(test); + + + #else + JSONNode one; + one = 15; + JSONNode two; + two = 15; + assertEquals(one, two); + one.set_comment(JSON_TEXT("Number")); + assertEquals(one, two); + + JSONNode test = libjson::parse(JSON_TEXT("#one line comment\n{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + + test = libjson::parse(JSON_TEXT("//one line comment\n{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + + test = libjson::parse(JSON_TEXT("/*one line comment*/{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + + test = libjson::parse(JSON_TEXT("#one line comment\n#another\n{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + + test = libjson::parse(JSON_TEXT("//one line comment\n//another\n{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + + test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + + + test = libjson::parse(JSON_TEXT("#one line comment\n{#comment\n\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment")); + + test = libjson::parse(JSON_TEXT("//one line comment\n{//comment\n\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment")); + + test = libjson::parse(JSON_TEXT("/*one line comment*/{/*comment*/\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test.get_comment(), JSON_TEXT("one line comment")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment")); + + test = libjson::parse(JSON_TEXT("#one line comment\n#another\n{#comment\n#comment2\n\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2")); + + test = libjson::parse(JSON_TEXT("//one line comment\n//another\n{//comment\n//comment2\n\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2")); + + test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2")); + + + test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 2); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[1].name(), JSON_TEXT("hi")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[1], JSON_TEXT("mars")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2")); + assertEquals(test[1].get_comment(), JSON_TEXT("comment")); + + test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\", //comment 2\n\"and\" : \"pluto\"}")); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 3); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[1].name(), JSON_TEXT("hi")); + assertEquals(test[2].name(), JSON_TEXT("and")); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[1], JSON_TEXT("mars")); + assertEquals(test[2], JSON_TEXT("pluto")); + assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother")); + assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2")); + assertEquals(test[1].get_comment(), JSON_TEXT("comment")); + assertEquals(test[2].get_comment(), JSON_TEXT("comment 2")); + + test = libjson::parse(JSON_TEXT("#array\n [#one\n\"hello\", //two\n\"world\", /*three*/\"mars\"]\r\n")); + assertEquals(test.type(), JSON_ARRAY); + assertEquals(test.get_comment(), JSON_TEXT("array")); + assertEquals(test.size(), 3); + assertEquals(test[0], JSON_TEXT("hello")); + assertEquals(test[0].get_comment(), JSON_TEXT("one")); + assertEquals(test[1], JSON_TEXT("world")); + assertEquals(test[1].get_comment(), JSON_TEXT("two")); + assertEquals(test[2], JSON_TEXT("mars")); + assertEquals(test[2].get_comment(), JSON_TEXT("three")); + #endif + #endif + } +#endif diff --git a/libjson/_internal/TestSuite/TestConverters.cpp b/libjson/_internal/TestSuite/TestConverters.cpp new file mode 100644 index 0000000..87ea67c --- /dev/null +++ b/libjson/_internal/TestSuite/TestConverters.cpp @@ -0,0 +1,204 @@ +#include "TestSuite.h" +#include "../Source/NumberToString.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestConverters(void){ + UnitTest::SetPrefix("TestConverters.cpp - Converters"); + + assertEquals(sizeof(char), 1); + assertEquals(NumberToString::_itoa((char)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((char)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((char)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((char)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((char)-127), JSON_TEXT("-127")); + + assertEquals(sizeof(short), 2); + assertEquals(NumberToString::_itoa((short)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_itoa((short)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((short)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((short)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((short)-32767), JSON_TEXT("-32767")); + + assertEquals(sizeof(int), 4); + assertEquals(NumberToString::_itoa(2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_itoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa(0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa(-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa(-2147483647), JSON_TEXT("-2147483647")); + + #ifdef TEST_LONG_EXTREMES + assertEquals(NumberToString::_itoa(9223372036854775807L), JSON_TEXT("9223372036854775807")); + assertEquals(NumberToString::_itoa(-9223372036854775807L), JSON_TEXT("-9223372036854775807")); + #ifndef JSON_LIBRARY + assertEquals(NumberToString::_uitoa(18446744073709551615UL), JSON_TEXT("18446744073709551615")); + #endif + #endif + assertEquals(NumberToString::_itoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa(0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa(-15), JSON_TEXT("-15")); + + #ifndef JSON_LIBRARY + assertEquals(NumberToString::_uitoa(255), JSON_TEXT("255")); + assertEquals(NumberToString::_uitoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa(0), JSON_TEXT("0")); + + assertEquals(NumberToString::_uitoa(65535), JSON_TEXT("65535")); + assertEquals(NumberToString::_uitoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa(0), JSON_TEXT("0")); + + assertEquals(NumberToString::_uitoa(4294967295u), JSON_TEXT("4294967295")); + assertEquals(NumberToString::_uitoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa(0), JSON_TEXT("0")); + + assertEquals(NumberToString::_uitoa(15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa(0), JSON_TEXT("0")); + #endif + + assertEquals(NumberToString::_ftoa((json_number)1.0), JSON_TEXT("1")); + assertEquals(NumberToString::_ftoa((json_number)1.002), JSON_TEXT("1.002")); + assertEquals(NumberToString::_ftoa((json_number)10.0), JSON_TEXT("10")); + assertEquals(NumberToString::_ftoa((json_number)-1.0), JSON_TEXT("-1")); + assertEquals(NumberToString::_ftoa((json_number)-1.002), JSON_TEXT("-1.002")); + assertEquals(NumberToString::_ftoa((json_number)-10.0), JSON_TEXT("-10")); + assertEquals(NumberToString::_ftoa((json_number)0.0), JSON_TEXT("0")); + + assertTrue(_floatsAreEqual(1.1, 1.1)); + assertTrue(_floatsAreEqual(1.000000001, 1.0)); + assertTrue(_floatsAreEqual(1.0, 1.000000001)); + assertFalse(_floatsAreEqual(1.0, 1.0001)); + assertFalse(_floatsAreEqual(1.0001, 1.0)); + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + #ifdef JSON_UNIT_TEST + UnitTest::SetPrefix("TestConverters.cpp - Checking case-insensitive"); + assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("HeLLo"))); + assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("hell5o"), JSON_TEXT("HELL5O"))); + assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("HeLLo"), JSON_TEXT("hello"))); + assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("HELL5O"), JSON_TEXT("hell5o"))); + + assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("Hello "))); + assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("hi"))); + assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("55555"))); + assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("jonny"))); + #endif + #endif + + #ifdef JSON_SAFE + assertTrue(NumberToString::isNumeric(JSON_TEXT("0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e+2"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e+2"))); + + + #ifdef JSON_STRICT + assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCD"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0."))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1."))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e+2"))); + #else + assertTrue(NumberToString::isNumeric(JSON_TEXT("0xABCD"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0124"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e+2"))); + #endif + assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCDv"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("00124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("09124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("n1234"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("12no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0en5"))); + #endif + +} + diff --git a/libjson/_internal/TestSuite/TestCtors.cpp b/libjson/_internal/TestSuite/TestCtors.cpp new file mode 100644 index 0000000..c2a28a1 --- /dev/null +++ b/libjson/_internal/TestSuite/TestCtors.cpp @@ -0,0 +1,115 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestConstructors(void){ + UnitTest::SetPrefix("TestCtor.cpp - Constructors"); + #ifdef JSON_LIBRARY + JSONNODE * test = json_new(JSON_NULL); + assertEquals(json_type(test), JSON_NULL); + json_delete(test); + + test = json_new_a(JSON_TEXT("hello"), JSON_TEXT("world")); + json_char * res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("world")); + json_free(res); + res = json_name(test); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + assertEquals(json_type(test), JSON_STRING); + json_delete(test); + + test = json_new_i(JSON_TEXT("hello"), 15); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("15")); + json_free(res); + #endif + assertEquals_Primitive(json_as_int(test), 15); + assertEquals_Primitive(json_as_float(test), 15.0f); + res = json_name(test); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + assertEquals(json_type(test), JSON_NUMBER); + json_delete(test); + + test = json_new_f(JSON_TEXT("hello"), 15.5f); + assertEquals_Primitive(json_as_int(test), 15); + assertEquals_Primitive(json_as_float(test), 15.5f); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("15.5")); + json_free(res); + #endif + res = json_name(test); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + assertEquals(json_type(test), JSON_NUMBER); + json_delete(test); + + test = json_new_b(JSON_TEXT("hello"), (int)true); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("true")); + json_free(res); + #endif + assertEquals(json_as_bool(test), (int)true); + res = json_name(test); + assertCStringSame(res, JSON_TEXT("hello")); + json_free(res); + assertEquals(json_type(test), JSON_BOOL); + + JSONNODE * cpy = json_copy(test); + assertTrue(json_equal(cpy, test)); + json_delete(cpy); + + json_delete(test); + #else + JSONNode test = JSONNode(JSON_NULL); + assertEquals(test.type(), JSON_NULL); + + test = JSONNode(JSON_TEXT("hello"), JSON_TEXT("world")); + assertEquals(test, JSON_TEXT("world")); + assertEquals(test.as_string(), JSON_TEXT("world")); + assertEquals(test.name(), JSON_TEXT("hello")); + assertEquals(test.type(), JSON_STRING); + + test = JSONNode(JSON_TEXT("hello"), 15); + assertEquals(test, 15); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("15")); + #endif + assertEquals(test.as_int(), 15); + assertEquals(test.as_float(), 15.0f); + assertEquals(test.name(), JSON_TEXT("hello")); + assertEquals(test.type(), JSON_NUMBER); + + test = JSONNode(JSON_TEXT("hello"), 15.5f); + assertEquals(test, 15.5f); + assertEquals(test.as_int(), 15); + assertEquals(test.as_float(), 15.5f); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("15.5")); + #endif + assertEquals(test.name(), JSON_TEXT("hello")); + assertEquals(test.type(), JSON_NUMBER); + + test = JSONNode(JSON_TEXT("hello"), true); + assertEquals(test, true); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("true")); + #endif + assertEquals(test.as_bool(), true); + assertEquals(test.name(), JSON_TEXT("hello")); + assertEquals(test.type(), JSON_BOOL); + + test = JSONNode(json_string(JSON_TEXT("hello")), JSON_TEXT('\0')); + assertEquals(test, 0); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("0")); + #endif + assertEquals(test.as_int(), 0); + assertEquals(test.as_float(), 0.0f); + assertEquals(test.name(), JSON_TEXT("hello")); + assertEquals(test.type(), JSON_NUMBER); + #endif +} diff --git a/libjson/_internal/TestSuite/TestEquality.cpp b/libjson/_internal/TestSuite/TestEquality.cpp new file mode 100644 index 0000000..66f7787 --- /dev/null +++ b/libjson/_internal/TestSuite/TestEquality.cpp @@ -0,0 +1,101 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestEquality(void){ + UnitTest::SetPrefix("TestEquality.cpp - Equality"); + #ifdef JSON_LIBRARY + JSONNODE * test1 = json_new(JSON_NODE); + JSONNODE * test2 = json_new(JSON_NODE); + assertTrue(json_equal(test1, test2)); + + //check literally the same internal pointer + json_set_n(test2, test1); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #else + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + #endif + assertTrue(json_equal(test1, test2)); + + json_set_a(test1, JSON_TEXT("hello")); + json_set_a(test2, JSON_TEXT("hello")); + assertTrue(json_equal(test1, test2)); + + json_set_f(test1, 13.5f); + json_set_f(test2, 13.5f); + assertTrue(json_equal(test1, test2)); + + json_set_i(test1, 13); + json_set_f(test2, 13.0f); + assertTrue(json_equal(test1, test2)); + + json_set_b(test1, true); + json_set_b(test2, (int)true); + assertTrue(json_equal(test1, test2)); + + json_set_b(test1, false); + json_set_b(test2, (int)false); + assertTrue(json_equal(test1, test2)); + + json_nullify(test1); + json_nullify(test2); + assertTrue(json_equal(test1, test2)); + JSONNODE * test3 = json_new(JSON_NULL); + assertTrue(json_equal(test1, test3)); + assertTrue(json_equal(test3, test3)); + + json_delete(test1); + json_delete(test2); + json_delete(test3); + #else + JSONNode test1; + JSONNode test2; + assertEquals(test1, test2); + + //check literally the same internal pointer + test2 = test1; + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + assertEquals(test1, test2); + + test1 = JSON_TEXT("hello"); + test2 = JSON_TEXT("hello"); + assertEquals(test1, JSON_TEXT("hello")); + assertEquals(test1, test2); + + test1 = 13.5f; + test2 = 13.5f; + assertEquals(test1, 13.5f); + assertEquals(test1, test2); + + test1 = 13; + test2 = 13.0f; + assertEquals(test1, 13.0f); + assertEquals(test1, 13); + assertEquals(test1, test2); + + test1 = true; + test2 = true; + assertEquals(test1, true); + assertEquals(test1, test2); + + test1 = false; + test2 = false; + assertEquals(test1, false); + assertEquals(test1, test2); + + test1.nullify(); + test2.nullify(); + assertEquals(test1, test2); + JSONNode test3 = JSONNode(JSON_NULL); + assertEquals(test1, test3); + assertEquals(test2, test3); + #endif +} diff --git a/libjson/_internal/TestSuite/TestFunctions.cpp b/libjson/_internal/TestSuite/TestFunctions.cpp new file mode 100644 index 0000000..8f24670 --- /dev/null +++ b/libjson/_internal/TestSuite/TestFunctions.cpp @@ -0,0 +1,257 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +void TestSuite::TestFunctions(void){ + UnitTest::SetPrefix("TestFunctions.cpp - Swap"); + #ifdef JSON_LIBRARY + JSONNODE * test1 = json_new(JSON_NODE); + JSONNODE * test2 = json_new(JSON_NODE); + json_set_i(test1, 14); + json_set_i(test2, 35); + json_swap(test1, test2); + assertEquals_Primitive(json_as_int(test1), 35); + assertEquals_Primitive(json_as_int(test2), 14); + + UnitTest::SetPrefix("TestFunctions.cpp - Duplicate"); + json_delete(test1); + test1 = json_duplicate(test2); + #ifdef JSON_UNIT_TEST + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + assertTrue(json_equal(test1, test2)); + + + UnitTest::SetPrefix("TestFunctions.cpp - Duplicate with children"); + JSONNODE * node = json_new(JSON_NODE); + json_push_back(node, json_new_i(JSON_TEXT(""), 15)); + json_push_back(node, json_new_f(JSON_TEXT(""), 27.4f)); + json_push_back(node, json_new_b(JSON_TEXT(""), true)); + + TestSuite::testParsingItself(node); + + JSONNODE * dup = json_duplicate(node); + assertEquals(json_size(dup), 3); + #ifdef JSON_UNIT_TEST + assertNotEquals(((JSONNode*)node) -> internal, ((JSONNode*)dup) -> internal); + #endif + assertEquals(json_type(dup), JSON_NODE); + + TestSuite::testParsingItself(node); + TestSuite::testParsingItself(dup); + + assertEquals_Primitive(json_as_int(json_at(dup, 0)), 15); + assertEquals_Primitive(json_as_float(json_at(dup, 1)), 27.4f); + assertEquals(json_as_bool(json_at(dup, 2)), true); + assertTrue(json_equal(json_at(dup, 0), json_at(node, 0))); + assertTrue(json_equal(json_at(dup, 1), json_at(node, 1))); + assertTrue(json_equal(json_at(dup, 2), json_at(node, 2))); + + + TestSuite::testParsingItself(dup); + + #ifdef JSON_ITERATORS + for(JSONNODE_ITERATOR it = json_begin(node), end = json_end(node), dup_it = json_begin(dup); + it != end; + ++it, ++dup_it){ + assertTrue(json_equal(*it, *dup_it)); + #ifdef JSON_UNIT_TEST + assertNotEquals(((JSONNode*)(*it)) -> internal, ((JSONNode*)(*dup_it)) -> internal); + #endif + } + #endif + + UnitTest::SetPrefix("TestFunctions.cpp - Nullify"); + json_nullify(test1); + assertEquals(json_type(test1), JSON_NULL); + json_char * res = json_name(test1); + assertCStringSame(res, JSON_TEXT("")); + json_free(res); + + #ifdef JSON_CASTABLE + UnitTest::SetPrefix("TestFunctions.cpp - Cast"); + json_cast(test1, JSON_NULL); + json_set_i(test2, 1); + json_cast(test2, JSON_BOOL); + assertEquals(json_type(test1), JSON_NULL); + assertEquals(json_type(test2), JSON_BOOL); + assertEquals(json_as_bool(test2), true); + json_set_b(test2, true); + assertEquals(json_as_bool(test2), true); + + json_cast(test2, JSON_NUMBER); + assertEquals_Primitive(json_as_float(test2), 1.0f); + json_set_f(test2, 0.0f); + assertEquals_Primitive(json_as_float(test2), 0.0f); + json_cast(test2, JSON_BOOL); + assertEquals(json_as_bool(test2), false); + #endif + + UnitTest::SetPrefix("TestFunctions.cpp - Merge"); + json_set_a(test1, JSON_TEXT("hello")); + json_set_a(test2, JSON_TEXT("hello")); + #ifdef JSON_UNIT_TEST + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + assertTrue(json_equal(test1, test2)); + json_merge(test1, test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #else + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + #endif + + #ifdef JSON_CASTABLE + json_cast(test1, JSON_NODE); + json_cast(test2, JSON_NODE); + assertEquals(json_type(test1), JSON_NODE); + assertEquals(json_type(test2), JSON_NODE); + json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + json_push_back(test2, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + json_merge(test1, test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #else + assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal); + #endif + #endif + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + #endif + + json_delete(test1); + json_delete(test2); + json_delete(node); + json_delete(dup); + #else + JSONNode test1; + JSONNode test2; + test1 = JSON_TEXT("hello"); + test2 = JSON_TEXT("world"); + test1.swap(test2); + assertEquals(test1, JSON_TEXT("world")); + assertEquals(test2, JSON_TEXT("hello")); + + UnitTest::SetPrefix("TestFunctions.cpp - Duplicate"); + test1 = test2.duplicate(); + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test2.internal); + #endif + assertEquals(test1, test2); + + UnitTest::SetPrefix("TestFunctions.cpp - Duplicate with children"); + JSONNode node = JSONNode(JSON_NODE); + node.push_back(JSONNode(JSON_TEXT(""), 15)); + node.push_back(JSONNode(JSON_TEXT(""), JSON_TEXT("hello world"))); + node.push_back(JSONNode(JSON_TEXT(""), true)); + + TestSuite::testParsingItself(node); + + JSONNode dup = node.duplicate(); + assertEquals(dup.size(), 3); + #ifdef JSON_UNIT_TEST + assertNotEquals(node.internal, dup.internal); + #endif + assertEquals(dup.type(), JSON_NODE); + + TestSuite::testParsingItself(node); + TestSuite::testParsingItself(dup); + + try { + assertEquals(dup.at(0), 15); + assertEquals(dup.at(1), JSON_TEXT("hello world")); + assertEquals(dup.at(2), true); + assertEquals(dup.at(0), node.at(0)); + assertEquals(dup.at(1), node.at(1)); + assertEquals(dup.at(2), node.at(2)); + } catch (std::out_of_range){ + FAIL("exception caught"); + } + + TestSuite::testParsingItself(dup); + + #ifdef JSON_ITERATORS + for(JSONNode::iterator it = node.begin(), end = node.end(), dup_it = dup.begin(); + it != end; + ++it, ++dup_it){ + assertEquals(*it, *dup_it); + #ifdef JSON_UNIT_TEST + assertNotEquals((*it).internal, (*dup_it).internal); + #endif + } + #endif + + UnitTest::SetPrefix("TestFunctions.cpp - Nullify"); + test1.nullify(); + assertEquals(test1.type(), JSON_NULL); + assertEquals(test1.name(), JSON_TEXT("")); + + #ifdef JSON_CASTABLE + UnitTest::SetPrefix("TestFunctions.cpp - Cast"); + test1.cast(JSON_NULL); + test2 = 1; + test2.cast(JSON_BOOL); + assertEquals(test1.type(), JSON_NULL); + assertEquals(test2.type(), JSON_BOOL); + assertEquals(test2, true); + test2 = true; + assertEquals(test2, true); + test2.cast(JSON_NUMBER); + assertEquals(test2, 1.0f); + test2 = 0.0f; + assertEquals(test2, 0.0f); + test2.cast(JSON_BOOL); + assertEquals(test2, false); + #endif + + UnitTest::SetPrefix("TestFunctions.cpp - Merge"); + test1 = JSON_TEXT("hello"); + test2 = JSON_TEXT("hello"); + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test2.internal); + #endif + assertEquals(test1, test2); + test1.merge(test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + + #ifdef JSON_CASTABLE + test1.cast(JSON_NODE); + test2.cast(JSON_NODE); + #else + test1 = JSONNode(JSON_NODE); + test2 = JSONNode(JSON_NODE); + #endif + assertEquals(test1.type(), JSON_NODE); + assertEquals(test2.type(), JSON_NODE); + test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + test2.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + + test1.merge(test2); + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + #endif +} diff --git a/libjson/_internal/TestSuite/TestInequality.cpp b/libjson/_internal/TestSuite/TestInequality.cpp new file mode 100644 index 0000000..9628253 --- /dev/null +++ b/libjson/_internal/TestSuite/TestInequality.cpp @@ -0,0 +1,78 @@ +#include "TestSuite.h" + +void TestSuite::TestInequality(void){ + UnitTest::SetPrefix("TestInequality.cpp - Inequality"); + #ifdef JSON_LIBRARY + JSONNODE * test1 = json_new(JSON_NODE); + JSONNODE * test2 = json_new(JSON_NODE); + json_set_a(test1, JSON_TEXT("hello")); + json_set_a(test2, JSON_TEXT("world")); + assertFalse(json_equal(test1, test2)); + + json_set_i(test2,13); + assertFalse(json_equal(test1, test2)); + + json_set_f(test2, 13.5f); + assertFalse(json_equal(test1, test2)); + + json_set_b(test2, true); + assertFalse(json_equal(test1, test2)); + + json_set_b(test2, false); + assertFalse(json_equal(test1, test2)); + + json_nullify(test2); + assertFalse(json_equal(test1, test2)); + json_delete(test1); + json_delete(test2); + #else + JSONNode test1; + JSONNode test2; + test1 = JSON_TEXT("hello"); + test2 = JSON_TEXT("world"); + assertNotEquals(test1, test2); + assertNotEquals(test1, JSON_TEXT("hi")); + assertNotEquals(test2, 13.5f); + assertNotEquals(test2, 14); + assertNotEquals(test2, true); + assertNotEquals(test2, false); + + test2 = 13; + assertNotEquals(test1, test2); + assertNotEquals(test2, 13.5f); + assertNotEquals(test2, 14); + assertNotEquals(test2, true); + assertNotEquals(test2, false); + assertNotEquals(test2, JSON_TEXT("13")); //not the same type + + test2 = 13.5f; + assertNotEquals(test1, test2); + assertNotEquals(test2, 13); + assertNotEquals(test2, 14); + assertNotEquals(test2, true); + assertNotEquals(test2, false); + assertNotEquals(test2, JSON_TEXT("13.5")); //not the same type + + test2 = true; + assertNotEquals(test1, test2); + assertNotEquals(test2, 13.5f); + assertNotEquals(test2, 14); + assertNotEquals(test2, false); + assertNotEquals(test2, JSON_TEXT("true")); //not the same type + + test2 = false; + assertNotEquals(test1, test2); + assertNotEquals(test2, 13.5f); + assertNotEquals(test2, 14); + assertNotEquals(test2, true); + assertNotEquals(test2, JSON_TEXT("false")); //not the same type + + test2.nullify(); + assertNotEquals(test1, test2); + assertNotEquals(test2, 13.5f); + assertNotEquals(test2, 14); + assertNotEquals(test2, true); + assertNotEquals(test2, false); + assertNotEquals(test2, "null"); //not the same type + #endif +} diff --git a/libjson/_internal/TestSuite/TestInspectors.cpp b/libjson/_internal/TestSuite/TestInspectors.cpp new file mode 100644 index 0000000..1b652ba --- /dev/null +++ b/libjson/_internal/TestSuite/TestInspectors.cpp @@ -0,0 +1,363 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" +#include + +void TestSuite::TestInspectors(void){ + UnitTest::SetPrefix("TestInspectors.cpp - Inspectors"); + #ifdef JSON_LIBRARY + JSONNODE * test = json_new(JSON_NULL); + assertEquals(json_type(test), JSON_NULL); + json_char * res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("")); + json_free(res); + assertEquals_Primitive(json_as_int(test), 0); + assertEquals_Primitive(json_as_float(test), 0.0f); + assertEquals(json_as_bool(test), false); + + json_set_f(test, 15.5f); + assertEquals(json_type(test), JSON_NUMBER); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("15.5")); + json_free(res); + #endif + assertEquals_Primitive(json_as_int(test), 15); + assertEquals_Primitive(json_as_float(test), 15.5f); + #ifdef JSON_CASTABLE + assertEquals(json_as_bool(test), true); + #endif + + json_set_f(test, 0.0f); + assertEquals(json_type(test), JSON_NUMBER); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("0")); + json_free(res); + #endif + assertEquals_Primitive(json_as_int(test), 0); + assertEquals_Primitive(json_as_float(test), 0.0f); + #ifdef JSON_CASTABLE + assertEquals(json_as_bool(test), false); + #endif + + json_set_b(test, true); + assertEquals(json_type(test), JSON_BOOL); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("true")); + json_free(res); + assertEquals_Primitive(json_as_int(test), 1); + assertEquals_Primitive(json_as_float(test), 1.0f); + #endif + assertEquals(json_as_bool(test), true); + + json_set_b(test, false); + assertEquals(json_type(test), JSON_BOOL); + #ifdef JSON_CASTABLE + res = json_as_string(test); + assertCStringSame(res, JSON_TEXT("false")); + json_free(res); + assertEquals_Primitive(json_as_int(test), 0); + assertEquals_Primitive(json_as_float(test), 0.0f); + #endif + assertEquals(json_as_bool(test), false); + #ifdef JSON_CASTABLE + json_cast(test, JSON_NODE); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 0); + json_push_back(test, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world"))); + json_push_back(test, json_new_a(JSON_TEXT("hello"), JSON_TEXT("mars"))); + json_push_back(test, json_new_a(JSON_TEXT("salut"), JSON_TEXT("france"))); + assertEquals(json_size(test), 3); + TestSuite::testParsingItself(test); + + JSONNODE * casted = json_as_array(test); + #ifdef JSON_UNIT_TEST + assertNotEquals(((JSONNode*)casted) -> internal, ((JSONNode*)test) -> internal); + #endif + assertEquals(json_type(casted), JSON_ARRAY); + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 3); + assertEquals(json_size(casted), 3); + TestSuite::testParsingItself(casted); + #endif + UnitTest::SetPrefix("TestInspectors.cpp - Location"); + + #ifdef JSON_CASTABLE + #define CheckAt(parent, locale, text)\ + if(JSONNODE * temp = json_at(parent, locale)){\ + json_char * _res = json_as_string(temp);\ + assertCStringSame(_res, text);\ + json_free(_res);\ + } else {\ + FAIL(std::string("CheckAt: ") + #parent + "[" + #locale + "]");\ + } + + #define CheckNameAt(parent, locale, text)\ + if(JSONNODE * temp = json_at(parent, locale)){\ + json_char * _res = json_name(temp);\ + assertCStringSame(_res, text);\ + json_free(_res);\ + } else {\ + FAIL(std::string("CheckNameAt: ") + #parent + "[" + #locale + "]");\ + } + + CheckAt(casted, 0, JSON_TEXT("world")); + CheckAt(casted, 1, JSON_TEXT("mars")); + CheckAt(casted, 2, JSON_TEXT("france")); + CheckNameAt(casted, 0, JSON_TEXT("")); + CheckNameAt(casted, 1, JSON_TEXT("")); + CheckNameAt(casted, 2, JSON_TEXT("")); + + CheckAt(test, 0, JSON_TEXT("world")); + CheckAt(test, 1, JSON_TEXT("mars")); + CheckAt(test, 2, JSON_TEXT("france")); + CheckNameAt(test, 0, JSON_TEXT("hi")); + CheckNameAt(test, 1, JSON_TEXT("hello")); + CheckNameAt(test, 2, JSON_TEXT("salut")); + + + #define CheckGet(parent, locale, text)\ + if(JSONNODE * temp = json_get(parent, locale)){\ + json_char * _res = json_as_string(temp);\ + assertCStringSame(_res, text);\ + json_free(_res);\ + } else {\ + FAIL(std::string("CheckGet: ") + #parent + "[" + #locale + "]");\ + } + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + #define CheckGetNoCase(parent, locale, text)\ + if(JSONNODE * temp = json_get_nocase(parent, locale)){\ + json_char * _res = json_as_string(temp);\ + assertCStringSame(_res, text);\ + json_free(_res);\ + } else {\ + FAIL(std::string("CheckGetNoCase: ") + #parent + "[" + #locale + "]");\ + } + #else + #define CheckGetNoCase(parent, locale, text) + #endif + + CheckGet(test, JSON_TEXT("hi"), JSON_TEXT("world")); + CheckGetNoCase(test, JSON_TEXT("HI"), JSON_TEXT("world")); + CheckGet(test, JSON_TEXT("hello"), JSON_TEXT("mars")); + CheckGetNoCase(test, JSON_TEXT("HELLO"), JSON_TEXT("mars")); + CheckGet(test, JSON_TEXT("salut"), JSON_TEXT("france")); + CheckGetNoCase(test, JSON_TEXT("SALUT"), JSON_TEXT("france")); + + assertNull(json_get(test, JSON_TEXT("meh"))); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + assertNull(json_get_nocase(test, JSON_TEXT("meh"))); + #endif + #endif + + + #ifdef JSON_ITERATORS + #ifdef JSON_CASTABLE + UnitTest::SetPrefix("TestInspectors.cpp - Iterators"); + for(JSONNODE_ITERATOR it = json_begin(casted), end = json_end(casted); it != end; ++it){ + json_char * _res = json_name(*it); + assertCStringSame(_res, JSON_TEXT("")); + json_free(_res); + } + #endif + #endif + + #ifdef JSON_BINARY + UnitTest::SetPrefix("TestInspectors.cpp - Binary"); + json_set_binary(test, (const unsigned char *)"Hello World", 11); + assertEquals(json_type(test), JSON_STRING); + json_char * _res = json_as_string(test); + assertCStringSame(_res, JSON_TEXT("SGVsbG8gV29ybGQ=")); + json_free(_res); + + unsigned long i; + if(char * bin = (char*)json_as_binary(test, &i)){ + assertEquals(i, 11); + char * terminated = (char*)std::memcpy(std::malloc(i + 1), bin, i); + terminated[i] = '\0'; + assertCStringEquals(terminated, "Hello World"); + json_free(bin); + std::free(terminated); + } else { + FAIL("as_binary failed"); + } + + json_set_a(test, JSON_TEXT("Hello World")); + assertEquals(json_type(test), JSON_STRING); + _res = json_as_string(test); + assertCStringSame(_res, JSON_TEXT("Hello World")); + json_free(_res); + + #ifdef JSON_SAFE + assertEquals(json_as_binary(test, &i), 0); + assertEquals(i, 0); + #endif + #endif + + + json_delete(test); + #ifdef JSON_CASTABLE + json_delete(casted); + #endif + #else + JSONNode test = JSONNode(JSON_NULL); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("")); + assertEquals(test.as_int(), 0); + assertEquals(test.as_float(), 0.0f); + assertEquals(test.as_bool(), false); + #endif + + test = 15.5f; + assertEquals(test.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("15.5")); + #endif + assertEquals(test.as_int(), 15); + assertEquals(test.as_float(), 15.5f); + #ifdef JSON_CASTABLE + assertEquals(test.as_bool(), true); + #endif + + test = 0.0f; + assertEquals(test.type(), JSON_NUMBER); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("0")); + #endif + assertEquals(test.as_int(), 0); + assertEquals(test.as_float(), 0.0f); + #ifdef JSON_CASTABLE + assertEquals(test.as_bool(), false); + #endif + + test = true; + assertEquals(test.type(), JSON_BOOL); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("true")); + assertEquals(test.as_int(), 1); + assertEquals(test.as_float(), 1.0f); + #endif + assertEquals(test.as_bool(), true); + + test = false; + assertEquals(test.type(), JSON_BOOL); + #ifdef JSON_CASTABLE + assertEquals(test.as_string(), JSON_TEXT("false")); + assertEquals(test.as_int(), 0); + assertEquals(test.as_float(), 0.0f); + #endif + assertEquals(test.as_bool(), false); + + #ifdef JSON_CASTABLE + test.cast(JSON_NODE); + #else + test = JSONNode(JSON_NODE); + #endif + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 0); + test.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world"))); + test.push_back(JSONNode(JSON_TEXT("hello"), JSON_TEXT("mars"))); + test.push_back(JSONNode(JSON_TEXT("salut"), JSON_TEXT("france"))); + assertEquals(test.size(), 3); + TestSuite::testParsingItself(test); + + #ifdef JSON_CASTABLE + JSONNode casted = test.as_array(); + #ifdef JSON_UNIT_TEST + assertNotEquals(casted.internal, test.internal); + #endif + assertEquals(casted.type(), JSON_ARRAY); + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 3); + assertEquals(casted.size(), 3); + TestSuite::testParsingItself(casted); + #endif + + UnitTest::SetPrefix("TestInspectors.cpp - Location"); + + try { + #ifdef JSON_CASTABLE + assertEquals(casted.at(0), JSON_TEXT("world")); + assertEquals(casted.at(1), JSON_TEXT("mars")); + assertEquals(casted.at(2), JSON_TEXT("france")); + assertEquals(casted.at(0).name(), JSON_TEXT("")); + assertEquals(casted.at(1).name(), JSON_TEXT("")); + assertEquals(casted.at(2).name(), JSON_TEXT("")); + #endif + assertEquals(test.at(0), JSON_TEXT("world")); + assertEquals(test.at(1), JSON_TEXT("mars")); + assertEquals(test.at(2), JSON_TEXT("france")); + assertEquals(test.at(0).name(), JSON_TEXT("hi")); + assertEquals(test.at(1).name(), JSON_TEXT("hello")); + assertEquals(test.at(2).name(), JSON_TEXT("salut")); + } catch (std::out_of_range){ + FAIL("exception caught"); + } + + try { + assertEquals(test.at(JSON_TEXT("hi")), JSON_TEXT("world")); + assertEquals(test.at(JSON_TEXT("hello")), JSON_TEXT("mars")); + assertEquals(test.at(JSON_TEXT("salut")), JSON_TEXT("france")); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + assertEquals(test.at_nocase(JSON_TEXT("SALUT")), JSON_TEXT("france")); + assertEquals(test.at_nocase(JSON_TEXT("HELLO")), JSON_TEXT("mars")); + assertEquals(test.at_nocase(JSON_TEXT("HI")), JSON_TEXT("world")); + #endif + } catch (std::out_of_range){ + FAIL("exception caught"); + } + + assertException(test.at(JSON_TEXT("meh")), std::out_of_range); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + assertException(test.at_nocase(JSON_TEXT("meh")), std::out_of_range); + #endif + + assertEquals(test[JSON_TEXT("hi")], json_string(JSON_TEXT("world"))); + assertEquals(test[JSON_TEXT("hello")], json_string(JSON_TEXT("mars"))); + assertEquals(test[JSON_TEXT("salut")], json_string(JSON_TEXT("france"))); + assertEquals(test[0], JSON_TEXT("world")); + assertEquals(test[1], JSON_TEXT("mars")); + assertEquals(test[2], JSON_TEXT("france")); + + #ifdef JSON_ITERATORS + #ifdef JSON_CASTABLE + UnitTest::SetPrefix("TestInspectors.cpp - Iterators"); + for(JSONNode::iterator it = casted.begin(), end = casted.end(); it != end; ++it){ + assertEquals((*it).name(), JSON_TEXT("")); + } + #endif + #endif + + #ifdef JSON_BINARY + UnitTest::SetPrefix("TestInspectors.cpp - Binary"); + test.set_binary((const unsigned char *)"Hello World", 11); + assertEquals(test.type(), JSON_STRING); + assertEquals(test.as_string(), JSON_TEXT("SGVsbG8gV29ybGQ=")); + assertEquals(test.as_binary(), "Hello World"); + assertEquals(test.as_binary().size(), 11); + + test = JSON_TEXT("Hello World"); + assertEquals(test.type(), JSON_STRING); + assertEquals(test.as_string(), JSON_TEXT("Hello World")); + #ifdef JSON_SAFE + assertEquals(test.as_binary(), ""); + #endif + #endif + + #ifdef JSON_READ_PRIORITY + //This is a regression test for a bug in at() + json_string buffer(JSON_TEXT("{ \"myValue1\" : \"foo\", \"myValue2\" : \"bar\"}")); + JSONNode current = libjson::parse(buffer); + try { + JSONNode & value1 = current[JSON_TEXT("myValue1")]; + assertEquals(value1.as_string(), JSON_TEXT("foo")); + JSONNode & value2 = current[JSON_TEXT("myValue2")]; + assertEquals(value2.as_string(), JSON_TEXT("bar")); + } catch (...){ + assertTrue(false); + } + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestIterators.cpp b/libjson/_internal/TestSuite/TestIterators.cpp new file mode 100644 index 0000000..69999e5 --- /dev/null +++ b/libjson/_internal/TestSuite/TestIterators.cpp @@ -0,0 +1,838 @@ +#include "TestSuite.h" + +#ifdef JSON_LIBRARY + void CreateTest(JSONNODE * test); //suppress warnings that it wasnt defined + void CreateTest(JSONNODE * test){ + json_push_back(test, json_new_a(JSON_TEXT("Hi"), JSON_TEXT("World"))); + json_push_back(test, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("There"))); + json_push_back(test, json_new_a(JSON_TEXT("Hai"), JSON_TEXT("Mars"))); + json_push_back(test, json_new_a(JSON_TEXT("Hia"), JSON_TEXT("Earth"))); + json_push_back(test, json_new_a(JSON_TEXT("Hey"), JSON_TEXT("Jude"))); + } +#else + void CreateTest(JSONNode & test); //suppress warnings that it wasnt defined + void CreateTest(JSONNode & test){ + test.push_back(JSONNode(JSON_TEXT("Hi"), JSON_TEXT("World"))); + test.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("There"))); + test.push_back(JSONNode(JSON_TEXT("Hai"), JSON_TEXT("Mars"))); + test.push_back(JSONNode(JSON_TEXT("Hia"), JSON_TEXT("Earth"))); + test.push_back(JSONNode(JSON_TEXT("Hey"), JSON_TEXT("Jude"))); + } +#endif + +void TestSuite::TestIterators(void){ +#ifdef JSON_ITERATORS + #define assertAutoCString(cone, ctwo)\ + {\ + json_char * _res = cone;\ + assertCStringSame(_res, ctwo);\ + json_free(_res);\ + } + + UnitTest::SetPrefix("TestIterators.cpp - Iterator"); + #ifdef JSON_LIBRARY + JSONNODE * empty = json_new(JSON_NODE); + assertEquals(json_begin(empty), json_end(empty)); + TestSuite::testParsingItself(empty); + + assertNull(json_at(empty, 15)); + assertNull(json_get(empty, JSON_TEXT("hello"))); + + JSONNODE * test = json_new(JSON_NODE); + json_push_back(test, json_new_i(JSON_TEXT(""), 15)); + json_push_back(test, json_new_a(JSON_TEXT(""), JSON_TEXT("hello world"))); + json_push_back(test, json_new_b(JSON_TEXT(""), true)); + assertEquals(json_size(test), 3); + TestSuite::testParsingItself(test); + + JSONNODE_ITERATOR it_test = json_begin(test); + assertEquals(json_as_int(*it_test), 15); + ++it_test; + assertAutoCString(json_as_string(*it_test), JSON_TEXT("hello world")); + it_test++; + assertEquals(json_as_bool(*it_test++), true); + assertEquals(it_test, json_end(test)); + + unsigned int i = 0; + for(JSONNODE_ITERATOR it = json_begin(test), end = json_end(test); it != end; ++it){ + ++i; + } + assertEquals(i, 3); + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Find"); + json_delete(test); + test = json_new(JSON_NODE); + CreateTest(test); + + JSONNODE_ITERATOR ti = json_find(test, JSON_TEXT("bye")); + assertEquals(ti, json_end(test)); + + ti = json_find(test, JSON_TEXT("Hai")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars")); + ti = json_find(test, JSON_TEXT("Hey")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude")); + ti = json_find(test, JSON_TEXT("Hi")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("World")); + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + ti = json_find_nocase(test, JSON_TEXT("BYE")); + assertEquals(ti, json_end(test)); + ti = json_find_nocase(test, JSON_TEXT("HAI")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars")); + ti = json_find_nocase(test, JSON_TEXT("HEY")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude")); + ti = json_find_nocase(test, JSON_TEXT("HI")); + assertNotEquals(ti, json_end(test)); + assertAutoCString(json_as_string(*ti), JSON_TEXT("World")); + #endif + UnitTest::SetPrefix("TestIterators.cpp - Iterator Erase"); + + ti = json_erase(test, json_begin(test) + 3); + assertEquals(json_size(test), 4); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude")); + ti = json_erase(test, json_begin(test)); + assertEquals(json_size(test), 3); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("There")); + + #ifdef JSON_SAFE + ti = json_erase(test, json_end(test)); + assertEquals(json_size(test), 3); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Jude")); + assertEquals(ti, json_end(test)); + #endif + + ti = json_erase(test, json_begin(test)); + assertEquals(json_size(test), 2); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars")); + + ti = json_erase(test, json_begin(test)); + assertEquals(json_size(test), 1); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude")); + + ti = json_erase(test, json_begin(test)); + assertEquals(json_size(test), 0); + assertEquals(ti, json_end(test)); + + CreateTest(test); + i = 0; + for (JSONNODE_ITERATOR it = json_begin(test); it != json_end(test); it = json_erase(test, it)){ + ++i; + } + assertEquals(json_size(test), 0); + assertEquals(i, 5); + + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Erase"); + CreateTest(test); + + ti = json_erase_multi(test, json_begin(test), json_begin(test)); + assertEquals(json_size(test), 5); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Jude")); + assertEquals(ti, json_begin(test)); + + json_erase_multi(test, json_begin(test), json_end(test)); + assertEquals(json_size(test), 0); + CreateTest(test); + + ti = json_erase_multi(test, json_begin(test), json_begin(test) + 1); + assertEquals(json_size(test), 4); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Jude")); + assertEquals(ti, json_begin(test)); + + ti = json_erase_multi(test, json_begin(test), json_begin(test) + 2); + assertEquals(json_size(test), 2); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Jude")); + assertEquals(ti, json_begin(test)); + + ti = json_erase_multi(test, json_begin(test), json_end(test) - 1); + assertEquals(json_size(test), 1); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Jude")); + assertEquals(ti, json_begin(test)); + json_clear(test); + + + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Insert"); + CreateTest(test); + ti = json_insert(test, json_begin(test) + 3, json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(json_size(test), 6); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Pluto")); + assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto")); + assertEquals(ti, json_begin(test) + 3); + json_clear(test); + + CreateTest(test); + ti = json_insert(test, json_begin(test), json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(json_size(test), 6); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Pluto")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto")); + assertEquals(ti, json_begin(test)); + json_clear(test); + + CreateTest(test); + ti = json_insert(test, json_begin(test) + 5, json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(json_size(test), 6); + assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Pluto")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto")); + assertEquals(ti, json_begin(test) + 5); + json_clear(test); + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Insert"); + + + + + JSONNODE * test3 = json_new(JSON_NODE); + + CreateTest(test); + CreateTest(test3); + ti = json_insert_multi(test3, json_begin(test3) + 3, json_begin(test) + 1, json_begin(test) + 3); + assertEquals(json_size(test3), 7); + assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("There")); + assertEquals(ti, json_begin(test3) + 3); + json_clear(test); + json_clear(test3); + + CreateTest(test); + CreateTest(test3); + ti = json_insert_multi(test3, json_begin(test3), json_begin(test) + 1, json_begin(test) + 3); + assertEquals(json_size(test3), 7); + assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("Earth")); + assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("There")); + assertEquals(ti, json_begin(test3)); + json_clear(test); + json_clear(test3); + + CreateTest(test); + CreateTest(test3); + json_set_a(json_at(test3, 2), JSON_TEXT("lol")); + json_set_a(json_at(test3, 3), JSON_TEXT("lul")); + ti = json_insert_multi(test3, json_begin(test3) + 5, json_begin(test) + 1, json_begin(test) + 3); + assertEquals(json_size(test3), 7); + assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("World")); + assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("lol")); + assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("lul")); + assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Jude")); + assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("There")); + assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Mars")); + assertAutoCString(json_as_string(*ti), JSON_TEXT("There")); + assertEquals(ti, json_begin(test3) + 5); + + json_delete(empty); + json_delete(test); + json_delete(test3); + #else + JSONNode empty = JSONNode(JSON_NODE); + assertEquals(empty.begin(), empty.end()); + assertEquals(empty.rbegin(), empty.rend()); + TestSuite::testParsingItself(empty); + + assertException(empty.at(15), std::out_of_range); + assertException(empty.at(JSON_TEXT("hello")), std::out_of_range); + + JSONNode test = JSONNode(JSON_NODE); + test.push_back(JSONNode(JSON_TEXT(""), 15)); + test.push_back(JSONNode(JSON_TEXT(""), JSON_TEXT("hello world"))); + test.push_back(JSONNode(JSON_TEXT(""), true)); + assertEquals(test.size(), 3); + TestSuite::testParsingItself(test); + + JSONNode::iterator it_test = test.begin(); + assertEquals(*it_test, 15); + ++it_test; + assertEquals(*it_test, JSON_TEXT("hello world")); + it_test++; + assertEquals(*it_test++, true); + assertEquals(it_test, test.end()); + + unsigned int i = 0; + for(JSONNode::iterator it = test.begin(), end = test.end(); it != end; ++it){ + ++i; + } + assertEquals(i, 3); + + + + UnitTest::SetPrefix("TestIterators.cpp - Const Iterator"); + const JSONNode test2 = test; + assertEquals(test2.size(), 3); + + JSONNode::const_iterator cit_test = test2.begin(); + assertEquals(*cit_test, 15); + ++cit_test; + assertEquals(*cit_test, JSON_TEXT("hello world")); + cit_test++; + assertEquals(*cit_test++, true); + assertEquals(cit_test, test2.end()); + i = 0; + for(JSONNode::const_iterator it = test2.begin(), end = test2.end(); it != end; ++it){ + ++i; + } + assertEquals(i, 3); + + + + UnitTest::SetPrefix("TestIterators.cpp - Reverse Iterator"); + assertEquals(test.size(), 3); + + JSONNode::reverse_iterator rit_test = test.rbegin(); + assertEquals(*rit_test, true); + ++rit_test; + assertEquals(*rit_test, JSON_TEXT("hello world")); + rit_test++; + assertEquals(*rit_test++, 15); + assertEquals(rit_test, test.rend()); + i = 0; + for(JSONNode::reverse_iterator it = test.rbegin(), end = test.rend(); it != end; ++it){ + ++i; + } + assertEquals(i, 3); + + + + UnitTest::SetPrefix("TestIterators.cpp - Reverse Const Iterator"); + assertEquals(test2.size(), 3); + + JSONNode::reverse_const_iterator rcit_test = test2.rbegin(); + assertEquals(*rcit_test, true); + ++rcit_test; + assertEquals(*rcit_test, JSON_TEXT("hello world")); + rcit_test++; + assertEquals(*rcit_test++, 15); + assertEquals(rcit_test, test2.rend()); + i = 0; + for(JSONNode::reverse_const_iterator it = test2.rbegin(), end = test2.rend(); it != end; ++it){ + ++i; + } + assertEquals(i, 3); + + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Find"); + test = JSONNode(); + CreateTest(test); + + JSONNode::iterator ti = test.find(JSON_TEXT("bye")); + assertEquals(ti, test.end()); + ti = test.find(JSON_TEXT("Hai")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("Mars")); + ti = test.find(JSON_TEXT("Hey")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("Jude")); + ti = test.find(JSON_TEXT("Hi")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("World")); + + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + ti = test.find_nocase(JSON_TEXT("BYE")); + assertEquals(ti, test.end()); + ti = test.find_nocase(JSON_TEXT("HAI")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("Mars")); + ti = test.find_nocase(JSON_TEXT("HEY")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("Jude")); + ti = test.find_nocase(JSON_TEXT("HI")); + assertNotEquals(ti, test.end()); + assertEquals(*ti, JSON_TEXT("World")); + #endif + UnitTest::SetPrefix("TestIterators.cpp - Iterator Erase"); + + ti = test.erase(test.begin() + 3); + assertEquals(test.size(), 4); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("Jude")); + ti = test.erase(test.begin()); + assertEquals(test.size(), 3); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(test[1], JSON_TEXT("Mars")); + assertEquals(test[2], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("There")); + + JSONNode::reverse_iterator rti = test.rbegin(); + assertEquals(*rti, JSON_TEXT("Jude")); + #ifdef JSON_SAFE + rti = test.erase(test.rend()); + assertEquals(test.size(), 3); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(test[1], JSON_TEXT("Mars")); + assertEquals(test[2], JSON_TEXT("Jude")); + assertEquals(rti, test.rend()); + ti = test.erase(test.end()); + assertEquals(test.size(), 3); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(test[1], JSON_TEXT("Mars")); + assertEquals(test[2], JSON_TEXT("Jude")); + assertEquals(ti, test.end()); + #endif + rti = test.erase(test.rbegin()); + assertEquals(test.size(), 2); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(test[1], JSON_TEXT("Mars")); + assertEquals(*rti, JSON_TEXT("Mars")); + + rti = test.erase(test.rbegin()); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(*rti, JSON_TEXT("There")); + + test.erase(test.rbegin()); + assertEquals(test.size(), 0); + #ifdef JSON_SAFE + test.erase(test.rend()); + assertEquals(test.size(), 0); + test.erase(test.end()); + assertEquals(test.size(), 0); + #endif + + CreateTest(test); + i = 0; + for (JSONNode::iterator it = test.begin(); it != test.end(); it = test.erase(it)){ + ++i; + } + assertEquals(test.size(), 0); + assertEquals(i, 5); + + CreateTest(test); + i = 0; + for (JSONNode::reverse_iterator it = test.rbegin(); it != test.rend(); it = test.erase(it)){ + ++i; + } + assertEquals(test.size(), 0); + assertEquals(i, 5); + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Erase"); + CreateTest(test); + + ti = test.erase(test.begin(), test.begin()); + assertEquals(test.size(), 5); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Earth")); + assertEquals(test[4], JSON_TEXT("Jude")); + assertEquals(ti, test.begin()); + + test.erase(test.begin(), test.end()); + assertEquals(test.size(), 0); + CreateTest(test); + + ti = test.erase(test.begin(), test.begin() + 1); + assertEquals(test.size(), 4); + assertEquals(test[0], JSON_TEXT("There")); + assertEquals(test[1], JSON_TEXT("Mars")); + assertEquals(test[2], JSON_TEXT("Earth")); + assertEquals(test[3], JSON_TEXT("Jude")); + assertEquals(ti, test.begin()); + + ti = test.erase(test.begin(), test.begin() + 2); + assertEquals(test.size(), 2); + assertEquals(test[0], JSON_TEXT("Earth")); + assertEquals(test[1], JSON_TEXT("Jude")); + assertEquals(ti, test.begin()); + + ti = test.erase(test.begin(), test.end() - 1); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("Jude")); + assertEquals(ti, test.begin()); + test.clear(); + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Reverse Erase"); + CreateTest(test); + + rti = test.erase(test.rbegin(), test.rbegin()); + assertEquals(test.size(), 5); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Earth")); + assertEquals(test[4], JSON_TEXT("Jude")); + assertEquals(rti, test.rbegin()); + + rti = test.erase(test.rbegin(), test.rend()); + assertEquals(test.size(), 0); + assertEquals(rti, test.rbegin()); + assertEquals(rti, test.rend()); + CreateTest(test); + + rti = test.erase(test.rbegin(), test.rbegin() + 1); + assertEquals(test.size(), 4); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Earth")); + assertEquals(rti, test.rbegin()); + + rti = test.erase(test.rbegin(), test.rbegin() + 2); + assertEquals(rti, test.rbegin()); + assertEquals(test.size(), 2); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(rti, test.rbegin()); + + rti = test.erase(test.rbegin(), test.rend() - 1); + assertEquals(test.size(), 1); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(rti, test.rbegin()); + test.clear(); + + UnitTest::SetPrefix("TestIterators.cpp - Iterator Insert"); + CreateTest(test); + ti = test.insert(test.begin() + 3, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Pluto")); + assertEquals(test[4], JSON_TEXT("Earth")); + assertEquals(test[5], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("Pluto")); + assertEquals(ti -> as_string(), JSON_TEXT("Pluto")); + assertEquals(ti, test.begin() + 3); + test.clear(); + + CreateTest(test); + ti = test.insert(test.begin(), JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("Pluto")); + assertEquals(test[1], JSON_TEXT("World")); + assertEquals(test[2], JSON_TEXT("There")); + assertEquals(test[3], JSON_TEXT("Mars")); + assertEquals(test[4], JSON_TEXT("Earth")); + assertEquals(test[5], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("Pluto")); + assertEquals(ti -> as_string(), JSON_TEXT("Pluto")); + assertEquals(ti, test.begin()); + test.clear(); + + CreateTest(test); + ti = test.insert(test.begin() + 5, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Earth")); + assertEquals(test[4], JSON_TEXT("Jude")); + assertEquals(test[5], JSON_TEXT("Pluto")); + assertEquals(*ti, JSON_TEXT("Pluto")); + assertEquals(ti -> as_string(), JSON_TEXT("Pluto")); + assertEquals(ti, test.begin() + 5); + test.clear(); + + CreateTest(test); + rti = test.insert(test.rbegin(), JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Earth")); + assertEquals(test[4], JSON_TEXT("Jude")); + assertEquals(test[5], JSON_TEXT("Pluto")); + assertEquals(*rti, JSON_TEXT("Pluto")); + assertEquals(rti, test.rbegin()); + test.clear(); + + CreateTest(test); + rti = test.insert(test.rbegin() + 5, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("Pluto")); + assertEquals(test[1], JSON_TEXT("World")); + assertEquals(test[2], JSON_TEXT("There")); + assertEquals(test[3], JSON_TEXT("Mars")); + assertEquals(test[4], JSON_TEXT("Earth")); + assertEquals(test[5], JSON_TEXT("Jude")) + assertEquals(*rti, JSON_TEXT("Pluto")); + assertEquals(rti, test.rbegin() + 5); + test.clear(); + + CreateTest(test); + rti = test.insert(test.rbegin() + 2, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto"))); + assertEquals(test.size(), 6); + assertEquals(test[0], JSON_TEXT("World")); + assertEquals(test[1], JSON_TEXT("There")); + assertEquals(test[2], JSON_TEXT("Mars")); + assertEquals(test[3], JSON_TEXT("Pluto")); + assertEquals(test[4], JSON_TEXT("Earth")); + assertEquals(test[5], JSON_TEXT("Jude")); + assertEquals(*rti, JSON_TEXT("Pluto")); + assertEquals(rti, test.rbegin() + 2); + test.clear(); + + JSONNode test3; + + CreateTest(test); + CreateTest(test3); + ti = test3.insert(test3.begin() + 3, test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("Mars")); + assertEquals(test3[3], JSON_TEXT("There")); + assertEquals(test3[4], JSON_TEXT("Mars")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("There")); + assertEquals(ti, test3.begin() + 3); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + ti = test3.insert(test3.begin(), test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("There")); + assertEquals(test3[1], JSON_TEXT("Mars")); + assertEquals(test3[2], JSON_TEXT("World")); + assertEquals(test3[3], JSON_TEXT("There")); + assertEquals(test3[4], JSON_TEXT("Mars")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("There")); + assertEquals(ti, test3.begin()); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + ti = test3.insert(test3.begin() + 5, test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("lol")); + assertEquals(test3[3], JSON_TEXT("lul")); + assertEquals(test3[4], JSON_TEXT("Jude")); + assertEquals(test3[5], JSON_TEXT("There")); + assertEquals(test3[6], JSON_TEXT("Mars")); + assertEquals(*ti, JSON_TEXT("There")); + assertEquals(ti, test3.begin() + 5); + test.clear(); + test3.clear(); + + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + ti = test3.insert(test3.begin() + 3, test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("lol")); + assertEquals(test3[3], JSON_TEXT("Earth")); + assertEquals(test3[4], JSON_TEXT("Mars")); + assertEquals(test3[5], JSON_TEXT("lul")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("Earth")); + assertEquals(ti, test3.begin() + 3); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + ti = test3.insert(test3.begin(), test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("Earth")); + assertEquals(test3[1], JSON_TEXT("Mars")); + assertEquals(test3[2], JSON_TEXT("World")); + assertEquals(test3[3], JSON_TEXT("There")); + assertEquals(test3[4], JSON_TEXT("lol")); + assertEquals(test3[5], JSON_TEXT("lul")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*ti, JSON_TEXT("Earth")); + assertEquals(ti, test3.begin()); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + ti = test3.insert(test3.begin() + 5, test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("lol")); + assertEquals(test3[3], JSON_TEXT("lul")); + assertEquals(test3[4], JSON_TEXT("Jude")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Mars")); + assertEquals(*ti, JSON_TEXT("Earth")); + assertEquals(ti, test3.begin() + 5); + test.clear(); + test3.clear(); + + + + + CreateTest(test); + CreateTest(test3); + test3[1] = JSON_TEXT("lol"); + test3[2] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin(), test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("lol")); + assertEquals(test3[2], JSON_TEXT("lul")); + assertEquals(test3[3], JSON_TEXT("Earth")); + assertEquals(test3[4], JSON_TEXT("Jude")); + assertEquals(test3[5], JSON_TEXT("Mars")); + assertEquals(test3[6], JSON_TEXT("There")); + assertEquals(*rti, JSON_TEXT("There")); + assertEquals(rti, test3.rbegin()); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[1] = JSON_TEXT("lol"); + test3[2] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin() + 3, test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("lol")); + assertEquals(test3[2], JSON_TEXT("Mars")); + assertEquals(test3[3], JSON_TEXT("There")); + assertEquals(test3[4], JSON_TEXT("lul")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*rti, JSON_TEXT("There")); + assertEquals(rti, test3.rbegin() + 3); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[1] = JSON_TEXT("lol"); + test3[2] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin() + 5, test.begin() + 1, test.begin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("Mars")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("World")); + assertEquals(test3[3], JSON_TEXT("lol")); + assertEquals(test3[4], JSON_TEXT("lul")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*rti, JSON_TEXT("There")); + assertEquals(rti, test3.rbegin() + 5); + test.clear(); + test3.clear(); + + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin(), test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("lol")); + assertEquals(test3[3], JSON_TEXT("lul")); + assertEquals(test3[4], JSON_TEXT("Jude")); + assertEquals(test3[5], JSON_TEXT("Earth")); + assertEquals(test3[6], JSON_TEXT("Mars")); + assertEquals(*rti, JSON_TEXT("Mars")); + assertEquals(rti, test3.rbegin()); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin() + 3, test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("World")); + assertEquals(test3[1], JSON_TEXT("There")); + assertEquals(test3[2], JSON_TEXT("Earth")); + assertEquals(test3[3], JSON_TEXT("Mars")); + assertEquals(test3[4], JSON_TEXT("lol")); + assertEquals(test3[5], JSON_TEXT("lul")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*rti, JSON_TEXT("Mars")); + assertEquals(rti, test3.rbegin() + 3); + test.clear(); + test3.clear(); + + CreateTest(test); + CreateTest(test3); + test3[2] = JSON_TEXT("lol"); + test3[3] = JSON_TEXT("lul"); + rti = test3.insert(test3.rbegin() + 5, test.rbegin() + 1, test.rbegin() + 3); + assertEquals(test3.size(), 7); + assertEquals(test3[0], JSON_TEXT("Earth")); + assertEquals(test3[1], JSON_TEXT("Mars")); + assertEquals(test3[2], JSON_TEXT("World")); + assertEquals(test3[3], JSON_TEXT("There")); + assertEquals(test3[4], JSON_TEXT("lol")); + assertEquals(test3[5], JSON_TEXT("lul")); + assertEquals(test3[6], JSON_TEXT("Jude")); + assertEquals(*rti, JSON_TEXT("Mars")); + assertEquals(rti, test3.rbegin() + 5); + test.clear(); + test3.clear(); + #endif +#endif +} diff --git a/libjson/_internal/TestSuite/TestMutex.cpp b/libjson/_internal/TestSuite/TestMutex.cpp new file mode 100644 index 0000000..559d46a --- /dev/null +++ b/libjson/_internal/TestSuite/TestMutex.cpp @@ -0,0 +1,345 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + + +#ifdef JSON_MUTEX_CALLBACKS + int testMutex = 0; + bool doassert = true; + int managerlock; + static void lock(void * mutex){ + if (mutex == &managerlock) return; + if (doassert) assertEquals(mutex, &testMutex); + if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash + ++(*((int*)mutex)); + } + static void unlock(void * mutex){ + if (mutex == &managerlock) return; + if (doassert) assertEquals(mutex, &testMutex); + if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash + --(*((int*)mutex)); + } + + void * currentMutexTest = 0; + + #ifdef JSON_MUTEX_MANAGE + #include "../Source/JSONGlobals.h" + + static void destroy(void * mutex){ + assertEquals(mutex, currentMutexTest); + assertEquals(*((int*)mutex), 0); + } + #endif + + void TestSuite::TestMutex(void){ + UnitTest::SetPrefix("TestMutex.cpp - Mutex"); + + #ifdef JSON_LIBRARY + + + #ifdef JSON_MUTEX_MANAGE + json_register_mutex_callbacks(lock, unlock, destroy, &managerlock); + #else + json_register_mutex_callbacks(lock, unlock, &managerlock); + #endif + + currentMutexTest = &testMutex; + { + JSONNODE * test1 = json_new(JSON_NODE); + #ifdef JSON_UNIT_TEST + assertNull(((JSONNode*)test1) -> internal -> mylock); + #endif + + JSONNODE * test2 = json_copy(test1); + assertNotEquals(test1, test2); + #ifdef JSON_UNIT_TEST + assertNull(((JSONNode*)test2) -> internal -> mylock); + #endif + + json_set_mutex(test2, &testMutex); + + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)test2) -> internal -> mylock, &testMutex); + assertNull(((JSONNode*)test1) -> internal -> mylock); + #endif + + JSONNODE * test3 = json_copy(test2); + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)test2) -> internal -> mylock, &testMutex); + #endif + json_set_a(test3, JSON_TEXT("Hello World")); + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex); + #endif + + #ifdef JSON_CASTABLE + json_cast(test3, JSON_NODE); + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex); + #endif + + JSONNODE * tree = json_new(JSON_NODE); + json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("world"))); + json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("Mars"))); + json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("USA"))); + json_push_back(test3, json_copy(tree)); + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(test3, 0)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 0)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 1)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 2)) -> internal -> mylock, &testMutex); + #endif + + json_clear(test3); + json_set_mutex(test3, 0); + assertEquals(json_size(test3), 0); + assertEquals(json_size(tree), 3); + #ifdef JSON_UNIT_TEST + assertNull(((JSONNode*)tree) -> internal -> mylock); + assertNull(((JSONNode*)json_at(tree, 0)) -> internal -> mylock); + assertNull(((JSONNode*)json_at(tree, 1)) -> internal -> mylock); + assertNull(((JSONNode*)json_at(tree, 2)) -> internal -> mylock); + #endif + json_set_mutex(tree, &testMutex); + #ifdef JSON_UNIT_TEST + assertEquals(((JSONNode*)tree) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(tree, 0)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(tree, 1)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(tree, 2)) -> internal -> mylock, &testMutex); + #endif + json_push_back(test3, tree); + #ifdef JSON_UNIT_TEST + assertNull(((JSONNode*)test3) -> internal -> mylock); + assertEquals(((JSONNode*)json_at(test3, 0)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 0)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 1)) -> internal -> mylock, &testMutex); + assertEquals(((JSONNode*)json_at(json_at(test3, 0), 2)) -> internal -> mylock, &testMutex); + #endif + assertEquals(testMutex, 0); + #endif + + #ifdef JSON_MUTEX_MANAGE + UnitTest::SetPrefix("TestMutex.cpp - Mutex Management"); + { + JSONNODE * deleteTest = json_new(JSON_NODE); + int i = 0; + currentMutexTest = &i; + json_set_mutex(deleteTest, &i); + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&i); + assertEquals(json_global(MUTEX_MANAGER).size(), 2); + assertNotEquals(it, json_global(MUTEX_MANAGER).end()); + assertEquals(it -> first, (void*)&i); + assertEquals(it -> second, 1); + + json_set_mutex(deleteTest, &testMutex); + currentMutexTest = &testMutex; + json_delete(deleteTest); + } + #endif + + json_delete(test1); + json_delete(test2); + json_delete(test3); + } + #ifdef JSON_MUTEX_MANAGE + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&testMutex); + assertEquals(json_global(MUTEX_MANAGER).size(), 0); + assertEquals(it, json_global(MUTEX_MANAGER).end()); + #endif + + + + + + #else + #ifdef JSON_MUTEX_MANAGE + libjson::register_mutex_callbacks(lock, unlock, destroy, &managerlock); + #else + libjson::register_mutex_callbacks(lock, unlock, &managerlock); + #endif + + currentMutexTest = &testMutex; + { + JSONNode test1; + #ifdef JSON_UNIT_TEST + assertNull(test1.internal -> mylock); + #endif + JSONNode test2 = JSONNode(test1); + #ifdef JSON_UNIT_TEST + assertNull(test1.internal -> mylock); + #endif + test2.set_mutex(&testMutex); + #ifdef JSON_UNIT_TEST + assertEquals(test2.internal -> mylock, &testMutex); + assertNull(test1.internal -> mylock); + #endif + + JSONNode test3 = test2; + #ifdef JSON_UNIT_TEST + assertEquals(test3.internal -> mylock, &testMutex); + assertEquals(test2.internal -> mylock, &testMutex); + #endif + test3 = JSON_TEXT("Hello World"); + #ifdef JSON_UNIT_TEST + assertEquals(test3.internal -> mylock, &testMutex); + #endif + + #ifdef JSON_CASTABLE + test3.cast(JSON_NODE); + #ifdef JSON_UNIT_TEST + assertEquals(test3.internal -> mylock, &testMutex); + #endif + JSONNode tree = JSONNode(JSON_NODE); + tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("world"))); + tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("Mars"))); + tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("USA"))); + test3.push_back(tree); + #ifdef JSON_UNIT_TEST + assertEquals(test3.internal -> mylock, &testMutex); + assertEquals(test3[0].internal -> mylock, &testMutex); + assertEquals(test3[0][0].internal -> mylock, &testMutex); + assertEquals(test3[0][1].internal -> mylock, &testMutex); + assertEquals(test3[0][2].internal -> mylock, &testMutex); + #endif + + + test3.clear(); + test3.set_mutex(0); + assertEquals(test3.size(), 0); + assertEquals(tree.size(), 3); + #ifdef JSON_UNIT_TEST + assertNull(tree.internal -> mylock); + assertNull(tree[0].internal -> mylock); + assertNull(tree[1].internal -> mylock); + assertNull(tree[2].internal -> mylock); + #endif + tree.set_mutex(&testMutex); + #ifdef JSON_UNIT_TEST + assertEquals(tree.internal -> mylock, &testMutex); + assertEquals(tree[0].internal -> mylock, &testMutex); + assertEquals(tree[1].internal -> mylock, &testMutex); + assertEquals(tree[2].internal -> mylock, &testMutex); + #endif + test3.push_back(tree); + #ifdef JSON_UNIT_TEST + assertNull(test3.internal -> mylock); + assertEquals(test3[0].internal -> mylock, &testMutex); + assertEquals(test3[0][0].internal -> mylock, &testMutex); + assertEquals(test3[0][1].internal -> mylock, &testMutex); + assertEquals(test3[0][2].internal -> mylock, &testMutex); + #endif + #ifndef JSON_SAFE + doassert = false; + #endif + { + JSONNode::auto_lock temp1(test3, 1); //null, so it should do nothing + JSONNode::auto_lock temp2(tree, 1); + assertEquals(testMutex, 1); + } + #ifndef JSON_SAFE + doassert = true; + #endif + #endif + + assertEquals(testMutex, 0); + + #ifdef JSON_MUTEX_MANAGE + UnitTest::SetPrefix("TestMutex.cpp - Mutex Management"); + { + JSONNode deleteTest = JSONNode(JSON_NODE); + int i = 0; + currentMutexTest = &i; + deleteTest.set_mutex(&i); + JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&i); + assertEquals(json_global(MUTEX_MANAGER).size(), 2); + assertNotEquals(it, json_global(MUTEX_MANAGER).end()); + assertEquals(it -> first, (void*)&i); + assertEquals(it -> second, 1); + + deleteTest.set_mutex(&testMutex); + currentMutexTest = &testMutex; + } + #endif + } + #ifdef JSON_MUTEX_MANAGE + std::map::iterator it = json_global(MUTEX_MANAGER).find((void*)&testMutex); + assertEquals(json_global(MUTEX_MANAGER).size(), 0); + assertEquals(it, json_global(MUTEX_MANAGER).end()); + #endif + #endif + } + + #ifdef JSON_MUTEX_CALLBACKS + int handler = 0; + static void lock_mutex(void * mutex){ + if (mutex == &handler) return; + assertEquals(mutex, &testMutex); + if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash + ++(*((int*)mutex)); + } + static void unlock_mutex(void * mutex){ + if (mutex == &handler) return; + assertEquals(mutex, &testMutex); + if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash + --(*((int*)mutex)); + } + + static void destroy_mutex(void * ){} + + void TestSuite::TestThreading(void){ + //going to fake two threads os that I don't need pthread to link + UnitTest::SetPrefix("TestMutex.cpp - Threading"); + testMutex = 0; + #ifdef JSON_LIBRARY + //create the JSONNode + JSONNODE * test = json_new(JSON_NODE); + #ifdef JSON_MUTEX_MANAGE + json_register_mutex_callbacks(lock_mutex, unlock_mutex, destroy_mutex, &handler); + #else + json_register_mutex_callbacks(lock_mutex, unlock_mutex, &handler); + #endif + json_set_mutex(test, &testMutex); + + json_lock(test, 1); + assertEquals(testMutex, 1); + json_lock(test, 1); + assertEquals(testMutex, 1); + json_lock(test, 2); + assertEquals(testMutex, 2); + json_unlock(test, 1); + assertEquals(testMutex, 2); //because this thread locked it twice + json_unlock(test, 1); + assertEquals(testMutex, 1); + json_unlock(test, 2); + assertEquals(testMutex, 0); + + json_delete(test); + #else + //create the JSONNode + JSONNode test; + #ifdef JSON_MUTEX_MANAGE + libjson::register_mutex_callbacks(lock_mutex, unlock_mutex, destroy_mutex, &handler); + #else + libjson::register_mutex_callbacks(lock_mutex, unlock_mutex, &handler); + #endif + + test.set_mutex(&testMutex); + + test.lock(1); + assertEquals(testMutex, 1); + test.lock(1); + assertEquals(testMutex, 1); + test.lock(2); + assertEquals(testMutex, 2); + test.unlock(1); + assertEquals(testMutex, 2); //because this thread locked it twice + test.unlock(1); + assertEquals(testMutex, 1); + test.unlock(2); + assertEquals(testMutex, 0); + + #endif + #endif + } +#endif diff --git a/libjson/_internal/TestSuite/TestNamespace.cpp b/libjson/_internal/TestSuite/TestNamespace.cpp new file mode 100644 index 0000000..63eb97d --- /dev/null +++ b/libjson/_internal/TestSuite/TestNamespace.cpp @@ -0,0 +1,290 @@ +#include "TestSuite.h" + +#include "../Source/JSONGlobals.h" + +void TestSuite::TestNamespace(void){ + #ifdef JSON_LIBRARY + UnitTest::SetPrefix("TestNamespace.cpp - Memory Manager"); + #ifdef JSON_MEMORY_MANAGE + #define ASSERT_ZERO_ALLOCATIONS()\ + assertEquals(json_global(STRING_HANDLER).mymap.size(), 0);\ + assertEquals(json_global(NODE_HANDLER).mymap.size(), 0) + ASSERT_ZERO_ALLOCATIONS(); + JSONNODE * test = json_new(JSON_NODE); + json_set_a(test, JSON_TEXT("Hello")); + assertCStringSame(json_as_string(test), JSON_TEXT("Hello")); + test = json_new_f(JSON_TEXT("Hi"), 14.3f); + assertCStringSame(json_name(test), JSON_TEXT("Hi")); + assertEquals(json_global(STRING_HANDLER).mymap.size(), 2); + assertEquals(json_global(NODE_HANDLER).mymap.size(), 2); + json_delete(test); + assertEquals(json_global(NODE_HANDLER).mymap.size(), 1); + json_delete_all(); + assertEquals(json_global(NODE_HANDLER).mymap.size(), 0); + json_free_all(); + ASSERT_ZERO_ALLOCATIONS(); + #else + #define ASSERT_ZERO_ALLOCATIONS() (void)0 + #endif + UnitTest::SetPrefix("TestNamespace.cpp - Stripper"); + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT("{\n\t\"hello\" : \"world\"\r\n} "); + const json_char * stripped = JSON_TEXT("{\"hello\":\"world\"}"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + + #ifndef JSON_STRICT + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT("/*comment*/{#comment\n\n\t\"hello\" ://comment\n \"world\"\r\n} "); + const json_char * stripped = JSON_TEXT("{\"hello\":\"world\"}"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + #endif + + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT("[\n\t\"hello world\" , \"hello mars\"\r\n] "); + const json_char * stripped = JSON_TEXT("[\"hello world\",\"hello mars\"]"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT(" {\n\t\"hello\" : true\r\n}"); + const json_char * stripped = JSON_TEXT("{\"hello\":true}"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT(" [\n\ttrue , false\r\n]"); + const json_char * stripped = JSON_TEXT("[true,false]"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT("[true,false]"); + const json_char * stripped = JSON_TEXT("[true,false]"); + json_char * res = json_strip_white_space(json); + assertCStringSame(res, stripped); + json_free(res); + ASSERT_ZERO_ALLOCATIONS(); + } + + #ifdef JSON_SAFE + UnitTest::SetPrefix("TestNamespace.cpp - Parser"); + { + ASSERT_ZERO_ALLOCATIONS(); + const json_char * json = JSON_TEXT("[{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\",\"e\":\"f "); + assertNull(json_parse(json)); + ASSERT_ZERO_ALLOCATIONS(); + } + #endif + + + + #ifdef JSON_VALIDATE + UnitTest::SetPrefix("TestNamespace.cpp - Validator"); + assertTrue(json_is_valid(JSON_TEXT("[true,false] "))); + assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":\"world\"}"))) + assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":null}"))) + #ifdef JSON_STRICT + assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":}"))); + assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}"))); + #else + assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":}"))); + assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}"))); + #endif + assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":null, \"hi\" : \"Mars\"}"))); + assertFalse(json_is_valid(JSON_TEXT("{\"hello\":\"world\""))); + assertFalse(json_is_valid(JSON_TEXT("\"hello\":\"world\""))); + assertFalse(json_is_valid(JSON_TEXT("true,false]"))); + assertFalse(json_is_valid(JSON_TEXT("[true,false"))); + assertFalse(json_is_valid(JSON_TEXT("hello"))); + assertFalse(json_is_valid(JSON_TEXT(""))); + #ifdef JSON_SAFE + assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":world\"}"))); + assertFalse(json_is_valid(JSON_TEXT("{\"hello\":\"world\",}"))); + #endif + #endif + #else + UnitTest::SetPrefix("TestNamespace.cpp - Stripper"); + { + json_string json = JSON_TEXT("{\n\t\"hello\" : \"world\"\r\n} "); + json_string stripped = JSON_TEXT("{\"hello\":\"world\"}"); + assertEquals(libjson::strip_white_space(json), stripped); + } + + #ifndef JSON_STRICT + { + json_string json = JSON_TEXT("/*comment*/{#comment\n\n\t\"hello\" ://comment\n \"world\"\r\n} "); + json_string stripped = JSON_TEXT("{\"hello\":\"world\"}"); + assertEquals(libjson::strip_white_space(json), stripped); + } + #endif + + { + json_string json = JSON_TEXT("[\n\t\"hello world\" , \"hello mars\"\r\n] "); + json_string stripped = JSON_TEXT("[\"hello world\",\"hello mars\"]"); + assertEquals(libjson::strip_white_space(json), stripped); + } + { + json_string json = JSON_TEXT(" {\n\t\"hello\" : true\r\n}"); + json_string stripped = JSON_TEXT("{\"hello\":true}"); + assertEquals(libjson::strip_white_space(json), stripped); + } + { + json_string json = JSON_TEXT(" [\n\ttrue , false\r\n]"); + json_string stripped = JSON_TEXT("[true,false]"); + assertEquals(libjson::strip_white_space(json), stripped); + } + { + json_string json = JSON_TEXT("[true,false]"); + json_string stripped = JSON_TEXT("[true,false]"); + assertEquals(libjson::strip_white_space(json), stripped); + } + + #ifdef JSON_VALIDATE + UnitTest::SetPrefix("TestNamespace.cpp - Validator"); + assertTrue(libjson::is_valid(JSON_TEXT("[true,false] "))); + assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":\"world\"}"))); + + assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":null}"))); + #ifdef JSON_STRICT + assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":}"))); + assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}"))); + #else + assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":}"))); + assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}"))); + #endif + assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":null, \"hi\" : \"Mars\"}"))); + + assertFalse(libjson::is_valid(JSON_TEXT("{\"hello\":\"world\""))); + assertFalse(libjson::is_valid(JSON_TEXT("\"hello\":\"world\""))); + assertFalse(libjson::is_valid(JSON_TEXT("true,false]"))); + assertFalse(libjson::is_valid(JSON_TEXT("[true,false"))); + assertFalse(libjson::is_valid(JSON_TEXT("hello"))); + assertFalse(libjson::is_valid(JSON_TEXT(""))); + assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":world\"}"))); + + assertFalse(libjson::is_valid(JSON_TEXT("[\"hello\"\"world\"]"))); + assertFalse(libjson::is_valid(JSON_TEXT("{\"hello\"\"world\", \"hi\":\"mars\"}"))); + assertFalse(libjson::is_valid(JSON_TEXT("[\"hello\":\"world\"]"))); + #endif + + JSONNode tester; + + #ifdef JSON_READ_PRIORITY + UnitTest::SetPrefix("TestNamespace.cpp - Parse"); + tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\"}")); + assertEquals(tester.type(), JSON_NODE); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertFalse(tester.internal -> fetched); + tester.preparse(); + assertTrue(tester.internal -> fetched); + assertTrue(tester[0].internal -> fetched); + #endif + #endif + assertEquals(tester.size(), 1); + assertEquals(tester[0].name(), JSON_TEXT("hello")); + assertEquals(tester[0], JSON_TEXT("world")); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertTrue(tester.internal -> fetched); + #endif + #endif + #ifdef JSON_SAFE + assertException(libjson::parse(JSON_TEXT("{\"hello\":\"world\"")), std::invalid_argument); + #endif + assertException(libjson::parse(JSON_TEXT("\"hello\":\"world\"")), std::invalid_argument); + tester = libjson::parse(JSON_TEXT(" [true, false]\r\n")); + assertEquals(tester.type(), JSON_ARRAY); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertFalse(tester.internal -> fetched); + #endif + #endif + assertEquals(tester.size(), 2); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertTrue(tester.internal -> fetched); + #endif + #endif + assertException(libjson::parse(JSON_TEXT("true,false]")), std::invalid_argument); + #ifdef JSON_SAFE + assertException(libjson::parse(JSON_TEXT("[true,false")), std::invalid_argument); + #endif + assertException(libjson::parse(JSON_TEXT("hello")), std::invalid_argument); + assertException(libjson::parse(JSON_TEXT("")), std::invalid_argument); + TestSuite::testParsingItself(tester); + + tester = libjson::parse(JSON_TEXT(" [\"hello\", \"world\", \"mars\"]\r\n")); + assertEquals(tester.type(), JSON_ARRAY); + assertEquals(tester.size(), 3); + assertEquals(tester[0], JSON_TEXT("hello")); + assertEquals(tester[1], JSON_TEXT("world")); + assertEquals(tester[2], JSON_TEXT("mars")); + TestSuite::testParsingItself(tester); + + tester = libjson::parse(JSON_TEXT("{\"\":{},\"\":2}")); + assertEquals(tester.type(), JSON_NODE); + assertEquals(tester.size(), 2); + assertEquals(tester[0].type(), JSON_NODE); + assertTrue(tester[0].empty()); + assertEquals(tester[1].type(), JSON_NUMBER); + assertEquals(tester[1], 2); + assertEquals(tester, libjson::parse(JSON_TEXT("{\"\":{},\"\":2}"))); + TestSuite::testParsingItself(tester); + + tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\", \"hi\":\"mars\"}")); + assertEquals(tester.type(), JSON_NODE); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertFalse(tester.internal -> fetched); + #endif + #endif + assertEquals(tester.size(), 2); + assertEquals(tester[0].name(), JSON_TEXT("hello")); + assertEquals(tester[0], JSON_TEXT("world")); + assertEquals(tester[1].name(), JSON_TEXT("hi")); + assertEquals(tester[1], JSON_TEXT("mars")); + TestSuite::testParsingItself(tester); + + tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\", \"hi\":\"mars\", \"and\":\"pluto\"}")); + assertEquals(tester.type(), JSON_NODE); + #ifdef JSON_UNIT_TEST + #if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + assertFalse(tester.internal -> fetched); + #endif + #endif + assertEquals(tester.size(), 3); + assertEquals(tester[0].name(), JSON_TEXT("hello")); + assertEquals(tester[0], JSON_TEXT("world")); + assertEquals(tester[1].name(), JSON_TEXT("hi")); + assertEquals(tester[1], JSON_TEXT("mars")); + assertEquals(tester[2].name(), JSON_TEXT("and")); + assertEquals(tester[2], JSON_TEXT("pluto")); + TestSuite::testParsingItself(tester); + + #ifdef JSON_SAFE + assertException(libjson::parse(JSON_TEXT("[{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\",\"e\":\"f ")), std::invalid_argument); + #endif + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestRefCounting.cpp b/libjson/_internal/TestSuite/TestRefCounting.cpp new file mode 100644 index 0000000..86f8fb4 --- /dev/null +++ b/libjson/_internal/TestSuite/TestRefCounting.cpp @@ -0,0 +1,131 @@ +#include "TestSuite.h" + +void TestSuite::TestReferenceCounting(void){ + UnitTest::SetPrefix("TestRefCounting.cpp - Reference Counting"); + #ifdef JSON_LIBRARY + #else + JSONNode test1; + #ifdef JSON_UNIT_TEST + assertNotNull(test1.internal); + #ifdef JSON_REF_COUNT + assertEquals(test1.internal -> refcount, 1); + #endif + #endif + + //copy ctor, should simply increment the reference counter + JSONNode test2 = JSONNode(test1); + #ifdef JSON_REF_COUNT + #ifdef JSON_UNIT_TEST + assertEquals(test1.internal, test2.internal); + #endif + assertEquals(test1, test2); + #ifdef JSON_UNIT_TEST + assertEquals(test1.internal -> refcount, 2); + #endif + #else + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test2.internal); + #endif + assertEquals(test1, test2); + #endif + + //assignment operator, should simply increment the reference counter + JSONNode test3 = test2; + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test3.internal); + assertEquals(test2.internal, test3.internal); + assertEquals(test1.internal -> refcount, 3); + #else + assertNotEquals(test1.internal, test3.internal); + assertNotEquals(test2.internal, test3.internal); + #endif + #endif + + //assigning something, it should copy now + test2 = "hello"; + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test3.internal); + assertNotEquals(test2.internal, test3.internal); + assertEquals(test1.internal -> refcount, 2); + assertEquals(test2.internal -> refcount, 1); + #else + assertNotEquals(test1.internal, test3.internal); + assertNotEquals(test2.internal, test3.internal); + #endif + #endif + + //assigning something, it should copy now + test1 = 15; + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test3.internal); + #ifdef JSON_REF_COUNT + assertEquals(test1.internal -> refcount, 1); + assertEquals(test3.internal -> refcount, 1); + #endif + #endif + + test1 = test2; + #ifdef JSON_REF_COUNT + #ifdef JSON_UNIT_TEST + assertEquals(test1.internal, test2.internal); + assertEquals(test1.internal -> refcount, 2); + #endif + #else + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test2.internal); + #endif + assertEquals(test1, test2); + #endif + + test1.set_name(JSON_TEXT("hello world")); + #ifdef JSON_UNIT_TEST + assertNotEquals(test1.internal, test2.internal); + #ifdef JSON_REF_COUNT + assertEquals(test1.internal -> refcount, 1); + assertEquals(test1.internal -> refcount, 1); + #endif + #endif + + //test tree copying and partial tree copying + UnitTest::SetPrefix("TestRefCounting.cpp - Partial Copy"); + test1 = JSONNode(JSON_NODE); + test1.push_back(JSONNode(JSON_NODE)); + test1.push_back(JSONNode(JSON_TEXT(""), 5)); + assertEquals(test1.size(), 2); + test2 = test1; + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal -> refcount, 2); + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + #ifdef JSON_READ_PRIORITY + assertEquals(test1, libjson::parse(JSON_TEXT("{\"\":{},\"\":5}"))); + assertEquals(test1, test1); + assertEquals(libjson::parse(JSON_TEXT("{\"\":{},\"\":5}")), libjson::parse(JSON_TEXT("{\"\":{},\"\":5}"))); + TestSuite::testParsingItself(test1); + #endif + + test2[1] = 15; + assertEquals(test1[1], 5); + assertEquals(test2[1], 15); + test1 = test2; + #ifdef JSON_UNIT_TEST + #ifdef JSON_REF_COUNT + assertEquals(test1.internal, test2.internal); + #else + assertNotEquals(test1.internal, test2.internal); + #endif + #endif + test1[0].push_back(JSONNode(JSON_TEXT(""), 1)); + test1[0].push_back(JSONNode(JSON_TEXT(""), 2)); + assertEquals(test1[0].size(), 2); + assertEquals(test2[0].size(), 0); + TestSuite::testParsingItself(test1); + TestSuite::testParsingItself(test2); + #endif +} diff --git a/libjson/_internal/TestSuite/TestSharedString.cpp b/libjson/_internal/TestSuite/TestSharedString.cpp new file mode 100644 index 0000000..4d679a3 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSharedString.cpp @@ -0,0 +1,125 @@ + +#include "TestSuite.h" +#include "../Source/JSONSharedString.h" + +void TestSuite::TestSharedString(void){ + UnitTest::SetPrefix("TestSharedString.cpp - Seeing how much regular strings share"); + json_string sharey = JSON_TEXT("Hello world"); + json_string sharey2 = sharey; + if (sharey2.data() == sharey.data()) echo("Assignment shares data"); + sharey2 = json_string(sharey); + if (sharey2.data() == sharey.data()) echo("Copy ctor shares data"); + sharey2 = json_string(sharey.begin(), sharey.end()); + if (sharey2.data() == sharey.data()) echo("Copy with iterators shares data"); + sharey2 = sharey.substr(0); + if (sharey2.data() == sharey.data()) echo("substr shares data"); + + json_string value = JSON_TEXT("Hello, I am a string with lots of words"); + json_shared_string shared = json_shared_string(value); + + UnitTest::SetPrefix("TestSharedString.cpp - Whole String"); + //make it out of a string, make sure they are equal + assertEquals(value.length(), shared.length()); + assertEquals(value, json_string(shared.std_begin(), shared.std_end())); + #ifdef JSON_UNIT_TEST + assertEquals(1, shared._str -> refCount); + #endif + + UnitTest::SetPrefix("TestSharedString.cpp - Substring"); + //take a substring out of it, make sure its using the same reference + json_shared_string hello = json_shared_string(shared, 0, 5); + json_string shello = value.substr(0, 5); + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, hello._str); + assertEquals(2, shared._str -> refCount); + #endif + assertEquals(shello, json_string(hello.std_begin(), hello.std_end())); + + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, hello._str); + assertEquals(2, shared._str -> refCount); + #endif + + UnitTest::SetPrefix("TestSharedString.cpp - Substring to String"); + //make sure converting it to a string actually does the convert + assertEquals(json_string(JSON_TEXT("Hello")), hello.toString()); + #ifdef JSON_UNIT_TEST + assertNotEquals(shared._str, hello._str); + assertEquals(1, shared._str -> refCount); + assertEquals(1, hello._str -> refCount); + #endif + + UnitTest::SetPrefix("TestSharedString.cpp - Substring of substring offset zero"); + json_shared_string rest = json_shared_string(shared, 7); + json_string srest = value.substr(7); + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, rest._str); + assertEquals(7,rest.offset); + assertEquals(2, shared._str -> refCount); + #endif + assertEquals(srest, json_string(rest.std_begin(), rest.std_end())); + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, rest._str); + assertEquals(2, shared._str -> refCount); + #endif + + json_shared_string I_am_a_string = json_shared_string(rest, 0, 13); + json_string sI_am_a_string = srest.substr(0, 13); + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, I_am_a_string._str); + assertEquals(7,rest.offset); + assertEquals(3, shared._str -> refCount); + #endif + assertEquals(sI_am_a_string, json_string(I_am_a_string.std_begin(), I_am_a_string.std_end())); + assertEquals(srest, json_string(rest.std_begin(), rest.std_end())); + #ifdef JSON_UNIT_TEST + assertEquals(shared._str, I_am_a_string._str); + assertEquals(3, shared._str -> refCount); + #endif + + + UnitTest::SetPrefix("TestSharedString.cpp - Finding Ref 1"); + assertEquals(0, hello.find(JSON_TEXT('H'))); + assertEquals(shello.find(JSON_TEXT('H')), hello.find(JSON_TEXT('H'))); + assertEquals(4, hello.find(JSON_TEXT('o'))); + assertEquals(shello.find(JSON_TEXT('o')), hello.find(JSON_TEXT('o'))); + assertEquals(json_string::npos, hello.find(JSON_TEXT('z'))); + assertEquals(shello.find(JSON_TEXT('z')), hello.find(JSON_TEXT('z'))); + + UnitTest::SetPrefix("TestSharedString.cpp - Finding Shared"); + assertEquals(0, I_am_a_string.find(JSON_TEXT('I'))); + assertEquals(sI_am_a_string.find(JSON_TEXT('I')), I_am_a_string.find(JSON_TEXT('I'))); + assertEquals(7, I_am_a_string.find(JSON_TEXT('s'))); + assertEquals(sI_am_a_string.find(JSON_TEXT('s')), I_am_a_string.find(JSON_TEXT('s'))); + assertEquals(json_string::npos, I_am_a_string.find(JSON_TEXT('z'))); + assertEquals(sI_am_a_string.find(JSON_TEXT('z')), I_am_a_string.find(JSON_TEXT('z'))); + //still sharing memory with the parent string, which contains a w + assertEquals(json_string::npos, I_am_a_string.find(JSON_TEXT('w'))); + assertEquals(sI_am_a_string.find(JSON_TEXT('w')), I_am_a_string.find(JSON_TEXT('w'))); + + UnitTest::SetPrefix("TestSharedString.cpp - Iterator substrings"); + json_string blah = JSON_TEXT("hello world"); + json_shared_string blahs(blah); + #ifdef JSON_UNIT_TEST + assertEquals(blahs._str -> refCount, 1); + #endif + json_string sub = json_string(blah.begin(), blah.end()); + json_shared_string subs = json_shared_string(blahs.begin(), blahs.end()); + #ifdef JSON_UNIT_TEST + assertEquals(blahs._str, subs._str); + assertEquals(blahs._str -> refCount, 2); + #endif + assertEquals(blah, blahs.toString()); + assertEquals(sub, subs.toString()); + assertEquals(sub.length(), subs.length()); + sub = json_string(blah.begin(), blah.begin() + 5); + subs = json_shared_string(blahs.begin(), blahs.begin() + 5); + #ifdef JSON_UNIT_TEST + assertEquals(blahs._str, subs._str); + assertEquals(blahs._str -> refCount, 2); + #endif + assertEquals(blah, blahs.toString()); + assertEquals(sub, subs.toString()); + assertEquals(sub.length(), subs.length()); +} + diff --git a/libjson/_internal/TestSuite/TestStreams.cpp b/libjson/_internal/TestSuite/TestStreams.cpp new file mode 100644 index 0000000..d3e2c17 --- /dev/null +++ b/libjson/_internal/TestSuite/TestStreams.cpp @@ -0,0 +1,171 @@ +#include "TestSuite.h" + +#ifdef JSON_STREAM +unsigned int counter = 0; +unsigned int errorCounter = 0; + +void errorCallback(void *); +void errorCallback(void *){ + ++errorCounter; +} + +#ifdef JSON_LIBRARY +void Callback(JSONNODE * test, void *); +void Callback(JSONNODE * test, void *){ + ++counter; + switch(counter){ + case 1: + assertEquals(json_type(test), JSON_NODE); + assertTrue(json_empty(test)); + break; + case 2: + assertEquals(json_type(test), JSON_ARRAY); + assertTrue(json_empty(test)); + break; + case 3:{ + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + json_char * temp = json_name(json_at(test, 0)); + assertCStringSame(temp, JSON_TEXT("hello")); + json_free(temp); + assertEquals(json_as_int(json_at(test, 0)), 1); + break;} + case 4: + assertEquals(json_type(test), JSON_ARRAY); + assertEquals(json_size(test), 3); + break; + case 5:{ + assertEquals(json_type(test), JSON_NODE); + assertEquals(json_size(test), 1); + json_char * temp = json_name(json_at(test, 0)); + assertCStringSame(temp, JSON_TEXT("hi")); + json_free(temp); + assertEquals(json_size(json_at(test, 0)), 1); + assertEquals(json_type(json_at(json_at(test, 0),0)), JSON_NUMBER); + temp = json_name(json_at(json_at(test, 0),0)); + assertCStringSame(temp, JSON_TEXT("one")); + json_free(temp); + assertEquals(json_as_int(json_at(json_at(test, 0),0)), 1); + break;} + } +} +#else +void Callback(JSONNode & test, void * ide); +void Callback(JSONNode & test, void * ide){ + assertEquals(ide, (void*)0xDEADBEEF); + ++counter; + switch(counter){ + case 1: + assertEquals(test.type(), JSON_NODE); + assertTrue(test.empty()); + break; + case 2: + assertEquals(test.type(), JSON_ARRAY); + assertTrue(test.empty()); + break; + case 3: + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0].name(), JSON_TEXT("hello")); + assertEquals(test[0].as_int(), 1); + break; + case 4: + assertEquals(test.type(), JSON_ARRAY); + assertEquals(test.size(), 3); + break; + case 5: + assertEquals(test.type(), JSON_NODE); + assertEquals(test.size(), 1); + assertEquals(test[0].name(), JSON_TEXT("hi")); + assertEquals(test[0].size(), 1) + assertEquals(test[0][0].type(), JSON_NUMBER); + assertEquals(test[0][0].name(), JSON_TEXT("one")); + assertEquals(test[0][0].as_int(), 1); + break; + } +} +#endif //library +#endif //stream + + +void TestSuite::TestStreams(void){ +#ifdef JSON_STREAM + UnitTest::SetPrefix("TestStreams.cpp - Streams"); + counter = 0; + errorCounter = 0; + + #ifdef JSON_LIBRARY + JSONSTREAM * test = json_new_stream(Callback, errorCallback, (void*)0xDEADBEEF); + json_stream_push(test, JSON_TEXT("{}[]")); + assertEquals(2, counter); + assertEquals(0, errorCounter); + json_stream_push(test, JSON_TEXT("{\"hel")); + assertEquals(2, counter); + assertEquals(0, errorCounter); + json_stream_push(test, JSON_TEXT("lo\" : 1")); + assertEquals(2, counter); + assertEquals(0, errorCounter); + json_stream_push(test, JSON_TEXT("}[")); + assertEquals(3, counter); + assertEquals(0, errorCounter); + json_stream_push(test, JSON_TEXT("1,2,3]{\"hi\" : { \"one\" : 1}")); + assertEquals(4, counter); + assertEquals(0, errorCounter); + json_stream_push(test, JSON_TEXT("}")); + assertEquals(5, counter); + assertEquals(0, errorCounter); + + #ifdef JSON_SAFE + json_stream_push(test, JSON_TEXT("{\"hello\":12keaueuataueaouhe")); + assertEquals(1, errorCounter); + #endif + json_delete_stream(test); + #else + JSONStream test(Callback, errorCallback, (void*)0xDEADBEEF); + test << JSON_TEXT("{}[]"); + assertEquals(2, counter); + assertEquals(0, errorCounter); + test << JSON_TEXT("{\"hel"); + assertEquals(2, counter); + assertEquals(0, errorCounter); + test << JSON_TEXT("lo\" : 1"); + assertEquals(2, counter); + assertEquals(0, errorCounter); + test << JSON_TEXT("}["); + assertEquals(3, counter); + assertEquals(0, errorCounter); + test << JSON_TEXT("1,2,3]{\"hi\" : { \"one\" : 1}"); + assertEquals(4, counter); + assertEquals(0, errorCounter); + test << JSON_TEXT("}"); + assertEquals(5, counter); + assertEquals(0, errorCounter); + + #ifdef JSON_SAFE + test << JSON_TEXT("{\"hello\":12keaueuataueaouhe"); + assertEquals(1, errorCounter); + #endif + + #ifdef JSON_SECURITY_MAX_STREAM_OBJECTS + test.reset(); + unsigned int currentCount = errorCounter; + json_string safe; + for(int i = 0; i < JSON_SECURITY_MAX_STREAM_OBJECTS; ++i){ + safe += JSON_TEXT("{}"); + } + test << safe; + assertEquals(133, counter); + assertEquals(currentCount, errorCounter); + + test.reset(); + json_string unsafe; + for(int i = 0; i <= JSON_SECURITY_MAX_STREAM_OBJECTS + 1; ++i){ + unsafe += JSON_TEXT("{}"); + } + test << unsafe; + assertEquals(261, counter); + assertEquals(currentCount + 1, errorCounter); + #endif + #endif +#endif +} diff --git a/libjson/_internal/TestSuite/TestString.cpp b/libjson/_internal/TestSuite/TestString.cpp new file mode 100644 index 0000000..3e3a00f --- /dev/null +++ b/libjson/_internal/TestSuite/TestString.cpp @@ -0,0 +1,197 @@ +#include "TestSuite.h" + +#ifdef JSON_STRING_HEADER + #ifdef JSON_UNICODE + #include "UStringTest.h" + #else + #include "StringTest.h" + #endif +#else + //otherwise it will use the regular STL strings and act as a control + #include "../../libjson.h" +#endif + +static void assertConstEmpty(const json_string & s){ + assertEquals(s.length(), 0); + assertTrue(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("")); +} + +static void assertEmpty(json_string & s){ + assertEquals(s.length(), 0); + assertTrue(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("")); + assertConstEmpty(s); +} + +static void assertSame(json_string & s, json_string & m){ + assertEquals(s, m); + assertCStringSame(s.c_str(), m.c_str()); + assertEquals(s.length(), m.length()); + s.swap(m); + assertEquals(s, m); + assertCStringSame(s.c_str(), m.c_str()); + assertEquals(s.length(), m.length()); +} + +static void assertDifferent(json_string & s, json_string & m){ + assertNotEquals(s, m); + assertCStringNotSame(s.c_str(), m.c_str()); +} + +void TestSuite::TestString(void){ + UnitTest::SetPrefix("TestString.cpp - Test String Class"); + { + json_string s; + assertEmpty(s); + } + + { + json_string s; + assertEmpty(s); + json_string m(s); + assertEmpty(m); + assertEmpty(s); + assertSame(s, m); + } + + { + json_string s(JSON_TEXT("hello")); + assertEquals(s.length(), 5); + assertFalse(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("hello")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("hello")); + s.clear(); + assertEmpty(s); + } + + { + json_string s(5, 'h'); + assertEquals(s.length(), 5); + assertFalse(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("hhhhh")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("hhhhh")); + s.clear(); + assertEmpty(s); + } + + { + json_string s(5, 'h'); + json_string m(s); + assertSame(s, m); + } + + { + json_string s(5, 'h'); + json_string m(s); + assertSame(s, m); + s.clear(); + assertEmpty(s); + assertEquals(s.length(), 0); + assertDifferent(s, m); + } + + + { + json_string s(JSON_TEXT("hello")); + json_string m = s; + assertSame(s, m); + m = s.substr(1, 3); + assertEquals(m.length(), 3); + assertEquals(m, JSON_TEXT("ell")); + } + + { + json_string s(JSON_TEXT("hello")); + json_string m = s; + assertSame(s, m); + m = s.substr(1); + assertEquals(m.length(), 4); + assertEquals(m, JSON_TEXT("ello")); + } + + { + json_string s(JSON_TEXT("hello")); + s += JSON_TEXT(" world"); + assertEquals(s.length(), 11); + assertEquals(s, JSON_TEXT("hello world")); + } + + + { + json_string s(JSON_TEXT("hello")); + json_string m = s + JSON_TEXT(" world ") + s; + assertEquals(m.length(), 17); + assertEquals(m, JSON_TEXT("hello world hello")); + } + + { + json_string s(JSON_TEXT("hello")); + s += 'a'; + s += 'a'; + s += 'a'; + s += 'a'; + assertEquals(s.length(), 9); + assertEquals(s, JSON_TEXT("helloaaaa")); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find('w'); + assertEquals(pos, 6); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find('z'); + assertEquals(pos, json_string::npos); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find_first_not_of(JSON_TEXT("helo")); + assertEquals(pos, 5); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find_first_of(JSON_TEXT("ol")); + assertEquals(pos, 2); + } + + { + json_string s(JSON_TEXT("hello world")); + s.erase(s.begin(), s.begin() + 3); + assertEquals(s, JSON_TEXT("lo world")); + } + + { + json_string s(JSON_TEXT("hello world"), 5); + assertEquals(s, JSON_TEXT("hello")); + } + + #ifndef JSON_LIBRARY + #ifndef JSON_STRING_HEADER + { + json_string s(JSON_TEXT("hello world")); + std::wstring wtest(L"hello world"); + std::string stest("hello world"); + assertEquals(libjson::to_std_string(s), stest); + assertEquals(stest, libjson::to_std_string(s)); + assertEquals(libjson::to_std_wstring(s), wtest); + assertEquals(wtest, libjson::to_std_wstring(s)); + + assertEquals(s, libjson::to_json_string(stest)); + assertEquals(libjson::to_json_string(stest), s); + assertEquals(s, libjson::to_json_string(wtest)); + assertEquals(libjson::to_json_string(wtest), s); + } + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestString.cpp~ b/libjson/_internal/TestSuite/TestString.cpp~ new file mode 100644 index 0000000..8b2ec8e --- /dev/null +++ b/libjson/_internal/TestSuite/TestString.cpp~ @@ -0,0 +1,197 @@ +#include "TestSuite.h" + +#ifdef JSON_STRING_HEADER + #ifdef JSON_UNICODE + #include "UStringTest.h" + #else + #include "StringTest.h" + #endif +#else + //otherwise it will use the regular STL strings and act as a control + #include "../libjson.h" +#endif + +static void assertConstEmpty(const json_string & s){ + assertEquals(s.length(), 0); + assertTrue(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("")); +} + +static void assertEmpty(json_string & s){ + assertEquals(s.length(), 0); + assertTrue(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("")); + assertConstEmpty(s); +} + +static void assertSame(json_string & s, json_string & m){ + assertEquals(s, m); + assertCStringSame(s.c_str(), m.c_str()); + assertEquals(s.length(), m.length()); + s.swap(m); + assertEquals(s, m); + assertCStringSame(s.c_str(), m.c_str()); + assertEquals(s.length(), m.length()); +} + +static void assertDifferent(json_string & s, json_string & m){ + assertNotEquals(s, m); + assertCStringNotSame(s.c_str(), m.c_str()); +} + +void TestSuite::TestString(void){ + UnitTest::SetPrefix("TestString.cpp - Test String Class"); + { + json_string s; + assertEmpty(s); + } + + { + json_string s; + assertEmpty(s); + json_string m(s); + assertEmpty(m); + assertEmpty(s); + assertSame(s, m); + } + + { + json_string s(JSON_TEXT("hello")); + assertEquals(s.length(), 5); + assertFalse(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("hello")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("hello")); + s.clear(); + assertEmpty(s); + } + + { + json_string s(5, 'h'); + assertEquals(s.length(), 5); + assertFalse(s.empty()); + assertCStringSame(s.c_str(), JSON_TEXT("hhhhh")); + assertEquals(s, s); + assertEquals(s, JSON_TEXT("hhhhh")); + s.clear(); + assertEmpty(s); + } + + { + json_string s(5, 'h'); + json_string m(s); + assertSame(s, m); + } + + { + json_string s(5, 'h'); + json_string m(s); + assertSame(s, m); + s.clear(); + assertEmpty(s); + assertEquals(s.length(), 0); + assertDifferent(s, m); + } + + + { + json_string s(JSON_TEXT("hello")); + json_string m = s; + assertSame(s, m); + m = s.substr(1, 3); + assertEquals(m.length(), 3); + assertEquals(m, JSON_TEXT("ell")); + } + + { + json_string s(JSON_TEXT("hello")); + json_string m = s; + assertSame(s, m); + m = s.substr(1); + assertEquals(m.length(), 4); + assertEquals(m, JSON_TEXT("ello")); + } + + { + json_string s(JSON_TEXT("hello")); + s += JSON_TEXT(" world"); + assertEquals(s.length(), 11); + assertEquals(s, JSON_TEXT("hello world")); + } + + + { + json_string s(JSON_TEXT("hello")); + json_string m = s + JSON_TEXT(" world ") + s; + assertEquals(m.length(), 17); + assertEquals(m, JSON_TEXT("hello world hello")); + } + + { + json_string s(JSON_TEXT("hello")); + s += 'a'; + s += 'a'; + s += 'a'; + s += 'a'; + assertEquals(s.length(), 9); + assertEquals(s, JSON_TEXT("helloaaaa")); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find('w'); + assertEquals(pos, 6); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find('z'); + assertEquals(pos, json_string::npos); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find_first_not_of(JSON_TEXT("helo")); + assertEquals(pos, 5); + } + + { + json_string s(JSON_TEXT("hello world")); + size_t pos = s.find_first_of(JSON_TEXT("ol")); + assertEquals(pos, 2); + } + + { + json_string s(JSON_TEXT("hello world")); + s.erase(s.begin(), s.begin() + 3); + assertEquals(s, JSON_TEXT("lo world")); + } + + { + json_string s(JSON_TEXT("hello world"), 5); + assertEquals(s, JSON_TEXT("hello")); + } + + #ifndef JSON_LIBRARY + #ifndef JSON_STRING_HEADER + { + json_string s(JSON_TEXT("hello world")); + std::wstring wtest(L"hello world"); + std::string stest("hello world"); + assertEquals(libjson::to_std_string(s), stest); + assertEquals(stest, libjson::to_std_string(s)); + assertEquals(libjson::to_std_wstring(s), wtest); + assertEquals(wtest, libjson::to_std_wstring(s)); + + assertEquals(s, libjson::to_json_string(stest)); + assertEquals(libjson::to_json_string(stest), s); + assertEquals(s, libjson::to_json_string(wtest)); + assertEquals(libjson::to_json_string(wtest), s); + } + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestSuite.1 b/libjson/_internal/TestSuite/TestSuite.1 new file mode 100644 index 0000000..48b0652 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 9/3/10 \" DATE +.Dt TestSuite 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm TestSuite, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/libjson/_internal/TestSuite/TestSuite.cpp b/libjson/_internal/TestSuite/TestSuite.cpp new file mode 100644 index 0000000..1ca6091 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.cpp @@ -0,0 +1,78 @@ +#include "TestSuite.h" +#include "../Source/JSONNode.h" + +#ifndef JSON_STDERROR + #ifdef JSON_DEBUG + #ifdef JSON_LIBRARY + static void callback(const json_char * msg_c){ + json_string msg(msg_c); + #else + static void callback(const json_string & msg){ + #endif + #ifdef JSON_STRING_HEADER + echo("callback triggered, but can't display string"); + #else + #ifdef JSON_UNICODE + const std::string res = std::string(msg.begin(), msg.end()); + echo(res); + #else + echo(msg); + #endif + #endif + } + #endif +#endif + +void TestSuite::TestSelf(void){ + UnitTest::SetPrefix("TestSuite.cpp - Self Test"); + #ifndef JSON_STDERROR + #ifdef JSON_DEBUG + #ifdef JSON_LIBRARY + json_register_debug_callback(callback); + #else + libjson::register_debug_callback(callback); + #endif + #endif + #endif + assertUnitTest(); + + #if defined(JSON_SAFE) && ! defined(JSON_LIBRARY) + bool temp = false; + JSON_ASSERT_SAFE(true, JSON_TEXT(""), temp = true;); + assertFalse(temp); + JSON_ASSERT_SAFE(false, JSON_TEXT(""), temp = true;); + assertTrue(temp); + + temp = false; + JSON_FAIL_SAFE(JSON_TEXT(""), temp = true;); + assertTrue(temp); + #endif + + echo("If this fails, then edit JSON_INDEX_TYPE in JSONOptions.h"); + assertLessThanEqualTo(sizeof(json_index_t), sizeof(void*)); +} + +//makes sure that libjson didn't leak memory somewhere +void TestSuite::TestFinal(void){ + #ifdef JSON_UNIT_TEST + UnitTest::SetPrefix("TestSuite.cpp - Memory Leak"); + echo("Node allocations: " << JSONNode::getNodeAllocationCount()); + echo("Node deallocations: " << JSONNode::getNodeDeallocationCount()); + assertEquals(JSONNode::getNodeAllocationCount(), JSONNode::getNodeDeallocationCount()); + + echo("internal allocations: " << JSONNode::getInternalAllocationCount()); + echo("internal deallocations: " << JSONNode::getInternalDeallocationCount()); + assertEquals(JSONNode::getInternalAllocationCount(), JSONNode::getInternalDeallocationCount()); + + echo("children allocations: " << JSONNode::getChildrenAllocationCount()); + echo("children deallocations: " << JSONNode::getChildrenDeallocationCount()); + assertEquals(JSONNode::getChildrenAllocationCount(), JSONNode::getChildrenDeallocationCount()); + + #if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + echo("stl allocations: " << JSONAllocatorRelayer::getAllocationCount()); + echo("stl deallocations: " << JSONAllocatorRelayer::getDeallocationCount()); + echo("stl bytes: " << JSONAllocatorRelayer::getAllocationByteCount()); + assertEquals(JSONAllocatorRelayer::getAllocationCount(), JSONAllocatorRelayer::getDeallocationCount()); + #endif + #endif +} diff --git a/libjson/_internal/TestSuite/TestSuite.h b/libjson/_internal/TestSuite/TestSuite.h new file mode 100644 index 0000000..84ce4ca --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.h @@ -0,0 +1,109 @@ +#ifndef TESTSUITE_H +#define TESTSUITE_H + +#include "UnitTest.h" +#include "../../JSONOptions.h" +#include "../../libjson.h" +#include "../Source/JSONNode.h" + +#include +using namespace std; + +/* + This class tests libjson's internal working and it's + C++ interface +*/ + +#ifdef JSON_UNICODE + #define assertCStringSame(a, b) assertCStringEqualsW(a, b) + #define assertCStringNotSame(a, b) assertCStringNotEqualsW(a, b) +#else + #define assertCStringSame(a, b) assertCStringEquals(a, b) + #define assertCStringNotSame(a, b) assertCStringNotEquals(a, b) +#endif + + +class TestSuite { +public: + static void TestSelf(void); + static void TestString(void); + static void TestConverters(void); +#ifdef JSON_BINARY + static void TestBase64(void); +#endif + static void TestReferenceCounting(void); + static void TestConstructors(void); + static void TestAssigning(void); + static void TestEquality(void); + static void TestInequality(void); + static void TestChildren(void); + static void TestFunctions(void); + static void TestIterators(void); + static void TestInspectors(void); + static void TestNamespace(void); + static void TestValidator(void); + static void TestStreams(void); +#ifdef JSON_WRITE_PRIORITY + static void TestWriter(void); +#endif +#ifdef JSON_COMMENTS + static void TestComments(void); +#endif +#ifdef JSON_MUTEX_CALLBACKS + static void TestMutex(void); + static void TestThreading(void); +#endif + static void TestSharedString(void); + static void TestFinal(void); + + + + + +#ifdef JSON_LIBRARY + static void testParsingItself(JSONNODE * x){ + #if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY) + { + json_char * written = json_write(x); + JSONNODE * copy = json_parse(written); + assertTrue(json_equal(x, copy)); + json_delete(copy); + json_free(written); + } + { + json_char * written = json_write_formatted(x); + JSONNODE * copy = json_parse(written); + assertTrue(json_equal(x, copy)); + json_delete(copy); + json_free(written); + } + { + json_char * written = json_write_formatted(x); + json_char * written2 = json_write(x); + json_char * stripped = json_strip_white_space(written); + assertCStringSame(written2, stripped); + json_free(stripped); + json_free(written); + json_free(written2); + } + #endif + { + JSONNODE * copy = json_duplicate(x); + assertTrue(json_equal(x, copy)); + json_delete(copy); + } + } +#else + static void testParsingItself(JSONNode & x){ + #if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY) + assertEquals(libjson::parse(x.write()), x); + assertEquals(libjson::parse(x.write_formatted()), x); + assertEquals(libjson::strip_white_space(x.write_formatted()), x.write()); + #endif + assertEquals(x, x.duplicate()) + } +#endif +}; + +#endif + diff --git a/libjson/_internal/TestSuite/TestSuite.h~ b/libjson/_internal/TestSuite/TestSuite.h~ new file mode 100644 index 0000000..5ada7dd --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.h~ @@ -0,0 +1,109 @@ +#ifndef TESTSUITE_H +#define TESTSUITE_H + +#include "UnitTest.h" +#include "../JSONOptions.h" +#include "../libjson.h" +#include "../Source/JSONNode.h" + +#include +using namespace std; + +/* + This class tests libjson's internal working and it's + C++ interface +*/ + +#ifdef JSON_UNICODE + #define assertCStringSame(a, b) assertCStringEqualsW(a, b) + #define assertCStringNotSame(a, b) assertCStringNotEqualsW(a, b) +#else + #define assertCStringSame(a, b) assertCStringEquals(a, b) + #define assertCStringNotSame(a, b) assertCStringNotEquals(a, b) +#endif + + +class TestSuite { +public: + static void TestSelf(void); + static void TestString(void); + static void TestConverters(void); +#ifdef JSON_BINARY + static void TestBase64(void); +#endif + static void TestReferenceCounting(void); + static void TestConstructors(void); + static void TestAssigning(void); + static void TestEquality(void); + static void TestInequality(void); + static void TestChildren(void); + static void TestFunctions(void); + static void TestIterators(void); + static void TestInspectors(void); + static void TestNamespace(void); + static void TestValidator(void); + static void TestStreams(void); +#ifdef JSON_WRITE_PRIORITY + static void TestWriter(void); +#endif +#ifdef JSON_COMMENTS + static void TestComments(void); +#endif +#ifdef JSON_MUTEX_CALLBACKS + static void TestMutex(void); + static void TestThreading(void); +#endif + static void TestSharedString(void); + static void TestFinal(void); + + + + + +#ifdef JSON_LIBRARY + static void testParsingItself(JSONNODE * x){ + #if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY) + { + json_char * written = json_write(x); + JSONNODE * copy = json_parse(written); + assertTrue(json_equal(x, copy)); + json_delete(copy); + json_free(written); + } + { + json_char * written = json_write_formatted(x); + JSONNODE * copy = json_parse(written); + assertTrue(json_equal(x, copy)); + json_delete(copy); + json_free(written); + } + { + json_char * written = json_write_formatted(x); + json_char * written2 = json_write(x); + json_char * stripped = json_strip_white_space(written); + assertCStringSame(written2, stripped); + json_free(stripped); + json_free(written); + json_free(written2); + } + #endif + { + JSONNODE * copy = json_duplicate(x); + assertTrue(json_equal(x, copy)); + json_delete(copy); + } + } +#else + static void testParsingItself(JSONNode & x){ + #if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY) + assertEquals(libjson::parse(x.write()), x); + assertEquals(libjson::parse(x.write_formatted()), x); + assertEquals(libjson::strip_white_space(x.write_formatted()), x.write()); + #endif + assertEquals(x, x.duplicate()) + } +#endif +}; + +#endif + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/._project.xcworkspace b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._project.xcworkspace new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._project.xcworkspace differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.mode1v3 b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.mode1v3 new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.mode1v3 differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.pbxuser b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.pbxuser new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._wallace.pbxuser differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/._xcuserdata b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._xcuserdata new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/._xcuserdata differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.pbxproj b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.pbxproj new file mode 100644 index 0000000..82763ac --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.pbxproj @@ -0,0 +1,685 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F6A0486A84900D96B5E /* TestSuite.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* TestSuite.1 */; }; + BA01440512318DD6002575BA /* internalJSONNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143C912318DD6002575BA /* internalJSONNode.cpp */; }; + BA01440712318DD6002575BA /* JSONChildren.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143CD12318DD6002575BA /* JSONChildren.cpp */; }; + BA01440812318DD6002575BA /* JSONDebug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143CF12318DD6002575BA /* JSONDebug.cpp */; }; + BA01440912318DD6002575BA /* JSONIterators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D212318DD6002575BA /* JSONIterators.cpp */; }; + BA01440A12318DD6002575BA /* JSONMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D312318DD6002575BA /* JSONMemory.cpp */; }; + BA01440B12318DD6002575BA /* JSONNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D512318DD6002575BA /* JSONNode.cpp */; }; + BA01440C12318DD6002575BA /* JSONNode_Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */; }; + BA01440D12318DD6002575BA /* JSONWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D812318DD6002575BA /* JSONWorker.cpp */; }; + BA01440E12318DD6002575BA /* JSONWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143DA12318DD6002575BA /* JSONWriter.cpp */; }; + BA01440F12318DD6002575BA /* libjson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143DB12318DD6002575BA /* libjson.cpp */; }; + BA01441012318DD6002575BA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143EE12318DD6002575BA /* main.cpp */; }; + BA01441112318DD6002575BA /* TestAssign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143EF12318DD6002575BA /* TestAssign.cpp */; }; + BA01441212318DD6002575BA /* TestChildren.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F012318DD6002575BA /* TestChildren.cpp */; }; + BA01441312318DD6002575BA /* TestComments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F112318DD6002575BA /* TestComments.cpp */; }; + BA01441412318DD6002575BA /* TestConverters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F212318DD6002575BA /* TestConverters.cpp */; }; + BA01441512318DD6002575BA /* TestCtors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F312318DD6002575BA /* TestCtors.cpp */; }; + BA01441612318DD6002575BA /* TestEquality.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F412318DD6002575BA /* TestEquality.cpp */; }; + BA01441712318DD6002575BA /* TestFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F512318DD6002575BA /* TestFunctions.cpp */; }; + BA01441812318DD6002575BA /* TestInequality.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F612318DD6002575BA /* TestInequality.cpp */; }; + BA01441912318DD6002575BA /* TestInspectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F712318DD6002575BA /* TestInspectors.cpp */; }; + BA01441A12318DD6002575BA /* TestIterators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F812318DD6002575BA /* TestIterators.cpp */; }; + BA01441B12318DD6002575BA /* TestMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F912318DD6002575BA /* TestMutex.cpp */; }; + BA01441C12318DD6002575BA /* TestNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FA12318DD6002575BA /* TestNamespace.cpp */; }; + BA01441D12318DD6002575BA /* TestRefCounting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FB12318DD6002575BA /* TestRefCounting.cpp */; }; + BA01441E12318DD6002575BA /* TestSuite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FD12318DD6002575BA /* TestSuite.cpp */; }; + BA01441F12318DD6002575BA /* TestWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA01440212318DD6002575BA /* TestWriter.cpp */; }; + BA01442012318DD6002575BA /* UnitTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA01440312318DD6002575BA /* UnitTest.cpp */; }; + BA07EB3112C8DF7E001AE448 /* JSONStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */; }; + BA07EB3D12C8E402001AE448 /* TestStreams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA07EB3C12C8E402001AE448 /* TestStreams.cpp */; }; + BA24981513C4F8880021B041 /* JSONAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA24981413C4F8880021B041 /* JSONAllocator.cpp */; }; + BA2A923214705B8B00609A62 /* securityTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA2A923114705B8B00609A62 /* securityTest.cpp */; }; + BA3BBF4C147E8EBE004A159D /* RunTestSuite2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */; }; + BA7F532E146FF81E00FEEA70 /* json_encode64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */; }; + BA7F5339146FFC6200FEEA70 /* json_decode64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */; }; + BA7F5341146FFE4D00FEEA70 /* jsonSingleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */; }; + BA7F53471470015D00FEEA70 /* getLenSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53461470015D00FEEA70 /* getLenSize.cpp */; }; + BA7F53551470076400FEEA70 /* _uitoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53541470076400FEEA70 /* _uitoa.cpp */; }; + BA7F535F147007EC00FEEA70 /* _areFloatsEqual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */; }; + BA7F5360147007EC00FEEA70 /* _itoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F535D147007EC00FEEA70 /* _itoa.cpp */; }; + BA7F53671470098B00FEEA70 /* _ftoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53661470098B00FEEA70 /* _ftoa.cpp */; }; + BA7F536B14700BD200FEEA70 /* isNumeric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F536A14700BD200FEEA70 /* isNumeric.cpp */; }; + BA7F537414700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */; }; + BA7F537714700E9D00FEEA70 /* JSON_ASSERT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */; }; + BA7F537A14700EBA00FEEA70 /* JSON_FAIL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */; }; + BA7F537D14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */; }; + BA7F538E14701E5D00FEEA70 /* isValidNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */; }; + BA7F539114701E6C00FEEA70 /* isValidMember.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539014701E6C00FEEA70 /* isValidMember.cpp */; }; + BA7F539414701E7F00FEEA70 /* isValidString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539314701E7F00FEEA70 /* isValidString.cpp */; }; + BA7F539714701E9100FEEA70 /* isValidNamedObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */; }; + BA7F539A14701E9D00FEEA70 /* isValidObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539914701E9D00FEEA70 /* isValidObject.cpp */; }; + BA7F539D14701EAE00FEEA70 /* isValidArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */; }; + BA90E54112AEDB980064FE9F /* TestValidator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA90E54012AEDB980064FE9F /* TestValidator.cpp */; }; + BAA1135D147154E500166961 /* isValidPartialRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA11359147154E500166961 /* isValidPartialRoot.cpp */; }; + BAA1135E147154E500166961 /* isValidRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA1135B147154E500166961 /* isValidRoot.cpp */; }; + BAA11367147155D600166961 /* _atof.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA11366147155D600166961 /* _atof.cpp */; }; + BAB4249612AED5E700EA03D1 /* JSONValidator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */; }; + BAB51D521356503300C3349E /* JSONPreparse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAB51D511356503300C3349E /* JSONPreparse.cpp */; }; + BABED9AE12C931230047E2DF /* TestBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BABED9AD12C931230047E2DF /* TestBinary.cpp */; }; + BAD89A2B128F00BB00E1D300 /* TestString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAD89A2A128F00BB00E1D300 /* TestString.cpp */; }; + BAD8A0CC1493A9F0005C4908 /* TestSharedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F690486A84900D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F6A0486A84900D96B5E /* TestSuite.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 8DD76F6C0486A84900D96B5E /* TestSuite */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestSuite; sourceTree = BUILT_PRODUCTS_DIR; }; + BA0143C612318DD6002575BA /* JSONOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONOptions.h; path = ../JSONOptions.h; sourceTree = SOURCE_ROOT; }; + BA0143C712318DD6002575BA /* libjson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libjson.h; path = ../libjson.h; sourceTree = SOURCE_ROOT; }; + BA0143C912318DD6002575BA /* internalJSONNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = internalJSONNode.cpp; sourceTree = ""; }; + BA0143CA12318DD6002575BA /* internalJSONNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internalJSONNode.h; sourceTree = ""; }; + BA0143CD12318DD6002575BA /* JSONChildren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONChildren.cpp; sourceTree = ""; }; + BA0143CE12318DD6002575BA /* JSONChildren.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONChildren.h; sourceTree = ""; }; + BA0143CF12318DD6002575BA /* JSONDebug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONDebug.cpp; sourceTree = ""; }; + BA0143D012318DD6002575BA /* JSONDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONDebug.h; sourceTree = ""; }; + BA0143D112318DD6002575BA /* JSONDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONDefs.h; sourceTree = ""; }; + BA0143D212318DD6002575BA /* JSONIterators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONIterators.cpp; sourceTree = ""; }; + BA0143D312318DD6002575BA /* JSONMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONMemory.cpp; sourceTree = ""; }; + BA0143D412318DD6002575BA /* JSONMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONMemory.h; sourceTree = ""; }; + BA0143D512318DD6002575BA /* JSONNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONNode.cpp; sourceTree = ""; }; + BA0143D612318DD6002575BA /* JSONNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONNode.h; sourceTree = ""; }; + BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONNode_Mutex.cpp; sourceTree = ""; }; + BA0143D812318DD6002575BA /* JSONWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONWorker.cpp; sourceTree = ""; }; + BA0143D912318DD6002575BA /* JSONWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONWorker.h; sourceTree = ""; }; + BA0143DA12318DD6002575BA /* JSONWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONWriter.cpp; sourceTree = ""; }; + BA0143DB12318DD6002575BA /* libjson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libjson.cpp; sourceTree = ""; }; + BA0143DC12318DD6002575BA /* NumberToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberToString.h; sourceTree = ""; }; + BA0143EE12318DD6002575BA /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + BA0143EF12318DD6002575BA /* TestAssign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAssign.cpp; sourceTree = ""; }; + BA0143F012318DD6002575BA /* TestChildren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestChildren.cpp; sourceTree = ""; }; + BA0143F112318DD6002575BA /* TestComments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestComments.cpp; sourceTree = ""; }; + BA0143F212318DD6002575BA /* TestConverters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestConverters.cpp; sourceTree = ""; }; + BA0143F312318DD6002575BA /* TestCtors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCtors.cpp; sourceTree = ""; }; + BA0143F412318DD6002575BA /* TestEquality.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestEquality.cpp; sourceTree = ""; }; + BA0143F512318DD6002575BA /* TestFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestFunctions.cpp; sourceTree = ""; }; + BA0143F612318DD6002575BA /* TestInequality.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInequality.cpp; sourceTree = ""; }; + BA0143F712318DD6002575BA /* TestInspectors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInspectors.cpp; sourceTree = ""; }; + BA0143F812318DD6002575BA /* TestIterators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestIterators.cpp; sourceTree = ""; }; + BA0143F912318DD6002575BA /* TestMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMutex.cpp; sourceTree = ""; }; + BA0143FA12318DD6002575BA /* TestNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestNamespace.cpp; sourceTree = ""; }; + BA0143FB12318DD6002575BA /* TestRefCounting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRefCounting.cpp; sourceTree = ""; }; + BA0143FD12318DD6002575BA /* TestSuite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSuite.cpp; sourceTree = ""; }; + BA0143FE12318DD6002575BA /* TestSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSuite.h; sourceTree = ""; }; + BA01440212318DD6002575BA /* TestWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestWriter.cpp; sourceTree = ""; }; + BA01440312318DD6002575BA /* UnitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnitTest.cpp; sourceTree = ""; }; + BA01440412318DD6002575BA /* UnitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitTest.h; sourceTree = ""; }; + BA07EB2F12C8DF7E001AE448 /* JSONStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONStream.h; sourceTree = ""; }; + BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONStream.cpp; sourceTree = ""; }; + BA07EB3C12C8E402001AE448 /* TestStreams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestStreams.cpp; sourceTree = ""; }; + BA24981313C4F8880021B041 /* JSONAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAllocator.h; sourceTree = ""; }; + BA24981413C4F8880021B041 /* JSONAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONAllocator.cpp; sourceTree = ""; }; + BA2A923014705B8B00609A62 /* securityTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = securityTest.h; path = ../TestSuite2/JSONValidator/securityTest.h; sourceTree = ""; }; + BA2A923114705B8B00609A62 /* securityTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = securityTest.cpp; path = ../TestSuite2/JSONValidator/securityTest.cpp; sourceTree = ""; }; + BA37890D12A99A150007FFFC /* Checklist.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Checklist.txt; sourceTree = ""; }; + BA38C49D12901AD70088EBDD /* UStringTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringTest.h; sourceTree = ""; }; + BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.php; path = TestSuite2Creator.php; sourceTree = ""; }; + BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunTestSuite2.h; sourceTree = ""; }; + BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunTestSuite2.cpp; sourceTree = ""; }; + BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONSharedString.h; sourceTree = ""; }; + BA7F532C146FF81E00FEEA70 /* json_encode64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json_encode64.h; path = /Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_encode64.h; sourceTree = ""; }; + BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_encode64.cpp; path = /Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_encode64.cpp; sourceTree = ""; }; + BA7F5331146FF85D00FEEA70 /* BaseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BaseTest.h; path = ../TestSuite2/BaseTest.h; sourceTree = ""; }; + BA7F5337146FFC6200FEEA70 /* json_decode64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json_decode64.h; path = ../TestSuite2/JSON_Base64/json_decode64.h; sourceTree = ""; }; + BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_decode64.cpp; path = ../TestSuite2/JSON_Base64/json_decode64.cpp; sourceTree = ""; }; + BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsonSingleton.h; path = ../TestSuite2/JSONGlobals/jsonSingleton.h; sourceTree = ""; }; + BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsonSingleton.cpp; path = ../TestSuite2/JSONGlobals/jsonSingleton.cpp; sourceTree = ""; }; + BA7F53451470015D00FEEA70 /* getLenSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getLenSize.h; path = ../TestSuite2/NumberToString/getLenSize.h; sourceTree = ""; }; + BA7F53461470015D00FEEA70 /* getLenSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getLenSize.cpp; path = ../TestSuite2/NumberToString/getLenSize.cpp; sourceTree = ""; }; + BA7F53531470076400FEEA70 /* _uitoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _uitoa.h; path = ../TestSuite2/NumberToString/_uitoa.h; sourceTree = ""; }; + BA7F53541470076400FEEA70 /* _uitoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _uitoa.cpp; path = ../TestSuite2/NumberToString/_uitoa.cpp; sourceTree = ""; }; + BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _areFloatsEqual.cpp; path = ../TestSuite2/NumberToString/_areFloatsEqual.cpp; sourceTree = ""; }; + BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _areFloatsEqual.h; path = ../TestSuite2/NumberToString/_areFloatsEqual.h; sourceTree = ""; }; + BA7F535D147007EC00FEEA70 /* _itoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _itoa.cpp; path = ../TestSuite2/NumberToString/_itoa.cpp; sourceTree = ""; }; + BA7F535E147007EC00FEEA70 /* _itoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _itoa.h; path = ../TestSuite2/NumberToString/_itoa.h; sourceTree = ""; }; + BA7F53651470098B00FEEA70 /* _ftoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _ftoa.h; path = ../TestSuite2/NumberToString/_ftoa.h; sourceTree = ""; }; + BA7F53661470098B00FEEA70 /* _ftoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _ftoa.cpp; path = ../TestSuite2/NumberToString/_ftoa.cpp; sourceTree = ""; }; + BA7F536914700BD200FEEA70 /* isNumeric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isNumeric.h; path = ../TestSuite2/NumberToString/isNumeric.h; sourceTree = ""; }; + BA7F536A14700BD200FEEA70 /* isNumeric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isNumeric.cpp; path = ../TestSuite2/NumberToString/isNumeric.cpp; sourceTree = ""; }; + BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_ASSERT_SAFE.h; path = ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h; sourceTree = ""; }; + BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_ASSERT_SAFE.cpp; path = ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp; sourceTree = ""; }; + BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_ASSERT.h; path = ../TestSuite2/JSONDebug/JSON_ASSERT.h; sourceTree = ""; }; + BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_ASSERT.cpp; path = ../TestSuite2/JSONDebug/JSON_ASSERT.cpp; sourceTree = ""; }; + BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_FAIL.h; path = ../TestSuite2/JSONDebug/JSON_FAIL.h; sourceTree = ""; }; + BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_FAIL.cpp; path = ../TestSuite2/JSONDebug/JSON_FAIL.cpp; sourceTree = ""; }; + BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_FAIL_SAFE.h; path = ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.h; sourceTree = ""; }; + BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_FAIL_SAFE.cpp; path = ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp; sourceTree = ""; }; + BA7F538C14701E5D00FEEA70 /* isValidNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidNumber.h; path = ../TestSuite2/JSONValidator/isValidNumber.h; sourceTree = ""; }; + BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidNumber.cpp; path = ../TestSuite2/JSONValidator/isValidNumber.cpp; sourceTree = ""; }; + BA7F538F14701E6C00FEEA70 /* isValidMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidMember.h; path = ../TestSuite2/JSONValidator/isValidMember.h; sourceTree = ""; }; + BA7F539014701E6C00FEEA70 /* isValidMember.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidMember.cpp; path = ../TestSuite2/JSONValidator/isValidMember.cpp; sourceTree = ""; }; + BA7F539214701E7F00FEEA70 /* isValidString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidString.h; path = ../TestSuite2/JSONValidator/isValidString.h; sourceTree = ""; }; + BA7F539314701E7F00FEEA70 /* isValidString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidString.cpp; path = ../TestSuite2/JSONValidator/isValidString.cpp; sourceTree = ""; }; + BA7F539514701E9100FEEA70 /* isValidNamedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidNamedObject.h; path = ../TestSuite2/JSONValidator/isValidNamedObject.h; sourceTree = ""; }; + BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidNamedObject.cpp; path = ../TestSuite2/JSONValidator/isValidNamedObject.cpp; sourceTree = ""; }; + BA7F539814701E9D00FEEA70 /* isValidObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidObject.h; path = ../TestSuite2/JSONValidator/isValidObject.h; sourceTree = ""; }; + BA7F539914701E9D00FEEA70 /* isValidObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidObject.cpp; path = ../TestSuite2/JSONValidator/isValidObject.cpp; sourceTree = ""; }; + BA7F539B14701EAE00FEEA70 /* isValidArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidArray.h; path = ../TestSuite2/JSONValidator/isValidArray.h; sourceTree = ""; }; + BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidArray.cpp; path = ../TestSuite2/JSONValidator/isValidArray.cpp; sourceTree = ""; }; + BA7F53A614701FB900FEEA70 /* validyMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validyMacros.h; path = ../TestSuite2/JSONValidator/Resources/validyMacros.h; sourceTree = ""; }; + BA82868312F3BDD0005EAA8B /* Visual_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Visual_C.h; sourceTree = ""; }; + BA82868912F3BE63005EAA8B /* GNU_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GNU_C.h; sourceTree = ""; }; + BA82868A12F3BE76005EAA8B /* Unknown_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unknown_C.h; sourceTree = ""; }; + BA8286A912F3C391005EAA8B /* Strings_Defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strings_Defs.h; sourceTree = ""; }; + BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONGlobals.h; sourceTree = ""; }; + BA90E54012AEDB980064FE9F /* TestValidator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestValidator.cpp; sourceTree = ""; }; + BAA11359147154E500166961 /* isValidPartialRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidPartialRoot.cpp; path = ../TestSuite2/JSONValidator/isValidPartialRoot.cpp; sourceTree = ""; }; + BAA1135A147154E500166961 /* isValidPartialRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidPartialRoot.h; path = ../TestSuite2/JSONValidator/isValidPartialRoot.h; sourceTree = ""; }; + BAA1135B147154E500166961 /* isValidRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidRoot.cpp; path = ../TestSuite2/JSONValidator/isValidRoot.cpp; sourceTree = ""; }; + BAA1135C147154E500166961 /* isValidRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidRoot.h; path = ../TestSuite2/JSONValidator/isValidRoot.h; sourceTree = ""; }; + BAA11365147155D600166961 /* _atof.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _atof.h; path = ../TestSuite2/NumberToString/_atof.h; sourceTree = ""; }; + BAA11366147155D600166961 /* _atof.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _atof.cpp; path = ../TestSuite2/NumberToString/_atof.cpp; sourceTree = ""; }; + BAA87015140FC61F0088B03B /* JSONMemoryPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONMemoryPool.h; sourceTree = ""; }; + BAAB76C61232AFB100EA97E4 /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; + BAB4249412AED5E700EA03D1 /* JSONValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONValidator.h; sourceTree = ""; }; + BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONValidator.cpp; sourceTree = ""; }; + BAB51D501356503300C3349E /* JSONPreparse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONPreparse.h; sourceTree = ""; }; + BAB51D511356503300C3349E /* JSONPreparse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONPreparse.cpp; sourceTree = ""; }; + BABED9AD12C931230047E2DF /* TestBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestBinary.cpp; sourceTree = ""; }; + BAC2949914F6DF14005EBF87 /* libbase64++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "libbase64++.h"; sourceTree = ""; }; + BAC2949B14F6DF14005EBF87 /* mempool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mempool.h; sourceTree = ""; }; + BAC2949C14F6E102005EBF87 /* JSON_Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON_Base64.h; sourceTree = ""; }; + BAD899A4128EEEEA00E1D300 /* StringTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringTest.h; sourceTree = ""; }; + BAD89A2A128F00BB00E1D300 /* TestString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestString.cpp; sourceTree = ""; }; + BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSharedString.cpp; sourceTree = ""; }; + C6859E8B029090EE04C91782 /* TestSuite.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = TestSuite.1; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F660486A84900D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* TestSuite */ = { + isa = PBXGroup; + children = ( + BAC2949714F6DF14005EBF87 /* Dependencies */, + BA82868212F3BDA4005EAA8B /* JSONDefs */, + BA0143C612318DD6002575BA /* JSONOptions.h */, + BA0143C712318DD6002575BA /* libjson.h */, + BA0143C812318DD6002575BA /* Source */, + BA0143DD12318DD6002575BA /* TestSuite */, + C6859E8C029090F304C91782 /* Documentation */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + BAAB76C61232AFB100EA97E4 /* makefile */, + ); + name = TestSuite; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E /* TestSuite */, + ); + name = Products; + sourceTree = ""; + }; + BA0143C812318DD6002575BA /* Source */ = { + isa = PBXGroup; + children = ( + BAC2949C14F6E102005EBF87 /* JSON_Base64.h */, + BA0143C912318DD6002575BA /* internalJSONNode.cpp */, + BA0143CA12318DD6002575BA /* internalJSONNode.h */, + BA0143CD12318DD6002575BA /* JSONChildren.cpp */, + BA0143CE12318DD6002575BA /* JSONChildren.h */, + BA0143CF12318DD6002575BA /* JSONDebug.cpp */, + BA0143D012318DD6002575BA /* JSONDebug.h */, + BA0143D112318DD6002575BA /* JSONDefs.h */, + BA0143D212318DD6002575BA /* JSONIterators.cpp */, + BA0143D312318DD6002575BA /* JSONMemory.cpp */, + BA0143D412318DD6002575BA /* JSONMemory.h */, + BA0143D512318DD6002575BA /* JSONNode.cpp */, + BA0143D612318DD6002575BA /* JSONNode.h */, + BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */, + BA0143D812318DD6002575BA /* JSONWorker.cpp */, + BA0143D912318DD6002575BA /* JSONWorker.h */, + BA0143DA12318DD6002575BA /* JSONWriter.cpp */, + BA0143DB12318DD6002575BA /* libjson.cpp */, + BA0143DC12318DD6002575BA /* NumberToString.h */, + BAB4249412AED5E700EA03D1 /* JSONValidator.h */, + BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */, + BA07EB2F12C8DF7E001AE448 /* JSONStream.h */, + BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */, + BAB51D501356503300C3349E /* JSONPreparse.h */, + BAB51D511356503300C3349E /* JSONPreparse.cpp */, + BA24981313C4F8880021B041 /* JSONAllocator.h */, + BA24981413C4F8880021B041 /* JSONAllocator.cpp */, + BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */, + BAA87015140FC61F0088B03B /* JSONMemoryPool.h */, + BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */, + ); + name = Source; + path = ../Source; + sourceTree = SOURCE_ROOT; + }; + BA0143DD12318DD6002575BA /* TestSuite */ = { + isa = PBXGroup; + children = ( + BA7F538B14701E0200FEEA70 /* JSONValidator */, + BA7F537114700E4E00FEEA70 /* JSONDebug */, + BA7F53431470013200FEEA70 /* NumberToString */, + BA7F533E146FFDD300FEEA70 /* JSONGlobals */, + BA7F5330146FF82B00FEEA70 /* JSON_Base64 */, + BA0143EE12318DD6002575BA /* main.cpp */, + BA0143EF12318DD6002575BA /* TestAssign.cpp */, + BA0143F012318DD6002575BA /* TestChildren.cpp */, + BA0143F112318DD6002575BA /* TestComments.cpp */, + BA0143F212318DD6002575BA /* TestConverters.cpp */, + BA0143F312318DD6002575BA /* TestCtors.cpp */, + BA0143F412318DD6002575BA /* TestEquality.cpp */, + BA0143F512318DD6002575BA /* TestFunctions.cpp */, + BA0143F612318DD6002575BA /* TestInequality.cpp */, + BA0143F712318DD6002575BA /* TestInspectors.cpp */, + BA0143F812318DD6002575BA /* TestIterators.cpp */, + BA0143F912318DD6002575BA /* TestMutex.cpp */, + BA0143FA12318DD6002575BA /* TestNamespace.cpp */, + BA0143FB12318DD6002575BA /* TestRefCounting.cpp */, + BA0143FD12318DD6002575BA /* TestSuite.cpp */, + BA0143FE12318DD6002575BA /* TestSuite.h */, + BA01440212318DD6002575BA /* TestWriter.cpp */, + BA01440312318DD6002575BA /* UnitTest.cpp */, + BA01440412318DD6002575BA /* UnitTest.h */, + BAD899A4128EEEEA00E1D300 /* StringTest.h */, + BAD89A2A128F00BB00E1D300 /* TestString.cpp */, + BA38C49D12901AD70088EBDD /* UStringTest.h */, + BA37890D12A99A150007FFFC /* Checklist.txt */, + BA90E54012AEDB980064FE9F /* TestValidator.cpp */, + BA07EB3C12C8E402001AE448 /* TestStreams.cpp */, + BABED9AD12C931230047E2DF /* TestBinary.cpp */, + BA7F5331146FF85D00FEEA70 /* BaseTest.h */, + BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */, + BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */, + BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */, + BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */, + ); + name = TestSuite; + sourceTree = ""; + }; + BA7F5330146FF82B00FEEA70 /* JSON_Base64 */ = { + isa = PBXGroup; + children = ( + BA7F532C146FF81E00FEEA70 /* json_encode64.h */, + BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */, + BA7F5337146FFC6200FEEA70 /* json_decode64.h */, + BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */, + ); + name = JSON_Base64; + sourceTree = ""; + }; + BA7F533E146FFDD300FEEA70 /* JSONGlobals */ = { + isa = PBXGroup; + children = ( + BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */, + BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */, + ); + name = JSONGlobals; + sourceTree = ""; + }; + BA7F53431470013200FEEA70 /* NumberToString */ = { + isa = PBXGroup; + children = ( + BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */, + BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */, + BA7F535E147007EC00FEEA70 /* _itoa.h */, + BA7F535D147007EC00FEEA70 /* _itoa.cpp */, + BA7F53451470015D00FEEA70 /* getLenSize.h */, + BA7F53461470015D00FEEA70 /* getLenSize.cpp */, + BA7F53531470076400FEEA70 /* _uitoa.h */, + BA7F53541470076400FEEA70 /* _uitoa.cpp */, + BA7F53651470098B00FEEA70 /* _ftoa.h */, + BA7F53661470098B00FEEA70 /* _ftoa.cpp */, + BA7F536914700BD200FEEA70 /* isNumeric.h */, + BA7F536A14700BD200FEEA70 /* isNumeric.cpp */, + BAA11365147155D600166961 /* _atof.h */, + BAA11366147155D600166961 /* _atof.cpp */, + ); + name = NumberToString; + sourceTree = ""; + }; + BA7F537114700E4E00FEEA70 /* JSONDebug */ = { + isa = PBXGroup; + children = ( + BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */, + BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */, + BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */, + BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */, + BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */, + BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */, + BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */, + BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */, + ); + name = JSONDebug; + sourceTree = ""; + }; + BA7F538B14701E0200FEEA70 /* JSONValidator */ = { + isa = PBXGroup; + children = ( + BA7F53A514701F9800FEEA70 /* Resources */, + BA7F538C14701E5D00FEEA70 /* isValidNumber.h */, + BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */, + BA7F538F14701E6C00FEEA70 /* isValidMember.h */, + BA7F539014701E6C00FEEA70 /* isValidMember.cpp */, + BA7F539214701E7F00FEEA70 /* isValidString.h */, + BA7F539314701E7F00FEEA70 /* isValidString.cpp */, + BA7F539514701E9100FEEA70 /* isValidNamedObject.h */, + BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */, + BA7F539814701E9D00FEEA70 /* isValidObject.h */, + BA7F539914701E9D00FEEA70 /* isValidObject.cpp */, + BA7F539B14701EAE00FEEA70 /* isValidArray.h */, + BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */, + BAA1135A147154E500166961 /* isValidPartialRoot.h */, + BAA11359147154E500166961 /* isValidPartialRoot.cpp */, + BAA1135C147154E500166961 /* isValidRoot.h */, + BAA1135B147154E500166961 /* isValidRoot.cpp */, + BA2A923014705B8B00609A62 /* securityTest.h */, + BA2A923114705B8B00609A62 /* securityTest.cpp */, + ); + name = JSONValidator; + sourceTree = ""; + }; + BA7F53A514701F9800FEEA70 /* Resources */ = { + isa = PBXGroup; + children = ( + BA7F53A614701FB900FEEA70 /* validyMacros.h */, + ); + name = Resources; + sourceTree = ""; + }; + BA82868212F3BDA4005EAA8B /* JSONDefs */ = { + isa = PBXGroup; + children = ( + BA82868312F3BDD0005EAA8B /* Visual_C.h */, + BA82868912F3BE63005EAA8B /* GNU_C.h */, + BA82868A12F3BE76005EAA8B /* Unknown_C.h */, + BA8286A912F3C391005EAA8B /* Strings_Defs.h */, + ); + name = JSONDefs; + path = ../Source/JSONDefs; + sourceTree = SOURCE_ROOT; + }; + BAC2949714F6DF14005EBF87 /* Dependencies */ = { + isa = PBXGroup; + children = ( + BAC2949814F6DF14005EBF87 /* libbase64++ */, + BAC2949A14F6DF14005EBF87 /* mempool++ */, + ); + name = Dependencies; + path = ../Dependencies; + sourceTree = ""; + }; + BAC2949814F6DF14005EBF87 /* libbase64++ */ = { + isa = PBXGroup; + children = ( + BAC2949914F6DF14005EBF87 /* libbase64++.h */, + ); + path = "libbase64++"; + sourceTree = ""; + }; + BAC2949A14F6DF14005EBF87 /* mempool++ */ = { + isa = PBXGroup; + children = ( + BAC2949B14F6DF14005EBF87 /* mempool.h */, + ); + path = "mempool++"; + sourceTree = ""; + }; + C6859E8C029090F304C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859E8B029090EE04C91782 /* TestSuite.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F620486A84900D96B5E /* TestSuite */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "TestSuite" */; + buildPhases = ( + 8DD76F640486A84900D96B5E /* Sources */, + 8DD76F660486A84900D96B5E /* Frameworks */, + 8DD76F690486A84900D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TestSuite; + productInstallPath = "$(HOME)/bin"; + productName = TestSuite; + productReference = 8DD76F6C0486A84900D96B5E /* TestSuite */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0410; + }; + buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "TestSuite" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* TestSuite */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F620486A84900D96B5E /* TestSuite */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F640486A84900D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BA01440512318DD6002575BA /* internalJSONNode.cpp in Sources */, + BA01440712318DD6002575BA /* JSONChildren.cpp in Sources */, + BA01440812318DD6002575BA /* JSONDebug.cpp in Sources */, + BA01440912318DD6002575BA /* JSONIterators.cpp in Sources */, + BA01440A12318DD6002575BA /* JSONMemory.cpp in Sources */, + BA01440B12318DD6002575BA /* JSONNode.cpp in Sources */, + BA01440C12318DD6002575BA /* JSONNode_Mutex.cpp in Sources */, + BA01440D12318DD6002575BA /* JSONWorker.cpp in Sources */, + BA01440E12318DD6002575BA /* JSONWriter.cpp in Sources */, + BA01440F12318DD6002575BA /* libjson.cpp in Sources */, + BA01441012318DD6002575BA /* main.cpp in Sources */, + BA01441112318DD6002575BA /* TestAssign.cpp in Sources */, + BA01441212318DD6002575BA /* TestChildren.cpp in Sources */, + BA01441312318DD6002575BA /* TestComments.cpp in Sources */, + BA01441412318DD6002575BA /* TestConverters.cpp in Sources */, + BA01441512318DD6002575BA /* TestCtors.cpp in Sources */, + BA01441612318DD6002575BA /* TestEquality.cpp in Sources */, + BA01441712318DD6002575BA /* TestFunctions.cpp in Sources */, + BA01441812318DD6002575BA /* TestInequality.cpp in Sources */, + BA01441912318DD6002575BA /* TestInspectors.cpp in Sources */, + BA01441A12318DD6002575BA /* TestIterators.cpp in Sources */, + BA01441B12318DD6002575BA /* TestMutex.cpp in Sources */, + BA01441C12318DD6002575BA /* TestNamespace.cpp in Sources */, + BA01441D12318DD6002575BA /* TestRefCounting.cpp in Sources */, + BA01441E12318DD6002575BA /* TestSuite.cpp in Sources */, + BA01441F12318DD6002575BA /* TestWriter.cpp in Sources */, + BA01442012318DD6002575BA /* UnitTest.cpp in Sources */, + BAD89A2B128F00BB00E1D300 /* TestString.cpp in Sources */, + BAB4249612AED5E700EA03D1 /* JSONValidator.cpp in Sources */, + BA90E54112AEDB980064FE9F /* TestValidator.cpp in Sources */, + BA07EB3112C8DF7E001AE448 /* JSONStream.cpp in Sources */, + BA07EB3D12C8E402001AE448 /* TestStreams.cpp in Sources */, + BABED9AE12C931230047E2DF /* TestBinary.cpp in Sources */, + BAB51D521356503300C3349E /* JSONPreparse.cpp in Sources */, + BA24981513C4F8880021B041 /* JSONAllocator.cpp in Sources */, + BA7F532E146FF81E00FEEA70 /* json_encode64.cpp in Sources */, + BA7F5339146FFC6200FEEA70 /* json_decode64.cpp in Sources */, + BA7F5341146FFE4D00FEEA70 /* jsonSingleton.cpp in Sources */, + BA7F53471470015D00FEEA70 /* getLenSize.cpp in Sources */, + BA7F53551470076400FEEA70 /* _uitoa.cpp in Sources */, + BA7F535F147007EC00FEEA70 /* _areFloatsEqual.cpp in Sources */, + BA7F5360147007EC00FEEA70 /* _itoa.cpp in Sources */, + BA7F53671470098B00FEEA70 /* _ftoa.cpp in Sources */, + BA7F536B14700BD200FEEA70 /* isNumeric.cpp in Sources */, + BA7F537414700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp in Sources */, + BA7F537714700E9D00FEEA70 /* JSON_ASSERT.cpp in Sources */, + BA7F537A14700EBA00FEEA70 /* JSON_FAIL.cpp in Sources */, + BA7F537D14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp in Sources */, + BA7F538E14701E5D00FEEA70 /* isValidNumber.cpp in Sources */, + BA7F539114701E6C00FEEA70 /* isValidMember.cpp in Sources */, + BA7F539414701E7F00FEEA70 /* isValidString.cpp in Sources */, + BA7F539714701E9100FEEA70 /* isValidNamedObject.cpp in Sources */, + BA7F539A14701E9D00FEEA70 /* isValidObject.cpp in Sources */, + BA7F539D14701EAE00FEEA70 /* isValidArray.cpp in Sources */, + BA2A923214705B8B00609A62 /* securityTest.cpp in Sources */, + BAA1135D147154E500166961 /* isValidPartialRoot.cpp in Sources */, + BAA1135E147154E500166961 /* isValidRoot.cpp in Sources */, + BAA11367147155D600166961 /* _atof.cpp in Sources */, + BA3BBF4C147E8EBE004A159D /* RunTestSuite2.cpp in Sources */, + BAD8A0CC1493A9F0005C4908 /* TestSharedString.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB923208733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = TestSuite; + }; + name = Debug; + }; + 1DEB923308733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = TestSuite; + }; + name = Release; + }; + 1DEB923608733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEAD_CODE_STRIPPING = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES; + GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_PROFILING_CODE = YES; + ONLY_ACTIVE_ARCH = YES; + RUN_CLANG_STATIC_ANALYZER = YES; + SDKROOT = macosx; + VALIDATE_PRODUCT = YES; + }; + name = Debug; + }; + 1DEB923708733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEAD_CODE_STRIPPING = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "TestSuite" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923208733DC60010E9CD /* Debug */, + 1DEB923308733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "TestSuite" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923608733DC60010E9CD /* Debug */, + 1DEB923708733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/._xcuserdata b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/._xcuserdata new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/._xcuserdata differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..3ddf29e --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,11 @@ + + + + + + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/._wallace.xcuserdatad b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/._wallace.xcuserdatad new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/._wallace.xcuserdatad differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/UserInterfaceState.xcuserstate b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..8b1a6e2 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/UserInterfaceState.xcuserstate @@ -0,0 +1,17091 @@ + + + + + $archiver + NSKeyedArchiver + $objects + + $null + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 2 + + + CF$UID + 3 + + + CF$UID + 4 + + + NS.objects + + + CF$UID + 5 + + + CF$UID + 184 + + + CF$UID + 301 + + + + C5D34FE2-6F47-47BF-9744-B3CCD8037D41 + BEA0DDCC-9E88-4A1A-94F3-BD014D2E7F97 + IDEWorkspaceDocument + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 6 + + + CF$UID + 7 + + + CF$UID + 8 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 12 + + + CF$UID + 13 + + + NS.objects + + + CF$UID + 14 + + + CF$UID + 15 + + + CF$UID + 17 + + + CF$UID + 2 + + + CF$UID + 18 + + + CF$UID + 10 + + + CF$UID + 17 + + + CF$UID + 17 + + + + IDEWindowFrame + IDEOrderedWorkspaceTabControllers + IDEWindowInFullscreenMode + IDEWorkspaceWindowControllerUniqueIdentifier + IDEWorkspaceTabController_2AD1AA52-99FD-4BE3-8D2A-B59BCCEF8032 + IDEActiveWorkspaceTabController + IDEWindowToolbarIsVisible + IDEWindowTabBarIsVisible + {{0, 112}, {1037, 666}} + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 10 + + + + + $classes + + NSArray + NSObject + + $classname + NSArray + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 19 + + + CF$UID + 20 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + CF$UID + 26 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 17 + + + CF$UID + 28 + + + CF$UID + 29 + + + CF$UID + 42 + + + CF$UID + 70 + + + CF$UID + 17 + + + CF$UID + 79 + + + + IDETabLabel + IDEShowNavigator + AssistantEditorsLayout + IDEWorkspaceTabControllerUtilityAreaSplitView + IDENavigatorArea + IDEWorkspaceTabControllerDesignAreaSplitView + IDEShowUtilities + IDEEditorArea + internalJSONNode.h + 0 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 31 + + + + DVTSplitViewItems + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 32 + + + CF$UID + 38 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 35 + + + CF$UID + 36 + + + + DVTIdentifier + DVTViewMagnitude + + 322 + + $classes + + NSDictionary + NSObject + + $classname + NSDictionary + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 35 + + + CF$UID + 39 + + + + 320 + + $classes + + NSMutableArray + NSArray + NSObject + + $classname + NSMutableArray + + + $classes + + NSMutableDictionary + NSDictionary + NSObject + + $classname + NSMutableDictionary + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 43 + + + CF$UID + 44 + + + NS.objects + + + CF$UID + 44 + + + CF$UID + 45 + + + + SelectedNavigator + Xcode.IDEKit.Navigator.Structure + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 53 + + + CF$UID + 17 + + + CF$UID + 54 + + + CF$UID + 17 + + + CF$UID + 17 + + + CF$UID + 56 + + + CF$UID + 62 + + + + IDEVisibleRect + IDEUnsavedDocumentFilteringEnabled + IDENavigatorExpandedItemsBeforeFilteringSet + IDERecentDocumentFilteringEnabled + IDESCMStatusFilteringEnabled + IDESelectedObjects + IDEExpandedItemsSet + {{0, 0}, {0, 0}} + + $class + + CF$UID + 55 + + NS.objects + + + + $classes + + NSSet + NSObject + + $classname + NSSet + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 57 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 59 + + + CF$UID + 60 + + + CF$UID + 61 + + + + New Group + TestSuite + Source + internalJSONNode.h + + $class + + CF$UID + 55 + + NS.objects + + + CF$UID + 63 + + + CF$UID + 64 + + + CF$UID + 65 + + + CF$UID + 66 + + + CF$UID + 68 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 59 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 59 + + + CF$UID + 60 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 59 + + + CF$UID + 67 + + + + Documentation + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 59 + + + CF$UID + 69 + + + + Dependencies + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 71 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 72 + + + CF$UID + 74 + + + CF$UID + 76 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 23 + + + CF$UID + 73 + + + + 305 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 26 + + + CF$UID + 75 + + + + 975 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 78 + + + + IDEUtilitiesArea + 260 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 80 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 87 + + + NS.objects + + + CF$UID + 88 + + + CF$UID + 108 + + + CF$UID + 148 + + + CF$UID + 174 + + + CF$UID + 28 + + + CF$UID + 175 + + + CF$UID + 183 + + + CF$UID + 17 + + + + layoutTree + IDEEditorMode_Standard + IDEEDitorArea_DebugArea + IDEShowEditor + EditorMode + DebuggerSplitView + DefaultPersistentRepresentations + ShowDebuggerArea + + $class + + CF$UID + 107 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 89 + + rootLayoutTreeNode + + CF$UID + 104 + + + + $class + + CF$UID + 106 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 90 + + orientation + 0 + parent + + CF$UID + 104 + + + + $class + + CF$UID + 103 + + DocumentLocation + + CF$UID + 99 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 92 + + IndexOfDocumentIdentifier + + CF$UID + 28 + + + Xcode.IDENavigableItemDomain.WorkspaceStructure + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 93 + + + CF$UID + 95 + + + CF$UID + 96 + + + CF$UID + 98 + + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 61 + + + + $classes + + IDEArchivableStringIndexPair + NSObject + + $classname + IDEArchivableStringIndexPair + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 60 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 97 + + + TestSuite + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 58 + + + + $class + + CF$UID + 102 + + documentURL + + CF$UID + 100 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.h + + + $classes + + NSMutableString + NSString + NSObject + + $classname + NSMutableString + + + $classes + + DVTDocumentLocation + NSObject + + $classname + DVTDocumentLocation + + + $classes + + IDENavigableItemArchivableRepresentation + NSObject + + $classname + IDENavigableItemArchivableRepresentation + + + $class + + CF$UID + 106 + + children + + CF$UID + 105 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 89 + + + + + $classes + + IDEWorkspaceTabControllerLayoutTreeNode + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTreeNode + + + $classes + + IDEWorkspaceTabControllerLayoutTree + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTree + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 109 + + + NS.objects + + + CF$UID + 110 + + + + EditorLayout_PersistentRepresentation + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 111 + + + NS.objects + + + CF$UID + 112 + + + + Main + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 113 + + + CF$UID + 114 + + + CF$UID + 115 + + + NS.objects + + + CF$UID + 116 + + + CF$UID + 28 + + + CF$UID + 146 + + + + EditorLayout_StateSavingStateDictionaries + EditorLayout_Selected + EditorLayout_Geometry + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 117 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 118 + + + CF$UID + 119 + + + CF$UID + 120 + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + NS.objects + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 133 + + + CF$UID + 141 + + + CF$UID + 61 + + + CF$UID + 142 + + + CF$UID + 143 + + + + FileDataType + ArchivableRepresentation + EditorState + NavigableItemName + DocumentNavigableItemName + DocumentExtensionIdentifier + DocumentURL + public.c-header + + $class + + CF$UID + 103 + + DocumentLocation + + CF$UID + 99 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 127 + + IndexOfDocumentIdentifier + + CF$UID + 28 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 128 + + + CF$UID + 129 + + + CF$UID + 130 + + + CF$UID + 132 + + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 61 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 60 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 131 + + + TestSuite + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 58 + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 17 + + + CF$UID + 140 + + + + PrimaryDocumentTimestamp + PrimaryDocumentVisibleCharacterRange + HideAllIssues + PrimaryDocumentSelectedCharacterRange + 353943537.11604798 + {5947, 1977} + {7040, 0} + class internalJSONNode + Xcode.IDEKit.EditorDocument.SourceCode + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 144 + + + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.h + + $classes + + NSURL + NSObject + + $classname + NSURL + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 147 + + + + {{0, 0}, {1037, 620}} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 149 + + + CF$UID + 150 + + + CF$UID + 151 + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + NS.objects + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 158 + + + CF$UID + 155 + + + CF$UID + 160 + + + CF$UID + 168 + + + + LayoutFocusMode + console + variables + LayoutMode + IDEDebugArea_SplitView + IDEDebuggerAreaSplitView + 1 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 28 + + + + ConsoleFilterMode + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 159 + + + NS.objects + + + CF$UID + 155 + + + + VariablesViewSelectedScope + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 161 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 162 + + + CF$UID + 165 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 163 + + + CF$UID + 164 + + + + VariablesView + 521 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 166 + + + CF$UID + 167 + + + + ConsoleArea + 515 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 169 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 170 + + + CF$UID + 172 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 163 + + + CF$UID + 171 + + + + 521 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 166 + + + CF$UID + 173 + + + + 515 + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 176 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 177 + + + CF$UID + 180 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 178 + + + CF$UID + 179 + + + + IDEEditor + 203 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 181 + + + CF$UID + 182 + + + + IDEDebuggerArea + 115 + + $class + + CF$UID + 41 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 6 + + + CF$UID + 7 + + + CF$UID + 8 + + + CF$UID + 185 + + + CF$UID + 186 + + + CF$UID + 11 + + + CF$UID + 12 + + + CF$UID + 13 + + + NS.objects + + + CF$UID + 187 + + + CF$UID + 188 + + + CF$UID + 17 + + + CF$UID + 3 + + + CF$UID + 189 + + + CF$UID + 186 + + + CF$UID + 174 + + + CF$UID + 17 + + + + IDEWorkspaceWindowControllerUniqueIdentifier + IDEWorkspaceTabController_867920DF-D2AA-4CD6-BCB5-21B09A970732 + {{40, 60}, {1280, 718}} + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 186 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 21 + + + CF$UID + 20 + + + CF$UID + 26 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + CF$UID + 19 + + + NS.objects + + + CF$UID + 28 + + + CF$UID + 174 + + + CF$UID + 190 + + + CF$UID + 250 + + + CF$UID + 256 + + + CF$UID + 292 + + + CF$UID + 17 + + + CF$UID + 300 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 87 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 80 + + + NS.objects + + + CF$UID + 174 + + + CF$UID + 191 + + + CF$UID + 217 + + + CF$UID + 174 + + + CF$UID + 28 + + + CF$UID + 232 + + + CF$UID + 238 + + + CF$UID + 239 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 109 + + + NS.objects + + + CF$UID + 192 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 111 + + + NS.objects + + + CF$UID + 193 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 113 + + + CF$UID + 114 + + + CF$UID + 115 + + + NS.objects + + + CF$UID + 194 + + + CF$UID + 28 + + + CF$UID + 215 + + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 195 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 118 + + + CF$UID + 119 + + + CF$UID + 120 + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + NS.objects + + + CF$UID + 196 + + + CF$UID + 197 + + + CF$UID + 208 + + + CF$UID + 212 + + + CF$UID + 201 + + + CF$UID + 142 + + + CF$UID + 213 + + + + public.c-plus-plus-source + + $class + + CF$UID + 103 + + DocumentLocation + + CF$UID + 206 + + DomainIdentifier + + CF$UID + 198 + + IdentifierPath + + CF$UID + 199 + + IndexOfDocumentIdentifier + + CF$UID + 28 + + + Xcode.IDENavigableItemDomain.WorkspaceStructure + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 200 + + + CF$UID + 202 + + + CF$UID + 203 + + + CF$UID + 205 + + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 201 + + + JSONWriter.cpp + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 60 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 204 + + + TestSuite + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 58 + + + + $class + + CF$UID + 102 + + documentURL + + CF$UID + 207 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONWriter.cpp + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 209 + + + CF$UID + 210 + + + CF$UID + 17 + + + CF$UID + 211 + + + + 353943877.556804 + {1391, 1247} + {7100, 0} + internalJSONNode::DumpRawString(json_string & output) + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 214 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWriter.cpp + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 216 + + + + {{0, 0}, {975, 370}} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 149 + + + CF$UID + 150 + + + CF$UID + 154 + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 151 + + + NS.objects + + + CF$UID + 155 + + + CF$UID + 218 + + + CF$UID + 219 + + + CF$UID + 155 + + + CF$UID + 225 + + + CF$UID + 231 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 28 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 220 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 221 + + + CF$UID + 223 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 163 + + + CF$UID + 222 + + + + 487 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 166 + + + CF$UID + 224 + + + + 487 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 226 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 227 + + + CF$UID + 229 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 163 + + + CF$UID + 228 + + + + 487 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 166 + + + CF$UID + 230 + + + + 487 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 159 + + + NS.objects + + + CF$UID + 155 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 233 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 234 + + + CF$UID + 236 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 178 + + + CF$UID + 235 + + + + 392 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 181 + + + CF$UID + 237 + + + + 250 + + $class + + CF$UID + 41 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 107 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 240 + + rootLayoutTreeNode + + CF$UID + 248 + + + + $class + + CF$UID + 106 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 241 + + orientation + 0 + parent + + CF$UID + 248 + + + + $class + + CF$UID + 103 + + DocumentLocation + + CF$UID + 206 + + DomainIdentifier + + CF$UID + 198 + + IdentifierPath + + CF$UID + 242 + + IndexOfDocumentIdentifier + + CF$UID + 28 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 243 + + + CF$UID + 244 + + + CF$UID + 245 + + + CF$UID + 247 + + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 201 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 60 + + + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 246 + + + TestSuite + + $class + + CF$UID + 94 + + Identifier + + CF$UID + 58 + + + + $class + + CF$UID + 106 + + children + + CF$UID + 249 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 240 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 251 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 252 + + + CF$UID + 254 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 35 + + + CF$UID + 253 + + + + 322 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 35 + + + CF$UID + 255 + + + + 320 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 44 + + + CF$UID + 257 + + + CF$UID + 43 + + + CF$UID + 258 + + + NS.objects + + + CF$UID + 259 + + + CF$UID + 270 + + + CF$UID + 44 + + + CF$UID + 275 + + + + Xcode.IDEKit.Navigator.Debug + Xcode.IDEKit.Navigator.Issues + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 260 + + + CF$UID + 17 + + + CF$UID + 54 + + + CF$UID + 17 + + + CF$UID + 17 + + + CF$UID + 261 + + + CF$UID + 264 + + + + {{0, 149}, {304, 598}} + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 262 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 263 + + + CF$UID + 60 + + + CF$UID + 61 + + + + TestSuite + + $class + + CF$UID + 55 + + NS.objects + + + CF$UID + 265 + + + CF$UID + 266 + + + CF$UID + 267 + + + CF$UID + 268 + + + CF$UID + 269 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 263 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 263 + + + CF$UID + 67 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 263 + + + CF$UID + 69 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 58 + + + CF$UID + 263 + + + CF$UID + 60 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 271 + + + CF$UID + 272 + + + CF$UID + 273 + + + NS.objects + + + CF$UID + 274 + + + CF$UID + 28 + + + CF$UID + 17 + + + + IDEStackCompressionValue + IDEThreadOrQueueMode + IDEShowOnlyInterestingContent + 2 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 276 + + + CF$UID + 277 + + + CF$UID + 278 + + + CF$UID + 279 + + + CF$UID + 280 + + + CF$UID + 281 + + + CF$UID + 282 + + + CF$UID + 283 + + + CF$UID + 284 + + + NS.objects + + + CF$UID + 17 + + + CF$UID + 285 + + + CF$UID + 286 + + + CF$UID + 288 + + + CF$UID + 289 + + + CF$UID + 17 + + + CF$UID + 290 + + + CF$UID + 17 + + + CF$UID + 291 + + + + IDEErrorFilteringEnabled + IDEVisibleRect + IDECollapsedFiles + IDEExpandedIssues + IDESelectedNavigables + IDEShowsByType + IDECollapsedTypes + IDERecentFilteringEnabled + IDECollapsedGroups + {{0, 0}, {304, 576}} + + $class + + CF$UID + 287 + + NS.objects + + + + $classes + + NSMutableSet + NSSet + NSObject + + $classname + NSMutableSet + + + $class + + CF$UID + 287 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.objects + + + + $class + + CF$UID + 287 + + NS.objects + + + + $class + + CF$UID + 287 + + NS.objects + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 30 + + + NS.objects + + + CF$UID + 293 + + + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 294 + + + CF$UID + 296 + + + CF$UID + 298 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 23 + + + CF$UID + 295 + + + + 305 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 26 + + + CF$UID + 297 + + + + 975 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 33 + + + CF$UID + 34 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 299 + + + + 260 + JSONWriter.cpp + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 302 + + + CF$UID + 303 + + + CF$UID + 304 + + + CF$UID + 305 + + + CF$UID + 306 + + + CF$UID + 307 + + + CF$UID + 308 + + + CF$UID + 309 + + + CF$UID + 310 + + + CF$UID + 311 + + + CF$UID + 312 + + + NS.objects + + + CF$UID + 17 + + + CF$UID + 313 + + + CF$UID + 28 + + + CF$UID + 1004 + + + CF$UID + 1009 + + + CF$UID + 1012 + + + CF$UID + 1042 + + + CF$UID + 1043 + + + CF$UID + 1308 + + + CF$UID + 17 + + + CF$UID + 17 + + + + BreakpointsActivated + DefaultEditorStatesForURLs + DebuggingWindowBehavior + ActiveRunDestination + ActiveScheme + LastCompletedPersistentSchemeBasedActivityReport + DocumentWindows + DefaultEditorFrameSizeForURLs + RecentEditorDocumentURLs + AppFocusInMiniDebugging + MiniDebuggingConsole + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 314 + + + CF$UID + 315 + + + CF$UID + 316 + + + CF$UID + 317 + + + NS.objects + + + CF$UID + 318 + + + CF$UID + 324 + + + CF$UID + 528 + + + CF$UID + 967 + + + + Xcode.IDEKit.EditorDocument.DebuggerLogDocument + Xcode.Xcode3ProjectSupport.EditorDocument.Xcode3Project + Xcode.IDEKit.EditorDocument.SourceCode + Xcode.IDEKit.EditorDocument.LogDocument + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 319 + + + NS.objects + + + CF$UID + 321 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 320 + + + x-xcode-log://47440380-46FE-4197-A659-8E7B1D8FBA97 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 322 + + + NS.objects + + + CF$UID + 323 + + + + DBGConsoleLogEditorScrollRange + {0, 985} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 325 + + + NS.objects + + + CF$UID + 327 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 326 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSuite.xcodeproj/ + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 328 + + + CF$UID + 329 + + + CF$UID + 330 + + + CF$UID + 331 + + + NS.objects + + + CF$UID + 332 + + + CF$UID + 333 + + + CF$UID + 343 + + + CF$UID + 527 + + + + Xcode3ProjectEditorPreviousProjectEditorClass + Xcode3ProjectEditor.sourceList.splitview + Xcode3ProjectEditorSelectedDocumentLocations + Xcode3ProjectEditor_Xcode3BuildSettingsEditor + Xcode3BuildSettingsEditor + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 334 + + + NS.objects + + + CF$UID + 335 + + + + DVTSplitViewItems + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 336 + + + CF$UID + 341 + + + + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 337 + + + CF$UID + 338 + + + NS.objects + + + CF$UID + 339 + + + CF$UID + 340 + + + + DVTIdentifier + DVTViewMagnitude + + 170 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 337 + + + CF$UID + 338 + + + NS.objects + + + CF$UID + 339 + + + CF$UID + 342 + + + + 493 + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 344 + + + + + $class + + CF$UID + 526 + + documentURL + + CF$UID + 345 + + selection + + CF$UID + 347 + + timestamp + + CF$UID + 346 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSuite.xcodeproj/ + 351723307.97741598 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 348 + + + CF$UID + 349 + + + CF$UID + 350 + + + NS.objects + + + CF$UID + 351 + + + CF$UID + 332 + + + CF$UID + 352 + + + + Project + Editor + Xcode3BuildSettingsEditorLocations + TestSuite + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 353 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 354 + + + CF$UID + 355 + + + CF$UID + 356 + + + CF$UID + 357 + + + CF$UID + 358 + + + CF$UID + 359 + + + NS.objects + + + CF$UID + 360 + + + CF$UID + 361 + + + CF$UID + 360 + + + CF$UID + 360 + + + CF$UID + 363 + + + CF$UID + 155 + + + + Xcode3BuildSettingsEditorMode + Selected Build Properties + Xcode3BuildSettingsEditorDisplayMode + Xcode3BuildPropertyValueDisplayMode + Collapsed Build Property Categories + Xcode3BuildPropertyNameDisplayMode + 0 + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 362 + + + + + $class + + CF$UID + 101 + + NS.string + Build Options||GCC_VERSION + + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 364 + + + CF$UID + 365 + + + CF$UID + 366 + + + CF$UID + 367 + + + CF$UID + 368 + + + CF$UID + 369 + + + CF$UID + 370 + + + CF$UID + 371 + + + CF$UID + 372 + + + CF$UID + 373 + + + CF$UID + 374 + + + CF$UID + 375 + + + CF$UID + 376 + + + CF$UID + 377 + + + CF$UID + 378 + + + CF$UID + 379 + + + CF$UID + 380 + + + CF$UID + 381 + + + CF$UID + 382 + + + CF$UID + 383 + + + CF$UID + 384 + + + CF$UID + 385 + + + CF$UID + 386 + + + CF$UID + 387 + + + CF$UID + 388 + + + CF$UID + 389 + + + CF$UID + 390 + + + CF$UID + 391 + + + CF$UID + 392 + + + CF$UID + 393 + + + CF$UID + 394 + + + CF$UID + 395 + + + CF$UID + 396 + + + CF$UID + 397 + + + CF$UID + 398 + + + CF$UID + 399 + + + CF$UID + 400 + + + CF$UID + 401 + + + CF$UID + 402 + + + CF$UID + 403 + + + CF$UID + 404 + + + CF$UID + 405 + + + CF$UID + 406 + + + CF$UID + 407 + + + CF$UID + 408 + + + CF$UID + 409 + + + CF$UID + 410 + + + CF$UID + 411 + + + CF$UID + 412 + + + CF$UID + 413 + + + CF$UID + 414 + + + CF$UID + 415 + + + CF$UID + 416 + + + CF$UID + 417 + + + CF$UID + 418 + + + CF$UID + 419 + + + CF$UID + 420 + + + CF$UID + 421 + + + CF$UID + 422 + + + CF$UID + 423 + + + CF$UID + 424 + + + CF$UID + 425 + + + CF$UID + 426 + + + CF$UID + 427 + + + CF$UID + 428 + + + CF$UID + 429 + + + CF$UID + 430 + + + CF$UID + 431 + + + CF$UID + 432 + + + CF$UID + 433 + + + CF$UID + 434 + + + CF$UID + 435 + + + CF$UID + 436 + + + CF$UID + 437 + + + CF$UID + 438 + + + CF$UID + 439 + + + CF$UID + 440 + + + CF$UID + 441 + + + CF$UID + 442 + + + CF$UID + 443 + + + CF$UID + 444 + + + CF$UID + 445 + + + CF$UID + 446 + + + CF$UID + 447 + + + CF$UID + 448 + + + CF$UID + 449 + + + CF$UID + 450 + + + CF$UID + 451 + + + CF$UID + 452 + + + CF$UID + 453 + + + CF$UID + 454 + + + CF$UID + 455 + + + CF$UID + 456 + + + CF$UID + 457 + + + CF$UID + 458 + + + CF$UID + 459 + + + CF$UID + 460 + + + CF$UID + 461 + + + CF$UID + 462 + + + CF$UID + 463 + + + CF$UID + 464 + + + CF$UID + 465 + + + CF$UID + 466 + + + CF$UID + 467 + + + CF$UID + 468 + + + CF$UID + 469 + + + CF$UID + 470 + + + CF$UID + 471 + + + CF$UID + 472 + + + CF$UID + 473 + + + CF$UID + 474 + + + CF$UID + 475 + + + CF$UID + 476 + + + CF$UID + 477 + + + CF$UID + 478 + + + CF$UID + 479 + + + CF$UID + 480 + + + CF$UID + 481 + + + CF$UID + 482 + + + CF$UID + 483 + + + CF$UID + 484 + + + CF$UID + 485 + + + CF$UID + 486 + + + CF$UID + 487 + + + CF$UID + 488 + + + CF$UID + 489 + + + CF$UID + 490 + + + CF$UID + 491 + + + CF$UID + 492 + + + CF$UID + 493 + + + CF$UID + 494 + + + CF$UID + 495 + + + CF$UID + 496 + + + CF$UID + 497 + + + CF$UID + 498 + + + CF$UID + 499 + + + CF$UID + 500 + + + CF$UID + 501 + + + CF$UID + 502 + + + CF$UID + 503 + + + CF$UID + 504 + + + CF$UID + 505 + + + CF$UID + 506 + + + CF$UID + 507 + + + CF$UID + 508 + + + CF$UID + 509 + + + CF$UID + 510 + + + CF$UID + 511 + + + CF$UID + 512 + + + CF$UID + 513 + + + CF$UID + 514 + + + CF$UID + 515 + + + CF$UID + 516 + + + CF$UID + 517 + + + CF$UID + 518 + + + CF$UID + 519 + + + CF$UID + 520 + + + CF$UID + 521 + + + CF$UID + 522 + + + CF$UID + 523 + + + CF$UID + 524 + + + CF$UID + 525 + + + + + $class + + CF$UID + 101 + + NS.string + Architectures||ADDITIONAL_SDKS + + + $class + + CF$UID + 101 + + NS.string + Architectures||ARCHS + + + $class + + CF$UID + 101 + + NS.string + Architectures||SDKROOT + + + $class + + CF$UID + 101 + + NS.string + Architectures||SUPPORTED_PLATFORMS + + + $class + + CF$UID + 101 + + NS.string + Architectures||VALID_ARCHS + + + $class + + CF$UID + 101 + + NS.string + Build Locations||SYMROOT + + + $class + + CF$UID + 101 + + NS.string + Build Locations||OBJROOT + + + $class + + CF$UID + 101 + + NS.string + Build Locations||SHARED_PRECOMPS_DIR + + + $class + + CF$UID + 101 + + NS.string + Build Options||BUILD_VARIANTS + + + $class + + CF$UID + 101 + + NS.string + Build Options||GCC_VERSION + + + $class + + CF$UID + 101 + + NS.string + Build Options||DEBUG_INFORMATION_FORMAT + + + $class + + CF$UID + 101 + + NS.string + Build Options||ENABLE_OPENMP_SUPPORT + + + $class + + CF$UID + 101 + + NS.string + Build Options||PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR + + + $class + + CF$UID + 101 + + NS.string + Build Options||SCAN_ALL_SOURCE_FILES_FOR_INCLUDES + + + $class + + CF$UID + 101 + + NS.string + Code Signing||CODE_SIGN_ENTITLEMENTS + + + $class + + CF$UID + 101 + + NS.string + Code Signing||CODE_SIGN_IDENTITY + + + $class + + CF$UID + 101 + + NS.string + Code Signing||CODE_SIGN_RESOURCE_RULES_PATH + + + $class + + CF$UID + 101 + + NS.string + Code Signing||OTHER_CODE_SIGN_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Deployment||STRIPFLAGS + + + $class + + CF$UID + 101 + + NS.string + Deployment||ALTERNATE_GROUP + + + $class + + CF$UID + 101 + + NS.string + Deployment||ALTERNATE_OWNER + + + $class + + CF$UID + 101 + + NS.string + Deployment||ALTERNATE_MODE + + + $class + + CF$UID + 101 + + NS.string + Deployment||ALTERNATE_PERMISSIONS_FILES + + + $class + + CF$UID + 101 + + NS.string + Deployment||COMBINE_HIDPI_IMAGES + + + $class + + CF$UID + 101 + + NS.string + Deployment||DEPLOYMENT_LOCATION + + + $class + + CF$UID + 101 + + NS.string + Deployment||DEPLOYMENT_POSTPROCESSING + + + $class + + CF$UID + 101 + + NS.string + Deployment||INSTALL_GROUP + + + $class + + CF$UID + 101 + + NS.string + Deployment||INSTALL_OWNER + + + $class + + CF$UID + 101 + + NS.string + Deployment||INSTALL_MODE_FLAG + + + $class + + CF$UID + 101 + + NS.string + Deployment||DSTROOT + + + $class + + CF$UID + 101 + + NS.string + Deployment||INSTALL_PATH + + + $class + + CF$UID + 101 + + NS.string + Deployment||MACOSX_DEPLOYMENT_TARGET + + + $class + + CF$UID + 101 + + NS.string + Deployment||SKIP_INSTALL + + + $class + + CF$UID + 101 + + NS.string + Deployment||COPY_PHASE_STRIP + + + $class + + CF$UID + 101 + + NS.string + Deployment||STRIP_INSTALLED_PRODUCT + + + $class + + CF$UID + 101 + + NS.string + Deployment||STRIP_STYLE + + + $class + + CF$UID + 101 + + NS.string + Deployment||SEPARATE_STRIP + + + $class + + CF$UID + 101 + + NS.string + Kernel Module||MODULE_NAME + + + $class + + CF$UID + 101 + + NS.string + Kernel Module||MODULE_START + + + $class + + CF$UID + 101 + + NS.string + Kernel Module||MODULE_STOP + + + $class + + CF$UID + 101 + + NS.string + Kernel Module||MODULE_VERSION + + + $class + + CF$UID + 101 + + NS.string + Linking||BUNDLE_LOADER + + + $class + + CF$UID + 101 + + NS.string + Linking||DYLIB_COMPATIBILITY_VERSION + + + $class + + CF$UID + 101 + + NS.string + Linking||DYLIB_CURRENT_VERSION + + + $class + + CF$UID + 101 + + NS.string + Linking||DEAD_CODE_STRIPPING + + + $class + + CF$UID + 101 + + NS.string + Linking||LINKER_DISPLAYS_MANGLED_NAMES + + + $class + + CF$UID + 101 + + NS.string + Linking||LD_NO_PIE + + + $class + + CF$UID + 101 + + NS.string + Linking||PRESERVE_DEAD_CODE_INITS_AND_TERMS + + + $class + + CF$UID + 101 + + NS.string + Linking||LD_DYLIB_INSTALL_NAME + + + $class + + CF$UID + 101 + + NS.string + Linking||EXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 101 + + NS.string + Linking||INIT_ROUTINE + + + $class + + CF$UID + 101 + + NS.string + Linking||LINK_WITH_STANDARD_LIBRARIES + + + $class + + CF$UID + 101 + + NS.string + Linking||MACH_O_TYPE + + + $class + + CF$UID + 101 + + NS.string + Linking||LD_OPENMP_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Linking||ORDER_FILE + + + $class + + CF$UID + 101 + + NS.string + Linking||OTHER_LDFLAGS + + + $class + + CF$UID + 101 + + NS.string + Linking||GENERATE_MASTER_OBJECT_FILE + + + $class + + CF$UID + 101 + + NS.string + Linking||PRELINK_LIBS + + + $class + + CF$UID + 101 + + NS.string + Linking||KEEP_PRIVATE_EXTERNS + + + $class + + CF$UID + 101 + + NS.string + Linking||LD_RUNPATH_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Linking||SEPARATE_SYMBOL_EDIT + + + $class + + CF$UID + 101 + + NS.string + Linking||PRELINK_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Linking||SECTORDER_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Linking||UNEXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 101 + + NS.string + Linking||WARNING_LDFLAGS + + + $class + + CF$UID + 101 + + NS.string + Linking||LD_GENERATE_MAP_FILE + + + $class + + CF$UID + 101 + + NS.string + Packaging||APPLY_RULES_IN_COPY_FILES + + + $class + + CF$UID + 101 + + NS.string + Packaging||EXECUTABLE_EXTENSION + + + $class + + CF$UID + 101 + + NS.string + Packaging||EXECUTABLE_PREFIX + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_EXPAND_BUILD_SETTINGS + + + $class + + CF$UID + 101 + + NS.string + Packaging||GENERATE_PKGINFO_FILE + + + $class + + CF$UID + 101 + + NS.string + Packaging||FRAMEWORK_VERSION + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_FILE + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_OTHER_PREPROCESSOR_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_OUTPUT_FORMAT + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_PREFIX_HEADER + + + $class + + CF$UID + 101 + + NS.string + Packaging||INFOPLIST_PREPROCESS + + + $class + + CF$UID + 101 + + NS.string + Packaging||COPYING_PRESERVES_HFS_DATA + + + $class + + CF$UID + 101 + + NS.string + Packaging||PRIVATE_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 101 + + NS.string + Packaging||PRODUCT_NAME + + + $class + + CF$UID + 101 + + NS.string + Packaging||PLIST_FILE_OUTPUT_FORMAT + + + $class + + CF$UID + 101 + + NS.string + Packaging||PUBLIC_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 101 + + NS.string + Packaging||STRINGS_FILE_OUTPUT_ENCODING + + + $class + + CF$UID + 101 + + NS.string + Packaging||WRAPPER_EXTENSION + + + $class + + CF$UID + 101 + + NS.string + Search Paths||ALWAYS_SEARCH_USER_PATHS + + + $class + + CF$UID + 101 + + NS.string + Search Paths||FRAMEWORK_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Search Paths||HEADER_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Search Paths||LIBRARY_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Search Paths||REZ_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Search Paths||EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 101 + + NS.string + Search Paths||INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 101 + + NS.string + Search Paths||USER_HEADER_SEARCH_PATHS + + + $class + + CF$UID + 101 + + NS.string + Unit Testing||OTHER_TEST_FLAGS + + + $class + + CF$UID + 101 + + NS.string + Unit Testing||TEST_AFTER_BUILD + + + $class + + CF$UID + 101 + + NS.string + Unit Testing||TEST_HOST + + + $class + + CF$UID + 101 + + NS.string + Unit Testing||TEST_RIG + + + $class + + CF$UID + 101 + + NS.string + Versioning||CURRENT_PROJECT_VERSION + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSION_INFO_FILE + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSION_INFO_EXPORT_DECL + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSION_INFO_PREFIX + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSION_INFO_SUFFIX + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSIONING_SYSTEM + + + $class + + CF$UID + 101 + + NS.string + Versioning||VERSION_INFO_BUILDER + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_FAST_OBJC_DISPATCH + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_SSE3_EXTENSIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_SSE41_EXTENSIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_SSE42_EXTENSIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_STRICT_ALIASING + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_GENERATE_DEBUGGING_SYMBOLS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_DYNAMIC_NO_PIC + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_INLINES_ARE_PRIVATE_EXTERN + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_KERNEL_DEVELOPMENT + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||LLVM_LTO + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_REUSE_STRINGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_NO_COMMON_BLOCKS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_ENABLE_OBJC_GC + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_FAST_MATH + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_THREADSAFE_STATICS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_SYMBOLS_PRIVATE_EXTERN + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Code Generation||GCC_UNROLL_LOOPS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_CHAR_IS_UNSIGNED_CHAR + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_ASM_KEYWORD + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_C_LANGUAGE_STANDARD + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_INPUT_FILETYPE + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_CPP_EXCEPTIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_CPP_RTTI + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_LINK_WITH_DYNAMIC_LIBRARIES + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_OBJC_EXCEPTIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_TRIGRAPHS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_USE_INDIRECT_FUNCTION_CALLS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_USE_REGISTER_FUNCTION_CALLS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_INCREASE_PRECOMPILED_HEADER_SHARING + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_CW_ASM_SYNTAX + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||OTHER_CFLAGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||OTHER_CPLUSPLUSFLAGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_PRECOMPILE_PREFIX_HEADER + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_PREFIX_HEADER + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_BUILTIN_FUNCTIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_ENABLE_PASCAL_STRINGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_FORCE_CPU_SUBTYPE_ALL + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_SHORT_ENUMS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Language||GCC_USE_STANDARD_INCLUDE_SEARCHING + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_CHECK_SWITCH_STATEMENTS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_FOUR_CHARACTER_CONSTANTS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_INHIBIT_ALL_WARNINGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_ABOUT_RETURN_TYPE + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_MISSING_PARENTHESES + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||WARNING_CFLAGS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_ABOUT_POINTER_SIGNEDNESS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_TREAT_WARNINGS_AS_ERRORS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_TYPECHECK_CALLS_TO_PRINTF + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_UNUSED_VALUE + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_UNUSED_VARIABLE + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS + + + $class + + CF$UID + 101 + + NS.string + LLVM compiler 2.1 - Warnings||GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO + + + $classes + + Xcode3ProjectDocumentLocation + DVTDocumentLocation + NSObject + + $classname + Xcode3ProjectDocumentLocation + + + $class + + CF$UID + 41 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 529 + + + CF$UID + 531 + + + CF$UID + 533 + + + CF$UID + 535 + + + CF$UID + 537 + + + CF$UID + 539 + + + CF$UID + 541 + + + CF$UID + 543 + + + CF$UID + 545 + + + CF$UID + 547 + + + CF$UID + 549 + + + CF$UID + 551 + + + CF$UID + 553 + + + CF$UID + 555 + + + CF$UID + 557 + + + CF$UID + 559 + + + CF$UID + 561 + + + CF$UID + 563 + + + CF$UID + 565 + + + CF$UID + 567 + + + CF$UID + 569 + + + CF$UID + 571 + + + CF$UID + 573 + + + CF$UID + 575 + + + CF$UID + 577 + + + CF$UID + 579 + + + CF$UID + 581 + + + CF$UID + 583 + + + CF$UID + 585 + + + CF$UID + 587 + + + CF$UID + 589 + + + CF$UID + 591 + + + CF$UID + 593 + + + CF$UID + 595 + + + CF$UID + 597 + + + CF$UID + 599 + + + CF$UID + 601 + + + CF$UID + 603 + + + CF$UID + 605 + + + CF$UID + 607 + + + CF$UID + 609 + + + CF$UID + 611 + + + CF$UID + 613 + + + CF$UID + 615 + + + CF$UID + 617 + + + CF$UID + 619 + + + CF$UID + 621 + + + CF$UID + 623 + + + CF$UID + 625 + + + CF$UID + 627 + + + CF$UID + 629 + + + CF$UID + 631 + + + CF$UID + 633 + + + CF$UID + 635 + + + CF$UID + 637 + + + CF$UID + 639 + + + CF$UID + 641 + + + CF$UID + 643 + + + CF$UID + 645 + + + CF$UID + 647 + + + CF$UID + 649 + + + CF$UID + 651 + + + CF$UID + 653 + + + CF$UID + 655 + + + CF$UID + 657 + + + CF$UID + 659 + + + CF$UID + 661 + + + CF$UID + 663 + + + CF$UID + 665 + + + CF$UID + 667 + + + CF$UID + 669 + + + CF$UID + 671 + + + CF$UID + 673 + + + CF$UID + 675 + + + CF$UID + 677 + + + CF$UID + 679 + + + CF$UID + 681 + + + NS.objects + + + CF$UID + 683 + + + CF$UID + 691 + + + CF$UID + 695 + + + CF$UID + 699 + + + CF$UID + 703 + + + CF$UID + 707 + + + CF$UID + 711 + + + CF$UID + 715 + + + CF$UID + 719 + + + CF$UID + 722 + + + CF$UID + 725 + + + CF$UID + 729 + + + CF$UID + 733 + + + CF$UID + 737 + + + CF$UID + 740 + + + CF$UID + 744 + + + CF$UID + 747 + + + CF$UID + 751 + + + CF$UID + 754 + + + CF$UID + 758 + + + CF$UID + 762 + + + CF$UID + 765 + + + CF$UID + 768 + + + CF$UID + 771 + + + CF$UID + 775 + + + CF$UID + 778 + + + CF$UID + 781 + + + CF$UID + 784 + + + CF$UID + 787 + + + CF$UID + 791 + + + CF$UID + 795 + + + CF$UID + 799 + + + CF$UID + 802 + + + CF$UID + 806 + + + CF$UID + 810 + + + CF$UID + 813 + + + CF$UID + 817 + + + CF$UID + 821 + + + CF$UID + 825 + + + CF$UID + 828 + + + CF$UID + 832 + + + CF$UID + 835 + + + CF$UID + 839 + + + CF$UID + 842 + + + CF$UID + 845 + + + CF$UID + 849 + + + CF$UID + 853 + + + CF$UID + 857 + + + CF$UID + 860 + + + CF$UID + 864 + + + CF$UID + 867 + + + CF$UID + 871 + + + CF$UID + 875 + + + CF$UID + 879 + + + CF$UID + 882 + + + CF$UID + 886 + + + CF$UID + 890 + + + CF$UID + 894 + + + CF$UID + 898 + + + CF$UID + 902 + + + CF$UID + 906 + + + CF$UID + 910 + + + CF$UID + 914 + + + CF$UID + 918 + + + CF$UID + 921 + + + CF$UID + 925 + + + CF$UID + 929 + + + CF$UID + 933 + + + CF$UID + 937 + + + CF$UID + 940 + + + CF$UID + 943 + + + CF$UID + 947 + + + CF$UID + 950 + + + CF$UID + 954 + + + CF$UID + 958 + + + CF$UID + 961 + + + CF$UID + 963 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 530 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Source/JSONDefs.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 532 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONChildren.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 534 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Testing/Unit/JSONDebug.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 536 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestBinary.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 538 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Source/JSONChildren.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 540 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestNamespace.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 542 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONMemory.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 544 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestWriter.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 546 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/makefile + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 548 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/JSONOptions.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 550 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestComments.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 552 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 554 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/JSONOptions.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 556 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONNode.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 558 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONWorker.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 560 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 562 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/main.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 564 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestRegression.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 566 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSuite.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 568 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 570 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_FAIL_SAFE.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 572 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestConverters.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 574 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/test.json + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 576 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONMemory.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 578 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/var/folders/cw/y_q971pn7290lp80ww1wq8fm0000gp/T/abort_disassembly_0x00007fff8db71a9c.s + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 580 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Dependencies/libbase64++/libbase64++.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 582 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Dependencies/libbase64++/libbase64++.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 584 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/libjson.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 586 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/UStringTest.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 588 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONPreparse.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 590 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSON_Base64.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 592 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Source/JSON_Base64.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 594 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/mempool++/mempool.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 596 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Dependencies/mempool++/mempool.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 598 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONDebug.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 600 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/StringTest.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 602 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 604 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestInspectors.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 606 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/UnitTest.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 608 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONWorker.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 610 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_encode64.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 612 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Testing/Framework/Defines.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 614 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestAssign.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 616 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONValidator.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 618 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONDefs/GNU_C.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 620 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 622 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONStream.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 624 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Source/internalJSONNode.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 626 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_decode64.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 628 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONChildren.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 630 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Volumes/WALLACE/libjson/Source/JSONChildren.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 632 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONGlobals.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 634 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite2/NumberToString/_atof.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 636 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/UnitTest.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 638 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONMemoryPool.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 640 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONSingleton.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 642 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONSharedString.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 644 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestString.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 646 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestFunctions.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 648 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONAllocator.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 650 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 652 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONValidator.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 654 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONStream.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 656 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestIterators.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 658 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONPreparse.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 660 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/NumberToString.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 662 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestStreams.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 664 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestChildren.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 666 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSON_Base64.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 668 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestRefCounting.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 670 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/libjson.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 672 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONNode.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 674 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSharedString.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 676 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestValidator.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 678 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONDefs/Strings_Defs.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 680 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONDefs.h + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 682 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/Source/JSONWriter.cpp + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 688 + + + CF$UID + 689 + + + CF$UID + 17 + + + CF$UID + 690 + + + + PrimaryDocumentTimestamp + PrimaryDocumentVisibleCharacterRange + HideAllIssues + PrimaryDocumentSelectedCharacterRange + 351807661.54125798 + {0, 889} + {444, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 692 + + + CF$UID + 693 + + + CF$UID + 17 + + + CF$UID + 694 + + + + 351452552.35721397 + {7628, 2235} + {9107, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 696 + + + CF$UID + 697 + + + CF$UID + 17 + + + CF$UID + 698 + + + + 351714258.66459298 + {1374, 1025} + {2517, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 700 + + + CF$UID + 701 + + + CF$UID + 17 + + + CF$UID + 702 + + + + 335107729.59204501 + {0, 1619} + {0, 22} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 704 + + + CF$UID + 705 + + + CF$UID + 17 + + + CF$UID + 706 + + + + 351809767.446895 + {11071, 1091} + {12162, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 708 + + + CF$UID + 709 + + + CF$UID + 17 + + + CF$UID + 710 + + + + 351628161.34245598 + {5636, 2124} + {6632, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 712 + + + CF$UID + 713 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351631511.577151 + {0, 1698} + {0, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 716 + + + CF$UID + 717 + + + CF$UID + 17 + + + CF$UID + 718 + + + + 353943002.16869098 + {6802, 805} + {7585, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 720 + + + CF$UID + 721 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 333054979.75281501 + {0, 1870} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 723 + + + CF$UID + 724 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 353942752.01008701 + {0, 420} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 726 + + + CF$UID + 727 + + + CF$UID + 17 + + + CF$UID + 728 + + + + 351702324.23620898 + {10862, 1685} + {11717, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 730 + + + CF$UID + 731 + + + CF$UID + 17 + + + CF$UID + 732 + + + + 351714262.33133101 + {312, 1252} + {987, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 734 + + + CF$UID + 735 + + + CF$UID + 17 + + + CF$UID + 736 + + + + 351808641.31566799 + {0, 422} + {48, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 738 + + + CF$UID + 739 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 353943023.72365397 + {37996, 1044} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 741 + + + CF$UID + 742 + + + CF$UID + 17 + + + CF$UID + 743 + + + + 351549034.696091 + {67, 2387} + {276, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 745 + + + CF$UID + 746 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351705001.46278101 + {0, 415} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 748 + + + CF$UID + 749 + + + CF$UID + 17 + + + CF$UID + 750 + + + + 353942324.50674701 + {0, 1174} + {159, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 752 + + + CF$UID + 702 + + + CF$UID + 17 + + + CF$UID + 753 + + + + 335107725.41989899 + {22, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 755 + + + CF$UID + 756 + + + CF$UID + 17 + + + CF$UID + 757 + + + + 353942314.62687302 + {190, 1292} + {1119, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 759 + + + CF$UID + 760 + + + CF$UID + 17 + + + CF$UID + 761 + + + + 351711510.69294202 + {860, 1080} + {1226, 78} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 763 + + + CF$UID + 764 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351711712.68213499 + {0, 386} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 766 + + + CF$UID + 767 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351714263.29116398 + {0, 2313} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 769 + + + CF$UID + 770 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 353080603.77892601 + {0, 582} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 772 + + + CF$UID + 773 + + + CF$UID + 17 + + + CF$UID + 774 + + + + 351632195.58532101 + {4617, 1269} + {5778, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 776 + + + CF$UID + 777 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351808606.249403 + {1401, 1361} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 779 + + + CF$UID + 780 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 353941855.29327798 + {3034, 1039} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 782 + + + CF$UID + 783 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351809867.280801 + {654, 1273} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 785 + + + CF$UID + 786 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351628807.96873802 + {8812, 967} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 788 + + + CF$UID + 789 + + + CF$UID + 17 + + + CF$UID + 790 + + + + 351552131.95041698 + {3806, 1439} + {4444, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 792 + + + CF$UID + 793 + + + CF$UID + 17 + + + CF$UID + 794 + + + + 350834831.00231701 + {0, 1225} + {1208, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 796 + + + CF$UID + 797 + + + CF$UID + 17 + + + CF$UID + 798 + + + + 351725181.67164099 + {0, 826} + {789, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 800 + + + CF$UID + 801 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351808587.662449 + {0, 955} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 803 + + + CF$UID + 804 + + + CF$UID + 17 + + + CF$UID + 805 + + + + 351534708.23627102 + {0, 818} + {744, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 807 + + + CF$UID + 808 + + + CF$UID + 17 + + + CF$UID + 809 + + + + 351723361.61878997 + {0, 1163} + {108, 9} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 811 + + + CF$UID + 812 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351702490.70621002 + {0, 1541} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 814 + + + CF$UID + 815 + + + CF$UID + 17 + + + CF$UID + 816 + + + + 351552035.58949298 + {3477, 1558} + {4484, 16} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 818 + + + CF$UID + 819 + + + CF$UID + 17 + + + CF$UID + 820 + + + + 350662741.07660502 + {4743, 905} + {5341, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 822 + + + CF$UID + 823 + + + CF$UID + 17 + + + CF$UID + 824 + + + + 351608811.38211203 + {11588, 798} + {12038, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 826 + + + CF$UID + 827 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 333065443.95174003 + {0, 1328} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 829 + + + CF$UID + 830 + + + CF$UID + 17 + + + CF$UID + 831 + + + + 353942086.48953497 + {14461, 1708} + {15368, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 833 + + + CF$UID + 834 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351809752.24011397 + {0, 2102} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 836 + + + CF$UID + 837 + + + CF$UID + 17 + + + CF$UID + 838 + + + + 351711487.15000999 + {5769, 3379} + {9148, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 840 + + + CF$UID + 841 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351714268.261648 + {0, 1355} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 843 + + + CF$UID + 844 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351551092.89300901 + {9498, 648} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 846 + + + CF$UID + 847 + + + CF$UID + 17 + + + CF$UID + 848 + + + + 351723544.023476 + {0, 1098} + {53, 1647} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 850 + + + CF$UID + 851 + + + CF$UID + 17 + + + CF$UID + 852 + + + + 353943526.58995599 + {5947, 1938} + {7002, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 854 + + + CF$UID + 855 + + + CF$UID + 17 + + + CF$UID + 856 + + + + 350840744.106148 + {2609, 1511} + {3835, 18} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 858 + + + CF$UID + 859 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351809798.699417 + {0, 1065} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 861 + + + CF$UID + 862 + + + CF$UID + 17 + + + CF$UID + 863 + + + + 351723797.344549 + {0, 431} + {43, 6} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 865 + + + CF$UID + 866 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351608965.30250698 + {0, 1533} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 868 + + + CF$UID + 869 + + + CF$UID + 17 + + + CF$UID + 870 + + + + 351809778.49636501 + {2327, 1432} + {3759, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 872 + + + CF$UID + 873 + + + CF$UID + 17 + + + CF$UID + 874 + + + + 351608935.12914199 + {1107, 625} + {1648, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 876 + + + CF$UID + 877 + + + CF$UID + 17 + + + CF$UID + 878 + + + + 350847092.007267 + {1454, 1169} + {2094, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 880 + + + CF$UID + 881 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351550947.29271197 + {4547, 687} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 883 + + + CF$UID + 884 + + + CF$UID + 17 + + + CF$UID + 885 + + + + 351723350.144898 + {0, 1302} + {106, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 887 + + + CF$UID + 888 + + + CF$UID + 17 + + + CF$UID + 889 + + + + 335109685.68951797 + {24, 489} + {278, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 891 + + + CF$UID + 892 + + + CF$UID + 17 + + + CF$UID + 893 + + + + 351534730.56873602 + {10483, 733} + {8796, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 895 + + + CF$UID + 896 + + + CF$UID + 17 + + + CF$UID + 897 + + + + 351552012.802472 + {3245, 1364} + {3908, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 899 + + + CF$UID + 900 + + + CF$UID + 17 + + + CF$UID + 901 + + + + 351608807.57534403 + {7427, 636} + {7809, 29} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 903 + + + CF$UID + 904 + + + CF$UID + 17 + + + CF$UID + 905 + + + + 351452987.95765501 + {0, 998} + {843, 10} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 907 + + + CF$UID + 908 + + + CF$UID + 17 + + + CF$UID + 909 + + + + 351632365.489663 + {8846, 1053} + {9387, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 911 + + + CF$UID + 912 + + + CF$UID + 17 + + + CF$UID + 913 + + + + 350836144.99872899 + {0, 1323} + {1297, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 915 + + + CF$UID + 916 + + + CF$UID + 17 + + + CF$UID + 917 + + + + 351200583.76198 + {791, 1406} + {1156, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 919 + + + CF$UID + 920 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351608809.813429 + {1025, 616} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 922 + + + CF$UID + 923 + + + CF$UID + 17 + + + CF$UID + 924 + + + + 351629088.98004198 + {131, 972} + {610, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 926 + + + CF$UID + 927 + + + CF$UID + 17 + + + CF$UID + 928 + + + + 351608943.98261797 + {3018, 769} + {3601, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 930 + + + CF$UID + 931 + + + CF$UID + 17 + + + CF$UID + 932 + + + + 333315467.77203298 + {2846, 1567} + {4280, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 934 + + + CF$UID + 935 + + + CF$UID + 17 + + + CF$UID + 936 + + + + 351608805.81674099 + {23, 642} + {226, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 938 + + + CF$UID + 939 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 351723591.73724902 + {4060, 1221} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 941 + + + CF$UID + 942 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 353942571.91422099 + {0, 828} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 944 + + + CF$UID + 945 + + + CF$UID + 17 + + + CF$UID + 946 + + + + 351613214.63805699 + {3181, 1886} + {4254, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 948 + + + CF$UID + 949 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 350689771.82139403 + {10619, 1269} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 951 + + + CF$UID + 952 + + + CF$UID + 17 + + + CF$UID + 953 + + + + 350847218.479101 + {3653, 1254} + {4380, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 955 + + + CF$UID + 956 + + + CF$UID + 17 + + + CF$UID + 957 + + + + 333125205.254426 + {8608, 902} + {10205, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 959 + + + CF$UID + 960 + + + CF$UID + 17 + + + CF$UID + 714 + + + + 350851084.69411701 + {0, 820} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + NS.objects + + + CF$UID + 962 + + + CF$UID + 689 + + + CF$UID + 17 + + + CF$UID + 690 + + + + 351725405.53921002 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + NS.objects + + + CF$UID + 964 + + + CF$UID + 965 + + + CF$UID + 17 + + + CF$UID + 966 + + + + 353943877.55289102 + {1391, 1247} + {7100, 0} + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 968 + + + CF$UID + 970 + + + CF$UID + 972 + + + CF$UID + 974 + + + CF$UID + 976 + + + NS.objects + + + CF$UID + 978 + + + CF$UID + 987 + + + CF$UID + 992 + + + CF$UID + 997 + + + CF$UID + 1002 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 969 + + + x-xcode-log://29FB2382-E916-4230-B0C7-763DE4615A7F + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 971 + + + x-xcode-log://AFCD9966-F82A-48B4-97F1-F899F5EF095F + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 973 + + + x-xcode-log://F307955E-4245-46D3-89C4-1E6C1EAFDCE5 + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 975 + + + x-xcode-log://0917AFA2-840B-4B0C-90A3-2A41B08F6971 + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 977 + + + x-xcode-log://AA11E335-112A-4140-AE91-482B0CCCA902 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 979 + + + NS.objects + + + CF$UID + 980 + + + + SelectedDocumentLocations + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 981 + + + + + $class + + CF$UID + 986 + + documentURL + + CF$UID + 969 + + expandTranscript + + indexPath + + CF$UID + 982 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 985 + + NSIndexPathData + + CF$UID + 983 + + NSIndexPathLength + 2 + + + $class + + CF$UID + 984 + + NS.data + + AD0= + + + + $classes + + NSMutableData + NSData + NSObject + + $classname + NSMutableData + + + $classes + + NSIndexPath + NSObject + + $classname + NSIndexPath + + + $classes + + IDELogDocumentLocation + DVTDocumentLocation + NSObject + + $classname + IDELogDocumentLocation + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 979 + + + NS.objects + + + CF$UID + 988 + + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 989 + + + + + $class + + CF$UID + 986 + + documentURL + + CF$UID + 971 + + expandTranscript + + indexPath + + CF$UID + 990 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 985 + + NSIndexPathData + + CF$UID + 991 + + NSIndexPathLength + 3 + + + $class + + CF$UID + 984 + + NS.data + + AD4C + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 979 + + + NS.objects + + + CF$UID + 993 + + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 994 + + + + + $class + + CF$UID + 986 + + documentURL + + CF$UID + 973 + + expandTranscript + + indexPath + + CF$UID + 995 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 985 + + NSIndexPathData + + CF$UID + 996 + + NSIndexPathLength + 2 + + + $class + + CF$UID + 984 + + NS.data + + AAE= + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 979 + + + NS.objects + + + CF$UID + 998 + + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 999 + + + + + $class + + CF$UID + 986 + + documentURL + + CF$UID + 975 + + expandTranscript + + indexPath + + CF$UID + 1000 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 985 + + NSIndexPathData + + CF$UID + 1001 + + NSIndexPathLength + 2 + + + $class + + CF$UID + 984 + + NS.data + + ACU= + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 979 + + + NS.objects + + + CF$UID + 1003 + + + + + $class + + CF$UID + 16 + + NS.objects + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1005 + + + CF$UID + 1006 + + + NS.objects + + + CF$UID + 1007 + + + CF$UID + 1008 + + + + IDEDeviceLocation + IDEDeviceArchitecture + dvtdevice-local-computer:localhost + x86_64 + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1010 + + + NS.objects + + + CF$UID + 1011 + + + + IDENameString + TestSuite + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1013 + + + CF$UID + 1014 + + + CF$UID + 1015 + + + NS.objects + + + CF$UID + 1016 + + + CF$UID + 1041 + + + CF$UID + 1023 + + + + IDEActivityReportCompletionSummaryStringSegments + IDEActivityReportOptions + IDEActivityReportTitle + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 1017 + + + CF$UID + 1024 + + + CF$UID + 1028 + + + CF$UID + 1032 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1018 + + + CF$UID + 1019 + + + CF$UID + 1020 + + + NS.objects + + + CF$UID + 1021 + + + CF$UID + 1022 + + + CF$UID + 1023 + + + + IDEActivityReportStringSegmentPriority + IDEActivityReportStringSegmentBackSeparator + IDEActivityReportStringSegmentStringValue + 2 + + Build + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1018 + + + CF$UID + 1019 + + + CF$UID + 1020 + + + NS.objects + + + CF$UID + 1025 + + + CF$UID + 1026 + + + CF$UID + 1027 + + + + 4 + : + TestSuite + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1018 + + + CF$UID + 1019 + + + CF$UID + 1020 + + + NS.objects + + + CF$UID + 1029 + + + CF$UID + 1030 + + + CF$UID + 1031 + + + + 1 + │ + + $class + + CF$UID + 984 + + NS.data + + YnBsaXN0MDDUAQIDBAUGOzxYJHZlcnNpb25YJG9iamVjdHNZJGFy + Y2hpdmVyVCR0b3ASAAGGoK0HCA8QGhscJCUrMTQ3VSRudWxs0wkK + CwwNDlxOU0F0dHJpYnV0ZXNWJGNsYXNzWE5TU3RyaW5ngAOADIAC + WVN1Y2NlZWRlZNMKERITFBdXTlMua2V5c1pOUy5vYmplY3RzgAui + FRaABIAFohgZgAaACVZOU0ZvbnRXTlNDb2xvctQKHR4fICEiI1ZO + U05hbWVWTlNTaXplWE5TZkZsYWdzgAiAByNAJgAAAAAAABENEF8Q + EUx1Y2lkYUdyYW5kZS1Cb2xk0iYnKClaJGNsYXNzbmFtZVgkY2xh + c3Nlc1ZOU0ZvbnSiKCpYTlNPYmplY3TTCiwtLi8wXE5TQ29sb3JT + cGFjZVdOU1doaXRlgAoQA0IwANImJzIzV05TQ29sb3KiMirSJic1 + NlxOU0RpY3Rpb25hcnmiNSrSJic4OV8QEk5TQXR0cmlidXRlZFN0 + cmluZ6I6Kl8QEk5TQXR0cmlidXRlZFN0cmluZ18QD05TS2V5ZWRB + cmNoaXZlctE9PlRyb290gAEACAARABoAIwAtADIANwBFAEsAUgBf + AGYAbwBxAHMAdQB/AIYAjgCZAJsAngCgAKIApQCnAKkAsAC4AMEA + yADPANgA2gDcAOUA6AD8AQEBDAEVARwBHwEoAS8BPAFEAUYBSAFL + AVABWAFbAWABbQFwAXUBigGNAaIBtAG3AbwAAAAAAAACAQAAAAAA + AAA/AAAAAAAAAAAAAAAAAAABvg== + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1018 + + + CF$UID + 1033 + + + CF$UID + 1034 + + + CF$UID + 1020 + + + CF$UID + 1035 + + + CF$UID + 1036 + + + NS.objects + + + CF$UID + 1037 + + + CF$UID + 155 + + + CF$UID + 1038 + + + CF$UID + 1040 + + + CF$UID + 155 + + + CF$UID + 155 + + + + IDEActivityReportStringSegmentType + IDEActivityReportStringSegmentDate + IDEActivityReportStringSegmentDateStyle + IDEActivityReportStringSegmentTimeStyle + 3 + + $class + + CF$UID + 1039 + + NS.time + 353943722.61998999 + + + $classes + + NSDate + NSObject + + $classname + NSDate + + Today at 9:42 AM + 234 + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 3 + + + + + $class + + CF$UID + 41 + + NS.keys + + + CF$UID + 1044 + + + CF$UID + 1046 + + + CF$UID + 1048 + + + CF$UID + 1050 + + + CF$UID + 1052 + + + CF$UID + 1054 + + + CF$UID + 1056 + + + CF$UID + 1058 + + + CF$UID + 1060 + + + CF$UID + 1062 + + + CF$UID + 1064 + + + CF$UID + 1066 + + + CF$UID + 1068 + + + CF$UID + 1070 + + + CF$UID + 1072 + + + CF$UID + 1074 + + + CF$UID + 1076 + + + CF$UID + 1078 + + + CF$UID + 1080 + + + CF$UID + 1082 + + + CF$UID + 1084 + + + CF$UID + 1086 + + + CF$UID + 1088 + + + CF$UID + 1090 + + + CF$UID + 1092 + + + CF$UID + 1094 + + + CF$UID + 1096 + + + CF$UID + 1098 + + + CF$UID + 1100 + + + CF$UID + 1101 + + + CF$UID + 1103 + + + CF$UID + 1105 + + + CF$UID + 1107 + + + CF$UID + 970 + + + CF$UID + 1109 + + + CF$UID + 1111 + + + CF$UID + 1113 + + + CF$UID + 1115 + + + CF$UID + 1117 + + + CF$UID + 1119 + + + CF$UID + 1121 + + + CF$UID + 1123 + + + CF$UID + 1125 + + + CF$UID + 1127 + + + CF$UID + 1129 + + + CF$UID + 968 + + + CF$UID + 1131 + + + CF$UID + 1133 + + + CF$UID + 1135 + + + CF$UID + 1137 + + + CF$UID + 1139 + + + CF$UID + 1141 + + + CF$UID + 1143 + + + NS.objects + + + CF$UID + 1145 + + + CF$UID + 1150 + + + CF$UID + 1153 + + + CF$UID + 1156 + + + CF$UID + 1159 + + + CF$UID + 1162 + + + CF$UID + 1167 + + + CF$UID + 1170 + + + CF$UID + 1173 + + + CF$UID + 1176 + + + CF$UID + 1179 + + + CF$UID + 1182 + + + CF$UID + 1185 + + + CF$UID + 1188 + + + CF$UID + 1191 + + + CF$UID + 1194 + + + CF$UID + 1197 + + + CF$UID + 1200 + + + CF$UID + 1203 + + + CF$UID + 1206 + + + CF$UID + 1209 + + + CF$UID + 1212 + + + CF$UID + 1215 + + + CF$UID + 1218 + + + CF$UID + 1221 + + + CF$UID + 1224 + + + CF$UID + 1227 + + + CF$UID + 1230 + + + CF$UID + 1233 + + + CF$UID + 1236 + + + CF$UID + 1239 + + + CF$UID + 1242 + + + CF$UID + 1245 + + + CF$UID + 1248 + + + CF$UID + 1251 + + + CF$UID + 1254 + + + CF$UID + 1257 + + + CF$UID + 1260 + + + CF$UID + 1263 + + + CF$UID + 1266 + + + CF$UID + 1269 + + + CF$UID + 1272 + + + CF$UID + 1275 + + + CF$UID + 1278 + + + CF$UID + 1281 + + + CF$UID + 1284 + + + CF$UID + 1287 + + + CF$UID + 1290 + + + CF$UID + 1293 + + + CF$UID + 1296 + + + CF$UID + 1299 + + + CF$UID + 1302 + + + CF$UID + 1305 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1045 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONChildren.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1047 + + + file://localhost/Users/wallace/Documents/libjson/Testing/Unit/JSONDebug.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1049 + + + file://localhost/Volumes/WALLACE/libjson/Source/JSONChildren.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1051 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestNamespace.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1053 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONMemory.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1055 + + + + $class + + CF$UID + 101 + + NS.string + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestWriter.cpp + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1057 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/makefile + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1059 + + + file://localhost/Users/wallace/Documents/libjson/JSONOptions.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1061 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestComments.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1063 + + + file://localhost/Volumes/WALLACE/libjson/JSONOptions.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1065 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONNode.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1067 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWorker.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1069 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1071 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/main.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1073 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSuite.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1075 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1077 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONMemory.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1079 + + + file://localhost/Users/wallace/Documents/libjson/Dependencies/libbase64++/libbase64++.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1081 + + + file://localhost/Users/wallace/Documents/libjson/libjson.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1083 + + + file://localhost/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1085 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/UStringTest.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1087 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONPreparse.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1089 + + + file://localhost/Users/wallace/Documents/libjson/mempool++/mempool.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1091 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/StringTest.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1093 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/UnitTest.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1095 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWorker.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1097 + + + file://localhost/Users/wallace/Documents/libjson/Testing/Framework/Defines.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1099 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONValidator.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 100 + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1102 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONStream.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1104 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONChildren.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1106 + + + file://localhost/Volumes/WALLACE/libjson/Source/JSONChildren.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1108 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONGlobals.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1110 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/UnitTest.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1112 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONSharedString.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1114 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestString.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1116 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONAllocator.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1118 + + + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1120 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONValidator.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1122 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONStream.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1124 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONPreparse.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1126 + + + file://localhost/Users/wallace/Documents/libjson/Source/NumberToString.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1128 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestChildren.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1130 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestStreams.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1132 + + + file://localhost/Users/wallace/Documents/libjson/Source/libjson.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1134 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONNode.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1136 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSharedString.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1138 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONDefs/Strings_Defs.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1140 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestValidator.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1142 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWriter.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1144 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONDefs.h + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1148 + + + CF$UID + 1149 + + + + width + height + 1139 + 657 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1151 + + + CF$UID + 1152 + + + + 915 + 618 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1154 + + + CF$UID + 1155 + + + + 1042 + 671 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1157 + + + CF$UID + 1158 + + + + 1400 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1160 + + + CF$UID + 1161 + + + + 1400 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1163 + + + CF$UID + 1164 + + + NS.objects + + + CF$UID + 1165 + + + CF$UID + 1166 + + + + width + height + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1168 + + + CF$UID + 1169 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1171 + + + CF$UID + 1172 + + + + 1280 + 604 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1174 + + + CF$UID + 1175 + + + + 967 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1177 + + + CF$UID + 1178 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1180 + + + CF$UID + 1181 + + + + 1141 + 621 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1183 + + + CF$UID + 1184 + + + + 1400 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1186 + + + CF$UID + 1187 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1189 + + + CF$UID + 1190 + + + + 1032 + 626 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1192 + + + CF$UID + 1193 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1195 + + + CF$UID + 1196 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1198 + + + CF$UID + 1199 + + + + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1201 + + + CF$UID + 1202 + + + + 1400 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1204 + + + CF$UID + 1205 + + + + 1120 + 628 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1207 + + + CF$UID + 1208 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1210 + + + CF$UID + 1211 + + + + 946 + 694 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1213 + + + CF$UID + 1214 + + + + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1216 + + + CF$UID + 1217 + + + + 1215 + 689 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1219 + + + CF$UID + 1220 + + + + 1223 + 653 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1222 + + + CF$UID + 1223 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1225 + + + CF$UID + 1226 + + + + 933 + 621 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1228 + + + CF$UID + 1229 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1231 + + + CF$UID + 1232 + + + + 1181 + 692 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1163 + + + CF$UID + 1164 + + + NS.objects + + + CF$UID + 1234 + + + CF$UID + 1235 + + + + 1037 + 620 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1237 + + + CF$UID + 1238 + + + + 1174 + 643 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1240 + + + CF$UID + 1241 + + + + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1243 + + + CF$UID + 1244 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1246 + + + CF$UID + 1247 + + + + 1092 + 611 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1249 + + + CF$UID + 1250 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1252 + + + CF$UID + 1253 + + + + 1112 + 654 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1255 + + + CF$UID + 1256 + + + + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1258 + + + CF$UID + 1259 + + + + 1009 + 628 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1261 + + + CF$UID + 1262 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1264 + + + CF$UID + 1265 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1267 + + + CF$UID + 1268 + + + + 1033 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1270 + + + CF$UID + 1271 + + + + 1198 + 651 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1273 + + + CF$UID + 1274 + + + + 1036 + 653 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1276 + + + CF$UID + 1277 + + + + 1020 + 634 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1279 + + + CF$UID + 1280 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1282 + + + CF$UID + 1283 + + + + 1280 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1285 + + + CF$UID + 1286 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1288 + + + CF$UID + 1289 + + + + 1201 + 682 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1291 + + + CF$UID + 1292 + + + + 1203 + 642 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1294 + + + CF$UID + 1295 + + + + 1121 + 658 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1297 + + + CF$UID + 1298 + + + + 600 + 600 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1300 + + + CF$UID + 1301 + + + + 1140 + 674 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1303 + + + CF$UID + 1304 + + + + 1205 + 606 + + $class + + CF$UID + 37 + + NS.keys + + + CF$UID + 1146 + + + CF$UID + 1147 + + + NS.objects + + + CF$UID + 1306 + + + CF$UID + 1307 + + + + 1001 + 650 + + $class + + CF$UID + 40 + + NS.objects + + + CF$UID + 1309 + + + CF$UID + 1311 + + + CF$UID + 1313 + + + CF$UID + 1315 + + + CF$UID + 1317 + + + CF$UID + 968 + + + CF$UID + 1319 + + + CF$UID + 1321 + + + CF$UID + 1323 + + + CF$UID + 1325 + + + + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1310 + + + file://localhost/Users/wallace/Documents/libjson/Source/internalJSONNode.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1312 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWriter.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1314 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONNode.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1316 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestWriter.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1318 + + + file://localhost/Users/wallace/Documents/libjson/JSONOptions.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1320 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/main.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1322 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestSuite.h + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1324 + + + file://localhost/Users/wallace/Documents/libjson/TestSuite/TestRefCounting.cpp + + $class + + CF$UID + 145 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 1326 + + + file://localhost/Users/wallace/Documents/libjson/Source/JSONWorker.cpp + + $top + + State + + CF$UID + 1 + + + $version + 100000 + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/WorkspaceSettings.xcsettings b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..6ff33e6 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/project.xcworkspace/xcuserdata/wallace.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.mode1v3 b/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.mode1v3 new file mode 100644 index 0000000..f16edce --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.mode1v3 @@ -0,0 +1,1523 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCProjectFormatConflictsModule + Name + Project Format Conflicts List + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + BundleLoadPath + + MaxInstances + n + Module + XCSnapshotModule + Name + Snapshots Tool + + + BundlePath + /Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1v3 + FavBarConfig + + PBXProjectModuleGUID + BA01437612318D6D002575BA + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1v3 + MajorVersion + 33 + MinorVersion + 0 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-combo-popup + action + NSToolbarFlexibleSpaceItem + debugger-enable-breakpoints + build-and-go + com.apple.ide.PBXToolbarStopButton + get-info + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 08FB7794FE84155DC02AAC07 + BA82868212F3BDA4005EAA8B + BA0143C812318DD6002575BA + BA0143DD12318DD6002575BA + BA7F53431470013200FEEA70 + C6859E8C029090F304C91782 + 1AB674ADFE9D54B511CA2CBB + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 79 + 41 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 822}, {186, 572}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 590}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 0 147 1280 631 0 0 1280 778 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + _atof.cpp + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + _atof.cpp + _historyCapacity + 0 + bookmark + BAB34D1314D87C8F006BBCF9 + history + + BA3DA62F12F5DE5300B3D93A + BAFE242113183201007476F0 + BAFE242313183201007476F0 + BAFE242513183201007476F0 + BAFE242C13183201007476F0 + BAFE242E13183201007476F0 + BAFE243013183201007476F0 + BAFE243113183201007476F0 + BAFE243513183201007476F0 + BA41A4C7132D47A1001CD264 + BA4303FA1356361400B50B9A + BA7A111D13C4A5A800EA457F + BA23D50C13C5EC01002845DE + BA23D50D13C5EC01002845DE + BA8B9B5913D1D4E70077C2D5 + BA26B12313D61ED3000D6BA5 + BA0FB57513D62323008CB1E0 + BA29B11A141128AE00A38965 + BAD8EEB614705934003AF000 + BAD8EEB914705934003AF000 + BAD8EEBF14705934003AF000 + BAD8EEC814705934003AF000 + BA2A923F147060BC00609A62 + BA2A9241147060BC00609A62 + BA2A9243147060BC00609A62 + BA2A924F147060BC00609A62 + BAA1138314715B0200166961 + BAA1138414715B0200166961 + BAA1139B14715B0200166961 + BAA115A31471863500166961 + BAA116711471A38600166961 + BAA116D61471AC5000166961 + BAA116D81471AC5000166961 + BA974FA5147493EF00ED1B74 + BA974FA9147493EF00ED1B74 + BAD173EE1475872200592224 + BA3BBF63147E910D004A159D + BA3BBF68147E910D004A159D + BA3BBF69147E910D004A159D + BA3BBF6A147E910D004A159D + BA3BBF6B147E910D004A159D + BA3BBF6D147E910D004A159D + BA3BBF6E147E910D004A159D + BA3BBF6F147E910D004A159D + BA3BBF70147E910D004A159D + BA3BBF71147E910D004A159D + BA3BBF72147E910D004A159D + BA3BBF73147E910D004A159D + BA3BBF75147E910D004A159D + BA3BBF76147E910D004A159D + BA3BBF77147E910D004A159D + BA3BBF78147E910D004A159D + BA3BBF79147E910D004A159D + BA3BBF7A147E910D004A159D + BA3BBF7B147E910D004A159D + BA3BBF7C147E910D004A159D + BA3BBF7D147E910D004A159D + BA3BBF7E147E910D004A159D + BADEA900148BA39E000B4677 + BADEA941148BA95E000B4677 + BADEA942148BA95E000B4677 + BADEA943148BA95E000B4677 + BADEA945148BA95E000B4677 + BADEA946148BA95E000B4677 + BADEA948148BA95E000B4677 + BADEA949148BA95E000B4677 + BADEA96C148BAC96000B4677 + BADEA96E148BAC96000B4677 + BADEA96F148BAC96000B4677 + BADEA970148BAC96000B4677 + BADEA974148BAC96000B4677 + BA468C191490464B00CF4152 + BA15238414924BD700315E01 + BA15238514924BD700315E01 + BA1523BB149250DE00315E01 + BA8413731492589900957089 + BA8413A514925E7900957089 + BA8413F41492648800957089 + BA841418149265E700957089 + BA84142D149266AA00957089 + BA94176314926795003A9A94 + BA94176414926795003A9A94 + BA6A9B5D149293B300E86807 + BA6A9B5F149293B300E86807 + BA6A9B60149293B300E86807 + BA6A9B61149293B300E86807 + BA44ACC51492A7FA00FB2B4C + BA44ACFA1492B4B200FB2B4C + BA44ACFD1492B4B200FB2B4C + BA5D5E051492BC8500FAEDF1 + BAA5DBE81492E2D90089981F + BAD8A0AB1493A8EB005C4908 + BAD8A0AC1493A8EB005C4908 + BAD8A0AE1493A8EB005C4908 + BAD8A0E21493AEDE005C4908 + BAD8A0E31493AEDE005C4908 + BAD8A0E51493AEDE005C4908 + BAD8A0EA1493AEDE005C4908 + BAD8A0F31493AF0B005C4908 + BAD547E114997493002E82BF + BA1A4ABE14BA29D600916DC9 + BA59BFA214BA46A400A0E534 + BAFD7D2614D0769C00B7D679 + BAFD7D2714D0769C00B7D679 + BA2BEDF414D096DC002CF1C4 + BA2BEE1A14D0999E002CF1C4 + BAC8717114D09BC9001FCC02 + BA69DF3C14D09F30000402EE + BA54A62F14D0A23200CB60A8 + BA49A59E14D449760005C0EB + BA49A5B814D44A510005C0EB + BA49A5C714D44AEE0005C0EB + BA49A5D314D44E490005C0EB + BA49A5D414D44E490005C0EB + BA1D640914D470E900D625D6 + BAF8D20314D48ACE00F6CDE6 + BAF8D22D14D48E8C00F6CDE6 + BAF8D22E14D48E8C00F6CDE6 + BAF8D22F14D48E8C00F6CDE6 + BAF8D23014D48E8C00F6CDE6 + BA52A12114D87AF8006575E8 + BAB34D0B14D87C8F006BBCF9 + BAB34D0C14D87C8F006BBCF9 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1072, 585}} + RubberWindowFrame + 0 147 1280 631 0 0 1280 778 + + Module + PBXNavigatorGroup + Proportion + 585pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 590}, {1072, 0}} + RubberWindowFrame + 0 147 1280 631 0 0 1280 778 + + Module + XCDetailModule + Proportion + 0pt + + + Proportion + 1072pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + BAB34D0E14D87C8F006BBCF9 + 1CE0B1FE06471DED0097A5F4 + BAB34D0F14D87C8F006BBCF9 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfigUserDefaultsMinorVersion + 2 + ToolbarConfiguration + xcode.toolbar.config.defaultV3 + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.shortV3 + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarConfigUserDefaultsMinorVersion + 2 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + BAB34D1014D87C8F006BBCF9 + BAB34D1114D87C8F006BBCF9 + 1C78EAAD065D492600B07095 + 1CD10A99069EF8BA00B06720 + BAB34D1214D87C8F006BBCF9 + BA01437712318D6D002575BA + /Users/wallace/Documents/libjson/TestSuite/TestSuite.xcodeproj + + WindowString + 0 147 1280 631 0 0 1280 778 + WindowToolsV3 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + _atof.cpp + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1280, 286}} + RubberWindowFrame + 0 120 1280 658 0 0 1280 778 + + Module + PBXNavigatorGroup + Proportion + 286pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build Results + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 291}, {1280, 326}} + RubberWindowFrame + 0 120 1280 658 0 0 1280 778 + + Module + PBXBuildResultsModule + Proportion + 326pt + + + Proportion + 617pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + BA01437712318D6D002575BA + BAB34CFD14D87C1F006BBCF9 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.buildV3 + WindowContentMinSize + 486 300 + WindowString + 0 120 1280 658 0 0 1280 778 + WindowToolGUID + BA01437712318D6D002575BA + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugger + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {622, 327}} + {{622, 0}, {658, 327}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {1280, 327}} + {{0, 327}, {1280, 290}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {1280, 617}} + PBXDebugSessionStackFrameViewKey + + DebugVariablesTableConfiguration + + Name + 304 + Value + 264 + Summary + 80 + + Frame + {{622, 0}, {658, 327}} + RubberWindowFrame + 0 120 1280 658 0 0 1280 778 + + RubberWindowFrame + 0 120 1280 658 0 0 1280 778 + + Module + PBXDebugSessionModule + Proportion + 617pt + + + Proportion + 617pt + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + + TableOfContents + + 1CD10A99069EF8BA00B06720 + BAB34D0414D87C8D006BBCF9 + 1C162984064C10D400B95A72 + BAB34D0514D87C8D006BBCF9 + BAB34D0614D87C8D006BBCF9 + BAB34D0714D87C8D006BBCF9 + BAB34D0814D87C8D006BBCF9 + BAB34D0914D87C8D006BBCF9 + + ToolbarConfiguration + xcode.toolbar.config.debugV3 + WindowString + 0 120 1280 658 0 0 1280 778 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {842, 323}} + RubberWindowFrame + 351 61 842 717 0 0 1280 778 + + Module + PBXNavigatorGroup + Proportion + 842pt + + + Proportion + 323pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 328}, {842, 348}} + RubberWindowFrame + 351 61 842 717 0 0 1280 778 + + Module + PBXProjectFindModule + Proportion + 348pt + + + Proportion + 676pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + BA1D640614D470E600D625D6 + BA1D640714D470E600D625D6 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 351 61 842 717 0 0 1280 778 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debuggerConsole + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {830, 575}} + RubberWindowFrame + 408 162 830 616 0 0 1280 778 + + Module + PBXDebugCLIModule + Proportion + 575pt + + + Proportion + 575pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + + TableOfContents + + 1C78EAAD065D492600B07095 + BAB34D0A14D87C8D006BBCF9 + 1C78EAAC065D492600B07095 + + ToolbarConfiguration + xcode.toolbar.config.consoleV3 + WindowString + 408 162 830 616 0 0 1280 778 + WindowToolGUID + 1C78EAAD065D492600B07095 + WindowToolIsVisible + + + + Identifier + windowTool.snapshots + Layout + + + Dock + + + Module + XCSnapshotModule + Proportion + 100% + + + Proportion + 100% + + + Name + Snapshots + ServiceClasses + + XCSnapshotModule + + StatusbarIsVisible + Yes + ToolbarConfiguration + xcode.toolbar.config.snapshots + WindowString + 315 824 300 550 0 0 1440 878 + WindowToolIsVisible + Yes + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.0950012207031 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.breakpoints + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C77FABC04509CD000000102 + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + no + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 168 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 1C77FABC04509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {168, 350}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + + GeometryConfiguration + + Frame + {{0, 0}, {185, 368}} + GroupTreeTableConfiguration + + MainColumn + 168 + + RubberWindowFrame + 328 314 744 409 0 0 1280 778 + + Module + PBXSmartGroupTreeModule + Proportion + 185pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CA1AED706398EBD00589147 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{190, 0}, {554, 368}} + RubberWindowFrame + 328 314 744 409 0 0 1280 778 + + Module + XCDetailModule + Proportion + 554pt + + + Proportion + 368pt + + + MajorVersion + 3 + MinorVersion + 0 + Name + Breakpoints + ServiceClasses + + PBXSmartGroupTreeModule + XCDetailModule + + StatusbarIsVisible + + TableOfContents + + BA23D4FF13C5E885002845DE + BA23D50013C5E885002845DE + 1CE0B1FE06471DED0097A5F4 + 1CA1AED706398EBD00589147 + + ToolbarConfiguration + xcode.toolbar.config.breakpointsV3 + WindowString + 328 314 744 409 0 0 1280 778 + WindowToolGUID + BA23D4FF13C5E885002845DE + WindowToolIsVisible + + + + Identifier + windowTool.debugAnimator + Layout + + + Dock + + + Module + PBXNavigatorGroup + Proportion + 100% + + + Proportion + 100% + + + Name + Debug Visualizer + ServiceClasses + + PBXNavigatorGroup + + StatusbarIsVisible + 1 + ToolbarConfiguration + xcode.toolbar.config.debugAnimatorV3 + WindowString + 100 100 700 500 0 0 1280 1002 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.projectFormatConflicts + Layout + + + Dock + + + Module + XCProjectFormatConflictsModule + Proportion + 100% + + + Proportion + 100% + + + Name + Project Format Conflicts + ServiceClasses + + XCProjectFormatConflictsModule + + StatusbarIsVisible + 0 + WindowContentMinSize + 450 300 + WindowString + 50 850 472 307 0 0 1440 877 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.refactoring + IncludeInToolsMenu + 0 + Layout + + + Dock + + + BecomeActive + 1 + GeometryConfiguration + + Frame + {0, 0}, {500, 335} + RubberWindowFrame + {0, 0}, {500, 335} + + Module + XCRefactoringModule + Proportion + 100% + + + Proportion + 100% + + + Name + Refactoring + ServiceClasses + + XCRefactoringModule + + WindowString + 200 200 500 356 0 0 1920 1200 + + + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.pbxuser b/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.pbxuser new file mode 100644 index 0000000..38b9190 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/wallace.pbxuser @@ -0,0 +1,2465 @@ +// !$*UTF8*$! +{ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = BA01437012318D69002575BA /* TestSuite */; + activeTarget = 8DD76F620486A84900D96B5E /* TestSuite */; + addToTargets = ( + 8DD76F620486A84900D96B5E /* TestSuite */, + ); + breakpoints = ( + ); + codeSenseManager = BA01437A12318D6D002575BA /* Code sense */; + executables = ( + BA01437012318D69002575BA /* TestSuite */, + ); + perUserDictionary = { + "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 20, + 198, + 20, + 99, + 99, + 29, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXBreakpointsDataSource_ActionID, + PBXBreakpointsDataSource_TypeID, + PBXBreakpointsDataSource_BreakpointID, + PBXBreakpointsDataSource_UseID, + PBXBreakpointsDataSource_LocationID, + PBXBreakpointsDataSource_ConditionID, + PBXBreakpointsDataSource_IgnoreCountID, + PBXBreakpointsDataSource_ContinueID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 848, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 375, + 60, + 20, + 48.16259765625, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 349731775; + PBXWorkspaceStateSaveDate = 349731775; + }; + perUserProjectItems = { + BA0FB57513D62323008CB1E0 /* PBXTextBookmark */ = BA0FB57513D62323008CB1E0 /* PBXTextBookmark */; + BA15238414924BD700315E01 /* PBXTextBookmark */ = BA15238414924BD700315E01 /* PBXTextBookmark */; + BA15238514924BD700315E01 /* PBXTextBookmark */ = BA15238514924BD700315E01 /* PBXTextBookmark */; + BA1523BB149250DE00315E01 /* PBXTextBookmark */ = BA1523BB149250DE00315E01 /* PBXTextBookmark */; + BA1A4ABE14BA29D600916DC9 /* PBXTextBookmark */ = BA1A4ABE14BA29D600916DC9 /* PBXTextBookmark */; + BA1D640914D470E900D625D6 /* PBXTextBookmark */ = BA1D640914D470E900D625D6 /* PBXTextBookmark */; + BA23D50C13C5EC01002845DE /* PBXTextBookmark */ = BA23D50C13C5EC01002845DE /* PBXTextBookmark */; + BA23D50D13C5EC01002845DE /* PBXTextBookmark */ = BA23D50D13C5EC01002845DE /* PBXTextBookmark */; + BA26B12313D61ED3000D6BA5 /* PBXTextBookmark */ = BA26B12313D61ED3000D6BA5 /* PBXTextBookmark */; + BA29B11A141128AE00A38965 /* PBXTextBookmark */ = BA29B11A141128AE00A38965 /* PBXTextBookmark */; + BA2A923F147060BC00609A62 /* PBXTextBookmark */ = BA2A923F147060BC00609A62 /* PBXTextBookmark */; + BA2A9241147060BC00609A62 /* PBXTextBookmark */ = BA2A9241147060BC00609A62 /* PBXTextBookmark */; + BA2A9243147060BC00609A62 /* PBXTextBookmark */ = BA2A9243147060BC00609A62 /* PBXTextBookmark */; + BA2A924F147060BC00609A62 /* PBXTextBookmark */ = BA2A924F147060BC00609A62 /* PBXTextBookmark */; + BA2BEDF414D096DC002CF1C4 /* PBXTextBookmark */ = BA2BEDF414D096DC002CF1C4 /* PBXTextBookmark */; + BA2BEE1A14D0999E002CF1C4 /* PBXTextBookmark */ = BA2BEE1A14D0999E002CF1C4 /* PBXTextBookmark */; + BA3BBF63147E910D004A159D /* PBXTextBookmark */ = BA3BBF63147E910D004A159D /* PBXTextBookmark */; + BA3BBF68147E910D004A159D /* PBXTextBookmark */ = BA3BBF68147E910D004A159D /* PBXTextBookmark */; + BA3BBF69147E910D004A159D /* PBXTextBookmark */ = BA3BBF69147E910D004A159D /* PBXTextBookmark */; + BA3BBF6A147E910D004A159D /* PBXTextBookmark */ = BA3BBF6A147E910D004A159D /* PBXTextBookmark */; + BA3BBF6B147E910D004A159D /* PBXTextBookmark */ = BA3BBF6B147E910D004A159D /* PBXTextBookmark */; + BA3BBF6D147E910D004A159D /* PBXTextBookmark */ = BA3BBF6D147E910D004A159D /* PBXTextBookmark */; + BA3BBF6E147E910D004A159D /* PBXTextBookmark */ = BA3BBF6E147E910D004A159D /* PBXTextBookmark */; + BA3BBF6F147E910D004A159D /* PBXTextBookmark */ = BA3BBF6F147E910D004A159D /* PBXTextBookmark */; + BA3BBF70147E910D004A159D /* PBXTextBookmark */ = BA3BBF70147E910D004A159D /* PBXTextBookmark */; + BA3BBF71147E910D004A159D /* PBXTextBookmark */ = BA3BBF71147E910D004A159D /* PBXTextBookmark */; + BA3BBF72147E910D004A159D /* PBXTextBookmark */ = BA3BBF72147E910D004A159D /* PBXTextBookmark */; + BA3BBF73147E910D004A159D /* PBXTextBookmark */ = BA3BBF73147E910D004A159D /* PBXTextBookmark */; + BA3BBF75147E910D004A159D /* PBXTextBookmark */ = BA3BBF75147E910D004A159D /* PBXTextBookmark */; + BA3BBF76147E910D004A159D /* PBXTextBookmark */ = BA3BBF76147E910D004A159D /* PBXTextBookmark */; + BA3BBF77147E910D004A159D /* PBXTextBookmark */ = BA3BBF77147E910D004A159D /* PBXTextBookmark */; + BA3BBF78147E910D004A159D /* PBXTextBookmark */ = BA3BBF78147E910D004A159D /* PBXTextBookmark */; + BA3BBF79147E910D004A159D /* PBXTextBookmark */ = BA3BBF79147E910D004A159D /* PBXTextBookmark */; + BA3BBF7A147E910D004A159D /* PBXTextBookmark */ = BA3BBF7A147E910D004A159D /* PBXTextBookmark */; + BA3BBF7B147E910D004A159D /* PBXTextBookmark */ = BA3BBF7B147E910D004A159D /* PBXTextBookmark */; + BA3BBF7C147E910D004A159D /* PBXTextBookmark */ = BA3BBF7C147E910D004A159D /* PBXTextBookmark */; + BA3BBF7D147E910D004A159D /* PBXTextBookmark */ = BA3BBF7D147E910D004A159D /* PBXTextBookmark */; + BA3BBF7E147E910D004A159D /* PBXTextBookmark */ = BA3BBF7E147E910D004A159D /* PBXTextBookmark */; + BA3DA62F12F5DE5300B3D93A /* PBXTextBookmark */ = BA3DA62F12F5DE5300B3D93A /* PBXTextBookmark */; + BA41A4C7132D47A1001CD264 /* PBXTextBookmark */ = BA41A4C7132D47A1001CD264 /* PBXTextBookmark */; + BA4303FA1356361400B50B9A /* PBXTextBookmark */ = BA4303FA1356361400B50B9A /* PBXTextBookmark */; + BA44ACC51492A7FA00FB2B4C /* PBXTextBookmark */ = BA44ACC51492A7FA00FB2B4C /* PBXTextBookmark */; + BA44ACFA1492B4B200FB2B4C /* PBXTextBookmark */ = BA44ACFA1492B4B200FB2B4C /* PBXTextBookmark */; + BA44ACFD1492B4B200FB2B4C /* PBXTextBookmark */ = BA44ACFD1492B4B200FB2B4C /* PBXTextBookmark */; + BA468C191490464B00CF4152 /* PBXTextBookmark */ = BA468C191490464B00CF4152 /* PBXTextBookmark */; + BA49A59E14D449760005C0EB /* PBXTextBookmark */ = BA49A59E14D449760005C0EB /* PBXTextBookmark */; + BA49A5B814D44A510005C0EB /* PBXTextBookmark */ = BA49A5B814D44A510005C0EB /* PBXTextBookmark */; + BA49A5C714D44AEE0005C0EB /* PBXTextBookmark */ = BA49A5C714D44AEE0005C0EB /* PBXTextBookmark */; + BA49A5D314D44E490005C0EB /* PBXTextBookmark */ = BA49A5D314D44E490005C0EB /* PBXTextBookmark */; + BA49A5D414D44E490005C0EB /* PBXTextBookmark */ = BA49A5D414D44E490005C0EB /* PBXTextBookmark */; + BA52A12114D87AF8006575E8 /* PBXTextBookmark */ = BA52A12114D87AF8006575E8 /* PBXTextBookmark */; + BA54A62F14D0A23200CB60A8 /* PBXTextBookmark */ = BA54A62F14D0A23200CB60A8 /* PBXTextBookmark */; + BA59BFA214BA46A400A0E534 /* PBXTextBookmark */ = BA59BFA214BA46A400A0E534 /* PBXTextBookmark */; + BA5D5E051492BC8500FAEDF1 /* PBXTextBookmark */ = BA5D5E051492BC8500FAEDF1 /* PBXTextBookmark */; + BA69DF3C14D09F30000402EE /* PBXTextBookmark */ = BA69DF3C14D09F30000402EE /* PBXTextBookmark */; + BA6A9B5D149293B300E86807 /* PBXTextBookmark */ = BA6A9B5D149293B300E86807 /* PBXTextBookmark */; + BA6A9B5F149293B300E86807 /* PBXTextBookmark */ = BA6A9B5F149293B300E86807 /* PBXTextBookmark */; + BA6A9B60149293B300E86807 /* PBXTextBookmark */ = BA6A9B60149293B300E86807 /* PBXTextBookmark */; + BA6A9B61149293B300E86807 /* PBXTextBookmark */ = BA6A9B61149293B300E86807 /* PBXTextBookmark */; + BA7A111D13C4A5A800EA457F /* PBXTextBookmark */ = BA7A111D13C4A5A800EA457F /* PBXTextBookmark */; + BA8413731492589900957089 /* PBXTextBookmark */ = BA8413731492589900957089 /* PBXTextBookmark */; + BA8413A514925E7900957089 /* PBXTextBookmark */ = BA8413A514925E7900957089 /* PBXTextBookmark */; + BA8413F41492648800957089 /* PBXTextBookmark */ = BA8413F41492648800957089 /* PBXTextBookmark */; + BA841418149265E700957089 /* PBXTextBookmark */ = BA841418149265E700957089 /* PBXTextBookmark */; + BA84142D149266AA00957089 /* PBXTextBookmark */ = BA84142D149266AA00957089 /* PBXTextBookmark */; + BA8B9B5913D1D4E70077C2D5 /* PBXTextBookmark */ = BA8B9B5913D1D4E70077C2D5 /* PBXTextBookmark */; + BA94176314926795003A9A94 /* PBXTextBookmark */ = BA94176314926795003A9A94 /* PBXTextBookmark */; + BA94176414926795003A9A94 /* PBXTextBookmark */ = BA94176414926795003A9A94 /* PBXTextBookmark */; + BA974FA5147493EF00ED1B74 /* PBXTextBookmark */ = BA974FA5147493EF00ED1B74 /* PBXTextBookmark */; + BA974FA9147493EF00ED1B74 /* PBXTextBookmark */ = BA974FA9147493EF00ED1B74 /* PBXTextBookmark */; + BAA1138314715B0200166961 /* PBXTextBookmark */ = BAA1138314715B0200166961 /* PBXTextBookmark */; + BAA1138414715B0200166961 /* PBXTextBookmark */ = BAA1138414715B0200166961 /* PBXTextBookmark */; + BAA1139B14715B0200166961 /* PBXTextBookmark */ = BAA1139B14715B0200166961 /* PBXTextBookmark */; + BAA115A31471863500166961 /* PBXTextBookmark */ = BAA115A31471863500166961 /* PBXTextBookmark */; + BAA116711471A38600166961 /* PBXTextBookmark */ = BAA116711471A38600166961 /* PBXTextBookmark */; + BAA116D61471AC5000166961 /* PBXTextBookmark */ = BAA116D61471AC5000166961 /* PBXTextBookmark */; + BAA116D81471AC5000166961 /* PBXTextBookmark */ = BAA116D81471AC5000166961 /* PBXTextBookmark */; + BAA5DBE81492E2D90089981F /* PBXTextBookmark */ = BAA5DBE81492E2D90089981F /* PBXTextBookmark */; + BAB34D0B14D87C8F006BBCF9 /* PBXTextBookmark */ = BAB34D0B14D87C8F006BBCF9 /* PBXTextBookmark */; + BAB34D0C14D87C8F006BBCF9 /* XCBuildMessageTextBookmark */ = BAB34D0C14D87C8F006BBCF9 /* XCBuildMessageTextBookmark */; + BAB34D1314D87C8F006BBCF9 /* PBXTextBookmark */ = BAB34D1314D87C8F006BBCF9 /* PBXTextBookmark */; + BAC8717114D09BC9001FCC02 /* PBXTextBookmark */ = BAC8717114D09BC9001FCC02 /* PBXTextBookmark */; + BAD173EE1475872200592224 /* PBXTextBookmark */ = BAD173EE1475872200592224 /* PBXTextBookmark */; + BAD547E114997493002E82BF /* PBXTextBookmark */ = BAD547E114997493002E82BF /* PBXTextBookmark */; + BAD8A0AB1493A8EB005C4908 /* PBXTextBookmark */ = BAD8A0AB1493A8EB005C4908 /* PBXTextBookmark */; + BAD8A0AC1493A8EB005C4908 /* PBXTextBookmark */ = BAD8A0AC1493A8EB005C4908 /* PBXTextBookmark */; + BAD8A0AE1493A8EB005C4908 /* PBXTextBookmark */ = BAD8A0AE1493A8EB005C4908 /* PBXTextBookmark */; + BAD8A0E21493AEDE005C4908 /* PBXTextBookmark */ = BAD8A0E21493AEDE005C4908 /* PBXTextBookmark */; + BAD8A0E31493AEDE005C4908 /* PBXTextBookmark */ = BAD8A0E31493AEDE005C4908 /* PBXTextBookmark */; + BAD8A0E51493AEDE005C4908 /* PBXTextBookmark */ = BAD8A0E51493AEDE005C4908 /* PBXTextBookmark */; + BAD8A0EA1493AEDE005C4908 /* PBXTextBookmark */ = BAD8A0EA1493AEDE005C4908 /* PBXTextBookmark */; + BAD8A0F31493AF0B005C4908 /* PBXTextBookmark */ = BAD8A0F31493AF0B005C4908 /* PBXTextBookmark */; + BAD8EEB614705934003AF000 /* PBXTextBookmark */ = BAD8EEB614705934003AF000 /* PBXTextBookmark */; + BAD8EEB914705934003AF000 /* PBXTextBookmark */ = BAD8EEB914705934003AF000 /* PBXTextBookmark */; + BAD8EEBF14705934003AF000 /* PBXTextBookmark */ = BAD8EEBF14705934003AF000 /* PBXTextBookmark */; + BAD8EEC814705934003AF000 /* PBXTextBookmark */ = BAD8EEC814705934003AF000 /* PBXTextBookmark */; + BADEA900148BA39E000B4677 /* PBXTextBookmark */ = BADEA900148BA39E000B4677 /* PBXTextBookmark */; + BADEA941148BA95E000B4677 /* PBXTextBookmark */ = BADEA941148BA95E000B4677 /* PBXTextBookmark */; + BADEA942148BA95E000B4677 /* PBXTextBookmark */ = BADEA942148BA95E000B4677 /* PBXTextBookmark */; + BADEA943148BA95E000B4677 /* PBXTextBookmark */ = BADEA943148BA95E000B4677 /* PBXTextBookmark */; + BADEA945148BA95E000B4677 /* PBXTextBookmark */ = BADEA945148BA95E000B4677 /* PBXTextBookmark */; + BADEA946148BA95E000B4677 /* PBXTextBookmark */ = BADEA946148BA95E000B4677 /* PBXTextBookmark */; + BADEA948148BA95E000B4677 /* PBXTextBookmark */ = BADEA948148BA95E000B4677 /* PBXTextBookmark */; + BADEA949148BA95E000B4677 /* PBXTextBookmark */ = BADEA949148BA95E000B4677 /* PBXTextBookmark */; + BADEA96C148BAC96000B4677 /* PBXTextBookmark */ = BADEA96C148BAC96000B4677 /* PBXTextBookmark */; + BADEA96E148BAC96000B4677 /* PBXTextBookmark */ = BADEA96E148BAC96000B4677 /* PBXTextBookmark */; + BADEA96F148BAC96000B4677 /* PBXTextBookmark */ = BADEA96F148BAC96000B4677 /* PBXTextBookmark */; + BADEA970148BAC96000B4677 /* PBXTextBookmark */ = BADEA970148BAC96000B4677 /* PBXTextBookmark */; + BADEA974148BAC96000B4677 /* PBXTextBookmark */ = BADEA974148BAC96000B4677 /* PBXTextBookmark */; + BAF8D20314D48ACE00F6CDE6 /* PBXTextBookmark */ = BAF8D20314D48ACE00F6CDE6 /* PBXTextBookmark */; + BAF8D22D14D48E8C00F6CDE6 /* PBXTextBookmark */ = BAF8D22D14D48E8C00F6CDE6 /* PBXTextBookmark */; + BAF8D22E14D48E8C00F6CDE6 /* PBXTextBookmark */ = BAF8D22E14D48E8C00F6CDE6 /* PBXTextBookmark */; + BAF8D22F14D48E8C00F6CDE6 /* PBXTextBookmark */ = BAF8D22F14D48E8C00F6CDE6 /* PBXTextBookmark */; + BAF8D23014D48E8C00F6CDE6 /* PBXTextBookmark */ = BAF8D23014D48E8C00F6CDE6 /* PBXTextBookmark */; + BAFD7D2614D0769C00B7D679 /* PBXTextBookmark */ = BAFD7D2614D0769C00B7D679 /* PBXTextBookmark */; + BAFD7D2714D0769C00B7D679 /* PBXTextBookmark */ = BAFD7D2714D0769C00B7D679 /* PBXTextBookmark */; + BAFE242113183201007476F0 /* PBXTextBookmark */ = BAFE242113183201007476F0 /* PBXTextBookmark */; + BAFE242313183201007476F0 /* PBXTextBookmark */ = BAFE242313183201007476F0 /* PBXTextBookmark */; + BAFE242513183201007476F0 /* PBXTextBookmark */ = BAFE242513183201007476F0 /* PBXTextBookmark */; + BAFE242C13183201007476F0 /* PBXTextBookmark */ = BAFE242C13183201007476F0 /* PBXTextBookmark */; + BAFE242E13183201007476F0 /* PBXTextBookmark */ = BAFE242E13183201007476F0 /* PBXTextBookmark */; + BAFE243013183201007476F0 /* PBXTextBookmark */ = BAFE243013183201007476F0 /* PBXTextBookmark */; + BAFE243113183201007476F0 /* PBXTextBookmark */ = BAFE243113183201007476F0 /* PBXTextBookmark */; + BAFE243513183201007476F0 /* PBXTextBookmark */ = BAFE243513183201007476F0 /* PBXTextBookmark */; + }; + sourceControlManager = BA01437912318D6D002575BA /* Source Control */; + userBuildSettings = { + }; + }; + 8DD76F620486A84900D96B5E /* TestSuite */ = { + activeExec = 0; + executables = ( + BA01437012318D69002575BA /* TestSuite */, + ); + }; + BA01437012318D69002575BA /* TestSuite */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 0; + configStateDict = { + }; + customDataFormattersEnabled = 1; + dataTipCustomDataFormattersEnabled = 1; + dataTipShowTypeColumn = 1; + dataTipSortType = 0; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 1; + name = TestSuite; + savedGlobals = { + }; + showTypeColumn = 0; + sourceDirectories = ( + ); + variableFormatDictionary = { + }; + }; + BA01437912318D6D002575BA /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + scmConfiguration = { + repositoryNamesForRoots = { + "" = ""; + }; + }; + }; + BA01437A12318D6D002575BA /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + BA0143C612318DD6002575BA /* JSONOptions.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1206, 586}}"; + sepNavSelRange = "{98, 0}"; + sepNavVisRange = "{0, 106}"; + sepNavWindowFrame = "{{15, 60}, {1265, 714}}"; + }; + }; + BA0143C712318DD6002575BA /* libjson.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1167, 4641}}"; + sepNavSelRange = "{8819, 0}"; + sepNavVisRange = "{7992, 1819}"; + sepNavWindowFrame = "{{37, 64}, {1226, 714}}"; + }; + }; + BA0143C912318DD6002575BA /* internalJSONNode.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1206, 10751}}"; + sepNavSelRange = "{24817, 0}"; + sepNavVisRange = "{24484, 1661}"; + sepNavWindowFrame = "{{15, 64}, {1265, 714}}"; + }; + }; + BA0143CA12318DD6002575BA /* internalJSONNode.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1055, 6682}}"; + sepNavSelRange = "{3247, 0}"; + sepNavVisRange = "{9485, 1156}"; + sepNavWindowFrame = "{{15, 64}, {1265, 714}}"; + }; + }; + BA0143CB12318DD6002575BA /* JSON_Base64.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1979, 1638}}"; + sepNavSelRange = "{4250, 0}"; + sepNavVisRange = "{3677, 1604}"; + sepNavWindowFrame = "{{190, 60}, {1143, 718}}"; + }; + }; + BA0143CC12318DD6002575BA /* JSON_Base64.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{442, 0}"; + sepNavVisRange = "{0, 442}"; + sepNavWindowFrame = "{{15, 60}, {1143, 718}}"; + }; + }; + BA0143CD12318DD6002575BA /* JSONChildren.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1248}}"; + sepNavSelRange = "{3615, 0}"; + sepNavVisRange = "{1865, 1755}"; + sepNavWindowFrame = "{{1344, -2}, {1265, 714}}"; + }; + }; + BA0143CE12318DD6002575BA /* JSONChildren.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1083, 4576}}"; + sepNavSelRange = "{4399, 0}"; + sepNavVisRange = "{268, 1461}"; + sepNavWindowFrame = "{{15, 60}, {1265, 718}}"; + }; + }; + BA0143CF12318DD6002575BA /* JSONDebug.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1020, 819}}"; + sepNavSelRange = "{30, 10}"; + sepNavVisRange = "{0, 1335}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143D012318DD6002575BA /* JSONDebug.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1729}}"; + sepNavSelRange = "{3649, 16}"; + sepNavVisRange = "{2542, 1298}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143D112318DD6002575BA /* JSONDefs.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1084, 2444}}"; + sepNavSelRange = "{4188, 6}"; + sepNavVisRange = "{3516, 1115}"; + sepNavWindowFrame = "{{137, 60}, {1143, 714}}"; + }; + }; + BA0143D212318DD6002575BA /* JSONIterators.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 2769}}"; + sepNavSelRange = "{9889, 0}"; + sepNavVisRange = "{0, 1424}"; + sepNavWindowFrame = "{{15, 58}, {1226, 720}}"; + }; + }; + BA0143D312318DD6002575BA /* JSONMemory.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 1924}}"; + sepNavSelRange = "{3128, 0}"; + sepNavVisRange = "{3839, 1209}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143D412318DD6002575BA /* JSONMemory.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 2314}}"; + sepNavSelRange = "{5462, 0}"; + sepNavVisRange = "{5283, 361}"; + sepNavWindowFrame = "{{63, 60}, {1143, 718}}"; + }; + }; + BA0143D512318DD6002575BA /* JSONNode.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1206, 4524}}"; + sepNavSelRange = "{9357, 12}"; + sepNavVisRange = "{10991, 1294}"; + sepNavWindowFrame = "{{15, 60}, {1265, 714}}"; + }; + }; + BA0143D612318DD6002575BA /* JSONNode.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1202, 12623}}"; + sepNavSelRange = "{24524, 19}"; + sepNavVisRange = "{17305, 2657}"; + sepNavWindowFrame = "{{15, 60}, {1265, 714}}"; + }; + }; + BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 2600}}"; + sepNavSelRange = "{404, 0}"; + sepNavVisRange = "{0, 1175}"; + sepNavWindowFrame = "{{1501, 28}, {1265, 718}}"; + }; + }; + BA0143D812318DD6002575BA /* JSONWorker.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1636, 8944}}"; + sepNavSelRange = "{23305, 11}"; + sepNavVisRange = "{22169, 2653}"; + sepNavWindowFrame = "{{137, 64}, {1143, 714}}"; + }; + }; + BA0143D912318DD6002575BA /* JSONWorker.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1027, 923}}"; + sepNavSelRange = "{1241, 0}"; + sepNavVisRange = "{1172, 2004}"; + sepNavWindowFrame = "{{137, 60}, {1143, 714}}"; + }; + }; + BA0143DA12318DD6002575BA /* JSONWriter.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 3289}}"; + sepNavSelRange = "{9016, 0}"; + sepNavVisRange = "{8727, 625}"; + sepNavWindowFrame = "{{291, 64}, {1143, 714}}"; + }; + }; + BA0143DB12318DD6002575BA /* libjson.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1097, 7800}}"; + sepNavSelRange = "{9573, 0}"; + sepNavVisRange = "{8608, 1681}"; + sepNavWindowFrame = "{{54, 60}, {1226, 714}}"; + }; + }; + BA0143DC12318DD6002575BA /* NumberToString.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {858, 7124}}"; + sepNavSelRange = "{49, 0}"; + sepNavVisRange = "{1939, 1225}"; + sepNavWindowFrame = "{{363, 65}, {917, 713}}"; + }; + }; + BA0143EE12318DD6002575BA /* main.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {831, 1794}}"; + sepNavSelRange = "{3438, 0}"; + sepNavVisRange = "{2293, 1145}"; + sepNavWindowFrame = "{{183, 62}, {818, 714}}"; + }; + }; + BA0143EF12318DD6002575BA /* TestAssign.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1989}}"; + sepNavSelRange = "{0, 92}"; + sepNavVisRange = "{0, 1325}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143F012318DD6002575BA /* TestChildren.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 4498}}"; + sepNavSelRange = "{3041, 53}"; + sepNavVisRange = "{2889, 1309}"; + sepNavWindowFrame = "{{15, 64}, {1265, 714}}"; + }; + }; + BA0143F112318DD6002575BA /* TestComments.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1328, 5473}}"; + sepNavSelRange = "{17996, 0}"; + sepNavVisRange = "{15868, 2141}"; + sepNavWindowFrame = "{{15, 60}, {917, 713}}"; + }; + }; + BA0143F212318DD6002575BA /* TestConverters.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {781, 2236}}"; + sepNavSelRange = "{11535, 0}"; + sepNavVisRange = "{4552, 993}"; + sepNavWindowFrame = "{{462, 60}, {818, 718}}"; + }; + }; + BA0143F312318DD6002575BA /* TestCtors.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1534}}"; + sepNavSelRange = "{680, 0}"; + sepNavVisRange = "{96, 1368}"; + sepNavWindowFrame = "{{15, 60}, {917, 713}}"; + }; + }; + BA0143F412318DD6002575BA /* TestEquality.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {698, 1326}}"; + sepNavSelRange = "{2662, 0}"; + sepNavVisRange = "{0, 1361}"; + sepNavWindowFrame = "{{15, 60}, {917, 713}}"; + }; + }; + BA0143F512318DD6002575BA /* TestFunctions.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {747, 3354}}"; + sepNavSelRange = "{7292, 0}"; + sepNavVisRange = "{0, 1607}"; + sepNavWindowFrame = "{{169, 65}, {917, 713}}"; + }; + }; + BA0143F612318DD6002575BA /* TestInequality.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {639, 1027}}"; + sepNavSelRange = "{2323, 0}"; + sepNavVisRange = "{965, 1358}"; + sepNavWindowFrame = "{{15, 60}, {917, 713}}"; + }; + }; + BA0143F712318DD6002575BA /* TestInspectors.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1084, 4888}}"; + sepNavSelRange = "{9056, 0}"; + sepNavVisRange = "{8608, 1785}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143F812318DD6002575BA /* TestIterators.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {761, 10790}}"; + sepNavSelRange = "{32574, 0}"; + sepNavVisRange = "{16322, 1684}"; + sepNavWindowFrame = "{{348, 58}, {818, 720}}"; + }; + }; + BA0143F912318DD6002575BA /* TestMutex.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {789, 4446}}"; + sepNavSelRange = "{4893, 0}"; + sepNavVisRange = "{4149, 1619}"; + sepNavWindowFrame = "{{407, 58}, {1265, 720}}"; + }; + }; + BA0143FA12318DD6002575BA /* TestNamespace.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1084, 3783}}"; + sepNavSelRange = "{6626, 0}"; + sepNavVisRange = "{4925, 1856}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BA0143FB12318DD6002575BA /* TestRefCounting.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {852, 1716}}"; + sepNavSelRange = "{3426, 32}"; + sepNavVisRange = "{2625, 1394}"; + sepNavWindowFrame = "{{15, 58}, {1143, 720}}"; + }; + }; + BA0143FD12318DD6002575BA /* TestSuite.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1027}}"; + sepNavSelRange = "{2275, 415}"; + sepNavVisRange = "{809, 1882}"; + sepNavWindowFrame = "{{28, 83}, {1252, 695}}"; + }; + }; + BA0143FE12318DD6002575BA /* TestSuite.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1495}}"; + sepNavSelRange = "{3121, 0}"; + sepNavVisRange = "{2103, 1064}"; + sepNavWindowFrame = "{{28, 83}, {1252, 695}}"; + }; + }; + BA01440212318DD6002575BA /* TestWriter.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1538, 2002}}"; + sepNavSelRange = "{6301, 0}"; + sepNavVisRange = "{5481, 2006}"; + sepNavWindowFrame = "{{137, 64}, {1143, 714}}"; + }; + }; + BA01440312318DD6002575BA /* UnitTest.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1454, 2262}}"; + sepNavSelRange = "{4831, 0}"; + sepNavVisRange = "{4466, 601}"; + sepNavWindowFrame = "{{28, 83}, {1252, 695}}"; + }; + }; + BA01440412318DD6002575BA /* UnitTest.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1193, 2990}}"; + sepNavSelRange = "{3212, 0}"; + sepNavVisRange = "{2391, 961}"; + sepNavWindowFrame = "{{28, 83}, {1252, 695}}"; + }; + }; + BA07EB2F12C8DF7E001AE448 /* JSONStream.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1027, 1196}}"; + sepNavSelRange = "{1434, 5}"; + sepNavVisRange = "{1039, 1288}"; + sepNavWindowFrame = "{{275, 65}, {917, 713}}"; + }; + }; + BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1594, 1859}}"; + sepNavSelRange = "{2430, 0}"; + sepNavVisRange = "{2655, 1610}"; + sepNavWindowFrame = "{{275, 65}, {917, 713}}"; + }; + }; + BA07EB3C12C8E402001AE448 /* TestStreams.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {858, 2236}}"; + sepNavSelRange = "{4875, 0}"; + sepNavVisRange = "{3734, 1250}"; + sepNavWindowFrame = "{{345, 65}, {917, 713}}"; + }; + }; + BA0FB57513D62323008CB1E0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA82868912F3BE63005EAA8B /* GNU_C.h */; + name = "GNU_C.h: 50"; + rLen = 16; + rLoc = 1621; + rType = 0; + vrLen = 1516; + vrLoc = 278; + }; + BA15238414924BD700315E01 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */; + name = "JSONStream.cpp: 66"; + rLen = 0; + rLoc = 1622; + rType = 0; + vrLen = 1637; + vrLoc = 1561; + }; + BA15238514924BD700315E01 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAD89A2A128F00BB00E1D300 /* TestString.cpp */; + name = "TestString.cpp: 172"; + rLen = 0; + rLoc = 3823; + rType = 0; + vrLen = 1261; + vrLoc = 3284; + }; + BA1523BB149250DE00315E01 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143FA12318DD6002575BA /* TestNamespace.cpp */; + name = "TestNamespace.cpp: 275"; + rLen = 130; + rLoc = 11302; + rType = 0; + vrLen = 1680; + vrLoc = 9361; + }; + BA1A4ABE14BA29D600916DC9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CF12318DD6002575BA /* JSONDebug.cpp */; + name = "JSONDebug.cpp: 2"; + rLen = 10; + rLoc = 30; + rType = 0; + vrLen = 1335; + vrLoc = 0; + }; + BA1D640914D470E900D625D6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA1D640A14D470E900D625D6 /* JSONOptions.h */; + name = "JSONOptions.h: 82"; + rLen = 0; + rLoc = 2732; + rType = 0; + vrLen = 1279; + vrLoc = 2092; + }; + BA1D640A14D470E900D625D6 /* JSONOptions.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = JSONOptions.h; + path = /Users/wallace/Documents/JSONOptions.h; + sourceTree = ""; + }; + BA23D50C13C5EC01002845DE /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F212318DD6002575BA /* TestConverters.cpp */; + name = "TestConverters.cpp: 205"; + rLen = 0; + rLoc = 11560; + rType = 0; + vrLen = 2506; + vrLoc = 9053; + }; + BA23D50D13C5EC01002845DE /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143FB12318DD6002575BA /* TestRefCounting.cpp */; + name = "TestRefCounting.cpp: 110"; + rLen = 32; + rLoc = 3426; + rType = 0; + vrLen = 1394; + vrLoc = 2625; + }; + BA24981313C4F8880021B041 /* JSONAllocator.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 1027}}"; + sepNavSelRange = "{1471, 0}"; + sepNavVisRange = "{1015, 878}"; + sepNavWindowFrame = "{{103, 60}, {1177, 646}}"; + }; + }; + BA24981413C4F8880021B041 /* JSONAllocator.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{28, 63}"; + sepNavVisRange = "{0, 998}"; + sepNavWindowFrame = "{{310, 132}, {1177, 646}}"; + }; + }; + BA26B12313D61ED3000D6BA5 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA82868A12F3BE76005EAA8B /* Unknown_C.h */; + name = "Unknown_C.h: 22"; + rLen = 0; + rLoc = 540; + rType = 0; + vrLen = 559; + vrLoc = 0; + }; + BA29B11A141128AE00A38965 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA87012140FC4D20088B03B /* mempool.h */; + name = "mempool.h: 1003"; + rLen = 0; + rLoc = 27362; + rType = 0; + vrLen = 2510; + vrLoc = 5922; + }; + BA2A923014705B8B00609A62 /* securityTest.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{235, 0}"; + sepNavVisRange = "{0, 318}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA2A923114705B8B00609A62 /* securityTest.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{101, 0}"; + sepNavVisRange = "{0, 758}"; + }; + }; + BA2A923F147060BC00609A62 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */; + name = "isValidNamedObject.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 185; + vrLoc = 0; + }; + BA2A9241147060BC00609A62 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539914701E9D00FEEA70 /* isValidObject.cpp */; + name = "isValidObject.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 175; + vrLoc = 0; + }; + BA2A9243147060BC00609A62 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */; + name = "isValidArray.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 173; + vrLoc = 0; + }; + BA2A924F147060BC00609A62 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BABED9AD12C931230047E2DF /* TestBinary.cpp */; + name = "TestBinary.cpp: 17"; + rLen = 0; + rLoc = 973; + rType = 0; + vrLen = 1641; + vrLoc = 0; + }; + BA2BEDF414D096DC002CF1C4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143DB12318DD6002575BA /* libjson.cpp */; + name = "libjson.cpp: 259"; + rLen = 0; + rLoc = 9573; + rType = 0; + vrLen = 1681; + vrLoc = 8608; + }; + BA2BEE1A14D0999E002CF1C4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA90E54012AEDB980064FE9F /* TestValidator.cpp */; + name = "TestValidator.cpp: 168"; + rLen = 0; + rLoc = 8335; + rType = 0; + vrLen = 2512; + vrLoc = 5099; + }; + BA37890D12A99A150007FFFC /* Checklist.txt */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {639, 575}}"; + sepNavSelRange = "{351, 0}"; + sepNavVisRange = "{0, 378}"; + }; + }; + BA38C49D12901AD70088EBDD /* UStringTest.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1084, 3614}}"; + sepNavSelRange = "{1329, 84}"; + sepNavVisRange = "{908, 1857}"; + sepNavWindowFrame = "{{101, 60}, {1143, 718}}"; + }; + }; + BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 962}}"; + sepNavSelRange = "{1664, 0}"; + sepNavVisRange = "{739, 1464}"; + sepNavWindowFrame = "{{63, 60}, {1217, 718}}"; + }; + }; + BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 254}}"; + sepNavSelRange = "{123, 0}"; + sepNavVisRange = "{0, 123}"; + }; + }; + BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 1937}}"; + sepNavSelRange = "{1450, 0}"; + sepNavVisRange = "{424, 1769}"; + sepNavWindowFrame = "{{63, 60}, {1217, 718}}"; + }; + }; + BA3BBF63147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */; + name = "RunTestSuite2.h: 4"; + rLen = 13; + rLoc = 59; + rType = 0; + vrLen = 121; + vrLoc = 0; + }; + BA3BBF68147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA11365147155D600166961 /* _atof.h */; + name = "_atof.h: 8"; + rLen = 90; + rLoc = 182; + rType = 0; + vrLen = 580; + vrLoc = 0; + }; + BA3BBF69147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F532C146FF81E00FEEA70 /* json_encode64.h */; + name = "json_encode64.h: 8"; + rLen = 75; + rLoc = 197; + rType = 0; + vrLen = 344; + vrLoc = 0; + }; + BA3BBF6A147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F5337146FFC6200FEEA70 /* json_decode64.h */; + name = "json_decode64.h: 8"; + rLen = 0; + rLoc = 221; + rType = 0; + vrLen = 311; + vrLoc = 0; + }; + BA3BBF6B147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */; + name = "jsonSingleton.h: 8"; + rLen = 0; + rLoc = 231; + rType = 0; + vrLen = 336; + vrLoc = 0; + }; + BA3BBF6D147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53531470076400FEEA70 /* _uitoa.h */; + name = "_uitoa.h: 8"; + rLen = 0; + rLoc = 211; + rType = 0; + vrLen = 382; + vrLoc = 0; + }; + BA3BBF6E147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53451470015D00FEEA70 /* getLenSize.h */; + name = "getLenSize.h: 8"; + rLen = 0; + rLoc = 235; + rType = 0; + vrLen = 316; + vrLoc = 0; + }; + BA3BBF6F147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F535E147007EC00FEEA70 /* _itoa.h */; + name = "_itoa.h: 8"; + rLen = 0; + rLoc = 207; + rType = 0; + vrLen = 378; + vrLoc = 0; + }; + BA3BBF70147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */; + name = "_areFloatsEqual.h: 8"; + rLen = 0; + rLoc = 251; + rType = 0; + vrLen = 386; + vrLoc = 0; + }; + BA3BBF71147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */; + name = "JSON_FAIL.h: 8"; + rLen = 0; + rLoc = 203; + rType = 0; + vrLen = 365; + vrLoc = 0; + }; + BA3BBF72147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */; + name = "JSON_FAIL_SAFE.h: 8"; + rLen = 0; + rLoc = 223; + rType = 0; + vrLen = 386; + vrLoc = 0; + }; + BA3BBF73147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */; + name = "JSON_ASSERT.h: 8"; + rLen = 0; + rLoc = 211; + rType = 0; + vrLen = 396; + vrLoc = 0; + }; + BA3BBF75147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539514701E9100FEEA70 /* isValidNamedObject.h */; + name = "isValidNamedObject.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 150; + vrLoc = 0; + }; + BA3BBF76147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539814701E9D00FEEA70 /* isValidObject.h */; + name = "isValidObject.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 145; + vrLoc = 0; + }; + BA3BBF77147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539B14701EAE00FEEA70 /* isValidArray.h */; + name = "isValidArray.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 144; + vrLoc = 0; + }; + BA3BBF78147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA1135A147154E500166961 /* isValidPartialRoot.h */; + name = "isValidPartialRoot.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 150; + vrLoc = 0; + }; + BA3BBF79147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA2A923114705B8B00609A62 /* securityTest.cpp */; + name = "securityTest.cpp: 3"; + rLen = 0; + rLoc = 101; + rType = 0; + vrLen = 758; + vrLoc = 0; + }; + BA3BBF7A147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA2A923014705B8B00609A62 /* securityTest.h */; + name = "securityTest.h: 8"; + rLen = 0; + rLoc = 235; + rType = 0; + vrLen = 318; + vrLoc = 0; + }; + BA3BBF7B147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA1135C147154E500166961 /* isValidRoot.h */; + name = "isValidRoot.h: 8"; + rLen = 0; + rLoc = 233; + rType = 0; + vrLen = 366; + vrLoc = 0; + }; + BA3BBF7C147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539214701E7F00FEEA70 /* isValidString.h */; + name = "isValidString.h: 8"; + rLen = 0; + rLoc = 241; + rType = 0; + vrLen = 452; + vrLoc = 0; + }; + BA3BBF7D147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F538F14701E6C00FEEA70 /* isValidMember.h */; + name = "isValidMember.h: 8"; + rLen = 0; + rLoc = 241; + rType = 0; + vrLen = 429; + vrLoc = 0; + }; + BA3BBF7E147E910D004A159D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F538C14701E5D00FEEA70 /* isValidNumber.h */; + name = "isValidNumber.h: 8"; + rLen = 0; + rLoc = 241; + rType = 0; + vrLen = 649; + vrLoc = 0; + }; + BA3DA62F12F5DE5300B3D93A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F8C1E12F5DC05002EBC38 /* AI.cpp */; + name = "AI.cpp: 959"; + rLen = 0; + rLoc = 28336; + rType = 0; + vrLen = 1807; + vrLoc = 29278; + }; + BA41A4C7132D47A1001CD264 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F512318DD6002575BA /* TestFunctions.cpp */; + name = "TestFunctions.cpp: 229"; + rLen = 0; + rLoc = 7292; + rType = 0; + vrLen = 1287; + vrLoc = 6528; + }; + BA4303FA1356361400B50B9A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA4303FB1356361400B50B9A /* iostream */; + name = "iostream: 77"; + rLen = 0; + rLoc = 2900; + rType = 0; + vrLen = 1382; + vrLoc = 1608; + }; + BA4303FB1356361400B50B9A /* iostream */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.h; + name = iostream; + path = "/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iostream"; + sourceTree = ""; + }; + BA44ACC51492A7FA00FB2B4C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAB51D511356503300C3349E /* JSONPreparse.cpp */; + name = "JSONPreparse.cpp: 134"; + rLen = 11; + rLoc = 3991; + rType = 0; + vrLen = 955; + vrLoc = 12814; + }; + BA44ACFA1492B4B200FB2B4C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F536914700BD200FEEA70 /* isNumeric.h */; + name = "isNumeric.h: 8"; + rLen = 56; + rLoc = 200; + rType = 0; + vrLen = 634; + vrLoc = 0; + }; + BA44ACFD1492B4B200FB2B4C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */; + name = "JSON_ASSERT_SAFE.cpp: 19"; + rLen = 0; + rLoc = 566; + rType = 0; + vrLen = 1094; + vrLoc = 0; + }; + BA468C191490464B00CF4152 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA07EB2F12C8DF7E001AE448 /* JSONStream.h */; + name = "JSONStream.h: 53"; + rLen = 0; + rLoc = 1439; + rType = 0; + vrLen = 1310; + vrLoc = 863; + }; + BA49A59E14D449760005C0EB /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA49A59F14D449760005C0EB /* main.cpp */; + name = "main.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1264; + vrLoc = 0; + }; + BA49A59F14D449760005C0EB /* main.cpp */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = main.cpp; + path = /Users/wallace/Documents/libjson/TestSuite/All/main.cpp; + sourceTree = ""; + }; + BA49A5B814D44A510005C0EB /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143EE12318DD6002575BA /* main.cpp */; + name = "main.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1095; + vrLoc = 0; + }; + BA49A5C714D44AEE0005C0EB /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */; + name = "RunTestSuite2.cpp: 117"; + rLen = 0; + rLoc = 4182; + rType = 0; + vrLen = 1332; + vrLoc = 3730; + }; + BA49A5D314D44E490005C0EB /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143DC12318DD6002575BA /* NumberToString.h */; + name = "NumberToString.h: 2"; + rLen = 0; + rLoc = 49; + rType = 0; + vrLen = 931; + vrLoc = 0; + }; + BA49A5D414D44E490005C0EB /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F536A14700BD200FEEA70 /* isNumeric.cpp */; + name = "isNumeric.cpp: 17"; + rLen = 0; + rLoc = 436; + rType = 0; + vrLen = 1374; + vrLoc = 0; + }; + BA52A12114D87AF8006575E8 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CA12318DD6002575BA /* internalJSONNode.h */; + name = "internalJSONNode.h: 103"; + rLen = 0; + rLoc = 3247; + rType = 0; + vrLen = 1156; + vrLoc = 9485; + }; + BA54A62F14D0A23200CB60A8 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CD12318DD6002575BA /* JSONChildren.cpp */; + name = "JSONChildren.cpp: 94"; + rLen = 0; + rLoc = 3615; + rType = 0; + vrLen = 1755; + vrLoc = 1865; + }; + BA59BFA214BA46A400A0E534 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D112318DD6002575BA /* JSONDefs.h */; + name = "JSONDefs.h: 162"; + rLen = 6; + rLoc = 4188; + rType = 0; + vrLen = 1161; + vrLoc = 3391; + }; + BA5D5E051492BC8500FAEDF1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143C712318DD6002575BA /* libjson.h */; + name = "libjson.h: 217"; + rLen = 0; + rLoc = 8682; + rType = 0; + vrLen = 1658; + vrLoc = 9344; + }; + BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 2093}}"; + sepNavSelRange = "{1071, 0}"; + sepNavVisRange = "{367, 1190}"; + sepNavWindowFrame = "{{63, 60}, {1217, 718}}"; + }; + }; + BA69DF3C14D09F30000402EE /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539314701E7F00FEEA70 /* isValidString.cpp */; + name = "isValidString.cpp: 6"; + rLen = 0; + rLoc = 161; + rType = 0; + vrLen = 1528; + vrLoc = 27; + }; + BA6A9B5D149293B300E86807 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D012318DD6002575BA /* JSONDebug.h */; + name = "JSONDebug.h: 130"; + rLen = 16; + rLoc = 3649; + rType = 0; + vrLen = 1298; + vrLoc = 2542; + }; + BA6A9B5F149293B300E86807 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143DA12318DD6002575BA /* JSONWriter.cpp */; + name = "JSONWriter.cpp: 73"; + rLen = 11; + rLoc = 2826; + rType = 0; + vrLen = 1861; + vrLoc = 2009; + }; + BA6A9B60149293B300E86807 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D512318DD6002575BA /* JSONNode.cpp */; + name = "JSONNode.cpp: 287"; + rLen = 12; + rLoc = 9357; + rType = 0; + vrLen = 1638; + vrLoc = 8588; + }; + BA6A9B61149293B300E86807 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D312318DD6002575BA /* JSONMemory.cpp */; + name = "JSONMemory.cpp: 92"; + rLen = 0; + rLoc = 3128; + rType = 0; + vrLen = 1209; + vrLoc = 3839; + }; + BA7A111D13C4A5A800EA457F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7A111E13C4A5A800EA457F /* stl_iterator.h */; + name = "stl_iterator.h: 675"; + rLen = 0; + rLoc = 21546; + rType = 0; + vrLen = 1228; + vrLoc = 20566; + }; + BA7A111E13C4A5A800EA457F /* stl_iterator.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = stl_iterator.h; + path = "/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_iterator.h"; + sourceTree = ""; + }; + BA7F532C146FF81E00FEEA70 /* json_encode64.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{197, 75}"; + sepNavVisRange = "{0, 344}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1201, 845}}"; + sepNavSelRange = "{2238, 0}"; + sepNavVisRange = "{126, 2443}"; + sepNavWindowFrame = "{{20, 60}, {1260, 718}}"; + }; + }; + BA7F5331146FF85D00FEEA70 /* BaseTest.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 590}}"; + sepNavSelRange = "{513, 0}"; + sepNavVisRange = "{0, 554}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BA7F5337146FFC6200FEEA70 /* json_decode64.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{221, 0}"; + sepNavVisRange = "{0, 311}"; + }; + }; + BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 528}}"; + sepNavSelRange = "{99, 0}"; + sepNavVisRange = "{0, 431}"; + sepNavWindowFrame = "{{1317, -32}, {1260, 718}}"; + }; + }; + BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{231, 0}"; + sepNavVisRange = "{0, 336}"; + }; + }; + BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{163, 0}"; + sepNavVisRange = "{0, 754}"; + }; + }; + BA7F53451470015D00FEEA70 /* getLenSize.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{235, 0}"; + sepNavVisRange = "{0, 316}"; + }; + }; + BA7F53461470015D00FEEA70 /* getLenSize.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{215, 0}"; + sepNavVisRange = "{0, 426}"; + sepNavWindowFrame = "{{376, 60}, {1260, 718}}"; + }; + }; + BA7F53531470076400FEEA70 /* _uitoa.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{211, 0}"; + sepNavVisRange = "{0, 382}"; + }; + }; + BA7F53541470076400FEEA70 /* _uitoa.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 1183}}"; + sepNavSelRange = "{3024, 0}"; + sepNavVisRange = "{2333, 862}"; + sepNavWindowFrame = "{{117, 60}, {740, 718}}"; + }; + }; + BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 624}}"; + sepNavSelRange = "{623, 0}"; + sepNavVisRange = "{0, 1431}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{251, 0}"; + sepNavVisRange = "{0, 386}"; + }; + }; + BA7F535D147007EC00FEEA70 /* _itoa.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1365}}"; + sepNavSelRange = "{4802, 0}"; + sepNavVisRange = "{2999, 2124}"; + sepNavWindowFrame = "{{15, 60}, {1260, 718}}"; + }; + }; + BA7F535E147007EC00FEEA70 /* _itoa.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{207, 0}"; + sepNavVisRange = "{0, 378}"; + }; + }; + BA7F53651470098B00FEEA70 /* _ftoa.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{207, 0}"; + sepNavVisRange = "{0, 328}"; + }; + }; + BA7F53661470098B00FEEA70 /* _ftoa.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{885, 0}"; + sepNavVisRange = "{0, 1921}"; + sepNavWindowFrame = "{{540, 60}, {740, 718}}"; + }; + }; + BA7F536914700BD200FEEA70 /* isNumeric.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 528}}"; + sepNavSelRange = "{200, 56}"; + sepNavVisRange = "{0, 634}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F536A14700BD200FEEA70 /* isNumeric.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 4706}}"; + sepNavSelRange = "{436, 0}"; + sepNavVisRange = "{0, 1374}"; + sepNavWindowFrame = "{{540, 60}, {740, 718}}"; + }; + }; + BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 590}}"; + sepNavSelRange = "{201, 75}"; + sepNavVisRange = "{0, 415}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 962}}"; + sepNavSelRange = "{566, 0}"; + sepNavVisRange = "{0, 1094}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{211, 0}"; + sepNavVisRange = "{0, 396}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 806}}"; + sepNavSelRange = "{514, 0}"; + sepNavVisRange = "{0, 1211}"; + sepNavWindowFrame = "{{63, 60}, {1217, 718}}"; + }; + }; + BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{203, 0}"; + sepNavVisRange = "{0, 365}"; + }; + }; + BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {796, 650}}"; + sepNavSelRange = "{562, 0}"; + sepNavVisRange = "{0, 1217}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{223, 0}"; + sepNavVisRange = "{0, 386}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 767}}"; + sepNavSelRange = "{570, 0}"; + sepNavVisRange = "{296, 1289}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BA7F538C14701E5D00FEEA70 /* isValidNumber.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{241, 0}"; + sepNavVisRange = "{0, 649}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 6669}}"; + sepNavSelRange = "{13729, 50}"; + sepNavVisRange = "{12328, 1949}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F538F14701E6C00FEEA70 /* isValidMember.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{241, 0}"; + sepNavVisRange = "{0, 429}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F539014701E6C00FEEA70 /* isValidMember.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 1326}}"; + sepNavSelRange = "{1964, 2}"; + sepNavVisRange = "{1639, 1646}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F539214701E7F00FEEA70 /* isValidString.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{241, 0}"; + sepNavVisRange = "{0, 452}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F539314701E7F00FEEA70 /* isValidString.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 871}}"; + sepNavSelRange = "{161, 0}"; + sepNavVisRange = "{27, 1528}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BA7F539514701E9100FEEA70 /* isValidNamedObject.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 150}"; + }; + }; + BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 185}"; + }; + }; + BA7F539814701E9D00FEEA70 /* isValidObject.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 145}"; + }; + }; + BA7F539914701E9D00FEEA70 /* isValidObject.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 175}"; + }; + }; + BA7F539B14701EAE00FEEA70 /* isValidArray.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 144}"; + }; + }; + BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 173}"; + }; + }; + BA7F53A614701FB900FEEA70 /* validyMacros.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1158, 637}}"; + sepNavSelRange = "{1474, 0}"; + sepNavVisRange = "{66, 1417}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BA7F8C1E12F5DC05002EBC38 /* AI.cpp */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = AI.cpp; + path = /Users/wallace/Documents/ninjabot/AI.cpp; + sourceTree = ""; + }; + BA82868312F3BDD0005EAA8B /* Visual_C.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{55, 0}"; + sepNavVisRange = "{0, 560}"; + sepNavWindowFrame = "{{191, 64}, {1089, 714}}"; + }; + }; + BA82868912F3BE63005EAA8B /* GNU_C.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 884}}"; + sepNavSelRange = "{1621, 16}"; + sepNavVisRange = "{278, 1516}"; + sepNavWindowFrame = "{{191, 64}, {1089, 714}}"; + }; + }; + BA82868A12F3BE76005EAA8B /* Unknown_C.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 581}}"; + sepNavSelRange = "{540, 0}"; + sepNavVisRange = "{0, 559}"; + sepNavWindowFrame = "{{59, 64}, {1089, 714}}"; + }; + }; + BA8286A912F3C391005EAA8B /* Strings_Defs.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 528}}"; + sepNavSelRange = "{423, 11}"; + sepNavVisRange = "{0, 820}"; + sepNavWindowFrame = "{{1422, 15}, {1089, 714}}"; + }; + }; + BA8413731492589900957089 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA07EB3C12C8E402001AE448 /* TestStreams.cpp */; + name = "TestStreams.cpp: 166"; + rLen = 0; + rLoc = 4875; + rType = 0; + vrLen = 1182; + vrLoc = 3802; + }; + BA8413A514925E7900957089 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F312318DD6002575BA /* TestCtors.cpp */; + name = "TestCtors.cpp: 22"; + rLen = 0; + rLoc = 680; + rType = 0; + vrLen = 1368; + vrLoc = 96; + }; + BA8413EB1492644D00957089 /* JSONWriter.cpp */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = JSONWriter.cpp; + path = /Users/wallace/Downloads/libjson/Source/JSONWriter.cpp; + sourceTree = ""; + }; + BA8413F41492648800957089 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA8413EB1492644D00957089 /* JSONWriter.cpp */; + name = "JSONWriter.cpp: 202"; + rLen = 9; + rLoc = 7919; + rType = 0; + vrLen = 1895; + vrLoc = 6300; + }; + BA841418149265E700957089 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA01440212318DD6002575BA /* TestWriter.cpp */; + name = "TestWriter.cpp: 140"; + rLen = 0; + rLoc = 6301; + rType = 0; + vrLen = 2006; + vrLoc = 5481; + }; + BA84142D149266AA00957089 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F712318DD6002575BA /* TestInspectors.cpp */; + name = "TestInspectors.cpp: 275"; + rLen = 0; + rLoc = 9056; + rType = 0; + vrLen = 1532; + vrLoc = 8343; + }; + BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {809, 1170}}"; + sepNavSelRange = "{69, 0}"; + sepNavVisRange = "{0, 1181}"; + sepNavWindowFrame = "{{412, 60}, {868, 639}}"; + }; + }; + BA8B9B5913D1D4E70077C2D5 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F912318DD6002575BA /* TestMutex.cpp */; + name = "TestMutex.cpp: 129"; + rLen = 0; + rLoc = 4893; + rType = 0; + vrLen = 1383; + vrLoc = 4299; + }; + BA90E54012AEDB980064FE9F /* TestValidator.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {858, 2782}}"; + sepNavSelRange = "{8352, 0}"; + sepNavVisRange = "{7490, 2125}"; + sepNavWindowFrame = "{{224, 65}, {917, 713}}"; + }; + }; + BA94176314926795003A9A94 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53651470098B00FEEA70 /* _ftoa.h */; + name = "_ftoa.h: 8"; + rLen = 0; + rLoc = 207; + rType = 0; + vrLen = 328; + vrLoc = 0; + }; + BA94176414926795003A9A94 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53661470098B00FEEA70 /* _ftoa.cpp */; + name = "_ftoa.cpp: 20"; + rLen = 0; + rLoc = 885; + rType = 0; + vrLen = 1921; + vrLoc = 0; + }; + BA974FA5147493EF00ED1B74 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CE12318DD6002575BA /* JSONChildren.h */; + name = "JSONChildren.h: 128"; + rLen = 0; + rLoc = 4399; + rType = 0; + vrLen = 1461; + vrLoc = 268; + }; + BA974FA9147493EF00ED1B74 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D212318DD6002575BA /* JSONIterators.cpp */; + name = "JSONIterators.cpp: 215"; + rLen = 0; + rLoc = 9889; + rType = 0; + vrLen = 1424; + vrLoc = 0; + }; + BAA11359147154E500166961 /* isValidPartialRoot.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{185, 0}"; + sepNavVisRange = "{0, 185}"; + }; + }; + BAA1135A147154E500166961 /* isValidPartialRoot.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 150}"; + }; + }; + BAA1135B147154E500166961 /* isValidRoot.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{1236, 0}"; + sepNavVisRange = "{0, 1552}"; + }; + }; + BAA1135C147154E500166961 /* isValidRoot.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{233, 0}"; + sepNavVisRange = "{0, 366}"; + }; + }; + BAA11365147155D600166961 /* _atof.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{182, 90}"; + sepNavVisRange = "{0, 580}"; + sepNavWindowFrame = "{{15, 60}, {740, 718}}"; + }; + }; + BAA11366147155D600166961 /* _atof.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 3380}}"; + sepNavSelRange = "{2093, 0}"; + sepNavVisRange = "{1652, 814}"; + sepNavWindowFrame = "{{117, 60}, {740, 718}}"; + }; + }; + BAA1138314715B0200166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53461470015D00FEEA70 /* getLenSize.cpp */; + name = "getLenSize.cpp: 10"; + rLen = 0; + rLoc = 215; + rType = 0; + vrLen = 426; + vrLoc = 0; + }; + BAA1138414715B0200166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA11359147154E500166961 /* isValidPartialRoot.cpp */; + name = "isValidPartialRoot.cpp: 12"; + rLen = 0; + rLoc = 185; + rType = 0; + vrLen = 185; + vrLoc = 0; + }; + BAA1139B14715B0200166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53541470076400FEEA70 /* _uitoa.cpp */; + name = "_uitoa.cpp: 73"; + rLen = 0; + rLoc = 3050; + rType = 0; + vrLen = 2168; + vrLoc = 2010; + }; + BAA115A31471863500166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA8286A912F3C391005EAA8B /* Strings_Defs.h */; + name = "Strings_Defs.h: 18"; + rLen = 11; + rLoc = 423; + rType = 0; + vrLen = 820; + vrLoc = 0; + }; + BAA116711471A38600166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */; + name = "json_decode64.cpp: 4"; + rLen = 0; + rLoc = 99; + rType = 0; + vrLen = 431; + vrLoc = 0; + }; + BAA116D61471AC5000166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */; + name = "json_encode64.cpp: 9"; + rLen = 32; + rLoc = 254; + rType = 0; + vrLen = 2317; + vrLoc = 0; + }; + BAA116D81471AC5000166961 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F5331146FF85D00FEEA70 /* BaseTest.h */; + name = "BaseTest.h: 17"; + rLen = 8; + rLoc = 453; + rType = 0; + vrLen = 460; + vrLoc = 0; + }; + BAA5DBE81492E2D90089981F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */; + name = "JSONGlobals.h: 5"; + rLen = 0; + rLoc = 69; + rType = 0; + vrLen = 1282; + vrLoc = 0; + }; + BAA87012140FC4D20088B03B /* mempool.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1293, 12415}}"; + sepNavSelRange = "{27362, 0}"; + sepNavVisRange = "{4085, 1192}"; + sepNavWindowFrame = "{{256, 60}, {946, 718}}"; + }; + }; + BAA87015140FC61F0088B03B /* JSONMemoryPool.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1027, 553}}"; + sepNavSelRange = "{1305, 0}"; + sepNavVisRange = "{0, 1305}"; + sepNavWindowFrame = "{{334, 60}, {946, 718}}"; + }; + }; + BAAB76C61232AFB100EA97E4 /* makefile */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 689}}"; + sepNavSelRange = "{2525, 0}"; + sepNavVisRange = "{0, 2142}"; + sepNavWindowFrame = "{{137, 58}, {1143, 720}}"; + }; + }; + BAB34D0B14D87C8F006BBCF9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA01440412318DD6002575BA /* UnitTest.h */; + name = "UnitTest.h: 60"; + rLen = 0; + rLoc = 1315; + rType = 0; + vrLen = 971; + vrLoc = 2115; + }; + BAB34D0C14D87C8F006BBCF9 /* XCBuildMessageTextBookmark */ = { + isa = PBXTextBookmark; + comments = "Expected `)' before '{' token"; + fRef = BAA11366147155D600166961 /* _atof.cpp */; + fallbackIsa = XCBuildMessageTextBookmark; + rLen = 1; + rLoc = 56; + rType = 1; + }; + BAB34D1314D87C8F006BBCF9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA11366147155D600166961 /* _atof.cpp */; + name = "_atof.cpp: 57"; + rLen = 0; + rLoc = 2093; + rType = 0; + vrLen = 2000; + vrLoc = 1316; + }; + BAB4249412AED5E700EA03D1 /* JSONValidator.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 507}}"; + sepNavSelRange = "{602, 0}"; + sepNavVisRange = "{440, 883}"; + sepNavWindowFrame = "{{921, 66}, {1206, 712}}"; + }; + }; + BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 5278}}"; + sepNavSelRange = "{7966, 0}"; + sepNavVisRange = "{8806, 1082}"; + sepNavWindowFrame = "{{188, 65}, {917, 713}}"; + }; + }; + BAB51D501356503300C3349E /* JSONPreparse.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1174, 553}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 1225}"; + sepNavWindowFrame = "{{15, 64}, {1206, 712}}"; + }; + }; + BAB51D511356503300C3349E /* JSONPreparse.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1147, 6565}}"; + sepNavSelRange = "{1865, 11}"; + sepNavVisRange = "{11595, 1369}"; + sepNavWindowFrame = "{{74, 66}, {1206, 712}}"; + }; + }; + BABED9AD12C931230047E2DF /* TestBinary.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 553}}"; + sepNavSelRange = "{973, 0}"; + sepNavVisRange = "{0, 1641}"; + sepNavWindowFrame = "{{275, 65}, {917, 713}}"; + }; + }; + BAC8717114D09BC9001FCC02 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */; + name = "JSONValidator.cpp: 314"; + rLen = 0; + rLoc = 7966; + rType = 0; + vrLen = 1082; + vrLoc = 8806; + }; + BAD173EE1475872200592224 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAB51D501356503300C3349E /* JSONPreparse.h */; + name = "JSONPreparse.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1225; + vrLoc = 0; + }; + BAD547E114997493002E82BF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */; + name = "TestSharedString.cpp: 59"; + rLen = 0; + rLoc = 2166; + rType = 0; + vrLen = 1758; + vrLoc = 1456; + }; + BAD899A4128EEEEA00E1D300 /* StringTest.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1084, 3653}}"; + sepNavSelRange = "{1346, 0}"; + sepNavVisRange = "{537, 1917}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BAD89A2A128F00BB00E1D300 /* TestString.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1011, 2483}}"; + sepNavSelRange = "{3823, 0}"; + sepNavVisRange = "{3284, 1261}"; + sepNavWindowFrame = "{{137, 60}, {1143, 718}}"; + }; + }; + BAD8A0AB1493A8EB005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143C912318DD6002575BA /* internalJSONNode.cpp */; + name = "internalJSONNode.cpp: 145"; + rLen = 0; + rLoc = 5120; + rType = 0; + vrLen = 1853; + vrLoc = 4325; + }; + BAD8A0AC1493A8EB005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F112318DD6002575BA /* TestComments.cpp */; + name = "TestComments.cpp: 434"; + rLen = 0; + rLoc = 17996; + rType = 0; + vrLen = 2141; + vrLoc = 15868; + }; + BAD8A0AE1493A8EB005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D912318DD6002575BA /* JSONWorker.h */; + name = "JSONWorker.h: 27"; + rLen = 0; + rLoc = 1241; + rType = 0; + vrLen = 2004; + vrLoc = 1172; + }; + BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1219, 1144}}"; + sepNavSelRange = "{2858, 0}"; + sepNavVisRange = "{2496, 1167}"; + sepNavWindowFrame = "{{15, 60}, {1217, 718}}"; + }; + }; + BAD8A0E21493AEDE005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143EF12318DD6002575BA /* TestAssign.cpp */; + name = "TestAssign.cpp: 1"; + rLen = 92; + rLoc = 0; + rType = 0; + vrLen = 1325; + vrLoc = 0; + }; + BAD8A0E31493AEDE005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143FE12318DD6002575BA /* TestSuite.h */; + name = "TestSuite.h: 110"; + rLen = 0; + rLoc = 3121; + rType = 0; + vrLen = 1064; + vrLoc = 2103; + }; + BAD8A0E51493AEDE005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F012318DD6002575BA /* TestChildren.cpp */; + name = "TestChildren.cpp: 103"; + rLen = 53; + rLoc = 3041; + rType = 0; + vrLen = 1309; + vrLoc = 2889; + }; + BAD8A0EA1493AEDE005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA24981313C4F8880021B041 /* JSONAllocator.h */; + name = "JSONAllocator.h: 18"; + rLen = 0; + rLoc = 437; + rType = 0; + vrLen = 1143; + vrLoc = 0; + }; + BAD8A0F31493AF0B005C4908 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143FD12318DD6002575BA /* TestSuite.cpp */; + name = "TestSuite.cpp: 71"; + rLen = 415; + rLoc = 2275; + rType = 0; + vrLen = 1882; + vrLoc = 809; + }; + BAD8EEB614705934003AF000 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D412318DD6002575BA /* JSONMemory.h */; + name = "JSONMemory.h: 112"; + rLen = 32; + rLoc = 4297; + rType = 0; + vrLen = 1413; + vrLoc = 4181; + }; + BAD8EEB914705934003AF000 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */; + name = "JSONNode_Mutex.cpp: 18"; + rLen = 0; + rLoc = 404; + rType = 0; + vrLen = 1175; + vrLoc = 0; + }; + BAD8EEBF14705934003AF000 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAB4249412AED5E700EA03D1 /* JSONValidator.h */; + name = "JSONValidator.h: 31"; + rLen = 0; + rLoc = 1202; + rType = 0; + vrLen = 1323; + vrLoc = 0; + }; + BAD8EEC814705934003AF000 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA87015140FC61F0088B03B /* JSONMemoryPool.h */; + name = "JSONMemoryPool.h: 39"; + rLen = 0; + rLoc = 1305; + rType = 0; + vrLen = 1305; + vrLoc = 0; + }; + BADEA900148BA39E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */; + name = "TestSuite2Creator.php: 57"; + rLen = 0; + rLoc = 1664; + rType = 0; + vrLen = 1464; + vrLoc = 739; + }; + BADEA941148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */; + name = "JSON_ASSERT.cpp: 59"; + rLen = 0; + rLoc = 1622; + rType = 0; + vrLen = 1040; + vrLoc = 615; + }; + BADEA942148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */; + name = "JSON_ASSERT_SAFE.h: 8"; + rLen = 75; + rLoc = 201; + rType = 0; + vrLen = 415; + vrLoc = 0; + }; + BADEA943148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */; + name = "JSON_FAIL.cpp: 16"; + rLen = 0; + rLoc = 437; + rType = 0; + vrLen = 1141; + vrLoc = 0; + }; + BADEA945148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */; + name = "JSON_FAIL_SAFE.cpp: 48"; + rLen = 0; + rLoc = 1384; + rType = 0; + vrLen = 1223; + vrLoc = 312; + }; + BADEA946148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */; + name = "jsonSingleton.cpp: 5"; + rLen = 0; + rLoc = 163; + rType = 0; + vrLen = 754; + vrLoc = 0; + }; + BADEA948148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F539014701E6C00FEEA70 /* isValidMember.cpp */; + name = "isValidMember.cpp: 68"; + rLen = 2; + rLoc = 1964; + rType = 0; + vrLen = 1646; + vrLoc = 1639; + }; + BADEA949148BA95E000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F53A614701FB900FEEA70 /* validyMacros.h */; + name = "validyMacros.h: 32"; + rLen = 0; + rLoc = 190; + rType = 0; + vrLen = 1239; + vrLoc = 0; + }; + BADEA96C148BAC96000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CC12318DD6002575BA /* JSON_Base64.h */; + name = "JSON_Base64.h: 18"; + rLen = 0; + rLoc = 442; + rType = 0; + vrLen = 442; + vrLoc = 0; + }; + BADEA96E148BAC96000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */; + name = "isValidNumber.cpp: 317"; + rLen = 50; + rLoc = 13729; + rType = 0; + vrLen = 1949; + vrLoc = 12328; + }; + BADEA96F148BAC96000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAA1135B147154E500166961 /* isValidRoot.cpp */; + name = "isValidRoot.cpp: 32"; + rLen = 0; + rLoc = 1236; + rType = 0; + vrLen = 1552; + vrLoc = 0; + }; + BADEA970148BAC96000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */; + name = "_areFloatsEqual.cpp: 22"; + rLen = 0; + rLoc = 623; + rType = 0; + vrLen = 1431; + vrLoc = 0; + }; + BADEA974148BAC96000B4677 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA7F535D147007EC00FEEA70 /* _itoa.cpp */; + name = "_itoa.cpp: 102"; + rLen = 0; + rLoc = 4802; + rType = 0; + vrLen = 2124; + vrLoc = 2999; + }; + BAF8D20314D48ACE00F6CDE6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA82868312F3BDD0005EAA8B /* Visual_C.h */; + name = "Visual_C.h: 2"; + rLen = 0; + rLoc = 55; + rType = 0; + vrLen = 560; + vrLoc = 0; + }; + BAF8D22D14D48E8C00F6CDE6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143C612318DD6002575BA /* JSONOptions.h */; + name = "JSONOptions.h: 2"; + rLen = 0; + rLoc = 45; + rType = 0; + vrLen = 83; + vrLoc = 0; + }; + BAF8D22E14D48E8C00F6CDE6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA24981413C4F8880021B041 /* JSONAllocator.cpp */; + name = "JSONAllocator.cpp: 3"; + rLen = 63; + rLoc = 28; + rType = 0; + vrLen = 998; + vrLoc = 0; + }; + BAF8D22F14D48E8C00F6CDE6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D812318DD6002575BA /* JSONWorker.cpp */; + name = "JSONWorker.cpp: 673"; + rLen = 0; + rLoc = 23342; + rType = 0; + vrLen = 2334; + vrLoc = 22488; + }; + BAF8D23014D48E8C00F6CDE6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143D612318DD6002575BA /* JSONNode.h */; + name = "JSONNode.h: 531"; + rLen = 19; + rLoc = 24524; + rType = 0; + vrLen = 2657; + vrLoc = 17305; + }; + BAFD7D2614D0769C00B7D679 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143CB12318DD6002575BA /* JSON_Base64.cpp */; + name = "JSON_Base64.cpp: 94"; + rLen = 0; + rLoc = 4250; + rType = 0; + vrLen = 1604; + vrLoc = 3677; + }; + BAFD7D2714D0769C00B7D679 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */; + name = "JSONSharedString.h: 68"; + rLen = 0; + rLoc = 1889; + rType = 0; + vrLen = 1390; + vrLoc = 1593; + }; + BAFE242113183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F412318DD6002575BA /* TestEquality.cpp */; + name = "TestEquality.cpp: 102"; + rLen = 0; + rLoc = 2662; + rType = 0; + vrLen = 1361; + vrLoc = 0; + }; + BAFE242313183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F612318DD6002575BA /* TestInequality.cpp */; + name = "TestInequality.cpp: 79"; + rLen = 0; + rLoc = 2323; + rType = 0; + vrLen = 1289; + vrLoc = 0; + }; + BAFE242513183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA0143F812318DD6002575BA /* TestIterators.cpp */; + name = "TestIterators.cpp: 839"; + rLen = 0; + rLoc = 32574; + rType = 0; + vrLen = 1808; + vrLoc = 0; + }; + BAFE242C13183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA01440312318DD6002575BA /* UnitTest.cpp */; + name = "UnitTest.cpp: 170"; + rLen = 0; + rLoc = 4959; + rType = 0; + vrLen = 1109; + vrLoc = 22; + }; + BAFE242E13183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAD899A4128EEEEA00E1D300 /* StringTest.h */; + name = "StringTest.h: 244"; + rLen = 0; + rLoc = 6790; + rType = 0; + vrLen = 969; + vrLoc = 5734; + }; + BAFE243013183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA38C49D12901AD70088EBDD /* UStringTest.h */; + name = "UStringTest.h: 243"; + rLen = 0; + rLoc = 6862; + rType = 0; + vrLen = 1193; + vrLoc = 50; + }; + BAFE243113183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BA37890D12A99A150007FFFC /* Checklist.txt */; + name = "Checklist.txt: 13"; + rLen = 0; + rLoc = 351; + rType = 0; + vrLen = 351; + vrLoc = 0; + }; + BAFE243513183201007476F0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = BAAB76C61232AFB100EA97E4 /* makefile */; + name = "makefile: 54"; + rLen = 0; + rLoc = 2525; + rType = 0; + vrLen = 2142; + vrLoc = 0; + }; +} diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/._wallace.xcuserdatad b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/._wallace.xcuserdatad new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/._wallace.xcuserdatad differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcdebugger b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcdebugger new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcdebugger differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcschemes b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcschemes new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/._xcschemes differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..cd8a895 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._TestSuite.xcscheme b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._TestSuite.xcscheme new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._TestSuite.xcscheme differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._xcschememanagement.plist b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._xcschememanagement.plist new file mode 100644 index 0000000..2089f6a Binary files /dev/null and b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/._xcschememanagement.plist differ diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/TestSuite.xcscheme b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/TestSuite.xcscheme new file mode 100644 index 0000000..55b59db --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/TestSuite.xcscheme @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/xcschememanagement.plist b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..56b2a36 --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite.xcodeproj/xcuserdata/wallace.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + TestSuite.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DD76F620486A84900D96B5E + + primary + + + + + diff --git a/libjson/_internal/TestSuite/TestSuite2Creator.php b/libjson/_internal/TestSuite/TestSuite2Creator.php new file mode 100644 index 0000000..f8f41eb --- /dev/null +++ b/libjson/_internal/TestSuite/TestSuite2Creator.php @@ -0,0 +1,74 @@ + +#include +#include //need wide characters +#include + +typedef wchar_t mychar; + +static size_t mystrlen(const mychar * str){ + unsigned int i = 0; + for(const mychar * it = str; *it; ++it, ++i){ + //dummy + } + return i; +} + +class json_string { +public: + struct const_iterator { + inline const_iterator& operator ++(void) { ++it; return *this; } + inline const_iterator& operator --(void) { --it; return *this; } + inline const_iterator& operator +=(long i) { it += i; return *this; } + inline const_iterator& operator -=(long i) { it -= i; return *this; } + inline const_iterator operator ++(int) { + const_iterator result(*this); + ++it; + return result; + } + inline const_iterator operator --(int) { + const_iterator result(*this); + --it; + return result; + } + inline const_iterator operator +(long i) const { + const_iterator result(*this); + result.it += i; + return result; + } + inline const_iterator operator -(long i) const { + const_iterator result(*this); + result.it -= i; + return result; + } + inline size_t operator -(const_iterator other) const { + return it - other.it; + } + inline mychar & operator [](size_t pos) const { return it[pos]; }; + inline mychar & operator *(void) const { return *it; } + inline bool operator == (const const_iterator & other) const { return it == other.it; } + inline bool operator != (const const_iterator & other) const { return it != other.it; } + inline bool operator > (const const_iterator & other) const { return it > other.it; } + inline bool operator >= (const const_iterator & other) const { return it >= other.it; } + inline bool operator < (const const_iterator & other) const { return it < other.it; } + inline bool operator <= (const const_iterator & other) const { return it <= other.it; } + inline const_iterator & operator = (const const_iterator & orig) { it = orig.it; return *this; } + const_iterator (const const_iterator & orig) : it(orig.it) {} + const_iterator (const mychar * place) : it((mychar*)place) {} + const_iterator(void) : it(0) {}; + + mychar * it; + }; + + struct iterator { + inline iterator& operator ++(void) { ++it; return *this; } + inline iterator& operator --(void) { --it; return *this; } + inline iterator& operator +=(long i) { it += i; return *this; } + inline iterator& operator -=(long i) { it -= i; return *this; } + inline iterator operator ++(int) { + iterator result(*this); + ++it; + return result; + } + inline iterator operator --(int) { + iterator result(*this); + --it; + return result; + } + inline iterator operator +(long i) const { + iterator result(*this); + result.it += i; + return result; + } + inline iterator operator -(long i) const { + iterator result(*this); + result.it -= i; + return result; + } + inline mychar & operator [](size_t pos) const { return it[pos]; }; + inline mychar & operator *(void) const { return *it; } + inline bool operator == (const iterator & other) const { return it == other.it; } + inline bool operator != (const iterator & other) const { return it != other.it; } + inline bool operator > (const iterator & other) const { return it > other.it; } + inline bool operator >= (const iterator & other) const { return it >= other.it; } + inline bool operator < (const iterator & other) const { return it < other.it; } + inline bool operator <= (const iterator & other) const { return it <= other.it; } + inline iterator & operator = (const iterator & orig) { it = orig.it; return *this; } + inline operator const_iterator() const json_nothrow { return const_iterator(it); } + iterator (const iterator & orig) : it(orig.it) {} + iterator (const mychar * place) : it((mychar*)place) {} + + mychar * it; + }; + + + const static size_t npos = 0xFFFFFFFF; + json_string(void) : len(0), str(0){ + setToCStr(L"", 0); + } + + json_string(const mychar * meh) : len(0), str(0){ + setToCStr(meh, mystrlen(meh)); + } + + json_string(const mychar * meh, size_t l) : len(l), str(0){ + setToCStr(meh, l); + str[len] = '\0'; + } + + json_string(const iterator & beg, const iterator & en) : len(0), str(0){ + setToCStr(beg.it, en.it - beg.it); + str[len] = '\0'; + } + + json_string(const const_iterator & beg, const const_iterator & en) : len(0), str(0){ + setToCStr(beg.it, en.it - beg.it); + str[len] = '\0'; + } + + json_string(const json_string & meh) : len(0), str(0){ + setToCStr(meh.c_str(), meh.len); + } + + ~json_string(void){ std::free(str); }; + + json_string(unsigned int l, mychar meh) : len(0), str(0){ + str = (mychar*)std::malloc((l + 1) * sizeof(mychar)); + len = l; + for (unsigned int i = 0; i < l; ++i){ + str[i] = meh; + } + str[l] = L'\0'; + } + + void swap(json_string & meh){ + size_t _len = len; + mychar * _str = str; + len = meh.len; + str = meh.str; + meh.len = _len; + meh.str = _str; + } + + iterator begin(void){ return iterator(str); }; + iterator end(void){ return iterator(str + length()); }; + const iterator begin(void) const { return iterator(str); }; + const iterator end(void) const { return iterator(str + length()); }; + void assign(const iterator & beg, const iterator & en){ + json_string(beg, en).swap(*this); + } + json_string & append(const iterator & beg, const iterator & en){ + json_string temp(beg, en); + return *this += temp; + } + + const mychar * c_str(void) const { return str; }; + const mychar * data(void) const { return str; }; + size_t length(void) const { return len; }; + size_t capacity(void) const { return len; }; + bool empty(void) const { return len == 0; }; + + bool operator ==(const json_string & other) const { + if (len != other.len) return false; + return memcmp(str, other.str, len * sizeof(mychar)) == 0; + } + + bool operator !=(const json_string & other) const { + return !(*this == other); + } + + const wchar_t & operator[] (size_t pos) const { return str[pos]; } + wchar_t & operator[] ( size_t pos ){ return str[pos]; } + + json_string & operator = (const json_string & meh) { + std::free(str); + setToCStr(meh.c_str(), meh.len); + return *this; + } + + json_string & operator = (const mychar * meh) { + std::free(str); + setToCStr(meh, mystrlen(meh)); + return *this; + } + + json_string & operator += (const json_string & other) { + size_t newlen = len + other.len; + mychar * newstr = (mychar*)std::malloc((newlen + 1) * sizeof(mychar)); + std::memcpy(newstr, str, len * sizeof(mychar)); + std::memcpy(newstr + len, other.str, (other.len + 1) * sizeof(mychar)); + len = newlen; + std::free(str); + str = newstr; + return *this; + } + + const json_string operator + (const json_string & other) const { + json_string result = *this; + result += other; + return result; + } + + json_string & operator += (const mychar other) { + mychar temp[2] = {other, L'\0'}; + json_string temp_s(temp); + return (*this) += temp_s; + } + + const json_string operator + (const mychar other) const { + json_string result = *this; + result += other; + return result; + } + + void reserve(size_t){}; //noop, its just a test + void clear(void){setToCStr(L"", 0);} + + json_string substr(size_t pos = 0, size_t n = npos) const { + json_string res(false, false, false); + if (n > len) n = len; + if (n + pos > len) n = len - pos; + res.setToCStr(str + pos, n); + res.str[n] = L'\0'; + return res; + } + + + size_t find ( mychar c, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + if (*i == c) return i - str; + } + return npos; + } + + size_t find_first_not_of ( const mychar* s, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + bool found = false; + for(const mychar * k = s; *k; ++k){ + if (*i == *k){ + found = true; + break; + } + } + if (!found) return i - str; + } + return npos; + } + + size_t find_first_of ( const mychar* s, size_t pos = 0 ) const { + if (pos > len) return npos; + for(mychar * i = str + pos; *i; ++i){ + for(const mychar * k = s; *k; ++k){ + if (*i == *k){ + return i - str; + } + } + } + return npos; + } + + iterator erase(iterator it, iterator it2){ + size_t mov = it2.it - it.it; + std::memmove(str, it2.it, (len - mov + 1) * sizeof(mychar)); //+1 for null terminator + len -= mov; + return it; + } +private: + json_string(bool, bool, bool) : len(0), str(0){}; + + void setToCStr(const mychar * st, size_t l){ + len = l; + str = (mychar*)std::memcpy(std::malloc((len + 1) * sizeof(mychar)), st, (len + 1) * sizeof(mychar)); + } + + size_t len; + mychar * str; + +}; + +#endif diff --git a/libjson/_internal/TestSuite/UnitTest.cpp b/libjson/_internal/TestSuite/UnitTest.cpp new file mode 100644 index 0000000..ded2984 --- /dev/null +++ b/libjson/_internal/TestSuite/UnitTest.cpp @@ -0,0 +1,176 @@ +#include "UnitTest.h" +#include +#include +#include +#include +#include + +std::vector Fails; +std::vector All; +bool ReturnOnFail = false; +bool Echo = true; +std::string Prefix; +clock_t started = 0; +#if (!defined(CLOCKS_PER_SEC)) + #define noTimeFormatting +#endif + +std::string timing(); +std::string timing(){ + clock_t clockticks = clock() - started; + std::stringstream out; + + + if (CLOCKS_PER_SEC == 1000000){ + if (clockticks < 10000){ + out << clockticks << " microseconds"; + return out.str(); + } else if (clockticks < 10000000){ + out << clockticks / 1000 << " milliseconds"; + return out.str(); + } + } else if (CLOCKS_PER_SEC == 1000){ + if (clockticks < 10000){ + out << clockticks << " milliseconds"; + return out.str(); + } + } else { + out << clockticks << " clockticks"; + return out.str(); + } + + #ifndef noTimeFormatting + if ((CLOCKS_PER_SEC == 1000000) || (CLOCKS_PER_SEC == 1000)){ + clock_t seconds = clockticks / CLOCKS_PER_SEC; + if (seconds < 60){ + out << seconds << " seconds"; + } else if (seconds < 7200) { + out << seconds / 60 << " minutes"; + } else { + out << seconds / 3600 << " hours"; + } + return out.str(); + } + #endif +} + +void UnitTest::SelfCheck(void){ + assertTrue(true); + assertFalse(false); + assertEquals(1, 1); + assertNotEquals(1, 0); + + assertGreaterThan(1, 0); + assertGreaterThanEqualTo(1, 0); + assertGreaterThanEqualTo(1, 1); + + assertLessThan(0, 1); + assertLessThanEqualTo(0, 1); + assertLessThanEqualTo(1, 1); + + assertCStringEquals("Hello", "Hello"); + assertCStringNotEquals("Hello", "World"); + + assertCStringEqualsW(L"Hello", L"Hello"); + assertCStringNotEqualsW(L"Hello", L"World"); + + std::vector exception_Test; + assertException(std::string res = exception_Test.at(15), std::out_of_range); +} + +std::string fix(const std::string & str); +std::string fix(const std::string & str){ + std::string fff(str); + size_t pos = fff.find('\n'); + while(pos != std::string::npos){ + fff = fff.substr(0, pos) + "\\n" + fff.substr(pos + 1); + pos = fff.find('\n', pos + 1); + } + pos = fff.find('\t'); + while(pos != std::string::npos){ + fff = fff.substr(0, pos) + "\\t" + fff.substr(pos + 1); + pos = fff.find('\t', pos + 1); + } + pos = fff.find('\r'); + while(pos != std::string::npos){ + fff = fff.substr(0, pos) + "\\r" + fff.substr(pos + 1); + pos = fff.find('\r', pos + 1); + } + pos = fff.find('\"'); + while(pos != std::string::npos){ + fff = fff.substr(0, pos) + "\\\"" + fff.substr(pos + 1); + pos = fff.find('\"', pos + 2); + } + return fff; +} + +void UnitTest::PushFailure(const std::string & fail){ + Fails.push_back(fail); + if (test_likely(Echo)) std::cout << fail << std::endl; + All.push_back(std::string("") + fail + "
"); +} + +void UnitTest::PushSuccess(const std::string & pass){ + All.push_back(std::string("") + pass + "
"); +} + +std::string UnitTest::ToString(void){ + std::stringstream out; + out << "Number of failed tests: " << Fails.size(); + std::string result(out.str()); + for(std::vector::iterator it = Fails.begin(), end = Fails.end(); it != end; ++it){ + result += *it; + result += "\n"; + } + return result; +} + +std::string UnitTest::ToHTML(void){ + std::string result("Test Suite Results"); + std::stringstream out; + out << "Passed Tests: " << All.size() - Fails.size() << "
Failed Tests: " << Fails.size() << "
Total Tests: " << All.size() << "
"; + if (test_likely(started)){ + out << "Elapsed time: " << timing() << "

"; + } else { + out << "
"; + } + result += out.str(); + for(std::vector::iterator it = All.begin(), end = All.end(); it != end; ++it){ + result += *it; + } + return result + "
"; +} + +#include +#include +void UnitTest::SaveTo(const std::string & location){ + FILE * fp = fopen(location.c_str(), "w"); + if (test_likely(fp != 0)){ + std::string html(ToHTML()); + fwrite(html.c_str(), html.length(), 1, fp); + fclose(fp); + system("pwd"); + std::cout << "Saved file to " << location << std::endl; + } else { + std::cout << "Couldn't save file" << std::endl; + } + + if (test_likely(Echo)) std::cout << "Passed tests: " << All.size() - Fails.size() << std::endl << "Failed tests: " << Fails.size() << std::endl; +} + +bool UnitTest::GetReturnOnFail(void){ return ReturnOnFail; } +void UnitTest::SetReturnOnFail(bool option){ ReturnOnFail = option; } +void UnitTest::SetEcho(bool option){ Echo = option; } +void UnitTest::SetPrefix(const std::string & prefix){ + std::cout << prefix << std::endl; + Prefix = prefix; +} +std::string UnitTest::GetPrefix(void){ return Prefix; } +void UnitTest::echo_(const std::string & out){ + All.push_back(fix(out) + "
"); + std::cout << out << std::endl; +} + +void UnitTest::StartTime(void){ + started = clock(); +} diff --git a/libjson/_internal/TestSuite/UnitTest.h b/libjson/_internal/TestSuite/UnitTest.h new file mode 100644 index 0000000..f789d97 --- /dev/null +++ b/libjson/_internal/TestSuite/UnitTest.h @@ -0,0 +1,229 @@ +#ifndef _TEST_SUITE_H_ +#define _TEST_SUITE_H_ + +#include +#include +#include + +#ifdef __GNUC__ + #define TEST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) + #if (TEST_GCC_VERSION >= 29600) + #define test_likely(x) __builtin_expect((long)((bool)(x)),1) + #define test_unlikely(x) __builtin_expect((long)((bool)(x)),0) + #else + #define test_likely(x) x + #define test_unlikely(x) x + #endif +#else + #define test_likely(x) x + #define test_unlikely(x) x +#endif + +#include + +template +union unittest_numUnion { + unittest_numUnion(T _v) : val(_v){} + T val; + unsigned char c[sizeof(T)]; +}; + +template +static bool unittest_isNAN(T num){ + unittest_numUnion orig(num); + + static unittest_numUnion sig_nan(std::numeric_limits::signaling_NaN()); + + bool isNAN = true; + for(size_t i = 0; i < sizeof(T); ++i){ + if (orig.c[i] != sig_nan.c[i]){ + isNAN = false; + break; + } + } + if (isNAN) return true; + + static unittest_numUnion quiet_nan(std::numeric_limits::quiet_NaN()); + + for(size_t i = 0; i < sizeof(T); ++i){ + if (orig.c[i] != quiet_nan.c[i]){ + return false; + } + } + return true; +} + +class UnitTest { +public: + static void SelfCheck(void); + static void PushFailure(const std::string & fail); + static void PushSuccess(const std::string & pass); + static void echo_(const std::string & out); + static std::string ToString(void); + static std::string ToHTML(void); + static void SaveTo(const std::string & location); + static void SetReturnOnFail(bool option); + static bool GetReturnOnFail(void); + static void SetEcho(bool option); + static void SetPrefix(const std::string & prefix); + static std::string GetPrefix(void); + static void StartTime(void); + static inline bool _floatsAreEqual(const double & one, const double & two){ + return (one > two) ? (one - two) < .000001 : (one - two) > -.000001; + } +}; + +#define MakePre()\ + std::string pre = UnitTest::GetPrefix();\ + if (test_unlikely(pre.empty())){\ + std::stringstream out;\ + out << __FILE__ << ":" << __LINE__;\ + pre = out.str();\ + }\ + pre += ": "; + +#define FAIL(stri)\ + MakePre()\ + UnitTest::PushFailure(pre + std::string(stri));\ + if (UnitTest::GetReturnOnFail()) return; + +#define PASS(stri)\ + MakePre();\ + UnitTest::PushSuccess(pre + std::string(stri));\ + +#define assertUnitTest()\ + UnitTest::SelfCheck(); + +#define assertTrue(cond)\ + if (test_unlikely(!(cond))){\ + FAIL(#cond);\ + } else {\ + PASS(#cond);\ + } + +#define assertFalse(cond)\ + if (test_unlikely(cond)){\ + FAIL(#cond);\ + } else {\ + PASS(#cond);\ + } + +#define assertTrue_Primitive(cond, leftside, rightside)\ + if (test_unlikely(!(cond))){\ + std::stringstream unit_out;\ + unit_out << #cond;\ + unit_out << ", Left side: " << leftside;\ + unit_out << ", Right side: " << rightside;\ + FAIL(unit_out.str());\ + } else {\ + PASS(#cond);\ + } + +//needs to copy it so that if its a function call it only does it once +#define assertNAN(type, one)\ + {\ + type val = (type)one;\ + std::string lag(#one);\ + lag += " not a number";\ + if (test_likely(unittest_isNAN(one))){\ + PASS(lag)\ + } else {\ + FAIL(lag)\ + }\ + } + +#define assertFloatEquals(one, two)\ + assertTrue(UnitTest::_floatsAreEqual(one, two)) + +#define assertEquals(one, two)\ + assertTrue((one) == (two)) + +#define assertNotEquals(one, two)\ + assertTrue((one) != (two)) + +#define assertGreaterThan(one, two)\ + assertTrue((one) > (two)) + +#define assertGreaterThanEqualTo(one, two)\ + assertTrue((one) >= (two)) + +#define assertLessThan(one, two)\ + assertTrue((one) < (two)) + +#define assertLessThanEqualTo(one, two)\ + assertTrue((one) <= (two)) + + + +#define assertEquals_Primitive(one, two)\ + assertTrue_Primitive((one) == (two), one, two) + +#define assertNotEquals_Primitive(one, two)\ + assertTrue_Primitive((one) != (two), one, two) + +#define assertGreaterThan_Primitive(one, two)\ + assertTrue_Primitive((one) > (two), one, two) + +#define assertGreaterThanEqualTo_Primitive(one, two)\ + assertTrue_Primitive((one) >= (two), one, two) + +#define assertLessThan_Primitive(one, two)\ + assertTrue_Primitive((one) < (two), one, two) + +#define assertLessThanEqualTo_Primitive(one, two)\ + assertTrue_Primitive((one) <= (two), one, two) + +#define assertNull(one)\ + assertTrue(one == NULL); + +#define assertNotNull(one)\ + assertTrue(one != NULL); + +#define assertCStringEquals(one, two)\ + if (test_unlikely(strcmp(one, two))){\ + FAIL(std::string(#one) + "==" + #two);\ + } else {\ + PASS(std::string(#one) + "==" + #two);\ + } + +#define assertCStringNotEquals(one, two)\ + if (test_unlikely(!strcmp(one, two))){\ + FAIL(std::string(#one) + "!=" + #two);\ + } else {\ + PASS(std::string(#one) + "!=" + #two);\ + } + +#define assertCStringEqualsW(one, two)\ + if (test_unlikely(wcscmp(one, two))){\ + FAIL(std::string(#one) + "==" + #two);\ + } else {\ + PASS(std::string(#one) + "==" + #two);\ + } + +#define assertCStringNotEqualsW(one, two)\ + if (test_unlikely(!wcscmp(one, two))){\ + FAIL(std::string(#one) + "!=" + #two);\ + } else {\ + PASS(std::string(#one) + "!=" + #two);\ + } + +#define assertException(code, exc)\ + {\ + bool failed = false;\ + try {\ + code;\ + } catch (exc){\ + PASS(std::string(#exc) + " caught");\ + failed = true;\ + }\ + if (test_unlikely(!failed)){ FAIL(std::string(#exc) + " not caught");}\ + } + +#define echo(something)\ + {\ + std::stringstream somet;\ + somet << something;\ + UnitTest::echo_(somet.str());\ + } + +#endif diff --git a/libjson/_internal/TestSuite/main.cpp b/libjson/_internal/TestSuite/main.cpp new file mode 100644 index 0000000..9c39a1a --- /dev/null +++ b/libjson/_internal/TestSuite/main.cpp @@ -0,0 +1,149 @@ +#include +#include //for malloc, realloc, and free +#include "TestSuite.h" +#include "../../libjson.h" + +void DoTests(void); +void DoTests(void){ + TestSuite::TestStreams(); + TestSuite::TestValidator(); + TestSuite::TestString(); + TestSuite::TestConverters(); + #ifdef JSON_BINARY + TestSuite::TestBase64(); + #endif + + TestSuite::TestReferenceCounting(); + TestSuite::TestConstructors(); + TestSuite::TestAssigning(); + TestSuite::TestEquality(); + TestSuite::TestInequality(); + TestSuite::TestChildren(); + TestSuite::TestFunctions(); + TestSuite::TestIterators(); + TestSuite::TestInspectors(); + TestSuite::TestNamespace(); + #ifdef JSON_WRITE_PRIORITY + TestSuite::TestWriter(); + #endif + #ifdef JSON_COMMENTS + TestSuite::TestComments(); + #endif + #ifdef JSON_MUTEX_CALLBACKS + TestSuite::TestMutex(); + TestSuite::TestThreading(); + #endif + TestSuite::TestSharedString(); + TestSuite::TestFinal(); +} + +#ifdef JSON_MEMORY_CALLBACKS + long mallocs = 0; + long reallocs = 0; + long frees = 0; + long bytes = 0; + + //used to check load + size_t maxBytes = 0; + size_t currentBytes = 0; + #ifdef JSON_LIBRARY + #define MEMTYPE unsigned long + #else + #define MEMTYPE size_t + #endif + #include + #include + std::map mem_mapping; + std::vector bytesallocated; + + void * testmal(MEMTYPE siz); + void * testmal(MEMTYPE siz){ + ++mallocs; + bytes += (long)siz; + currentBytes += siz; + if (currentBytes > maxBytes) maxBytes = currentBytes; + bytesallocated.push_back(currentBytes); + + void * res = std::malloc(siz); + mem_mapping[res] = siz; + return res; + } + + void testfree(void * ptr); + void testfree(void * ptr){ + ++frees; + + std::map::iterator i = mem_mapping.find(ptr); + if (i != mem_mapping.end()){ //globals + currentBytes -= mem_mapping[ptr]; + mem_mapping.erase(ptr); + } + + bytesallocated.push_back(currentBytes); + + std::free(ptr); + } + + void * testreal(void * ptr, MEMTYPE siz); + void * testreal(void * ptr, MEMTYPE siz){ + ++reallocs; + + std::map::iterator i = mem_mapping.find(ptr); + if (i != mem_mapping.end()){ //globals + currentBytes -= mem_mapping[ptr]; + mem_mapping.erase(ptr); + } + currentBytes += siz; + if (currentBytes > maxBytes) maxBytes = currentBytes; + bytesallocated.push_back(currentBytes); + + + void * res = std::realloc(ptr, siz); + mem_mapping[res] = siz; + return res; + } + + void doMemTests(void); + void doMemTests(void){ + #ifdef JSON_LIBRARY + json_register_memory_callbacks(testmal, testreal, testfree); + #else + libjson::register_memory_callbacks(testmal, testreal, testfree); + #endif + DoTests(); + echo("mallocs: " << mallocs); + echo("frees: " << frees); + echo("reallocs: " << reallocs); + echo("bytes: " << bytes << " (" << (int)(bytes / 1024) << " KB)"); + echo("max bytes at once: " << maxBytes << " (" << (int)(maxBytes / 1024) << " KB)"); + std::vector::iterator i = bytesallocated.begin(); + std::vector::iterator e = bytesallocated.end(); + size_t bbytes = 0; + for(; i != e; ++i){ + bbytes += *i; + } + bbytes = (size_t)(((double)bbytes) / ((double)bytesallocated.size())); + echo("avg bytes at once: " << bbytes << " (" << (int)(bbytes / 1024) << " KB)"); + echo("still allocated: " << currentBytes << " (" << (int)(currentBytes / 1024) << " KB) (Global variables)"); + assertEquals(mallocs, frees); + } +#endif + +#include "RunTestSuite2.h" + +int main () { + UnitTest::StartTime(); + TestSuite::TestSelf(); + + DoTests(); + + #ifdef JSON_MEMORY_CALLBACKS + doMemTests(); + #endif + + RunTestSuite2::RunTests(); + + UnitTest::SaveTo("out.html"); + + return 0; +} diff --git a/libjson/_internal/TestSuite/main.cpp~ b/libjson/_internal/TestSuite/main.cpp~ new file mode 100644 index 0000000..cfe8f32 --- /dev/null +++ b/libjson/_internal/TestSuite/main.cpp~ @@ -0,0 +1,149 @@ +#include +#include //for malloc, realloc, and free +#include "TestSuite.h" +#include "../libjson.h" + +void DoTests(void); +void DoTests(void){ + TestSuite::TestStreams(); + TestSuite::TestValidator(); + TestSuite::TestString(); + TestSuite::TestConverters(); + #ifdef JSON_BINARY + TestSuite::TestBase64(); + #endif + + TestSuite::TestReferenceCounting(); + TestSuite::TestConstructors(); + TestSuite::TestAssigning(); + TestSuite::TestEquality(); + TestSuite::TestInequality(); + TestSuite::TestChildren(); + TestSuite::TestFunctions(); + TestSuite::TestIterators(); + TestSuite::TestInspectors(); + TestSuite::TestNamespace(); + #ifdef JSON_WRITE_PRIORITY + TestSuite::TestWriter(); + #endif + #ifdef JSON_COMMENTS + TestSuite::TestComments(); + #endif + #ifdef JSON_MUTEX_CALLBACKS + TestSuite::TestMutex(); + TestSuite::TestThreading(); + #endif + TestSuite::TestSharedString(); + TestSuite::TestFinal(); +} + +#ifdef JSON_MEMORY_CALLBACKS + long mallocs = 0; + long reallocs = 0; + long frees = 0; + long bytes = 0; + + //used to check load + size_t maxBytes = 0; + size_t currentBytes = 0; + #ifdef JSON_LIBRARY + #define MEMTYPE unsigned long + #else + #define MEMTYPE size_t + #endif + #include + #include + std::map mem_mapping; + std::vector bytesallocated; + + void * testmal(MEMTYPE siz); + void * testmal(MEMTYPE siz){ + ++mallocs; + bytes += (long)siz; + currentBytes += siz; + if (currentBytes > maxBytes) maxBytes = currentBytes; + bytesallocated.push_back(currentBytes); + + void * res = std::malloc(siz); + mem_mapping[res] = siz; + return res; + } + + void testfree(void * ptr); + void testfree(void * ptr){ + ++frees; + + std::map::iterator i = mem_mapping.find(ptr); + if (i != mem_mapping.end()){ //globals + currentBytes -= mem_mapping[ptr]; + mem_mapping.erase(ptr); + } + + bytesallocated.push_back(currentBytes); + + std::free(ptr); + } + + void * testreal(void * ptr, MEMTYPE siz); + void * testreal(void * ptr, MEMTYPE siz){ + ++reallocs; + + std::map::iterator i = mem_mapping.find(ptr); + if (i != mem_mapping.end()){ //globals + currentBytes -= mem_mapping[ptr]; + mem_mapping.erase(ptr); + } + currentBytes += siz; + if (currentBytes > maxBytes) maxBytes = currentBytes; + bytesallocated.push_back(currentBytes); + + + void * res = std::realloc(ptr, siz); + mem_mapping[res] = siz; + return res; + } + + void doMemTests(void); + void doMemTests(void){ + #ifdef JSON_LIBRARY + json_register_memory_callbacks(testmal, testreal, testfree); + #else + libjson::register_memory_callbacks(testmal, testreal, testfree); + #endif + DoTests(); + echo("mallocs: " << mallocs); + echo("frees: " << frees); + echo("reallocs: " << reallocs); + echo("bytes: " << bytes << " (" << (int)(bytes / 1024) << " KB)"); + echo("max bytes at once: " << maxBytes << " (" << (int)(maxBytes / 1024) << " KB)"); + std::vector::iterator i = bytesallocated.begin(); + std::vector::iterator e = bytesallocated.end(); + size_t bbytes = 0; + for(; i != e; ++i){ + bbytes += *i; + } + bbytes = (size_t)(((double)bbytes) / ((double)bytesallocated.size())); + echo("avg bytes at once: " << bbytes << " (" << (int)(bbytes / 1024) << " KB)"); + echo("still allocated: " << currentBytes << " (" << (int)(currentBytes / 1024) << " KB) (Global variables)"); + assertEquals(mallocs, frees); + } +#endif + +#include "RunTestSuite2.h" + +int main () { + UnitTest::StartTime(); + TestSuite::TestSelf(); + + DoTests(); + + #ifdef JSON_MEMORY_CALLBACKS + doMemTests(); + #endif + + RunTestSuite2::RunTests(); + + UnitTest::SaveTo("out.html"); + + return 0; +} diff --git a/libjson/_internal/TestSuite/makefile b/libjson/_internal/TestSuite/makefile new file mode 100644 index 0000000..3eb122f --- /dev/null +++ b/libjson/_internal/TestSuite/makefile @@ -0,0 +1,137 @@ +OS=$(shell uname) +ifeq ($(OS), Darwin) + fastflag = -fast -ffast-math -fexpensive-optimizations +else + fastflag = -O3 -ffast-math -fexpensive-optimizations +endif + +COMPILER ?= g++ + +single: + $(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \ + TestComments.cpp TestConverters.cpp TestCtors.cpp \ + TestEquality.cpp TestFunctions.cpp TestInequality.cpp \ + TestInspectors.cpp TestIterators.cpp TestMutex.cpp \ + TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \ + TestWriter.cpp TestString.cpp UnitTest.cpp \ + TestValidator.cpp TestStreams.cpp TestBinary.cpp \ + RunTestSuite2.cpp TestSharedString.cpp \ + ../Source/internalJSONNode.cpp \ + ../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \ + ../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \ + ../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \ + ../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \ + ../Source/libjson.cpp ../Source/JSONValidator.cpp \ + ../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \ + ../Source/JSONPreparse.cpp \ + ../TestSuite2/JSON_Base64/json_decode64.cpp \ + ../TestSuite2/JSON_Base64/json_encode64.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL.cpp \ + ../TestSuite2/JSONGlobals/jsonSingleton.cpp \ + ../TestSuite2/JSONValidator/isValidArray.cpp \ + ../TestSuite2/JSONValidator/isValidMember.cpp \ + ../TestSuite2/JSONValidator/isValidNamedObject.cpp \ + ../TestSuite2/JSONValidator/isValidNumber.cpp \ + ../TestSuite2/JSONValidator/isValidObject.cpp \ + ../TestSuite2/JSONValidator/isValidPartialRoot.cpp \ + ../TestSuite2/JSONValidator/isValidRoot.cpp \ + ../TestSuite2/JSONValidator/isValidString.cpp \ + ../TestSuite2/JSONValidator/securityTest.cpp \ + ../TestSuite2/NumberToString/_areFloatsEqual.cpp \ + ../TestSuite2/NumberToString/_atof.cpp \ + ../TestSuite2/NumberToString/_ftoa.cpp \ + ../TestSuite2/NumberToString/_itoa.cpp \ + ../TestSuite2/NumberToString/_uitoa.cpp \ + ../TestSuite2/NumberToString/getLenSize.cpp \ + ../TestSuite2/NumberToString/isNumeric.cpp \ + -Wfatal-errors -DNDEBUG $(fastflag) -pipe -o testapp + +debug: + $(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \ + TestComments.cpp TestConverters.cpp TestCtors.cpp \ + TestEquality.cpp TestFunctions.cpp TestInequality.cpp \ + TestInspectors.cpp TestIterators.cpp TestMutex.cpp \ + TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \ + TestWriter.cpp TestString.cpp UnitTest.cpp \ + TestValidator.cpp TestStreams.cpp TestBinary.cpp \ + RunTestSuite2.cpp TestSharedString.cpp \ + ../Source/internalJSONNode.cpp \ + ../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \ + ../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \ + ../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \ + ../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \ + ../Source/libjson.cpp ../Source/JSONValidator.cpp \ + ../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \ + ../Source/JSONPreparse.cpp \ + ../TestSuite2/JSON_Base64/json_decode64.cpp \ + ../TestSuite2/JSON_Base64/json_encode64.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL.cpp \ + ../TestSuite2/JSONGlobals/jsonSingleton.cpp \ + ../TestSuite2/JSONValidator/isValidArray.cpp \ + ../TestSuite2/JSONValidator/isValidMember.cpp \ + ../TestSuite2/JSONValidator/isValidNamedObject.cpp \ + ../TestSuite2/JSONValidator/isValidNumber.cpp \ + ../TestSuite2/JSONValidator/isValidObject.cpp \ + ../TestSuite2/JSONValidator/isValidPartialRoot.cpp \ + ../TestSuite2/JSONValidator/isValidRoot.cpp \ + ../TestSuite2/JSONValidator/isValidString.cpp \ + ../TestSuite2/JSONValidator/securityTest.cpp \ + ../TestSuite2/NumberToString/_areFloatsEqual.cpp \ + ../TestSuite2/NumberToString/_atof.cpp \ + ../TestSuite2/NumberToString/_ftoa.cpp \ + ../TestSuite2/NumberToString/_itoa.cpp \ + ../TestSuite2/NumberToString/_uitoa.cpp \ + ../TestSuite2/NumberToString/getLenSize.cpp \ + ../TestSuite2/NumberToString/isNumeric.cpp \ + -Wfatal-errors -DJSON_DEBUG -pipe -o testapp + +small: + $(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \ + TestComments.cpp TestConverters.cpp TestCtors.cpp \ + TestEquality.cpp TestFunctions.cpp TestInequality.cpp \ + TestInspectors.cpp TestIterators.cpp TestMutex.cpp \ + TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \ + TestWriter.cpp TestString.cpp UnitTest.cpp \ + TestValidator.cpp TestStreams.cpp TestBinary.cpp \ + RunTestSuite2.cpp TestSharedString.cpp \ + ../Source/internalJSONNode.cpp \ + ../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \ + ../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \ + ../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \ + ../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \ + ../Source/libjson.cpp ../Source/JSONValidator.cpp \ + ../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \ + ../Source/JSONPreparse.cpp \ + ../TestSuite2/JSON_Base64/json_decode64.cpp \ + ../TestSuite2/JSON_Base64/json_encode64.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_ASSERT.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \ + ../TestSuite2/JSONDebug/JSON_FAIL.cpp \ + ../TestSuite2/JSONGlobals/jsonSingleton.cpp \ + ../TestSuite2/JSONValidator/isValidArray.cpp \ + ../TestSuite2/JSONValidator/isValidMember.cpp \ + ../TestSuite2/JSONValidator/isValidNamedObject.cpp \ + ../TestSuite2/JSONValidator/isValidNumber.cpp \ + ../TestSuite2/JSONValidator/isValidObject.cpp \ + ../TestSuite2/JSONValidator/isValidPartialRoot.cpp \ + ../TestSuite2/JSONValidator/isValidRoot.cpp \ + ../TestSuite2/JSONValidator/isValidString.cpp \ + ../TestSuite2/JSONValidator/securityTest.cpp \ + ../TestSuite2/NumberToString/_areFloatsEqual.cpp \ + ../TestSuite2/NumberToString/_atof.cpp \ + ../TestSuite2/NumberToString/_ftoa.cpp \ + ../TestSuite2/NumberToString/_itoa.cpp \ + ../TestSuite2/NumberToString/_uitoa.cpp \ + ../TestSuite2/NumberToString/getLenSize.cpp \ + ../TestSuite2/NumberToString/isNumeric.cpp \ + -Wfatal-errors -DNDEBUG -Os -ffast-math -DJSON_LESS_MEMORY -pipe -o testapp + +test: + $(COMPILER) All/main.cpp UnitTest.cpp -DNDEBUG $(fastflag) -ffast-math -fexpensive-optimizations -pipe -o testall diff --git a/libjson/_internal/TestSuite2/BaseTest.h b/libjson/_internal/TestSuite2/BaseTest.h new file mode 100644 index 0000000..61f7e09 --- /dev/null +++ b/libjson/_internal/TestSuite2/BaseTest.h @@ -0,0 +1,24 @@ +#ifndef JSON_TESTSUITE_BASETEST_H +#define JSON_TESTSUITE_BASETEST_H + +#include "../TestSuite/UnitTest.h" +#include + +class libjson_CodeCoverage; + +class BaseTest { +public: + BaseTest(const std::string & name) : _name(name), coverage(0) {} + virtual ~BaseTest(void){}; + virtual void setUp(const std::string & methodName){ UnitTest::SetPrefix(_name + "::" + methodName); } + virtual void tearDown(void){} +protected: + const std::string _name; + libjson_CodeCoverage * coverage; +private: + BaseTest(const BaseTest &); + BaseTest & operator=(const BaseTest &); +}; + +#endif + diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.cpp b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.cpp new file mode 100644 index 0000000..9e27608 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.cpp @@ -0,0 +1,64 @@ +#include "JSON_ASSERT.h" +#include "../../Source/JSONDebug.h" + +#if defined JSON_DEBUG + #ifndef JSON_STDERROR + static json_string last; + #ifdef JSON_LIBRARY + static void callback(const json_char * p){ last = p; } + #else + static void callback(const json_string & p){ last = p; } + #endif + #endif +#endif + +const json_string fail_consta = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies +const json_string null_consta = JSON_TEXT(""); +#if defined JSON_DEBUG || defined JSON_SAFE + json_error_callback_t origCallbacka = NULL; +#endif + +void testJSONDebug_JSON_ASSERT::setUp(const std::string & methodName){ + BaseTest::setUp(methodName); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + origCallbacka = JSONDebug::register_callback(callback); //check that the callback was called + last = null_consta; + #endif + #endif +} + +void testJSONDebug_JSON_ASSERT::tearDown(void){ + BaseTest::tearDown(); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSONDebug::register_callback(origCallbacka); //check that the callback was called + #endif + #endif +} + + +/** + * Make sure asserts that pass do not call the callback or run extra code + */ +void testJSONDebug_JSON_ASSERT::testPass(void){ + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSON_ASSERT(1 == 1, fail_consta); + assertEquals(last, null_consta); //make sure the callback was not called + #endif + #endif +} + + +/** + * Make sure asserts that fail do call the callback and run extra code + */ +void testJSONDebug_JSON_ASSERT::testFail(void){ + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSON_ASSERT(1 == 0, fail_consta); + assertEquals(last, fail_consta); //make sure the callback was actually called + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.h b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.h new file mode 100644 index 0000000..1d4e21c --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT.h @@ -0,0 +1,15 @@ +#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_H +#define JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_H + +#include "../BaseTest.h" + +class testJSONDebug_JSON_ASSERT : public BaseTest { +public: + testJSONDebug_JSON_ASSERT(const std::string & name) : BaseTest(name){} + virtual void setUp(const std::string & methodName); + virtual void tearDown(void); + void testPass(void); + void testFail(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp new file mode 100644 index 0000000..e5042e3 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp @@ -0,0 +1,74 @@ +#include "JSON_ASSERT_SAFE.h" +#include "../../Source/JSONDebug.h" + +#if defined JSON_DEBUG + #ifndef JSON_STDERROR + static json_string last; + #ifdef JSON_LIBRARY + static void callback(const json_char * p){ last = p; } + #else + static void callback(const json_string & p){ last = p; } + #endif + #endif +#endif + +const json_string fail_const = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies +const json_string null_const = JSON_TEXT(""); +#if defined JSON_DEBUG || defined JSON_SAFE + json_error_callback_t origCallback = NULL; +#endif + +void testJSONDebug_JSON_ASSERT_SAFE::setUp(const std::string & methodName){ + BaseTest::setUp(methodName); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + origCallback = JSONDebug::register_callback(callback); //check that the callback was called + last = null_const; + #endif + #endif +} + +void testJSONDebug_JSON_ASSERT_SAFE::tearDown(void){ + BaseTest::tearDown(); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSONDebug::register_callback(origCallback); //check that the callback was called + #endif + #endif +} + + +/** + * Make sure asserts that pass do not call the callback or run extra code + */ +void testJSONDebug_JSON_ASSERT_SAFE::testPass(void){ + int i = 0; + JSON_ASSERT_SAFE(1 == 1, fail_const, i = 1;); + assertEquals(i, 0); + + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + assertEquals(last, null_const); //make sure the callback was not called + #endif + #endif +} + + +/** + * Make sure asserts that fail do call the callback and run extra code + */ +void testJSONDebug_JSON_ASSERT_SAFE::testFail(void){ + int i = 0; + JSON_ASSERT_SAFE(1 == 0, fail_const, i = 1;); + #if defined(JSON_SAFE) + assertEquals(i, 1); //safe caught the code + #else + assertEquals(i, 0); //fell through because no safety catch + #endif + + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + assertEquals(last, fail_const); //make sure the callback was actually called + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h new file mode 100644 index 0000000..fa25219 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h @@ -0,0 +1,15 @@ +#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_SAFE_H +#define JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_SAFE_H + +#include "../BaseTest.h" + +class testJSONDebug_JSON_ASSERT_SAFE : public BaseTest { +public: + testJSONDebug_JSON_ASSERT_SAFE(const std::string & name) : BaseTest(name){} + virtual void setUp(const std::string & methodName); + virtual void tearDown(void); + void testPass(void); + void testFail(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.cpp b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.cpp new file mode 100644 index 0000000..7a66c82 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.cpp @@ -0,0 +1,51 @@ +#include "JSON_FAIL.h" +#include "../../Source/JSONDebug.h" + +#if defined JSON_DEBUG + #ifndef JSON_STDERROR + static json_string last; + #ifdef JSON_LIBRARY + static void callback(const json_char * p){ last = p; } + #else + static void callback(const json_string & p){ last = p; } + #endif + #endif +#endif + +const json_string fail_constf = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies +const json_string null_constf = JSON_TEXT(""); +#if defined JSON_DEBUG || defined JSON_SAFE + json_error_callback_t origCallbackf = NULL; +#endif + +void testJSONDebug_JSON_FAIL::setUp(const std::string & methodName){ + BaseTest::setUp(methodName); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + origCallbackf = JSONDebug::register_callback(callback); //check that the callback was called + last = null_constf; + #endif + #endif +} + +void testJSONDebug_JSON_FAIL::tearDown(void){ + BaseTest::tearDown(); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSONDebug::register_callback(origCallbackf); //check that the callback was called + #endif + #endif +} + + +/** + * Make sure fails do call the callback + */ +void testJSONDebug_JSON_FAIL::testFail(void){ + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSON_FAIL(fail_constf); + assertEquals(last, fail_constf); //make sure the callback was actually called + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.h b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.h new file mode 100644 index 0000000..70da789 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL.h @@ -0,0 +1,14 @@ +#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_H +#define JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_H + +#include "../BaseTest.h" + +class testJSONDebug_JSON_FAIL : public BaseTest { +public: + testJSONDebug_JSON_FAIL(const std::string & name) : BaseTest(name){} + virtual void setUp(const std::string & methodName); + virtual void tearDown(void); + void testFail(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp new file mode 100644 index 0000000..b196038 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp @@ -0,0 +1,58 @@ +#include "JSON_FAIL_SAFE.h" +#include "../../Source/JSONDebug.h" + +#if defined JSON_DEBUG + #ifndef JSON_STDERROR + static json_string last; + #ifdef JSON_LIBRARY + static void callback(const json_char * p){ last = p; } + #else + static void callback(const json_string & p){ last = p; } + #endif + #endif +#endif + +const json_string fail_constfs = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies +const json_string null_constfs = JSON_TEXT(""); +#if defined JSON_DEBUG || defined JSON_SAFE + json_error_callback_t origCallbackfs = NULL; +#endif + +void testJSONDebug_JSON_FAIL_SAFE::setUp(const std::string & methodName){ + BaseTest::setUp(methodName); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + origCallbackfs = JSONDebug::register_callback(callback); //check that the callback was called + last = null_constfs; + #endif + #endif +} + +void testJSONDebug_JSON_FAIL_SAFE::tearDown(void){ + BaseTest::tearDown(); + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + JSONDebug::register_callback(origCallbackfs); //check that the callback was called + #endif + #endif +} + + +/** + * Make sure fails do call the callback and run extra code + */ +void testJSONDebug_JSON_FAIL_SAFE::testFail(void){ + int i = 0; + JSON_FAIL_SAFE(fail_constfs, i = 1;); + #if defined(JSON_SAFE) + assertEquals(i, 1); //safe caught the code + #else + assertEquals(i, 0); //fell through because no safety catch + #endif + + #if defined JSON_DEBUG + #ifndef JSON_STDERROR + assertEquals(last, fail_constfs); //make sure the callback was actually called + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.h b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.h new file mode 100644 index 0000000..a408b18 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONDebug/JSON_FAIL_SAFE.h @@ -0,0 +1,14 @@ +#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_SAFE_H +#define JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_SAFE_H + +#include "../BaseTest.h" + +class testJSONDebug_JSON_FAIL_SAFE : public BaseTest { +public: + testJSONDebug_JSON_FAIL_SAFE(const std::string & name) : BaseTest(name){} + virtual void setUp(const std::string & methodName); + virtual void tearDown(void); + void testFail(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.cpp b/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.cpp new file mode 100644 index 0000000..ce8327e --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.cpp @@ -0,0 +1,21 @@ +#include "jsonSingleton.h" +#include "../../Source/JSONGlobals.h" + +json_global_decl(std::string, WITHVALUE, "myvalue"); +json_global_decl(std::string, WITHOUTVALUE, ); + +void testJSONGlobals__jsonSingleton::testValue(void){ + std::string * p1 = &jsonSingletonWITHVALUE::getValue(); + std::string * p2 = &json_global(WITHVALUE); + assertEquals(p1, p2); + assertEquals(json_global(WITHVALUE), "myvalue"); + assertEquals(jsonSingletonWITHVALUE::getValue(), "myvalue"); +} + +void testJSONGlobals__jsonSingleton::testNoValue(void){ + std::string * p1 = &jsonSingletonWITHOUTVALUE::getValue(); + std::string * p2 = &json_global(WITHOUTVALUE); + assertEquals(p1, p2); + assertEquals(json_global(WITHOUTVALUE), ""); + assertEquals(jsonSingletonWITHOUTVALUE::getValue(), ""); +} diff --git a/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.h b/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.h new file mode 100644 index 0000000..905cb24 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONGlobals/jsonSingleton.h @@ -0,0 +1,13 @@ +#ifndef JSON_TESTSUITE_JSON_GLOBALS__JSON_SINGLETON_H +#define JSON_TESTSUITE_JSON_GLOBALS__JSON_SINGLETON_H + +#include "../BaseTest.h" + +class testJSONGlobals__jsonSingleton : public BaseTest { +public: + testJSONGlobals__jsonSingleton(const std::string & name) : BaseTest(name){} + void testValue(void); + void testNoValue(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h b/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h new file mode 100644 index 0000000..199aa22 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h @@ -0,0 +1,48 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H +#define JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H + +#include "../../../../JSONOptions.h" + +#ifdef JSON_VALIDATE + + #define assertValid(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(JSONValidator::method(ptr) && ((*ptr)==JSON_TEXT(nextchar)));\ + } + + #define assertNotValid(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(!JSONValidator::method(ptr) || ((*ptr)!=JSON_TEXT(nextchar)));\ + } + + #ifdef JSON_SECURITY_MAX_NEST_LEVEL + #define assertValid_Depth(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(JSONValidator::method(ptr, 1) && ((*ptr)==JSON_TEXT(nextchar)));\ + } + + #define assertNotValid_Depth(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(!JSONValidator::method(ptr, 1) || ((*ptr)!=JSON_TEXT(nextchar)));\ + } + #else + #define assertValid_Depth(x, method, nextchar) assertValid(x, method, nextchar) + #define assertNotValid_Depth(x, method, nextchar) assertNotValid(x, method, nextchar) + #endif + +#else + #define assertValid(x, method, nextchar) + #define assertNotValid(x, method, nextchar) + #define assertValid_Depth(x, method, nextchar) + #define assertNotValid_Depth(x, method, nextchar) +#endif + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h~ b/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h~ new file mode 100644 index 0000000..31ccee1 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/Resources/validyMacros.h~ @@ -0,0 +1,48 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H +#define JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H + +#include "../../../JSONOptions.h" + +#ifdef JSON_VALIDATE + + #define assertValid(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(JSONValidator::method(ptr) && ((*ptr)==JSON_TEXT(nextchar)));\ + } + + #define assertNotValid(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(!JSONValidator::method(ptr) || ((*ptr)!=JSON_TEXT(nextchar)));\ + } + + #ifdef JSON_SECURITY_MAX_NEST_LEVEL + #define assertValid_Depth(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(JSONValidator::method(ptr, 1) && ((*ptr)==JSON_TEXT(nextchar)));\ + } + + #define assertNotValid_Depth(x, method, nextchar)\ + {\ + json_string temp(JSON_TEXT(x));\ + const json_char * ptr = temp.c_str();\ + assertTrue(!JSONValidator::method(ptr, 1) || ((*ptr)!=JSON_TEXT(nextchar)));\ + } + #else + #define assertValid_Depth(x, method, nextchar) assertValid(x, method, nextchar) + #define assertNotValid_Depth(x, method, nextchar) assertNotValid(x, method, nextchar) + #endif + +#else + #define assertValid(x, method, nextchar) + #define assertNotValid(x, method, nextchar) + #define assertValid_Depth(x, method, nextchar) + #define assertNotValid_Depth(x, method, nextchar) +#endif + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidArray.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidArray.cpp new file mode 100644 index 0000000..df4b84e --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidArray.cpp @@ -0,0 +1,11 @@ +/* + * isValidArray.cpp + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + +#include "isValidArray.h" + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidArray.h b/libjson/_internal/TestSuite2/JSONValidator/isValidArray.h new file mode 100644 index 0000000..a941101 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidArray.h @@ -0,0 +1,9 @@ +/* + * isValidArray.h + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidMember.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidMember.cpp new file mode 100644 index 0000000..4059547 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidMember.cpp @@ -0,0 +1,101 @@ +#include "isValidMember.h" +#include "Resources/validyMacros.h" +#include "../../Source/JSONValidator.h" + +/* + * + * !!! ATTENTION !!! + * + * libjson currently has three number parsing methods, they are being merged + * behind the scenes, but all three interfaces must be consistent, so every set + * of numbers need to be tested in all three spots + * + * JSONValidator/isValidMember *this file* + * * Soon to come actual parser * + */ + + +/** + * This tests the three valid members that is not string, number, or container + */ +void testJSONValidator__isValidMember::testMembers(void){ + #ifdef JSON_VALIDATE + assertValid_Depth("true,", isValidMember, ','); + assertValid_Depth("false,", isValidMember, ','); + assertValid_Depth("null,", isValidMember, ','); + #endif +} + + +/** + * This tests that json's case sensitive rules are to be obeyed + */ +void testJSONValidator__isValidMember::testStrict(void){ + #ifdef JSON_VALIDATE + #ifdef JSON_STRICT + assertNotValid_Depth("TRUE,", isValidMember, ','); + assertNotValid_Depth("FALSE,", isValidMember, ','); + assertNotValid_Depth("NULL,", isValidMember, ','); + assertNotValid_Depth(",", isValidMember, ','); //also accepted as null usually + #endif + #endif +} + + +/** + * This tests that json's case sensitive rules are not obeyed normally + */ +void testJSONValidator__isValidMember::testNotStrict(void){ + #ifdef JSON_VALIDATE + #ifndef JSON_STRICT + assertValid_Depth("TRUE,", isValidMember, ','); + assertValid_Depth("FALSE,", isValidMember, ','); + assertValid_Depth("NULL,", isValidMember, ','); + assertValid_Depth(",", isValidMember, ','); //also accepted as null usually + #endif + #endif +} + + +/** + * This tests that non member values are not allowed + */ +void testJSONValidator__isValidMember::testNotMembers(void){ + #ifdef JSON_VALIDATE + assertNotValid_Depth("tru,", isValidMember, ','); + assertNotValid_Depth("fals,", isValidMember, ','); + assertNotValid_Depth("nul,", isValidMember, ','); + assertNotValid_Depth("", isValidMember, ','); //needs a comma after it because of how the pipeline works + assertNotValid_Depth("xxx,", isValidMember, ','); + assertNotValid_Depth("nonsense,", isValidMember, ','); + #endif +} + + +/** + * This tests that for all cases, if the string suddely ends, it recovers + */ +void testJSONValidator__isValidMember::testSuddenEnd(void){ + #ifdef JSON_VALIDATE + assertNotValid_Depth("", isValidMember, ','); + + //--- void testJSONValidator__isValidMember::testSuddenEnd(void){ + assertNotValid_Depth("true", isValidMember, ','); + assertNotValid_Depth("false", isValidMember, ','); + assertNotValid_Depth("null", isValidMember, ','); + + //strict stuff + assertNotValid_Depth("TRUE", isValidMember, ','); + assertNotValid_Depth("FALSE", isValidMember, ','); + assertNotValid_Depth("NULL", isValidMember, ','); + + //--- void testJSONValidator__isValidMember::testNotMembers(void){ + assertNotValid_Depth("tru", isValidMember, ','); + assertNotValid_Depth("fals", isValidMember, ','); + assertNotValid_Depth("nul", isValidMember, ','); + assertNotValid_Depth("", isValidMember, ','); //needs a comma after it because of how the pipeline works + assertNotValid_Depth("xxx", isValidMember, ','); + assertNotValid_Depth("nonsense", isValidMember, ','); + assertNotValid_Depth("1234", isValidMember, ','); + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidMember.h b/libjson/_internal/TestSuite2/JSONValidator/isValidMember.h new file mode 100644 index 0000000..33a505a --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidMember.h @@ -0,0 +1,16 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_MEMBER_H +#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_MEMBER_H + +#include "../BaseTest.h" + +class testJSONValidator__isValidMember : public BaseTest { +public: + testJSONValidator__isValidMember(const std::string & name) : BaseTest(name){} + void testMembers(void); + void testStrict(void); + void testNotStrict(void); + void testNotMembers(void); + void testSuddenEnd(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.cpp new file mode 100644 index 0000000..0e27441 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.cpp @@ -0,0 +1,11 @@ +/* + * isValidNamedObject.cpp + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + +#include "isValidNamedObject.h" + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.h b/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.h new file mode 100644 index 0000000..135c5fc --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidNamedObject.h @@ -0,0 +1,9 @@ +/* + * isValidNamedObject.h + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.cpp new file mode 100644 index 0000000..686961d --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.cpp @@ -0,0 +1,506 @@ +#include "isValidNumber.h" +#include "Resources/validyMacros.h" +#include "../../Source/JSONValidator.h" + +/* + * + * !!! ATTENTION !!! + * + * libjson currently has three number parsing methods, they are being merged + * behind the scenes, but all three interfaces must be consistent, so every set + * of numbers need to be tested in all three spots + * + * JSONValidator/isValidNumber *this file* + * NumberToString/isNumeric + * * Soon to come actual parser * + */ + + +/** + * Tests regular positive numbers in various forms + */ +void testJSONValidator__isValidNumber::testPositive(void){ + #ifdef JSON_VALIDATE + assertValid("123,\"next\"", isValidNumber, ','); + assertValid("12.3,\"next\"", isValidNumber, ','); + assertValid("0.123,\"next\"", isValidNumber, ','); + assertValid("0,\"next\"", isValidNumber, ','); + assertValid("0.,\"next\"", isValidNumber, ','); + assertValid("1.,\"next\"", isValidNumber, ','); + assertValid("1,\"next\"", isValidNumber, ','); + assertValid("0.0,\"next\"", isValidNumber, ','); + assertValid("1.0,\"next\"", isValidNumber, ','); + assertValid("1.01,\"next\"", isValidNumber, ','); + //signed positives are legal when not in strict mode, this is tested below + #endif +} + + +/** + * Tests regular negative numbers in various forms + */ +void testJSONValidator__isValidNumber::testNegative(void){ + #ifdef JSON_VALIDATE + assertValid("-123,\"next\"", isValidNumber, ','); + assertValid("-12.3,\"next\"", isValidNumber, ','); + assertValid("-0.123,\"next\"", isValidNumber, ','); + assertValid("-0,\"next\"", isValidNumber, ','); + assertValid("-0.,\"next\"", isValidNumber, ','); + assertValid("-1,\"next\"", isValidNumber, ','); + assertValid("-1.,\"next\"", isValidNumber, ','); + assertValid("-0.0,\"next\"", isValidNumber, ','); + assertValid("-1.0,\"next\"", isValidNumber, ','); + assertValid("-1.01,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * Tests positive numbers with regular scientific notation + */ +void testJSONValidator__isValidNumber::testPositive_ScientificNotation(void){ + #ifdef JSON_VALIDATE + assertValid("0e123,\"next\"", isValidNumber, ','); //TODO is 0e... a valid scientific number? its always zero + assertNotValid("0e12.3,\"next\"", isValidNumber, ','); + assertValid("1.e123,\"next\"", isValidNumber, ','); + assertNotValid("1.e12.3,\"next\"", isValidNumber, ','); + assertValid("1.0e123,\"next\"", isValidNumber, ','); + assertNotValid("1.0e12.3,\"next\"", isValidNumber, ','); + + assertValid("0e2,\"next\"", isValidNumber, ','); + assertValid("1e2,\"next\"", isValidNumber, ','); + assertValid("0.e2,\"next\"", isValidNumber, ','); + assertValid("1.e2,\"next\"", isValidNumber, ','); + assertValid("0.0e2,\"next\"", isValidNumber, ','); + assertValid("1.0e2,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * Tests negative numbers with regular scientifc notation + */ +void testJSONValidator__isValidNumber::testNegative_ScientificNotation(void){ + #ifdef JSON_VALIDATE + assertValid("-0e123,\"next\"", isValidNumber, ','); + assertNotValid("-0e12.3,\"next\"", isValidNumber, ','); + assertValid("-1.e123,\"next\"", isValidNumber, ','); + assertNotValid("-1.e12.3,\"next\"", isValidNumber, ','); + assertValid("-1.0e123,\"next\"", isValidNumber, ','); + assertNotValid("-1.0e12.3,\"next\"", isValidNumber, ','); + + assertValid("-0e2,\"next\"", isValidNumber, ','); + assertValid("-1e2,\"next\"", isValidNumber, ','); + assertValid("-0.e2,\"next\"", isValidNumber, ','); + assertValid("-1.e2,\"next\"", isValidNumber, ','); + assertValid("-0.0e2,\"next\"", isValidNumber, ','); + assertValid("-1.0e2,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * Tests positive numbers with scientific notiation that has a sign in it + */ +void testJSONValidator__isValidNumber::testPositive_SignedScientificNotation(void){ + #ifdef JSON_VALIDATE + assertValid("0e-123,\"next\"", isValidNumber, ','); + assertValid("0e+123,\"next\"", isValidNumber, ','); + assertNotValid("0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("0e+12.3,\"next\"", isValidNumber, ','); + assertValid("1.e-123,\"next\"", isValidNumber, ','); + assertValid("1.e+123,\"next\"", isValidNumber, ','); + assertNotValid("1.e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("1.e+12.3,\"next\"", isValidNumber, ','); + assertValid("1.0e-123,\"next\"", isValidNumber, ','); + assertValid("1.0e+123,\"next\"", isValidNumber, ','); + assertNotValid("1.0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("1.0e+12.3,\"next\"", isValidNumber, ','); + + assertValid("0e2,\"next\"", isValidNumber, ','); + assertValid("1e2,\"next\"", isValidNumber, ','); + assertValid("0.e2,\"next\"", isValidNumber, ','); + assertValid("1.e2,\"next\"", isValidNumber, ','); + assertValid("0.0e2,\"next\"", isValidNumber, ','); + assertValid("1.0e2,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * Tests negative numbers with scientific notiation that has a sign in it + */ +void testJSONValidator__isValidNumber::testNegative_SignedScientificNotation(void){ + #ifdef JSON_VALIDATE + assertValid("-0e-123,\"next\"", isValidNumber, ','); + assertValid("-0e+123,\"next\"", isValidNumber, ','); + assertNotValid("-0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("-0e+12.3,\"next\"", isValidNumber, ','); + assertValid("-0.e-123,\"next\"", isValidNumber, ','); + assertValid("-0.e+123,\"next\"", isValidNumber, ','); + assertValid("-1.e-123,\"next\"", isValidNumber, ','); + assertValid("-1.e+123,\"next\"", isValidNumber, ','); + assertNotValid("-1.e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("-1.e+12.3,\"next\"", isValidNumber, ','); + assertValid("-0.0e-123,\"next\"", isValidNumber, ','); + assertValid("-0.0e+123,\"next\"", isValidNumber, ','); + assertValid("-1.0e-123,\"next\"", isValidNumber, ','); + assertValid("-1.0e+123,\"next\"", isValidNumber, ','); + assertNotValid("-1.0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("-1.0e+12.3,\"next\"", isValidNumber, ','); + + assertValid("-0e-2,\"next\"", isValidNumber, ','); + assertValid("-1e-2,\"next\"", isValidNumber, ','); + assertValid("-0.e-2,\"next\"", isValidNumber, ','); + assertValid("-1.e-2,\"next\"", isValidNumber, ','); + assertValid("-0.0e-2,\"next\"", isValidNumber, ','); + assertValid("-1.0e-2,\"next\"", isValidNumber, ','); + assertValid("-0e+2,\"next\"", isValidNumber, ','); + assertValid("-1e+2,\"next\"", isValidNumber, ','); + assertValid("-0.e+2,\"next\"", isValidNumber, ','); + assertValid("-1.e+2,\"next\"", isValidNumber, ','); + assertValid("-0.0e+2,\"next\"", isValidNumber, ','); + assertValid("-1.0e+2,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * Tests that in strict mode, libjson isn't relaxed about what is and isn't + * a valid number. libjson by default accepts a few extra common notations. + */ +void testJSONValidator__isValidNumber::testStrict(void){ + #ifdef JSON_VALIDATE + #ifdef JSON_STRICT + assertNotValid("00,\"next\"", isValidNumber, ','); + assertNotValid("00.01,\"next\"", isValidNumber, ','); + assertNotValid(".01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard + assertNotValid("-.01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard + assertNotValid("+123,\"next\"", isValidNumber, ','); //no leading + + assertNotValid("+12.3,\"next\"", isValidNumber, ','); + assertNotValid("+0.123,\"next\"", isValidNumber, ','); + assertNotValid("+0e123,\"next\"", isValidNumber, ','); + assertNotValid("+0e-123,\"next\"", isValidNumber, ','); + assertNotValid("+0e+123,\"next\"", isValidNumber, ','); + assertNotValid("+1.e123,\"next\"", isValidNumber, ','); + assertNotValid("+1.e-123,\"next\"", isValidNumber, ','); + assertNotValid("+1.e+123,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e123,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e-123,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e+123,\"next\"", isValidNumber, ','); + assertNotValid("+0e12.3,\"next\"", isValidNumber, ','); + assertNotValid("+0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("+0e+12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.e12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.e+12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e-12.3,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e+12.3,\"next\"", isValidNumber, ','); + + assertNotValid("0x12FF,\"next\"", isValidNumber, ','); + assertValid("0128,\"next\"", isValidNumber, ','); //legal because in STRICT mode, this is not octal, leading zero is ignored + + assertNotValid("0xABCD,\"next\"", isValidNumber, ','); + assertNotValid("0124,\"next\"", isValidNumber, ','); + assertNotValid("+1,\"next\"", isValidNumber, ','); + assertNotValid("+1.,\"next\"", isValidNumber, ','); + assertNotValid("+0.0,\"next\"", isValidNumber, ','); + assertNotValid("+1.0,\"next\"", isValidNumber, ','); + assertNotValid("+0e2,\"next\"", isValidNumber, ','); + assertNotValid("+1e2,\"next\"", isValidNumber, ','); + assertNotValid("+0.e2,\"next\"", isValidNumber, ','); + assertNotValid("+1.e2,\"next\"", isValidNumber, ','); + assertNotValid("+0.0e2,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e2,\"next\"", isValidNumber, ','); + assertNotValid("+0e-2,\"next\"", isValidNumber, ','); + assertNotValid("+1e-2,\"next\"", isValidNumber, ','); + assertNotValid("+0.e-2,\"next\"", isValidNumber, ','); + assertNotValid("+1.e-2,\"next\"", isValidNumber, ','); + assertNotValid("+0e+2,\"next\"", isValidNumber, ','); + assertNotValid("+1e+2,\"next\"", isValidNumber, ','); + assertNotValid("+0.e+2,\"next\"", isValidNumber, ','); + assertNotValid("+1.e+2,\"next\"", isValidNumber, ','); + assertNotValid("+0.0e+2,\"next\"", isValidNumber, ','); + assertNotValid("+1.0e+2,\"next\"", isValidNumber, ','); + + assertNotValid("1e-0123,\"next\"", isValidNumber, ','); //not valid because of negative and leading zero + #endif + #endif +} + + +/** + * Tests that the extra common notations that libjson supports all + * test out as valid + */ +void testJSONValidator__isValidNumber::testNotStrict(void){ + #ifdef JSON_VALIDATE + #ifndef JSON_STRICT + assertValid("00,\"next\"", isValidNumber, ','); + assertValid("00.01,\"next\"", isValidNumber, ','); + assertValid(".01,\"next\"", isValidNumber, ','); + assertValid("-.01,\"next\"", isValidNumber, ','); + assertValid("+123,\"next\"", isValidNumber, ','); + assertValid("+12.3,\"next\"", isValidNumber, ','); + assertValid("+0.123,\"next\"", isValidNumber, ','); + assertValid("+0,\"next\"", isValidNumber, ','); + assertValid("+0.,\"next\"", isValidNumber, ','); + assertValid("+0e123,\"next\"", isValidNumber, ','); + assertValid("+0e-123,\"next\"", isValidNumber, ','); + assertValid("+0e+123,\"next\"", isValidNumber, ','); + assertValid("+1.e123,\"next\"", isValidNumber, ','); + assertValid("+1.e-123,\"next\"", isValidNumber, ','); + assertValid("+1.e+123,\"next\"", isValidNumber, ','); + assertValid("+1.0e123,\"next\"", isValidNumber, ','); + assertValid("+1.0e-123,\"next\"", isValidNumber, ','); + assertValid("+1.0e+123,\"next\"", isValidNumber, ','); + assertValid("+0e12.3,\"next\"", isValidNumber, ','); + assertValid("+0e-12.3,\"next\"", isValidNumber, ','); + assertValid("+0e+12.3,\"next\"", isValidNumber, ','); + assertValid("+1.e12.3,\"next\"", isValidNumber, ','); + assertValid("+1.e-12.3,\"next\"", isValidNumber, ','); + assertValid("+1.e+12.3,\"next\"", isValidNumber, ','); + assertValid("+1.0e12.3,\"next\"", isValidNumber, ','); + assertValid("+1.0e-12.3,\"next\"", isValidNumber, ','); + assertValid("+1.0e+12.3,\"next\"", isValidNumber, ','); + + assertValid("0x12FF,\"next\"", isValidNumber, ','); + #ifdef JSON_OCTAL + assertNotValid("0128,\"next\"", isValidNumber, ','); //because of the 8 + assertValid("0123,\"next\"", isValidNumber, ','); + assertNotValid("-0128,\"next\"", isValidNumber, ','); + assertValid("-0123,\"next\"", isValidNumber, ','); + #else + assertValid("0128,\"next\"", isValidNumber, ','); //because of the 8 + assertValid("0123,\"next\"", isValidNumber, ','); + assertValid("-0128,\"next\"", isValidNumber, ','); + assertValid("-0123,\"next\"", isValidNumber, ','); + #endif + + + assertValid("0xABCD,\"next\"", isValidNumber, ','); + assertValid("0124,\"next\"", isValidNumber, ','); + assertValid("+1,\"next\"", isValidNumber, ','); + assertValid("+1.,\"next\"", isValidNumber, ','); + assertValid("+0.0,\"next\"", isValidNumber, ','); + assertValid("+1.0,\"next\"", isValidNumber, ','); + assertValid("+0e2,\"next\"", isValidNumber, ','); + assertValid("+1e2,\"next\"", isValidNumber, ','); + assertValid("+0.e2,\"next\"", isValidNumber, ','); + assertValid("+1.e2,\"next\"", isValidNumber, ','); + assertValid("+0.0e2,\"next\"", isValidNumber, ','); + assertValid("+1.0e2,\"next\"", isValidNumber, ','); + assertValid("+0e-2,\"next\"", isValidNumber, ','); + assertValid("+1e-2,\"next\"", isValidNumber, ','); + assertValid("+0.e-2,\"next\"", isValidNumber, ','); + assertValid("+1.e-2,\"next\"", isValidNumber, ','); + assertValid("+0e+2,\"next\"", isValidNumber, ','); + assertValid("+1e+2,\"next\"", isValidNumber, ','); + assertValid("+0.e+2,\"next\"", isValidNumber, ','); + assertValid("+1.e+2,\"next\"", isValidNumber, ','); + assertValid("+0.0e+2,\"next\"", isValidNumber, ','); + assertValid("+1.0e+2,\"next\"", isValidNumber, ','); + + assertValid("1e-0123,\"next\"", isValidNumber, ','); + #endif + #endif +} + + +/** + * This tests values that aren't numbers at all, to make sure they are + * flagged as not valid + */ +void testJSONValidator__isValidNumber::testNotNumbers(void){ + #ifdef JSON_VALIDATE + assertNotValid("-.,\"next\"", isValidNumber, ','); + assertNotValid("-e,\"next\"", isValidNumber, ','); + assertNotValid("0xABCDv,\"next\"", isValidNumber, ','); + assertNotValid("001234,\"next\"", isValidNumber, ','); + assertNotValid("09124,\"next\"", isValidNumber, ','); + assertNotValid("0no,\"next\"", isValidNumber, ','); + assertNotValid("no,\"next\"", isValidNumber, ','); + assertNotValid("n1234,\"next\"", isValidNumber, ','); + assertNotValid("12no,\"next\"", isValidNumber, ','); + assertNotValid("0en5,\"next\"", isValidNumber, ','); + #endif +} + + +/** + * This test checks that for all above mentioned valids, + * if the string cuts off suddenly, it recovers + */ +void testJSONValidator__isValidNumber::testSuddenEnd(void){ + #ifdef JSON_VALIDATE + assertNotValid("", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testPositive(void){ + assertNotValid("123", isValidNumber, ','); + assertNotValid("12.3", isValidNumber, ','); + assertNotValid("0.123", isValidNumber, ','); + assertNotValid("0", isValidNumber, ','); + assertNotValid("0.", isValidNumber, ','); + assertNotValid("1.", isValidNumber, ','); + assertNotValid("1", isValidNumber, ','); + assertNotValid("0.0", isValidNumber, ','); + assertNotValid("1.0", isValidNumber, ','); + assertNotValid("1.01", isValidNumber, ','); + assertNotValid("0123", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testNegative(void){ + assertNotValid("-123", isValidNumber, ','); + assertNotValid("-12.3", isValidNumber, ','); + assertNotValid("-0.123", isValidNumber, ','); + assertNotValid("-0", isValidNumber, ','); + assertNotValid("-0.", isValidNumber, ','); + assertNotValid("-1", isValidNumber, ','); + assertNotValid("-1.", isValidNumber, ','); + assertNotValid("-0.0", isValidNumber, ','); + assertNotValid("-1.0", isValidNumber, ','); + assertNotValid("-1.01", isValidNumber, ','); + assertNotValid("-0123", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testPositive_ScientificNotation(void){ + assertNotValid("0e", isValidNumber, ','); + assertNotValid("0E", isValidNumber, ','); + assertNotValid("0e123", isValidNumber, ','); + assertNotValid("0e12.3", isValidNumber, ','); + assertNotValid("1.e123", isValidNumber, ','); + assertNotValid("1.e12.3", isValidNumber, ','); + assertNotValid("1.0e123", isValidNumber, ','); + assertNotValid("1.0e12.3", isValidNumber, ','); + assertNotValid("0e2", isValidNumber, ','); + assertNotValid("1e2", isValidNumber, ','); + assertNotValid("0.e2", isValidNumber, ','); + assertNotValid("1.e2", isValidNumber, ','); + assertNotValid("0.0e2", isValidNumber, ','); + assertNotValid("1.0e2", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testNegative_ScientificNotation(void){ + assertNotValid("-0e123", isValidNumber, ','); + assertNotValid("-0e12.3", isValidNumber, ','); + assertNotValid("-1.e123", isValidNumber, ','); + assertNotValid("-1.e12.3", isValidNumber, ','); + assertNotValid("-1.0e123", isValidNumber, ','); + assertNotValid("-1.0e12.3", isValidNumber, ','); + assertNotValid("-0e2", isValidNumber, ','); + assertNotValid("-1e2", isValidNumber, ','); + assertNotValid("-0.e2", isValidNumber, ','); + assertNotValid("-1.e2", isValidNumber, ','); + assertNotValid("-0.0e2", isValidNumber, ','); + assertNotValid("-1.0e2", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testPositive_SignedScientificNotation(void){ + assertNotValid("0e-123", isValidNumber, ','); + assertNotValid("0e+123", isValidNumber, ','); + assertNotValid("0e-12.3", isValidNumber, ','); + assertNotValid("0e+12.3", isValidNumber, ','); + assertNotValid("1.e-123", isValidNumber, ','); + assertNotValid("1.e+123", isValidNumber, ','); + assertNotValid("1.e-12.3", isValidNumber, ','); + assertNotValid("1.e+12.3", isValidNumber, ','); + assertNotValid("1.0e-123", isValidNumber, ','); + assertNotValid("1.0e+123", isValidNumber, ','); + assertNotValid("1.0e-12.3", isValidNumber, ','); + assertNotValid("1.0e+12.3", isValidNumber, ','); + assertNotValid("0e2", isValidNumber, ','); + assertNotValid("1e2", isValidNumber, ','); + assertNotValid("0.e2", isValidNumber, ','); + assertNotValid("1.e2", isValidNumber, ','); + assertNotValid("0.0e2", isValidNumber, ','); + assertNotValid("1.0e2", isValidNumber, ','); + + //--- void testJSONValidator__isValidNumber::testNegative_SignedScientificNotation(void){ + assertNotValid("-0e-123", isValidNumber, ','); + assertNotValid("-0e+123", isValidNumber, ','); + assertNotValid("-0e-12.3", isValidNumber, ','); + assertNotValid("-0e+12.3", isValidNumber, ','); + assertNotValid("-0.e-123", isValidNumber, ','); + assertNotValid("-0.e+123", isValidNumber, ','); + assertNotValid("-1.e-123", isValidNumber, ','); + assertNotValid("-1.e+123", isValidNumber, ','); + assertNotValid("-1.e-12.3", isValidNumber, ','); + assertNotValid("-1.e+12.3", isValidNumber, ','); + assertNotValid("-0.0e-123", isValidNumber, ','); + assertNotValid("-0.0e+123", isValidNumber, ','); + assertNotValid("-1.0e-123", isValidNumber, ','); + assertNotValid("-1.0e+123", isValidNumber, ','); + assertNotValid("-1.0e-12.3", isValidNumber, ','); + assertNotValid("-1.0e+12.3", isValidNumber, ','); + assertNotValid("-0e-2", isValidNumber, ','); + assertNotValid("-1e-2", isValidNumber, ','); + assertNotValid("-0.e-2", isValidNumber, ','); + assertNotValid("-1.e-2", isValidNumber, ','); + assertNotValid("-0.0e-2", isValidNumber, ','); + assertNotValid("-1.0e-2", isValidNumber, ','); + assertNotValid("-0e+2", isValidNumber, ','); + assertNotValid("-1e+2", isValidNumber, ','); + assertNotValid("-0.e+2", isValidNumber, ','); + assertNotValid("-1.e+2", isValidNumber, ','); + assertNotValid("-0.0e+2", isValidNumber, ','); + assertNotValid("-1.0e+2", isValidNumber, ','); + + //strict stuff + assertNotValid(".01", isValidNumber, ','); //no leading 0 as required by the standard + assertNotValid("-.01", isValidNumber, ','); //no leading 0 as required by the standard + assertNotValid("+123", isValidNumber, ','); //no leading + + assertNotValid("+12.3", isValidNumber, ','); + assertNotValid("+0.123", isValidNumber, ','); + assertNotValid("+0e123", isValidNumber, ','); + assertNotValid("+0e-123", isValidNumber, ','); + assertNotValid("+0e+123", isValidNumber, ','); + assertNotValid("+1.e123", isValidNumber, ','); + assertNotValid("+1.e-123", isValidNumber, ','); + assertNotValid("+1.e+123", isValidNumber, ','); + assertNotValid("+1.0e123", isValidNumber, ','); + assertNotValid("+1.0e-123", isValidNumber, ','); + assertNotValid("+1.0e+123", isValidNumber, ','); + assertNotValid("+0e12.3", isValidNumber, ','); + assertNotValid("+0e-12.3", isValidNumber, ','); + assertNotValid("+0e+12.3", isValidNumber, ','); + assertNotValid("+1.e12.3", isValidNumber, ','); + assertNotValid("+1.e-12.3", isValidNumber, ','); + assertNotValid("+1.e+12.3", isValidNumber, ','); + assertNotValid("+1.0e12.3", isValidNumber, ','); + assertNotValid("+1.0e-12.3", isValidNumber, ','); + assertNotValid("+1.0e+12.3", isValidNumber, ','); + assertNotValid("0x12FF", isValidNumber, ','); + assertNotValid("0128", isValidNumber, ','); //legal because in STRICT mode, this is not octal, leading zero is ignored + assertNotValid("0xABCD", isValidNumber, ','); + assertNotValid("0124", isValidNumber, ','); + assertNotValid("+1", isValidNumber, ','); + assertNotValid("+1.", isValidNumber, ','); + assertNotValid("+0.0", isValidNumber, ','); + assertNotValid("+1.0", isValidNumber, ','); + assertNotValid("+0e2", isValidNumber, ','); + assertNotValid("+1e2", isValidNumber, ','); + assertNotValid("+0.e2", isValidNumber, ','); + assertNotValid("+1.e2", isValidNumber, ','); + assertNotValid("+0.0e2", isValidNumber, ','); + assertNotValid("+1.0e2", isValidNumber, ','); + assertNotValid("+0e-2", isValidNumber, ','); + assertNotValid("+1e-2", isValidNumber, ','); + assertNotValid("+0.e-2", isValidNumber, ','); + assertNotValid("+1.e-2", isValidNumber, ','); + assertNotValid("+0e+2", isValidNumber, ','); + assertNotValid("+1e+2", isValidNumber, ','); + assertNotValid("+0.e+2", isValidNumber, ','); + assertNotValid("+1.e+2", isValidNumber, ','); + assertNotValid("+0.0e+2", isValidNumber, ','); + assertNotValid("+1.0e+2", isValidNumber, ','); + assertNotValid("0128", isValidNumber, ','); //because of the 8 + + + //--- void testJSONValidator__isValidNumber::testNotNumbers(void){ + assertNotValid("0xABCDv", isValidNumber, ','); + assertNotValid("001234", isValidNumber, ','); + assertNotValid("09124", isValidNumber, ','); + assertNotValid("0no", isValidNumber, ','); + assertNotValid("no", isValidNumber, ','); + assertNotValid("n1234", isValidNumber, ','); + assertNotValid("12no", isValidNumber, ','); + assertNotValid("0en5", isValidNumber, ','); + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.h b/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.h new file mode 100644 index 0000000..da4e5fa --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidNumber.h @@ -0,0 +1,21 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_NUMBER_H +#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_NUMBER_H + +#include "../BaseTest.h" + +class testJSONValidator__isValidNumber : public BaseTest { +public: + testJSONValidator__isValidNumber(const std::string & name) : BaseTest(name){} + void testPositive(void); + void testNegative(void); + void testPositive_ScientificNotation(void); + void testNegative_ScientificNotation(void); + void testPositive_SignedScientificNotation(void); + void testNegative_SignedScientificNotation(void); + void testStrict(void); + void testNotStrict(void); + void testNotNumbers(void); + void testSuddenEnd(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidObject.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidObject.cpp new file mode 100644 index 0000000..ea6ae25 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidObject.cpp @@ -0,0 +1,11 @@ +/* + * isValidObject.cpp + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + +#include "isValidObject.h" + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidObject.h b/libjson/_internal/TestSuite2/JSONValidator/isValidObject.h new file mode 100644 index 0000000..713719e --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidObject.h @@ -0,0 +1,9 @@ +/* + * isValidObject.h + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.cpp new file mode 100644 index 0000000..ad9af9c --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.cpp @@ -0,0 +1,11 @@ +/* + * isValidPartialRoot.cpp + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + +#include "isValidPartialRoot.h" + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.h b/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.h new file mode 100644 index 0000000..74a6c4e --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidPartialRoot.h @@ -0,0 +1,9 @@ +/* + * isValidPartialRoot.h + * TestSuite + * + * Created by Jonathan Wallace on 11/13/11. + * Copyright 2011 StreamWIDE. All rights reserved. + * + */ + diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.cpp new file mode 100644 index 0000000..bd7b345 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.cpp @@ -0,0 +1,39 @@ +#include "isValidRoot.h" +#include "Resources/validyMacros.h" +#include "../../Source/JSONValidator.h" + +void testJSONValidator__isValidRoot::testRoots(void){ + #ifdef JSON_VALIDATE + assertTrue(JSONValidator::isValidRoot(JSON_TEXT("{}"))); + assertTrue(JSONValidator::isValidRoot(JSON_TEXT("[]"))); + assertTrue(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\"]"))); + #endif +} + +void testJSONValidator__isValidRoot::testNotRoots(void){ + #ifdef JSON_VALIDATE + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{]"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[}"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT(""))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\":{},]"))); + #endif +} + +void testJSONValidator__isValidRoot::testSuddenEnd(void){ + #ifdef JSON_VALIDATE + assertFalse(JSONValidator::isValidRoot(JSON_TEXT(""))); + + //--- void testJSONValidator__isValidRoot::testRoots(void){ + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("["))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff"))); + + //---void testJSONValidator__isValidRoot::testNotRoots(void){ + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe"))); + assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe"))); + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.h b/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.h new file mode 100644 index 0000000..ff1a26b --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidRoot.h @@ -0,0 +1,14 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_ROOT_H +#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_ROOT_H + +#include "../BaseTest.h" + +class testJSONValidator__isValidRoot : public BaseTest { +public: + testJSONValidator__isValidRoot(const std::string & name) : BaseTest(name){} + void testRoots(void); + void testNotRoots(void); + void testSuddenEnd(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidString.cpp b/libjson/_internal/TestSuite2/JSONValidator/isValidString.cpp new file mode 100644 index 0000000..b59b6db --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidString.cpp @@ -0,0 +1,63 @@ +#include "isValidString.h" +#include "Resources/validyMacros.h" +#include "../../Source/JSONValidator.h" + +void testJSONValidator__isValidString::testNormal(void){ + assertValid("hello\":123", isValidString, ':'); + assertValid("he\\\"ll\\\"o\":123", isValidString, ':'); +} + +void testJSONValidator__isValidString::testUnicode(void){ + assertValid("he\\u1234llo\":123", isValidString, ':'); + assertValid("he\\u0FFFllo\":123", isValidString, ':'); + assertNotValid("he\\uFFFGllo\":123", isValidString, ':'); +} + +void testJSONValidator__isValidString::testStrict(void){ + #ifdef JSON_STRICT + assertNotValid("he\\xFFllo\":123", isValidString, ':'); + assertNotValid("he\\0123llo\":123", isValidString, ':'); + #endif +} + +void testJSONValidator__isValidString::testNotStrict(void){ + #ifndef JSON_STRICT + assertValid("he\\xFFllo\":123", isValidString, ':'); + #ifdef JSON_OCTAL + assertValid("he\\0123llo\":123", isValidString, ':'); + #else + assertNotValid("he\\0123llo\":123", isValidString, ':'); + #endif + #endif +} + +void testJSONValidator__isValidString::testNotString(void){ + assertNotValid("he\\128llo\":123", isValidString, ':'); //not valid even when not strict because of the 8 +} + +void testJSONValidator__isValidString::testSuddenEnd(void){ + assertNotValid("he\\", isValidString, ':'); + assertNotValid("he\\\"", isValidString, ':'); //escaped quote + assertNotValid("he\\\"llo\\\"", isValidString, ':'); //two esacaped quotes + + //--- void testJSONValidator__isValidString::testNormal(void){ + assertNotValid("hello", isValidString, ':'); + assertNotValid("he\\\"ll\\\"o", isValidString, ':'); + + //--- void testJSONValidator__isValidString::testUnicode(void){ + assertNotValid("he\\u1234llo", isValidString, ':'); + assertNotValid("he\\u0FF", isValidString, ':'); + assertNotValid("he\\u0F", isValidString, ':'); + assertNotValid("he\\u0", isValidString, ':'); + assertNotValid("he\\u", isValidString, ':'); + assertNotValid("he\\", isValidString, ':'); + + //strict stuff + assertNotValid("he\\xFF", isValidString, ':'); + assertNotValid("he\\xF", isValidString, ':'); + assertNotValid("he\\x", isValidString, ':'); + assertNotValid("he\\0123", isValidString, ':'); + assertNotValid("he\\012", isValidString, ':'); + assertNotValid("he\\01", isValidString, ':'); + assertNotValid("he\\0", isValidString, ':'); +} diff --git a/libjson/_internal/TestSuite2/JSONValidator/isValidString.h b/libjson/_internal/TestSuite2/JSONValidator/isValidString.h new file mode 100644 index 0000000..f9d6b76 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/isValidString.h @@ -0,0 +1,17 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_STRING_H +#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_STRING_H + +#include "../BaseTest.h" + +class testJSONValidator__isValidString : public BaseTest { +public: + testJSONValidator__isValidString(const std::string & name) : BaseTest(name){} + void testNormal(void); + void testUnicode(void); + void testStrict(void); + void testNotStrict(void); + void testNotString(void); + void testSuddenEnd(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSONValidator/securityTest.cpp b/libjson/_internal/TestSuite2/JSONValidator/securityTest.cpp new file mode 100644 index 0000000..23d32e3 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/securityTest.cpp @@ -0,0 +1,27 @@ +#include "securityTest.h" +#include "Resources/validyMacros.h" +#include "../../Source/JSONValidator.h" + +void testJSONValidator__securityTest::testsecurity(void){ + #ifdef JSON_SECURITY_MAX_NEST_LEVEL + #if (JSON_SECURITY_MAX_NEST_LEVEL != 128) + #error, test suite only wants a nest security level of 100 + #endif + { + json_string json(JSON_TEXT("{")); + for(unsigned int i = 0; i < 127; ++i){ + json += JSON_TEXT("\"n\":{"); + } + json += json_string(128, '}'); + assertTrue(JSONValidator::isValidRoot(json.c_str())); + } + { + json_string json(JSON_TEXT("{")); + for(unsigned int i = 0; i < 128; ++i){ + json += JSON_TEXT("\"n\":{"); + } + json += json_string(129, '}'); + assertFalse(JSONValidator::isValidRoot(json.c_str())); + } + #endif +} diff --git a/libjson/_internal/TestSuite2/JSONValidator/securityTest.h b/libjson/_internal/TestSuite2/JSONValidator/securityTest.h new file mode 100644 index 0000000..9f3dd37 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSONValidator/securityTest.h @@ -0,0 +1,12 @@ +#ifndef JSON_TESTSUITE_JSON_VALIDATOR__SECURITY_TEST_H +#define JSON_TESTSUITE_JSON_VALIDATOR__SECURITY_TEST_H + +#include "../BaseTest.h" + +class testJSONValidator__securityTest : public BaseTest { +public: + testJSONValidator__securityTest(const std::string & name) : BaseTest(name){} + void testsecurity(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.cpp b/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.cpp new file mode 100644 index 0000000..2f97cf3 --- /dev/null +++ b/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.cpp @@ -0,0 +1,12 @@ +#include "json_decode64.h" +#include "../../Source/JSON_Base64.h" + +void testJSON_Base64__json_decode64::testNotBase64(void){ + #if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) + #ifdef JSON_SAFE + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123!abc")), ""); + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123=abc")), ""); + assertEquals(JSONBase64::json_decode64(JSON_TEXT("123abc===")), ""); + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.h b/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.h new file mode 100644 index 0000000..f4219ad --- /dev/null +++ b/libjson/_internal/TestSuite2/JSON_Base64/json_decode64.h @@ -0,0 +1,12 @@ +#ifndef JSON_TESTSUITE_JSON_BASE64__JSON_DECODE64_H +#define JSON_TESTSUITE_JSON_BASE64__JSON_DECODE64_H + +#include "../BaseTest.h" + +class testJSON_Base64__json_decode64 : public BaseTest { +public: + testJSON_Base64__json_decode64(const std::string & name) : BaseTest(name){} + void testNotBase64(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.cpp b/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.cpp new file mode 100644 index 0000000..84986fb --- /dev/null +++ b/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.cpp @@ -0,0 +1,48 @@ +#include "json_encode64.h" +#include "../../Source/JSON_Base64.h" + +/** + * Make sure that these two function reverse each other + */ +void testJSON_Base64__json_encode64::testReverseEachOther(void){ + #if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) + #ifdef JSON_SAFE + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"", 0)), ""); + #endif + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"A", 1)), "A"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"AB", 2)), "AB"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABC", 3)), "ABC"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCD", 4)), "ABCD"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDE", 5)), "ABCDE"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEF", 6)), "ABCDEF"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFG", 7)), "ABCDEFG"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGH", 8)), "ABCDEFGH"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHI", 9)), "ABCDEFGHI"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJ", 10)), "ABCDEFGHIJ"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJK", 11)), "ABCDEFGHIJK"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJKL", 12)), "ABCDEFGHIJKL"); + assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJKLM", 13)), "ABCDEFGHIJKLM"); +#endif +} + +/** + * Make sure all characters work in the code + */ +void testJSON_Base64__json_encode64::testAllChars(void){ + #if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64) + + //create a binary chunk of data to use with every char + unsigned char temp[255]; + for(unsigned int i = 0; i < 255; ++i){ + temp[i] = (unsigned char)i; + } + + //loop through all of the lengths + for(unsigned int length = 1; length < 255; ++length){ + json_string ts = JSONBase64::json_encode64(temp, length); + std::string rs = JSONBase64::json_decode64(ts); + assertEquals(rs.size(), length); + assertEquals(memcmp(rs.data(), temp, length), 0); + } + #endif +} diff --git a/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.h b/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.h new file mode 100644 index 0000000..291814b --- /dev/null +++ b/libjson/_internal/TestSuite2/JSON_Base64/json_encode64.h @@ -0,0 +1,13 @@ +#ifndef JSON_TESTSUITE_JSON_BASE64__JSON_ENCODE64_H +#define JSON_TESTSUITE_JSON_BASE64__JSON_ENCODE64_H + +#include "../BaseTest.h" + +class testJSON_Base64__json_encode64 : public BaseTest { +public: + testJSON_Base64__json_encode64(const std::string & name) : BaseTest(name){} + void testReverseEachOther(void); + void testAllChars(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.cpp b/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.cpp new file mode 100644 index 0000000..84e55dc --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.cpp @@ -0,0 +1,47 @@ +#include "_areFloatsEqual.h" +#include "../../Source/NumberToString.h" + + +/** + * Tests that numbers that are actually equal are identified that way + */ +void testNumberToString__areFloatsEqual::testEqual(void){ + assertTrue(_floatsAreEqual( 0.0, 0.0)); + assertTrue(_floatsAreEqual( 1.0, 1.0)); + assertTrue(_floatsAreEqual( 1.1, 1.1)); + assertTrue(_floatsAreEqual(-1.0, -1.0)); + assertTrue(_floatsAreEqual( 0.1, 0.1)); + assertTrue(_floatsAreEqual(-0.1, -0.1)); +} + + +/** + * Make sure that numbers that are very different are identified as not equal + */ +void testNumberToString__areFloatsEqual::testNotEqual(void){ + assertFalse(_floatsAreEqual( 1.0, -1.0)); + assertFalse(_floatsAreEqual( 1.0, 0.0)); + assertFalse(_floatsAreEqual(-1.0, -.0)); + assertFalse(_floatsAreEqual( 0.1, 0.0)); + assertFalse(_floatsAreEqual(-0.1, 0.0)); + assertFalse(_floatsAreEqual(1.0, 1.0001)); + assertFalse(_floatsAreEqual(1.0001, 1.0)); +} + + +/** + * Make sure numbers that are different, but within the threshold of + * floats/doubles being equal are identified as equal + */ +void testNumberToString__areFloatsEqual::testCloseEnough(void){ + //check the exact threshold + assertFalse(_floatsAreEqual( 0.0, JSON_FLOAT_THRESHHOLD)); + assertFalse(_floatsAreEqual( 0.0, -JSON_FLOAT_THRESHHOLD)); + + //check things beneath that threashold + assertTrue(_floatsAreEqual(0.0, JSON_FLOAT_THRESHHOLD / 2)); + assertTrue(_floatsAreEqual(0.0, JSON_FLOAT_THRESHHOLD / -2)); + assertTrue(_floatsAreEqual(-0.1, -0.1)); + assertTrue(_floatsAreEqual(1.000000001, 1.0)); + assertTrue(_floatsAreEqual(1.0, 1.000000001)); +} diff --git a/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.h b/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.h new file mode 100644 index 0000000..163b78b --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_areFloatsEqual.h @@ -0,0 +1,14 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ARE_FLOATS_EQUAL_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__ARE_FLOATS_EQUAL_H + +#include "../BaseTest.h" + +class testNumberToString__areFloatsEqual : public BaseTest { +public: + testNumberToString__areFloatsEqual(const std::string & name) : BaseTest(name){} + void testEqual(void); + void testNotEqual(void); + void testCloseEnough(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/_atof.cpp b/libjson/_internal/TestSuite2/NumberToString/_atof.cpp new file mode 100644 index 0000000..f1bfb29 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_atof.cpp @@ -0,0 +1,245 @@ +#include "_atof.h" +#include "../../Source/NumberToString.h" + +#ifdef JSON_SAFE + #define assertNaN(one) assertNAN(json_number, one) +#else + #define assertNaN(one) +#endif + +testNumberToString__atof::testNumberToString__atof(const std::string & name) : BaseTest(name){ + //ScopeCoverageHeap(_atof, 14); +} +testNumberToString__atof::~testNumberToString__atof(){ + //AssertScopeCoverageHeap(_atof); +} + +/** + * Tests regular positive numbers in various forms + */ +void testNumberToString__atof::testPositive(void){ +#ifdef JSON_STRICT + assertFloatEquals(123, NumberToString::_atof(JSON_TEXT("123"))); + assertFloatEquals(12.3, NumberToString::_atof(JSON_TEXT("12.3"))); + assertFloatEquals(0.123, NumberToString::_atof(JSON_TEXT("0.123"))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0"))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0."))); + assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1."))); + assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1"))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0.0"))); + assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1.0"))); + assertFloatEquals(1.01, NumberToString::_atof(JSON_TEXT("1.01"))); +#endif +} + +/** + * Tests negative numbers with regular scientifc notation + */ +void testNumberToString__atof::testNegative(void){ +#ifdef JSON_STRICT + assertFloatEquals(-123, NumberToString::_atof(JSON_TEXT("-123"))); + assertFloatEquals(-12.3, NumberToString::_atof(JSON_TEXT("-12.3"))); + assertFloatEquals(-.123, NumberToString::_atof(JSON_TEXT("-0.123"))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0"))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0."))); + assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1"))); + assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1."))); + assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0.0"))); + assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1.0"))); +#endif +} + +/** + * Tests positive numbers with scientific notiation that has a sign in it + */ +void testNumberToString__atof::testPositive_ScientificNotation(void){ +#ifdef JSON_STRICT + assertNAN(json_number, std::numeric_limits::signaling_NaN()); //sanity check + assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0e3.3"))); + + assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.e3.3"))); + assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.0e3.3"))); + + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.0e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.0e2"))); +#endif +} + +/** + * Tests negative numbers with regular scientifc notation + */ +void testNumberToString__atof::testNegative_ScientificNotation(void){ +#ifdef JSON_STRICT + assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("-0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-0e3.3"))); + assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.e3.3"))); + assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e3.3"))); + + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0e2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.e2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.0e2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.0e2"))); +#endif +} + +/** + * Tests positive numbers with scientific notiation that has a sign in it + */ +void testNumberToString__atof::testPositive_SignedScientificNotation(void){ +#ifdef JSON_STRICT + assertFloatEquals(0e-3, NumberToString::_atof(JSON_TEXT("0e-3"))); + assertFloatEquals(0e+3, NumberToString::_atof(JSON_TEXT("0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0e+3.3"))); + assertFloatEquals(1e-3, NumberToString::_atof(JSON_TEXT("1.e-3"))); + assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.e+3.3"))); + assertFloatEquals(1e-3, NumberToString::_atof(JSON_TEXT("1.0e-3"))); + assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.0e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("1.0e+3.3"))); + + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.e2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.0e2"))); + assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.0e2"))); +#endif +} + + +/** + * Tests negative numbers with scientific notiation that has a sign in it + */ +void testNumberToString__atof::testNegative_SignedScientificNotation(void){ +#ifdef JSON_STRICT + assertFloatEquals(0e-3, NumberToString::_atof(JSON_TEXT("-0e-3"))); + assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("-0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-0.e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-0.e+3.3"))); + assertFloatEquals(-1e-3, NumberToString::_atof(JSON_TEXT("-1.e-3"))); + assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.e+3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-0.0e-3.3"))); + assertNaN( NumberToString::_atof(JSON_TEXT("-0.0e+3.3"))); + assertFloatEquals(-1e-3, NumberToString::_atof(JSON_TEXT("-1.0e-3"))); + assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e+3.3"))); + + assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0e-2"))); + assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1e-2"))); + assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0.e-2"))); + assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1.e-2"))); + assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0.0e-2"))); + assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1.0e-2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0e+2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1e+2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.e+2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.e+2"))); + assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.0e+2"))); + assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.0e+2"))); + + assertNaN(NumberToString::_atof(JSON_TEXT("1e-0123"))); //not valid because of negative and leading zero +#endif +} + +void testNumberToString__atof::testStrict(void){ +#if defined(JSON_SAFE) || defined(JSON_DEBUG) +#ifdef JSON_STRICT + assertNaN(NumberToString::_atof(JSON_TEXT("00"))); + assertNaN(NumberToString::_atof(JSON_TEXT("00.01"))); + assertNaN(NumberToString::_atof(JSON_TEXT(".01"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-.01"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+123"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+12.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.123"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0."))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e-3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e+3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+3.3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3.3"))); + + assertNaN(NumberToString::_atof(JSON_TEXT("0x12FF"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0128"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0123"))); + assertNaN(NumberToString::_atof(JSON_TEXT("-0123"))); + + assertNaN(NumberToString::_atof(JSON_TEXT("0xABCD"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0124"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1."))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.0"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0e+2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1e+2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.e+2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e+2"))); + assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+2"))); +#endif +#endif +} + +void testNumberToString__atof::testNotNumbers(void){ +#if defined(JSON_SAFE) || defined(JSON_DEBUG) +#ifdef JSON_STRICT + assertNaN(NumberToString::_atof(JSON_TEXT("-."))); + assertNaN(NumberToString::_atof(JSON_TEXT("-e3"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0xABCDv"))); + assertNaN(NumberToString::_atof(JSON_TEXT("00124"))); + assertNaN(NumberToString::_atof(JSON_TEXT("09124"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0no"))); + assertNaN(NumberToString::_atof(JSON_TEXT("no"))); + assertNaN(NumberToString::_atof(JSON_TEXT("n1234"))); + assertNaN(NumberToString::_atof(JSON_TEXT("12no"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0en5"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0e"))); + assertNaN(NumberToString::_atof(JSON_TEXT("0E"))); +#endif +#endif +} + diff --git a/libjson/_internal/TestSuite2/NumberToString/_atof.h b/libjson/_internal/TestSuite2/NumberToString/_atof.h new file mode 100644 index 0000000..e98a0e5 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_atof.h @@ -0,0 +1,20 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ATOF_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__ATOF_H + +#include "../BaseTest.h" + +class testNumberToString__atof : public BaseTest { +public: + testNumberToString__atof(const std::string & name); + virtual ~testNumberToString__atof(); + void testPositive(void); + void testNegative(void); + void testPositive_ScientificNotation(void); + void testNegative_ScientificNotation(void); + void testPositive_SignedScientificNotation(void); + void testNegative_SignedScientificNotation(void); + void testStrict(void); + void testNotNumbers(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/_ftoa.cpp b/libjson/_internal/TestSuite2/NumberToString/_ftoa.cpp new file mode 100644 index 0000000..03b07c0 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_ftoa.cpp @@ -0,0 +1,38 @@ +#include "_ftoa.h" +#include "../../Source/NumberToString.h" + + +/** + * Test that the float to string function works + */ +void testNumberToString__ftoa::testRandomNumbers(void){ + //random numbers to varying precision + assertEquals(NumberToString::_ftoa((json_number) 1.2), JSON_TEXT( "1.2")); + assertEquals(NumberToString::_ftoa((json_number) -1.2), JSON_TEXT( "-1.2")); + assertEquals(NumberToString::_ftoa((json_number) 1.02), JSON_TEXT( "1.02")); + assertEquals(NumberToString::_ftoa((json_number) -1.02), JSON_TEXT( "-1.02")); + assertEquals(NumberToString::_ftoa((json_number) 1.002), JSON_TEXT( "1.002")); + assertEquals(NumberToString::_ftoa((json_number) -1.002), JSON_TEXT( "-1.002")); + assertEquals(NumberToString::_ftoa((json_number) 3.1415), JSON_TEXT( "3.1415")); + assertEquals(NumberToString::_ftoa((json_number) -3.1415), JSON_TEXT( "-3.1415")); +} + + +/** + * This function reverts to one of the int functions in case of an int because + * they are faster. This tests that. + */ +void testNumberToString__ftoa::testSpecializedInts(void){ + assertEquals(NumberToString::_ftoa((json_number) 1.0), JSON_TEXT( "1")); + assertEquals(NumberToString::_ftoa((json_number) 10.0), JSON_TEXT( "10")); + assertEquals(NumberToString::_ftoa((json_number) -1.0), JSON_TEXT( "-1")); + assertEquals(NumberToString::_ftoa((json_number)-10.0), JSON_TEXT("-10")); + assertEquals(NumberToString::_ftoa((json_number) 0.0), JSON_TEXT( "0")); + assertEquals(NumberToString::_ftoa((json_number) -0.0), JSON_TEXT( "0")); + + //close enough to an int + assertEquals(NumberToString::_ftoa((json_number) 1.000000001), JSON_TEXT( "1")); + assertEquals(NumberToString::_ftoa((json_number) -1.000000001), JSON_TEXT( "-1")); + assertEquals(NumberToString::_ftoa((json_number) 0.000000001), JSON_TEXT( "0")); + assertEquals(NumberToString::_ftoa((json_number) -0.000000001), JSON_TEXT( "0")); +} diff --git a/libjson/_internal/TestSuite2/NumberToString/_ftoa.h b/libjson/_internal/TestSuite2/NumberToString/_ftoa.h new file mode 100644 index 0000000..fc4ffe1 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_ftoa.h @@ -0,0 +1,13 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__FTOA_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__FTOA_H + +#include "../BaseTest.h" + +class testNumberToString__ftoa : public BaseTest { +public: + testNumberToString__ftoa(const std::string & name) : BaseTest(name){} + void testRandomNumbers(void); + void testSpecializedInts(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/_itoa.cpp b/libjson/_internal/TestSuite2/NumberToString/_itoa.cpp new file mode 100644 index 0000000..fcaa9bc --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_itoa.cpp @@ -0,0 +1,108 @@ +#include "_itoa.h" +#include "../../Source/NumberToString.h" + + +/** + * Test converting a char value into a string + */ +void testNumberToString__itoa::testChar(void){ + //GetScopeCoverage(_itoa, true); + assertEquals(sizeof(char), 1); + assertEquals(NumberToString::_itoa((char)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((char)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((char)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((char)-0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((char)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((char)-127), JSON_TEXT("-127")); + //AssertScopeCoverage(_itoa); +} + + +/** + * Test converting a short value into a string + */ +void testNumberToString__itoa::testShort(void){ + //GetScopeCoverage(_itoa, true); + assertEquals(sizeof(short), 2); + assertEquals(NumberToString::_itoa((short)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_itoa((short)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((short)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((short)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((short)-0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((short)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((short)-127), JSON_TEXT("-127")); + assertEquals(NumberToString::_itoa((short)-32767), JSON_TEXT("-32767")); + //AssertScopeCoverage(_itoa); +} + + +/** + * Test converting an int value into a string + */ +void testNumberToString__itoa::testInt(void){ + //GetScopeCoverage(_itoa, true); + assertEquals(sizeof(int), 4); + assertEquals(NumberToString::_itoa((int)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_itoa((int)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_itoa((int)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((int)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((int)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((int)-0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((int)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((int)-127), JSON_TEXT("-127")); + assertEquals(NumberToString::_itoa((int)-32767), JSON_TEXT("-32767")); + assertEquals(NumberToString::_itoa((int)-2147483647), JSON_TEXT("-2147483647")); + //AssertScopeCoverage(_itoa); +} + + +/** + * Test converting a long value into a string + */ +void testNumberToString__itoa::testLong(void){ + //GetScopeCoverage(_itoa, true); + #ifdef TEST_LONG_EXTREMES + if (sizeof(long) >= 8){ + assertEquals(NumberToString::_itoa((long)9223372036854775807L), JSON_TEXT("9223372036854775807")); + assertEquals(NumberToString::_itoa((long)-9223372036854775807L), JSON_TEXT("-9223372036854775807")); + } + #endif + assertEquals(NumberToString::_itoa((long)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_itoa((long)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_itoa((long)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((long)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((long)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((long)-0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((long)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((long)-127), JSON_TEXT("-127")); + assertEquals(NumberToString::_itoa((long)-32767), JSON_TEXT("-32767")); + assertEquals(NumberToString::_itoa((long)-2147483647), JSON_TEXT("-2147483647")); + //AssertScopeCoverage(_itoa); +} + + +/** + * Test converting a long long value into a string + */ +void testNumberToString__itoa::testLongLong(void){ + #ifndef JSON_ISO_STRICT + //GetScopeCoverage(_itoa, true); + #ifdef TEST_LONG_EXTREMES + if (sizeof(long long) >= 8){ + assertEquals(NumberToString::_itoa((long long)9223372036854775807L), JSON_TEXT("9223372036854775807")); + assertEquals(NumberToString::_itoa((long long)-9223372036854775807L), JSON_TEXT("-9223372036854775807")); + } + #endif + assertEquals(NumberToString::_itoa((long long)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_itoa((long long)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_itoa((long long)127), JSON_TEXT("127")); + assertEquals(NumberToString::_itoa((long long)15), JSON_TEXT("15")); + assertEquals(NumberToString::_itoa((long long)0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((long long)-0), JSON_TEXT("0")); + assertEquals(NumberToString::_itoa((long long)-15), JSON_TEXT("-15")); + assertEquals(NumberToString::_itoa((long long)-127), JSON_TEXT("-127")); + assertEquals(NumberToString::_itoa((long long)-32767), JSON_TEXT("-32767")); + assertEquals(NumberToString::_itoa((long long)-2147483647), JSON_TEXT("-2147483647")); + //AssertScopeCoverage(_itoa); + #endif +} diff --git a/libjson/_internal/TestSuite2/NumberToString/_itoa.h b/libjson/_internal/TestSuite2/NumberToString/_itoa.h new file mode 100644 index 0000000..d773060 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_itoa.h @@ -0,0 +1,16 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ITOA_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__ITOA_H + +#include "../BaseTest.h" + +class testNumberToString__itoa : public BaseTest { +public: + testNumberToString__itoa(const std::string & name) : BaseTest(name){} + void testChar(void); + void testShort(void); + void testInt(void); + void testLong(void); + void testLongLong(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/_uitoa.cpp b/libjson/_internal/TestSuite2/NumberToString/_uitoa.cpp new file mode 100644 index 0000000..c729592 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_uitoa.cpp @@ -0,0 +1,90 @@ +#include "_uitoa.h" +#include "../../Source/NumberToString.h" + + +/** + * Test converting a char value into a string + */ +void testNumberToString__uitoa::testChar(void){ + #ifndef JSON_LIBRARY + assertEquals(sizeof(unsigned char), 1); + assertEquals(NumberToString::_uitoa((unsigned char)255), JSON_TEXT("255")); + assertEquals(NumberToString::_uitoa((unsigned char)127), JSON_TEXT("127")); + assertEquals(NumberToString::_uitoa((unsigned char)15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa((unsigned char)0), JSON_TEXT("0")); + #endif +} + + +/** + * Test converting a short value into a string + */ +void testNumberToString__uitoa::testShort(void){ + #ifndef JSON_LIBRARY + assertEquals(sizeof(unsigned short), 2); + assertEquals(NumberToString::_uitoa((unsigned short)65535), JSON_TEXT("65535")); + assertEquals(NumberToString::_uitoa((unsigned short)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_uitoa((unsigned short)127), JSON_TEXT("127")); + assertEquals(NumberToString::_uitoa((unsigned short)15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa((unsigned short)0), JSON_TEXT("0")); + #endif +} + + +/** + * Test converting a int value into a string + */ +void testNumberToString__uitoa::testInt(void){ + #ifndef JSON_LIBRARY + assertEquals(sizeof(unsigned int), 4); + assertEquals(NumberToString::_uitoa((unsigned int)4294967295u), JSON_TEXT("4294967295")); + assertEquals(NumberToString::_uitoa((unsigned int)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_uitoa((unsigned int)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_uitoa((unsigned int)127), JSON_TEXT("127")); + assertEquals(NumberToString::_uitoa((unsigned int)15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa((unsigned int)0), JSON_TEXT("0")); + #endif +} + + +/** + * Test converting a long value into a string + */ +void testNumberToString__uitoa::testLong(void){ + #ifndef JSON_LIBRARY + #ifdef TEST_LONG_EXTREMES + if (sizeof(unsigned long) >= 8){ + assertEquals(NumberToString::_uitoa((unsigned long)18446744073709551615UL), JSON_TEXT("18446744073709551615")); + assertEquals(NumberToString::_uitoa((unsigned long)9223372036854775807L), JSON_TEXT("9223372036854775807")); + } + #endif + assertEquals(NumberToString::_uitoa((unsigned long)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_uitoa((unsigned long)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_uitoa((unsigned long)127), JSON_TEXT("127")); + assertEquals(NumberToString::_uitoa((unsigned long)15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa((unsigned long)0), JSON_TEXT("0")); + #endif +} + + +/** + * Test converting a long long value into a string + */ +void testNumberToString__uitoa::testLongLong(void){ + #ifndef JSON_LIBRARY + #ifndef JSON_ISO_STRICT + #ifdef TEST_LONG_EXTREMES + if (sizeof(unsigned long long) >= 8){ + assertEquals(NumberToString::_uitoa((unsigned long long)18446744073709551615UL), JSON_TEXT("18446744073709551615")); + assertEquals(NumberToString::_uitoa((unsigned long long)9223372036854775807L), JSON_TEXT("9223372036854775807")); + assertEquals(NumberToString::_uitoa((unsigned long long)-9223372036854775807L), JSON_TEXT("-9223372036854775807")); + } + #endif + assertEquals(NumberToString::_uitoa((unsigned long long)2147483647), JSON_TEXT("2147483647")); + assertEquals(NumberToString::_uitoa((unsigned long long)32767), JSON_TEXT("32767")); + assertEquals(NumberToString::_uitoa((unsigned long long)127), JSON_TEXT("127")); + assertEquals(NumberToString::_uitoa((unsigned long long)15), JSON_TEXT("15")); + assertEquals(NumberToString::_uitoa((unsigned long long)0), JSON_TEXT("0")); + #endif + #endif +} diff --git a/libjson/_internal/TestSuite2/NumberToString/_uitoa.h b/libjson/_internal/TestSuite2/NumberToString/_uitoa.h new file mode 100644 index 0000000..7c46656 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/_uitoa.h @@ -0,0 +1,16 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__UITOA_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__UITOA_H + +#include "../BaseTest.h" + +class testNumberToString__uitoa : public BaseTest { +public: + testNumberToString__uitoa(const std::string & name) : BaseTest(name){} + void testChar(void); + void testShort(void); + void testInt(void); + void testLong(void); + void testLongLong(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/getLenSize.cpp b/libjson/_internal/TestSuite2/NumberToString/getLenSize.cpp new file mode 100644 index 0000000..ad571b1 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/getLenSize.cpp @@ -0,0 +1,15 @@ +#include "getLenSize.h" +#include "../../Source/NumberToString.h" + + +/** + * Make sure the specialized template returns the right + * number of bytes required + */ +void testNumberToString__getLenSize::testStruct(void){ + assertEquals(getLenSize<1>::GETLEN, 5); + assertEquals(getLenSize<2>::GETLEN, 7); + assertEquals(getLenSize<4>::GETLEN, 12); + assertEquals(getLenSize<8>::GETLEN, 22); + assertEquals(getLenSize<16>::GETLEN, 41); +} diff --git a/libjson/_internal/TestSuite2/NumberToString/getLenSize.h b/libjson/_internal/TestSuite2/NumberToString/getLenSize.h new file mode 100644 index 0000000..99962ec --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/getLenSize.h @@ -0,0 +1,12 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__GET_LEN_SIZE_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__GET_LEN_SIZE_H + +#include "../BaseTest.h" + +class testNumberToString__getLenSize : public BaseTest { +public: + testNumberToString__getLenSize(const std::string & name) : BaseTest(name){} + void testStruct(void); +}; + +#endif diff --git a/libjson/_internal/TestSuite2/NumberToString/isNumeric.cpp b/libjson/_internal/TestSuite2/NumberToString/isNumeric.cpp new file mode 100644 index 0000000..281dc58 --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/isNumeric.cpp @@ -0,0 +1,342 @@ +#include "isNumeric.h" +#include "../../Source/NumberToString.h" + +/* + * + * !!! ATTENTION !!! + * + * libjson currently has three number parsing methods, they are being merged + * behind the scenes, but all three interfaces must be consistent, so every set + * of numbers need to be tested in all three spots + * + * JSONValidator/isValidNumber *this file* + * NumberToString/isNumeric + * NumberToString/_atof + */ + +testNumberToString__isNumeric::testNumberToString__isNumeric(const std::string & name) : BaseTest(name){ + /* + #ifndef JSON_STRICT + ScopeCoverageHeap(isNumeric, 34); + #else + ScopeCoverageHeap(isNumeric, 35); + #endif + */ +} +testNumberToString__isNumeric::~testNumberToString__isNumeric(){ + //AssertScopeCoverageHeap(isNumeric); +} + + +/** + * Tests regular positive numbers in various forms + */ +void testNumberToString__isNumeric::testPositive(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.01"))); + #endif +} + + +/** + * Tests negative numbers with regular scientifc notation + */ +void testNumberToString__isNumeric::testNegative(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0"))); + #endif +} + +/** + * Tests positive numbers with scientific notiation that has a sign in it + */ +void testNumberToString__isNumeric::testPositive_ScientificNotation(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0e12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.e12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.0e12.3"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e2"))); + #endif +} + +/** + * Tests negative numbers with regular scientifc notation + */ +void testNumberToString__isNumeric::testNegative_ScientificNotation(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0e12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.e12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.0e12.3"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e2"))); + #endif +} + + +/** + * Tests positive numbers with scientific notiation that has a sign in it + */ +void testNumberToString__isNumeric::testPositive_SignedScientificNotation(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0e-12.3"))); //period not supposed to be in there, exponent must be int + assertFalse(NumberToString::isNumeric(JSON_TEXT("0e+12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.e+12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.0e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("1.0e+12.3"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e2"))); + #endif +} + + +/** + * Tests negative numbers with scientific notiation that has a sign in it + */ +void testNumberToString__isNumeric::testNegative_SignedScientificNotation(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0.e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0.e+12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.e+12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0.0e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0.0e+12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.0e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-1.0e+12.3"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e+2"))); + #endif +} + + +/** + * Tests that in strict mode, libjson isn't relaxed about what is and isn't + * a valid number. libjson by default accepts a few extra common notations. + */ +void testNumberToString__isNumeric::testStrict(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + #ifdef JSON_STRICT + assertFalse(NumberToString::isNumeric(JSON_TEXT("00"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("00.01"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT(".01"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-.01"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0."))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e-123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e-123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e-123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e+123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e+12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e+12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e-12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e+12.3"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e12.3"))); + + assertFalse(NumberToString::isNumeric(JSON_TEXT("0x12FF"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0128"))); //legal because in STRICT mode, this is not octal, leading zero is ignored + assertFalse(NumberToString::isNumeric(JSON_TEXT("0123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0128"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0123"))); + + assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCD"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1."))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e-2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e+2"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e+2"))); + + assertFalse(NumberToString::isNumeric(JSON_TEXT("1e-0123"))); //not valid because of negative and leading zero + #endif + #endif +} + + +/** + * Tests that the extra common notations that libjson supports all + * test out as valid + */ +void testNumberToString__isNumeric::testNotStrict(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + #ifndef JSON_STRICT + assertTrue(NumberToString::isNumeric(JSON_TEXT("00"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("00.01"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT(".01"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-.01"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+12.3"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e+123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e+123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e-123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e+123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e123"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("0x12FF"))); + #ifdef JSON_OCTAL + assertFalse(NumberToString::isNumeric(JSON_TEXT("0128"))); //because of the 8 + assertTrue(NumberToString::isNumeric(JSON_TEXT("0123"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-0128"))); + assertTrue(NumberToString::_atof(JSON_TEXT("-0123"))); + #else + assertTrue(NumberToString::isNumeric(JSON_TEXT("0128"))); //because the leading 0 is ignored + assertTrue(NumberToString::isNumeric(JSON_TEXT("0123"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0128"))); //because the leading 0 is ignored + assertTrue(NumberToString::isNumeric(JSON_TEXT("-0123"))); + #endif + + + assertTrue(NumberToString::isNumeric(JSON_TEXT("0xABCD"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("0124"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1."))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e-2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e+2"))); + assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e+2"))); + + assertTrue(NumberToString::isNumeric(JSON_TEXT("1e-0123"))); + #endif + #endif +} + + +/** + * This tests values that aren't numbers at all, to make sure they are + * flagged as not valid + */ +void testNumberToString__isNumeric::testNotNumbers(void){ + #if defined(JSON_SAFE) || defined(JSON_DEBUG) + assertFalse(NumberToString::isNumeric(JSON_TEXT(""))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-."))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("-e12"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCDv"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("00124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("09124"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("n1234"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("12no"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0en5"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0e"))); + assertFalse(NumberToString::isNumeric(JSON_TEXT("0E"))); + #endif +} diff --git a/libjson/_internal/TestSuite2/NumberToString/isNumeric.h b/libjson/_internal/TestSuite2/NumberToString/isNumeric.h new file mode 100644 index 0000000..673baac --- /dev/null +++ b/libjson/_internal/TestSuite2/NumberToString/isNumeric.h @@ -0,0 +1,21 @@ +#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__IS_NUMERIC_H +#define JSON_TESTSUITE_NUMBER_TO_STRING__IS_NUMERIC_H + +#include "../BaseTest.h" + +class testNumberToString__isNumeric : public BaseTest { +public: + testNumberToString__isNumeric(const std::string & name); + virtual ~testNumberToString__isNumeric(); + void testPositive(void); + void testNegative(void); + void testPositive_ScientificNotation(void); + void testNegative_ScientificNotation(void); + void testPositive_SignedScientificNotation(void); + void testNegative_SignedScientificNotation(void); + void testStrict(void); + void testNotStrict(void); + void testNotNumbers(void); +}; + +#endif diff --git a/libjson/libjson.h b/libjson/libjson.h new file mode 100644 index 0000000..c22f258 --- /dev/null +++ b/libjson/libjson.h @@ -0,0 +1,336 @@ +#ifndef LIBJSON_H +#define LIBJSON_H + +#include "_internal/Source/JSONDefs.h" //for typedefs of functions, strings, and nodes + +/* + This is the C interface to libjson. + + This file also declares various things that are needed for + C++ programming +*/ + +#ifdef JSON_LIBRARY //compiling the library, hide the interface + #ifdef __cplusplus + extern "C" { + #endif + + #ifdef JSON_NO_C_CONSTS + /* The interface has no consts in it, but ther must be const_cast internally */ + #define json_const + #define TOCONST_CSTR(x) const_cast(x) + #else + #define json_const const + #define TOCONST_CSTR(x) x + #endif + + /* + stuff that's in namespace libjson + */ + void json_free(void * str); + void json_delete(JSONNODE * node); + #ifdef JSON_MEMORY_MANAGE + void json_free_all(void); + void json_delete_all(void); + #endif + #ifdef JSON_READ_PRIORITY + JSONNODE * json_parse(json_const json_char * json); + JSONNODE * json_parse_unformatted(json_const json_char * json); + #endif + json_char * json_strip_white_space(json_const json_char * json); + #ifdef JSON_VALIDATE + #ifdef JSON_DEPRECATED_FUNCTIONS + JSONNODE * json_deprecated(json_validate(json_const json_char * json), "json_validate is deprecated, use json_is_valid and json_parse instead"); + #endif + json_bool_t json_is_valid(json_const json_char * json); + json_bool_t json_is_valid_unformatted(json_const json_char * json); + #endif + #if defined JSON_DEBUG && !defined JSON_STDERROR + /* When libjson errors, a callback allows the user to know what went wrong */ + void json_register_debug_callback(json_error_callback_t callback); + #endif + #ifdef JSON_MUTEX_CALLBACKS + #ifdef JSON_MUTEX_MANAGE + void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock); + #else + void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock); + #endif + void json_set_global_mutex(void * mutex); + void json_set_mutex(JSONNODE * node, void * mutex); + void json_lock(JSONNODE * node, int threadid); + void json_unlock(JSONNODE * node, int threadid); + #endif + #ifdef JSON_MEMORY_CALLBACKS + void json_register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre); + #endif + + #ifdef JSON_STREAM + JSONSTREAM * json_new_stream(json_stream_callback_t callback, json_stream_e_callback_t e_callback, void * identifier); + void json_stream_push(JSONSTREAM * stream, json_const json_char * addendum); + void json_delete_stream(JSONSTREAM * stream); + void json_stream_reset(JSONSTREAM * stream); + #endif + + + /* + stuff that's in class JSONNode + */ + /* ctors */ + JSONNODE * json_new_a(json_const json_char * name, json_const json_char * value); + JSONNODE * json_new_i(json_const json_char * name, json_int_t value); + JSONNODE * json_new_f(json_const json_char * name, json_number value); + JSONNODE * json_new_b(json_const json_char * name, json_bool_t value); + JSONNODE * json_new(char type); + JSONNODE * json_copy(json_const JSONNODE * orig); + JSONNODE * json_duplicate(json_const JSONNODE * orig); + + /* assignment */ + void json_set_a(JSONNODE * node, json_const json_char * value); + void json_set_i(JSONNODE * node, json_int_t value); + void json_set_f(JSONNODE * node, json_number value); + void json_set_b(JSONNODE * node, json_bool_t value); + void json_set_n(JSONNODE * node, json_const JSONNODE * orig); + + /* inspectors */ + char json_type(json_const JSONNODE * node); + json_index_t json_size(json_const JSONNODE * node); + json_bool_t json_empty(json_const JSONNODE * node); + json_char * json_name(json_const JSONNODE * node); + #ifdef JSON_COMMENTS + json_char * json_get_comment(json_const JSONNODE * node); + #endif + json_char * json_as_string(json_const JSONNODE * node); + json_int_t json_as_int(json_const JSONNODE * node); + json_number json_as_float(json_const JSONNODE * node); + json_bool_t json_as_bool(json_const JSONNODE * node); + #ifdef JSON_CASTABLE + JSONNODE * json_as_node(json_const JSONNODE * node); + JSONNODE * json_as_array(json_const JSONNODE * node); + #endif + #ifdef JSON_BINARY + void * json_as_binary(json_const JSONNODE * node, unsigned long * size); + #endif + #ifdef JSON_WRITE_PRIORITY + json_char * json_write(json_const JSONNODE * node); + json_char * json_write_formatted(json_const JSONNODE * node); + #endif + + /* modifiers */ + void json_set_name(JSONNODE * node, json_const json_char * name); + #ifdef JSON_COMMENTS + void json_set_comment(JSONNODE * node, json_const json_char * comment); + #endif + void json_clear(JSONNODE * node); + void json_nullify(JSONNODE * node); + void json_swap(JSONNODE * node, JSONNODE * node2); + void json_merge(JSONNODE * node, JSONNODE * node2); + #if !defined (JSON_PREPARSE) && defined(JSON_READ_PRIORITY) + void json_preparse(JSONNODE * node); + #endif + #ifdef JSON_BINARY + void json_set_binary(JSONNODE * node, json_const void * data, unsigned long length); + #endif + #ifdef JSON_EXPOSE_BASE64 + json_char * json_encode64(json_const void * binary, json_index_t bytes); + void * json_decode64(json_const json_char * text, unsigned long * size); + #endif + #ifdef JSON_CASTABLE + void json_cast(JSONNODE * node, char type); + #endif + + /* children access */ + void json_reserve(JSONNODE * node, json_index_t siz); + JSONNODE * json_at(JSONNODE * node, json_index_t pos); + JSONNODE * json_get(JSONNODE * node, json_const json_char * name); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE * json_get_nocase(JSONNODE * node, json_const json_char * name); + JSONNODE * json_pop_back_nocase(JSONNODE * node, json_const json_char * name); + #endif + void json_push_back(JSONNODE * node, JSONNODE * node2); + JSONNODE * json_pop_back_at(JSONNODE * node, json_index_t pos); + JSONNODE * json_pop_back(JSONNODE * node, json_const json_char * name); + #ifdef JSON_ITERATORS + JSONNODE_ITERATOR json_find(JSONNODE * node, json_const json_char * name); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE_ITERATOR json_find_nocase(JSONNODE * node, json_const json_char * name); + #endif + JSONNODE_ITERATOR json_erase(JSONNODE * node, JSONNODE_ITERATOR it); + JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + JSONNODE_ITERATOR json_insert(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2); + JSONNODE_ITERATOR json_insert_multi(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + + /* iterator functions */ + JSONNODE_ITERATOR json_begin(JSONNODE * node); + JSONNODE_ITERATOR json_end(JSONNODE * node); + #endif + + /* comparison */ + json_bool_t json_equal(JSONNODE * node, JSONNODE * node2); + + #ifdef __cplusplus + } + #endif +#else + #ifndef __cplusplus + #error Turning off JSON_LIBRARY requires C++ + #endif + #include "_internal/Source/JSONNode.h" //not used in this file, but libjson.h should be the only file required to use it embedded + #include "_internal/Source/JSONWorker.h" + #include "_internal/Source/JSONValidator.h" + #include "_internal/Source/JSONStream.h" + #include "_internal/Source/JSONPreparse.h" + #ifdef JSON_EXPOSE_BASE64 + #include "_internal/Source/JSON_Base64.h" + #endif + #ifndef JSON_NO_EXCEPTIONS + #include //some methods throw exceptions + #endif + + #include /* need wide characters */ + #include + + namespace libjson { + #ifdef JSON_EXPOSE_BASE64 + inline static json_string encode64(const unsigned char * binary, size_t bytes) json_nothrow { + return JSONBase64::json_encode64(binary, bytes); + } + + inline static std::string decode64(const json_string & encoded) json_nothrow { + return JSONBase64::json_decode64(encoded); + } + #endif + + //useful if you have json that you don't want to parse, just want to strip to cut down on space + inline static json_string strip_white_space(const json_string & json) json_nothrow { + return JSONWorker::RemoveWhiteSpaceAndComments(json, false); + } + + #ifndef JSON_STRING_HEADER + inline static std::string to_std_string(const json_string & str){ + #if defined(JSON_UNICODE) ||defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + return std::string(str.begin(), str.end()); + #else + return str; + #endif + } + inline static std::wstring to_std_wstring(const json_string & str){ + #if (!defined(JSON_UNICODE)) || defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + return std::wstring(str.begin(), str.end()); + #else + return str; + #endif + } + + inline static json_string to_json_string(const std::string & str){ + #if defined(JSON_UNICODE) ||defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + return json_string(str.begin(), str.end()); + #else + return str; + #endif + } + inline static json_string to_json_string(const std::wstring & str){ + #if (!defined(JSON_UNICODE)) || defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL) + return json_string(str.begin(), str.end()); + #else + return str; + #endif + } + #endif + + #ifdef JSON_READ_PRIORITY + //if json is invalid, it throws a std::invalid_argument exception + inline static JSONNode parse(const json_string & json) json_throws(std::invalid_argument) { + #ifdef JSON_PREPARSE + size_t len; + json_auto buffer(JSONWorker::RemoveWhiteSpace(json, len, false)); + return JSONPreparse::isValidRoot(buffer.ptr); + #else + return JSONWorker::parse(json); + #endif + } + + inline static JSONNode parse_unformatted(const json_string & json) json_throws(std::invalid_argument) { + #ifdef JSON_PREPARSE + return JSONPreparse::isValidRoot(json); + #else + return JSONWorker::parse_unformatted(json); + #endif + } + + #ifdef JSON_VALIDATE + inline static bool is_valid(const json_string & json) json_nothrow { + #ifdef JSON_SECURITY_MAX_STRING_LENGTH + if (json_unlikely(json.length() > JSON_SECURITY_MAX_STRING_LENGTH)){ + JSON_FAIL(JSON_TEXT("Exceeding JSON_SECURITY_MAX_STRING_LENGTH")); + return false; + } + #endif + json_auto s; + s.set(JSONWorker::RemoveWhiteSpaceAndCommentsC(json, false)); + return JSONValidator::isValidRoot(s.ptr); + } + + inline static bool is_valid_unformatted(const json_string & json) json_nothrow { + #ifdef JSON_SECURITY_MAX_STRING_LENGTH + if (json_unlikely(json.length() > JSON_SECURITY_MAX_STRING_LENGTH)){ + JSON_FAIL(JSON_TEXT("Exceeding JSON_SECURITY_MAX_STRING_LENGTH")); + return false; + } + #endif + return JSONValidator::isValidRoot(json.c_str()); + } + #ifdef JSON_DEPRECATED_FUNCTIONS + #ifdef JSON_NO_EXCEPTIONS + #error, JSON_DEPRECATED_FUNCTIONS requires JSON_NO_EXCEPTIONS be off + #endif + //if json is invalid, it throws a std::invalid_argument exception (differs from parse because this checks the entire tree) + inline static JSONNode json_deprecated(validate(const json_string & json), "libjson::validate is deprecated, use libjson::is_valid and libjson::parse instead"); + #endif + #endif + #endif + + //When libjson errors, a callback allows the user to know what went wrong + #if defined JSON_DEBUG && !defined JSON_STDERROR + inline static void register_debug_callback(json_error_callback_t callback) json_nothrow { + JSONDebug::register_callback(callback); + } + #endif + + #ifdef JSON_MUTEX_CALLBACKS + #ifdef JSON_MUTEX_MANAGE + inline static void register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock) json_nothrow { + JSONNode::register_mutex_callbacks(lock, unlock, manager_lock); + JSONNode::register_mutex_destructor(destroy); + } + #else + inline static void register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock) json_nothrow { + JSONNode::register_mutex_callbacks(lock, unlock, manager_lock); + } + #endif + + inline static void set_global_mutex(void * mutex) json_nothrow { + JSONNode::set_global_mutex(mutex); + } + #endif + + #ifdef JSON_MEMORY_CALLBACKS + inline static void register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre) json_nothrow { + JSONMemory::registerMemoryCallbacks(mal, real, fre); + } + #endif + + } + #ifdef JSON_VALIDATE + #ifdef JSON_DEPRECATED_FUNCTIONS + //if json is invalid, it throws a std::invalid_argument exception (differs from parse because this checks the entire tree) + inline static JSONNode libjson::validate(const json_string & json) { + if (json_likely(is_valid(json))){ + return parse(json); + } + throw std::invalid_argument(""); + } + #endif + #endif +#endif //JSON_LIBRARY + +#endif //LIBJSON_H diff --git a/libjson/makefile b/libjson/makefile new file mode 100644 index 0000000..14dd7d4 --- /dev/null +++ b/libjson/makefile @@ -0,0 +1,338 @@ +############################################################################### +# +# Copyright 2010 Jonathan Wallace. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY JONATHAN WALLACE ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JONATHAN WALLACE OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# +# The views and conclusions contained in the software and documentation are +# those of the authors and should not be interpreted as representing official +# policies, either expressed or implied, of Jonathan Wallace.... +# +# +# Author Bernhard Fluehmann +# +# bernhard.fluehmann@patton-inalp.com +# +# +# TARGETS +# all +# Builds either a shared or a static library, depending of the value +# of the SHARED variable. +# Default: static +# +# banner +# Displays the library version and the target +# +# install +# Installs either the shared of the static library, depending of the value +# of the SHARED variable. Installs the header files as well. +# Builds the library before installing if it does not exist already. +# Ececutes ldconfig in case of the shared library. +# Default locations: +# library: $(exec_prefix)/$(libdir) => /usr/lib +# headers: $(prefix)/$(includedir) => /usr/include +# +# install_headers +# Installs the header files. +# Default location: $(prefix)/$(includedir) => /usr/include +# +# clean +# Removes the shared or the static library, depending of the value +# of the SHARED variable, from this folder and all the folders and objects +# which were created to build it. +# +# uninstall +# Removes the shared or the static library, depending of the value +# of the SHARED variable from the system. In case of the shared library, +# removes the symbolic links as well and executes ldconfig. +# +# uninstall_headers +# Remove the headers from the system. +# +# Variables +# prefix +# The general installation root directory. Default: /usr +# +# exec_prefix +# The installation root directory to place executables and libraries. +# Default: prefix +# +# libdir +# The directory where the libraries are installed, as a subdirectory of +# exec_prefix. Default: lib +# +# includedir +# The directory where the header files are installed, as a subdirectory of +# prefix. Default: include +# +# srcdir +# The directory where the object source files are located. +# Default: _internal/Source +# +# CXX +# The compiler to be used. Default: c++ +# +# CXXFLAGS +# The compiler flags used to compile the object files. +# Default: +# cxxflags_default for default +# cxxflags_small for BUILD_TYPE=small +# cxxflags_debug for BUILD_TYPE=debug +# +# AR +# The archiver to be used. Default: ar +# +# PIC +# The PIC to be used. Default: PIC +# +# BUILD_TYPE +# Used to select a specific set of predefined configuration parameters. +# Default: undefined: The default settings are used +# Options: +# small +# debug +# +# SHARED +# Used to select if the library is a shared or a dynamic one +# Default: undefined: static +# Options: +# 0: static +# 1: shared +# +# +# + +# JSON source files to build +objects = internalJSONNode.o JSONAllocator.o JSONChildren.o \ + JSONDebug.o JSONIterators.o JSONMemory.o JSONNode.o \ + JSONNode_Mutex.o JSONPreparse.o JSONStream.o JSONValidator.o \ + JSONWorker.o JSONWriter.o libjson.o +OS=$(shell uname) + +# Defaults +ifeq ($(OS), Darwin) + cxxflags_default = -fast -ffast-math -fexpensive-optimizations -DNDEBUG +else + cxxflags_default = -O3 -ffast-math -fexpensive-optimizations -DNDEBUG +endif +cxxflags_small = -Os -ffast-math -DJSON_LESS_MEMORY -DNDEBUG +cxxflags_debug = -g -DJSON_SAFE -DJSON_DEBUG +cxxflags_shared = -f$(PIC) +libname = libjson +libname_hdr := $(libname) +libname_debug = $(libname)_dbg +suffix_shared = so +suffix_static = a +major_version = 7 +minor_version = 6.1 +objdir = Objects + + +# Variables +prefix ?= /usr +exec_prefix ?= $(prefix) +libdir ?= lib +includedir ?= include +srcdir ?= _internal/Source +CXX ?= c++ +AR ?= ar +PIC ?= PIC +BUILD_TYPE ?= "default" +SHARED ?= "1" + + +# Internal Variables +inst_path = $(exec_prefix)/$(libdir) +include_path = $(prefix)/$(includedir) + + +# Usage check +ifdef CXXFLAGS +ifdef BUILD_TYPE + $(error CXXFLAGS and BUILD_TYPE are mutually exclusive) +endif +endif + +# BUILD_TYPE specific settings +ifeq ($(BUILD_TYPE), small) + CXXFLAGS = $(cxxflags_small) +else ifeq ($(BUILD_TYPE), debug) + CXXFLAGS = $(cxxflags_debug) + libname := $(libname_debug) +else + CXXFLAGS ?= $(cxxflags_default) +endif + +# SHARED specific settings +ifeq ($(SHARED), 1) + libname_shared = $(libname).$(suffix_shared) + libname_shared_major_version = $(libname_shared).$(major_version) + lib_target = $(libname_shared_major_version).$(minor_version) + objdir := $(objdir)_shared + CXXFLAGS := $(CXXFLAGS) $(cxxflags_shared) +else + lib_target = $(libname).$(suffix_static) + objdir := $(objdir)_static +endif + +# Phony targets +.PHONY: all banner installdirs install install_headers clean uninstall \ + uninstall_headers + +# Targets +all: $(lib_target) + @echo "============================================================" + @echo "Done" + @echo "============================================================" + +banner: + @echo "============================================================" + @echo "libjson version: "$(major_version).$(minor_version) "target: "$(target) "OS: "$(OS) + @echo "============================================================" + +installdirs: banner + mkdir -p $(objdir) + +# Libraries +ifeq ($(SHARED),1) +$(lib_target): banner installdirs $(addprefix $(objdir)/, $(objects)) + @echo "Link " + cd $(objdir) ; \ + if test "$(OS)" = "Darwin" ; then \ + $(CXX) -shared -Wl,-dylib_install_name -Wl,$(libname_shared_major_version) -o $@ $(objects) ; \ + else \ + $(CXX) -shared -Wl,-soname,$(libname_shared_major_version) -o $@ $(objects) ; \ + fi ; \ + mv -f $@ ../ + @echo "Link: Done" +else +$(lib_target): banner installdirs $(addprefix $(objdir)/, $(objects)) + @echo "Archive" + cd $(objdir) ; \ + $(AR) -cvq $@ $(objects) ; \ + mv -f $@ ../ + @echo "Archive: Done" +endif + +# Compile object files +$(objdir)/%.o: $(srcdir)/%.cpp + $(CXX) $< -o $@ -c $(CXXFLAGS) + +ifeq ($(SHARED),1) +install: banner install_headers $(lib_target) + @echo "Install shared library" + cp -f ./$(lib_target) $(inst_path) + cd $(inst_path) ; \ + ln -sf $(lib_target) $(libname_shared_major_version) ; \ + ln -sf $(libname_shared_major_version) $(libname_shared) +ifneq ($(OS),Darwin) + ldconfig +endif + @echo "Install shared library: Done." +else +install: banner install_headers $(lib_target) + @echo "Install static library" + cp -f ./$(lib_target) $(inst_path) + @echo "Install static library: Done." +endif + +install_headers: banner + @echo "Install header files" + mkdir -p $(include_path)/$(libname_hdr) + cp -f ./*.h $(include_path)/$(libname_hdr) + mkdir -p $(include_path)/$(libname_hdr)/$(srcdir) + cp -f ./$(srcdir)/*.h $(include_path)/$(libname_hdr)/$(srcdir) + cp -r ./$(srcdir)/JSONDefs $(include_path)/$(libname_hdr)/$(srcdir) + chmod -R a+r $(include_path)/$(libname_hdr) + find $(include_path)/$(libname_hdr) -type d -exec chmod a+x {} \; + cp -rv $(srcdir)/Dependencies/ $(include_path)/$(libname_hdr)/$(srcdir) + @echo "Install header files: Done." + +clean: banner + @echo "Clean library and object folder" + rm -rf $(objdir) + rm -f $(lib_target) + @echo "Clean library and object folder: Done" + +ifeq ($(SHARED),1) +uninstall: banner uninstall_headers + @echo "Uninstall shared library" + rm -f $(inst_path)/$(libname_shared) + rm -f $(inst_path)/$(libname_shared_major_version) + rm -f $(inst_path)/$(lib_target) +ifneq ($(OS),Darwin) + ldconfig +endif + @echo "Uninstall shared library: Done" +else +uninstall: banner uninstall_headers + @echo "Uninstall static library" + rm -f $(inst_path)/$(lib_target) + @echo "Uninstall static library: Done" +endif + +uninstall_headers: banner + @echo "Uninstall header files" + rm -rf $(include_path)/$(libname_hdr) + @echo "Uninstall header files: Done" + +test: + $(CXX) _internal/TestSuite/main.cpp _internal/TestSuite/TestAssign.cpp _internal/TestSuite/TestChildren.cpp \ + _internal/TestSuite/TestComments.cpp _internal/TestSuite/TestConverters.cpp _internal/TestSuite/TestCtors.cpp \ + _internal/TestSuite/TestEquality.cpp _internal/TestSuite/TestFunctions.cpp _internal/TestSuite/TestInequality.cpp \ + _internal/TestSuite/TestInspectors.cpp _internal/TestSuite/TestIterators.cpp _internal/TestSuite/TestMutex.cpp \ + _internal/TestSuite/TestNamespace.cpp _internal/TestSuite/TestRefCounting.cpp _internal/TestSuite/TestSuite.cpp \ + _internal/TestSuite/TestWriter.cpp _internal/TestSuite/TestString.cpp _internal/TestSuite/UnitTest.cpp \ + _internal/TestSuite/TestValidator.cpp _internal/TestSuite/TestStreams.cpp _internal/TestSuite/TestBinary.cpp \ + _internal/TestSuite/RunTestSuite2.cpp _internal/TestSuite/TestSharedString.cpp \ + _internal/Source/internalJSONNode.cpp _internal/Source/JSONPreparse.cpp _internal/Source/JSONChildren.cpp \ + _internal/Source/JSONDebug.cpp _internal/Source/JSONIterators.cpp _internal/Source/JSONMemory.cpp \ + _internal/Source/JSONNode_Mutex.cpp _internal/Source/JSONNode.cpp _internal/Source/JSONWorker.cpp \ + _internal/Source/JSONWriter.cpp _internal/Source/libjson.cpp _internal/Source/JSONValidator.cpp \ + _internal/Source/JSONStream.cpp _internal/Source/JSONAllocator.cpp \ + _internal/TestSuite/TestSuite2/JSON_Base64/json_decode64.cpp \ + _internal/TestSuite/TestSuite2/JSON_Base64/json_encode64.cpp \ + _internal/TestSuite/TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \ + _internal/TestSuite/TestSuite2/JSONDebug/JSON_ASSERT.cpp \ + _internal/TestSuite/TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \ + _internal/TestSuite/TestSuite2/JSONDebug/JSON_FAIL.cpp \ + _internal/TestSuite/TestSuite2/JSONGlobals/jsonSingleton.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidArray.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidMember.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidNamedObject.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidNumber.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidObject.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidPartialRoot.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidRoot.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/isValidString.cpp \ + _internal/TestSuite/TestSuite2/JSONValidator/securityTest.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/_areFloatsEqual.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/_atof.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/_ftoa.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/_itoa.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/_uitoa.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/getLenSize.cpp \ + _internal/TestSuite/TestSuite2/NumberToString/isNumeric.cpp \ + $(CXXFLAGS) -o ./testapp + ./testapp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..bd2c351 --- /dev/null +++ b/main.cpp @@ -0,0 +1,9 @@ +#include "main.hpp" +#include + +///----------------------------------------------------------------------------- +///----------------------------------------------------------------------------- +int main (int parArgc, const char* const argv[]) { + std::cout << "Hello world\n"; + return 0; +} diff --git a/main.hpp b/main.hpp new file mode 100644 index 0000000..5e05b18 --- /dev/null +++ b/main.hpp @@ -0,0 +1,6 @@ +#ifndef id80FAB3D5977B4A1797F2910935B34AEA +#define id80FAB3D5977B4A1797F2910935B34AEA + +#include + +#endif