// // AniResourceUtilities.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 23.06.2017. // // #ifndef AniResourceUtilities_h #define AniResourceUtilities_h #include "json/document.h" #include #include #include class AniResourceUtilities { public: static AniResourceUtilities& getInstance() { static AniResourceUtilities instance; return instance; } void setDeviceSpecificFolderName(std::string folderName){ DeviceSpecificFolderName = folderName; } std::string getDeviceSpecificFolderName(){return DeviceSpecificFolderName;} std::string getDownloadedResourcesPath(bool deviceDependentFiles = true); std::string getFullPathForDownloadedFile(const std::string& path, bool isDeviceDependent = true); std::vector< std::string> getFullPathsForDownloadedFiles(const std::vector< std::string>& paths, bool areDeviceDependent = true); // std::vector getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent = true); std::vector extractAllImagePathsFromJSONFile(std::string layoutJSONFilePath,std::string givenResourceFolderPath = "", std::string givenAltResourceFolderPath = "", std::string givenObjLayoutsFolderPath = ""); std::vector extractAllImagePathsFromLayoutString(std::string layoutJSONString,std::string givenResourceFolderPath = "", std::string givenAltResourceFolderPath = "", std::string givenObjLayoutsFolderPath = ""); std::vector extractAllSoundPathsFromScenarioString(std::string scenarioJSONString); void preloadResourcesForFile(std::string layoutJSONFilePath, std::function)> callback); void preloadFiles(std::vector files, std::function)> callback); protected: std::string DeviceSpecificFolderName; std::vector extractAllImagePaths(const rapidjson::Value& value, std::string resourceFolderPath = "", std::string altResourceFolderPath = "", std::string objLayoutsFolderPath = ""); }; #endif /* AniResourceUtilities_h */