esp::io namespace

Typedefs

using JsonDocument = rapidjson::Document
using JsonGenericValue = rapidjson::GenericValue<rapidjson::UTF8<>>
using JsonAllocator = rapidjson::MemoryPoolAllocator

Functions

auto espLoggingSubsystem() -> logging::Subsystem
auto changeExtension(const std::string& file, const std::string& ext) -> std::string
Replaces the extension of the given filename to the given ext.
auto normalizePath(const std::string& srcPath) -> std::string
This function will recursively remove any ellipsis in paths or path patterns, as well as the parent directory the ellisis is bypassing. This is so that if the ellipsis spans an OS link any function consuming the path does not get lost. If the ellipsis is at the beginning of srcPath then it is ignored.
auto globDirs(const std::string& pattern) -> std::vector<std::string>
This function will perform [glob-based pattern matching] (https://en.wikipedia.org/wiki/Glob_(programming)) to find and return all the files and directories that match the pattern.
auto writeJsonToFile(const JsonDocument& document, const std::string& file, bool usePrettyWriter = true, int maxDecimalPlaces = -1) -> bool
Write a Json doc to file.
auto parseJsonFile(const std::string& file) -> JsonDocument
Parse JSON file and return as JsonDocument object.
auto parseJsonString(const std::string& jsonString) -> JsonDocument
Parse JSON string and return as JsonDocument object.
auto jsonToString(const JsonDocument& d, int maxDecimalPlaces = -1) -> std::string
Return string representation of given JsonDocument.
auto jsonToVec3f(const JsonGenericValue& jsonArray) -> esp::vec3f
Return Vec3f coordinates representation of given JsonObject of array type.
template<typename T>
auto jsonIntoSetter(const JsonGenericValue& d, const char* tag, std::function<void(T)> setter) -> bool
Check passed json doc for existence of passed jsonTag as value of type T. If present, populate passed setter with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<typename T>
auto jsonIntoConstSetter(const JsonGenericValue& d, const char* tag, std::function<void(const T)> setter) -> bool
Check passed json doc for existence of passed jsonTag as value of type T, where the consuming setter will treat the value as const. If present, populate passed setter with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<typename GV, typename T>
void toVector(const GV& arr, std::vector<T>* vec, const std::function<T(const GV&)>& conv)
template<typename GV>
void toIntVector(const GV& value, std::vector<int>* vec)
template<typename GV>
void toInt64Vector(const GV& value, std::vector<int64_t>* vec)
template<typename GV>
void toFloatVector(const GV& value, std::vector<float>* vec)
template<typename GV>
void toDoubleVector(const GV& value, std::vector<double>* vec)
template<typename T>
auto toJsonArrayHelper(const T* objects, int count, JsonAllocator& allocator) -> JsonGenericValue
Helper to convert an array of objects to a json array object.
template<typename T>
void addMember(rapidjson::Value& value, rapidjson::GenericStringRef<char> name, const T& obj, JsonAllocator& allocator)
template<typename T>
auto readMember(const rapidjson::Value& value, const char* tag, T& x) -> bool
template<typename T>
void addMember(JsonGenericValue& value, rapidjson::GenericStringRef<char> name, const T& obj, JsonAllocator& allocator)
template<typename T>
auto readMember(const JsonGenericValue& value, const char* name, T& x) -> bool
auto toJsonValue(bool x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(int x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(unsigned x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(int64_t x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(uint64_t x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(double x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(float x, JsonAllocator&) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, bool& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, int& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, unsigned& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, int64_t& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, uint64_t& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, double& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, float& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
template<typename T>
void addMemberAsUint32(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, const T& x, JsonAllocator& allocator)
template<typename T>
auto readMemberAsUint32(const JsonGenericValue& value, const char* name, T& x) -> bool
void addMember(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, JsonGenericValue& child, JsonAllocator& allocator)
void addMember(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, JsonGenericValue&& child, JsonAllocator& allocator)
auto toJsonValue(const esp::vec3f& vec, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::vec3f& val) -> bool
auto toJsonValue(const esp::assets::PhongMaterialColor& material, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::assets::PhongMaterialColor& material) -> bool
auto toJsonValue(const esp::geo::CoordinateFrame& frame, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::geo::CoordinateFrame& frame) -> bool
auto toJsonValue(const esp::assets::AssetInfo& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::assets::AssetInfo& x) -> bool
auto toJsonValue(const metadata::attributes::ObjectInstanceShaderType& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, metadata::attributes::ObjectInstanceShaderType& x) -> bool
auto toJsonValue(const esp::assets::RenderAssetInstanceCreationInfo& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::assets::RenderAssetInstanceCreationInfo& x) -> bool
auto toJsonValue(const esp::gfx::replay::Transform& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::gfx::replay::Transform& x) -> bool
auto toJsonValue(const esp::gfx::replay::RenderAssetInstanceState& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::gfx::replay::RenderAssetInstanceState& x) -> bool
auto toJsonValue(const esp::gfx::LightInfo& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::gfx::LightInfo& x) -> bool
auto toJsonValue(const esp::gfx::LightPositionModel& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::gfx::LightPositionModel& x) -> bool
auto toJsonValue(const esp::gfx::replay::Keyframe& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& keyframeObj, esp::gfx::replay::Keyframe& keyframe) -> bool
auto toJsonValue(const esp::nav::NavMeshSettings& x, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, esp::nav::NavMeshSettings& x) -> bool
auto toJsonValue(const Magnum::Matrix3& mat, JsonAllocator& allocator) -> JsonGenericValue
Specialization to handle Magnum::Matrix3 values. Parses passed value into JsonGenericValue.
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Matrix3& val) -> bool
Specialization to handle Magnum::Matrix3 values. Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto toJsonValue(const Magnum::Vector2& vec, JsonAllocator& allocator) -> JsonGenericValue
Specialization to handle Magnum::Vector2 values. Parses passed value into JsonGenericValue.
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Vector2& val) -> bool
Specialization to handle Magnum::Vector2 values. Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto toJsonValue(const Magnum::Vector3& vec, JsonAllocator& allocator) -> JsonGenericValue
Specialization to handle Magnum::Vector3 values. Parses passed value into JsonGenericValue.
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Vector3& val) -> bool
Specialization to handle Magnum::Vector3 values. Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto toJsonValue(const Magnum::Vector4& vec, JsonAllocator& allocator) -> JsonGenericValue
Specialization to handle Magnum::Vector4 values. Parses passed value into JsonGenericValue.
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Vector4& val) -> bool
Specialization to handle Magnum::Vector4 values. Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto toJsonValue(const Magnum::Quaternion& quat, JsonAllocator& allocator) -> JsonGenericValue
Specialization to handle Magnum::Quaternion values. Parses passed value into JsonGenericValue.
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Quaternion& val) -> bool
Specialization to handle Magnum::Quaternion values. Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
template<typename T>
void addMember(rapidjson::Value& value, rapidjson::GenericStringRef<char> name, const Corrade::Containers::Optional<T>& x, JsonAllocator& allocator)
template<typename T>
auto readMember(const rapidjson::Value& value, const char* name, Corrade::Containers::Optional<T>& x) -> bool
auto fromJsonValue(const JsonGenericValue& obj, Magnum::Rad& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto toJsonValue(const std::string& str, JsonAllocator& allocator) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, std::string& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
template<typename T_first, typename T_second>
auto toJsonValue(const std::pair<T_first, T_second>& val, JsonAllocator& allocator) -> JsonGenericValue
template<typename T_first, typename T_second>
auto fromJsonValue(const JsonGenericValue& obj, std::pair<T_first, T_second>& val) -> bool
template<typename T>
void addMember(JsonGenericValue& value, rapidjson::GenericStringRef<char> name, const std::vector<T>& vec, JsonAllocator& allocator)
template<typename T>
auto readMember(const JsonGenericValue& value, const char* tag, std::vector<T>& vec) -> bool
template<>
auto readMember(const JsonGenericValue& d, const char* tag, std::map<std::string, std::string>& val) -> bool
Specialization to handle reading a JSON object into an std::map<std::string, std::string>. Check passed json doc for existence of passed tag and verify it is an object. If present, populate passed val with key-value pairs in cell. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriately configured.
template<>
auto readMember(const JsonGenericValue& d, const char* tag, std::map<std::string, float>& val) -> bool
Specialization to handle reading a JSON object into an std::map<std::string, float>. Check passed json doc for existence of passed tag and verify it is an object. If present, populate passed val with key-value pairs in cell. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriately configured.
template<typename T>
void addMember(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, const std::map<std::string, T>& mapVal, JsonAllocator& allocator)
Manage string-keyed map of type T to json Object.
template<typename T>
auto squashTinyDecimals(T x) -> T