1
2
3
4
5
6 #ifndef CMAJOR_SYMBOLS_RESOURCE_TABLE_INCLUDED
7 #define CMAJOR_SYMBOLS_RESOURCE_TABLE_INCLUDED
8 #include <cmajor/symbols/SymbolsApi.hpp>
9 #include <soulng/util/BinaryReader.hpp>
10 #include <soulng/util/BinaryWriter.hpp>
11 #include <soulng/util/CodeFormatter.hpp>
12 #include <vector>
13 #include <set>
14
15 namespace cmajor { namespace symbols {
16
17 using soulng::util::BinaryReader;
18 using soulng::util::BinaryWriter;
19 using soulng::util::CodeFormatter;
20
21 struct Resource
22 {
23 enum class Type : int
24 {
25 cursor= 0, icon= 1, bitmap= 2
26 };
27 Resource();
28 Resource(const std::u32string& name_, Type type_, const std::string& filePath_);
29 void Write(BinaryWriter& writer, const std::string& cmajorRootDir);
30 void Read(BinaryReader& reader, const std::string& cmajorRootDir);
31 void Dump(CodeFormatter& formatter, int index);
32 std::u32string name;
33 Type type;
34 std::string filePath;
35 };
36
37 std::string ResourceTypeStr(Resource::Type resourceType);
38
39 class ResourceTable
40 {
41 public:
42 bool Contains(const std::u32string& resourceName) const;
43 void AddResource(const Resource& resource);
44 const std::std::vector<Resource>&Resources() const{returnresources;}
45 void Write(BinaryWriter& writer);
46 void Read(BinaryReader& reader);
47 void Dump(CodeFormatter& formatter);
48 private:
49 std::vector<Resource> resources;
50 std::set<std::u32string> resourceNameSet;
51 };
52
53 } }
54
55 #endif // CMAJOR_SYMBOLS_RESOURCE_TABLE_INCLUDED