AniResourceUtilities.h
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// AniResourceUtilities.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 23.06.2017.
//
//
#ifndef AniResourceUtilities_h
#define AniResourceUtilities_h
#include "json/document.h"
#include <string>
#include <vector>
#include <functional>
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<std::string> getFullPathsForDownloadedFiles(const std::vector<std::string>& paths, bool areDeviceDependent = true);
std::vector<std::string> extractAllImagePathsFromJSONFile(std::string layoutJSONFilePath,std::string givenResourceFolderPath = "", std::string givenAltResourceFolderPath = "", std::string givenObjLayoutsFolderPath = "");
std::vector<std::string> extractAllImagePathsFromLayoutString(std::string layoutJSONString,std::string givenResourceFolderPath = "", std::string givenAltResourceFolderPath = "", std::string givenObjLayoutsFolderPath = "");
std::vector<std::string> extractAllSoundPathsFromScenarioString(std::string scenarioJSONString);
void preloadResourcesForFile(std::string layoutJSONFilePath, std::function<void(std::vector<std::string>)> callback);
void preloadFiles(std::vector<std::string> files, std::function<void(std::vector<std::string>)> callback);
protected:
std::string DeviceSpecificFolderName;
std::vector<std::string> extractAllImagePaths(const rapidjson::Value& value, std::string resourceFolderPath = "", std::string altResourceFolderPath = "", std::string objLayoutsFolderPath = "");
};
#endif /* AniResourceUtilities_h */