Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
JSONUtils.cpp File Reference
#include "scenes/JSONUtils.hpp"
#include <sstream>

Namespaces

namespace  JSONUtils
 Set of lightweight JSON parsing and formatting helper utilities.

Functions

std::string JSONUtils::indent (int level)
 Generates indentation string according to spacing level.
std::string JSONUtils::quote (const std::string &value)
 Wraps a string in double quotes.
std::string JSONUtils::vec3ToJson (const glm::vec3 &v)
 Serializes a glm::vec3 to a JSON array.
std::string JSONUtils::vec4ToJson (const glm::vec4 &v)
 Serializes a glm::vec4 to a JSON array.
std::string JSONUtils::extractStringValue (const std::string &source, const std::string &key)
 Finds and extracts a string value associated with a JSON key.
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.
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.
std::vector< std::string > JSONUtils::extractEntityObjects (const std::string &source)
 Extracts individual entity JSON blocks from a main scene array.
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.
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.
std::string JSONUtils::extractSubObject (const std::string &source, const std::string &key)
 Extracts a sub-object JSON string (enclosed in { ... }) for a given key.