CSEngine
Loading...
Searching...
No Matches
XMLParser.h
1#pragma once
2
3#include "../../Vector.h"
4#include "../../Matrix.h"
5
6#include <vector>
7#include <string>
8
9#include "../../../Component/SComponent.h"
10#include "../../STypeDef.h"
11#include "../../../Manager/EngineCore.h"
12#include "../../../Manager/ResMgr.h"
13
14namespace CSE {
15
16 class STexture;
17 class SFrameBuffer;
18 class SMaterial;
19
20 class XMLParser {
21 public:
22 static void parse(std::vector<std::string> values, void* dst, SType type);
23
24 static int parseInt(const char* value);
25 static float parseFloat(const char* value);
26 static bool parseBool(const char* value);
27
28
29 static vec2 parseVec2(std::vector<std::string> values);
30 static vec3 parseVec3(std::vector<std::string> values);
31 static vec4 parseVec4(std::vector<std::string> values);
32
33// static mat2 parseMat2(std::vector<std::string> values);
34// static mat3 parseMat3(std::vector<std::string> values);
35// static mat4 parseMat4(std::vector<std::string> values);
36
37 //Resources
38 template <class TYPE>
39 static TYPE* parseResources(const char* value);
40 static STexture* parseTexture(const char* value);
41 static SFrameBuffer* parseFrameBuffer(const char* value);
42 static SMaterial* parseMaterial(const char* value);
43
44 //Engine Objects
45 static SComponent* parseComponent(const char* value);
46 static SGameObject* parseGameObject(const char* value);
47
48 static SType GetType(std::string type);
49 static SType GetType(unsigned int type);
50
51 static std::string ToString(SType type);
52 };
53
54 template <class TYPE>
55 TYPE* XMLParser::parseResources(const char* value) {
56 TYPE* res = CORE->GetCore(ResMgr)->GetObjectByHash<TYPE>(value);
57 return res;
58 }
59
60}