esp::io namespace

Contents

Typedefs

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

Functions

auto exists(const std::string& file) -> bool
auto fileSize(const std::string& file) -> size_t
auto removeExtension(const std::string& file) -> std::string
auto changeExtension(const std::string& file, const std::string& ext) -> std::string
auto tokenize(const std::string& string, const std::string& delimiterCharList, int limit = 0, bool mergeAdjacentDelimiters = false) -> std::vector<std::string>
Tokenize input string by any delimiter char in delimiterCharList.
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) -> 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 jsonIntoVal(CORRADE_UNUSED const JsonDocument& d, const char* tag, CORRADE_UNUSED T& val) -> bool
Check passed json doc for existence of passed tag as.
template<>
auto jsonIntoVal(const JsonDocument& d, const char* tag, float& val) -> bool
Check passed json doc for existence of passed tag as float. If present, populate passed val with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<>
auto jsonIntoVal(const JsonDocument& d, const char* tag, double& val) -> bool
Check passed json doc for existence of passed tag as double. If present, populate passed val with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<>
auto jsonIntoVal(const JsonDocument& d, const char* tag, bool& val) -> bool
Check passed json doc for existence of passed tag as double. If present, populate passed val with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<>
auto jsonIntoVal(const JsonDocument& d, const char* tag, std::string& val) -> bool
Check passed json doc for existence of passed tag as double. If present, populate passed val with value. Returns whether tag is found and successfully populated, or not. Logs an error if tag is found but is inappropriate type.
template<>
auto jsonIntoVal(const JsonDocument& d, const char* tag, Magnum::Vector3& val) -> bool
Specialization to handle Magnum::Vector3 values. Check passed json doc for existence of passed tag as Magnum::Vector3. If present, populate passed val 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 jsonIntoSetter(const JsonDocument& 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. Should use explicit type cast on function call if setter is specified using std::bind()
template<typename T>
auto jsonIntoConstSetter(const JsonDocument& 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. Should use explicit type cast on function call if setter is specified using std::bind()
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)