blob: 9d0c8d873e08ef57ac7e3878f16f54ba565ae876 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#ifndef __XMLDEMOAPP_H__
#define __XMLDEMOAPP_H__
#include "SexyAppFramework/SexyAppBase.h"
namespace Sexy
{
class Board;
// This is the new class we're going to be learning about.
// It'll handle the loading and manipulation of XML files.
class XMLParser;
// These structs just represent the values from our properties/demo.xml
// file. In a real game, you'd have your own made up config file format.
// The names correspond to the attributes/sections from the XML file.
struct s_Section1
{
SexyString mItem1Text;
SexyString mBoolParamText;
bool mBoolParamElement;
};
struct s_Section2
{
SexyString mSectionAttribText;
SexyString mIntParamText;
int mIntParamElement;
SexyString mMultiAttrib1;
SexyString mMultiAttrib2;
SexyString mMultiAttrib3;
SexyString mSubsectionItem2;
};
class XMLDemoApp : public SexyAppBase
{
public:
Board* mBoard;
s_Section1 mSection1;
s_Section2 mSection2;
SexyString mInstructionTag;
SexyString mInstruction;
private:
// With this class, we'll read in our sample XML file, properties/demo.xml
XMLParser* mParser;
private:
//////////////////////////////////////////////////////////////////////////
// Function: ExtractXMLData
// Parameters: none
// Returns: false on error, otherwise true
//
// Purpose: After opening an XML file via the XMLParser::OpenFile() method,
// this function then extracts out the data it needs from the sample XML file.
// When complete, mSection1 and mSection2 will have their values initialized.
//////////////////////////////////////////////////////////////////////////
bool ExtractXMLData();
public:
XMLDemoApp();
virtual ~XMLDemoApp();
virtual void ShutdownHook();
virtual void InitHook();
};
}
#endif //__XMLDEMOAPP_H__
|