3 #include "../BlockTypePalette.h" 12 for (
const auto & c: contents)
29 auto itr =
mPalettes.find(aProtocolVersion);
34 return itr->second.mBlockTypePalette;
45 std::vector<AString> res;
48 res.push_back(p.first);
61 std::sort(contents.begin(), contents.end());
66 for (
const auto & c: contents)
78 auto fileType = c.substr(c.length() - 8);
79 if ((fileType ==
".btp.txt") || (c ==
"blocks.json"))
90 else if ((fileType ==
".itp.txt") || (c ==
"items.json"))
std::vector< AString > protocolVersions() const
Returns the version names of all protocols that have been loaded.
cCriticalSection mCS
The CS protecting all members against multithreaded access.
static AString ReadWholeFile(const AString &a_FileName)
Returns the entire contents of the specified file as a string.
static char PathSeparator()
void loadSingleVersion(const AString &aProtocolVersion, const AString &aFolder)
Loads all the palettes from the specified folder into mPalettes under the aProtocolVersion key...
std::map< AString, Palettes > mPalettes
The map of protocol version -> all its palettes.
std::shared_ptr< const BlockTypePalette > blockTypePalette(const AString &aProtocolVersion) const
Returns the BlockTypePalette for the specified protocol.
Holds a palette that maps between block type + state and numbers.
static bool IsFile(const AString &a_Path)
Returns true if the specified path is a regular file.
void load(const AString &aProtocolFolder)
Loads all the per-protocol palettes.
static bool IsFolder(const AString &a_Path)
Returns true if the specified path is a folder.
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
static AStringVector GetFolderContents(const AString &a_Folder)
Returns the list of all items in the specified folder (files, folders, nix pipes, whatever's there)...