|
Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
|
Set of lightweight JSON parsing and formatting helper utilities. More...
Functions | |
| std::string | indent (int level) |
| Generates indentation string according to spacing level. | |
| std::string | quote (const std::string &value) |
| Wraps a string in double quotes. | |
| std::string | vec3ToJson (const glm::vec3 &v) |
| Serializes a glm::vec3 to a JSON array. | |
| std::string | vec4ToJson (const glm::vec4 &v) |
| Serializes a glm::vec4 to a JSON array. | |
| std::string | extractStringValue (const std::string &source, const std::string &key) |
| Finds and extracts a string value associated with a JSON key. | |
| bool | extractFloatArray (const std::string &source, const std::string &key, float *values, size_t count) |
| Finds and extracts an array of floats associated with a JSON key. | |
| bool | extractFloatValue (const std::string &source, const std::string &key, float &value) |
| Finds and extracts a single float value associated with a JSON key. | |
| std::vector< std::string > | extractEntityObjects (const std::string &source) |
| Extracts individual entity JSON blocks from a main scene array. | |
| bool | extractIntVector (const std::string &source, const std::string &key, std::vector< int > &values) |
| Finds and extracts an array of integers associated with a JSON key. | |
| bool | extractStringVector (const std::string &source, const std::string &key, std::vector< std::string > &values) |
| Finds and extracts an array of quoted strings associated with a JSON key. | |
| std::string | extractSubObject (const std::string &source, const std::string &key) |
| Extracts a sub-object JSON string (enclosed in { ... }) for a given key. | |
Set of lightweight JSON parsing and formatting helper utilities.
Helper utilities for hand-parsing and formatting simple JSON files.
| std::vector< std::string > JSONUtils::extractEntityObjects | ( | const std::string & | source | ) |
Extracts individual entity JSON blocks from a main scene array.
Extracts individual entity JSON objects.
| source | Full JSON array text. |
| source | Raw JSON source. |
| bool JSONUtils::extractFloatArray | ( | const std::string & | source, |
| const std::string & | key, | ||
| float * | values, | ||
| size_t | count ) |
Finds and extracts an array of floats associated with a JSON key.
Extract float array values corresponding to target key.
| source | JSON text source. |
| key | Search key. |
| values | Destination buffer. |
| count | Count of floats. |
| source | Raw JSON source. |
| key | Target JSON property key. |
| values | Destination buffer. |
| count | Maximum array values to read. |
| bool JSONUtils::extractFloatValue | ( | const std::string & | source, |
| const std::string & | key, | ||
| float & | value ) |
Finds and extracts a single float value associated with a JSON key.
Extract single float value corresponding to target key.
| source | JSON text source. |
| key | Search key. |
| value | Destination float reference. |
| source | Raw JSON source. |
| key | Target JSON property key. |
| value | Destination variable reference. |
| bool JSONUtils::extractIntVector | ( | const std::string & | source, |
| const std::string & | key, | ||
| std::vector< int > & | values ) |
Finds and extracts an array of integers associated with a JSON key.
| source | JSON text source. |
| key | Search key. |
| values | Destination vector. |
| std::string JSONUtils::extractStringValue | ( | const std::string & | source, |
| const std::string & | key ) |
Finds and extracts a string value associated with a JSON key.
Extract string values corresponding to target key.
| source | JSON text source. |
| key | Search key. |
| source | Raw JSON source. |
| key | Target JSON property key. |
| bool JSONUtils::extractStringVector | ( | const std::string & | source, |
| const std::string & | key, | ||
| std::vector< std::string > & | values ) |
Finds and extracts an array of quoted strings associated with a JSON key.
Finds and extracts an array of quoted string values associated with a JSON key. Handles both compact (["a","b"]) and pretty-printed arrays.
| source | JSON text source. |
| key | Search key. |
| values | Destination vector of strings. |
| std::string JSONUtils::extractSubObject | ( | const std::string & | source, |
| const std::string & | key ) |
Extracts a sub-object JSON string (enclosed in { ... }) for a given key.
| source | Raw JSON text. |
| key | Property key. |
| std::string JSONUtils::indent | ( | int | level | ) |
Generates indentation string according to spacing level.
Returns a string of spaces representing indentation level.
| level | Indent level. |
| level | Indentation multiplier level. |
| std::string JSONUtils::quote | ( | const std::string & | value | ) |
Wraps a string in double quotes.
Quotes a string value.
| value | Raw string. |
| std::string JSONUtils::vec3ToJson | ( | const glm::vec3 & | v | ) |
Serializes a glm::vec3 to a JSON array.
Converts glm::vec3 value to a JSON array representation.
| v | 3D vector. |
| v | Input vector. |
| std::string JSONUtils::vec4ToJson | ( | const glm::vec4 & | v | ) |
Serializes a glm::vec4 to a JSON array.
Converts glm::vec4 value to a JSON array representation.
| v | 4D vector. |
| v | Input vector. |