axmol/templates/lua-template-runtime/frameworks/runtime-src/Classes/ConfigParser.h

61 lines
1.5 KiB
C
Raw Normal View History

2014-05-05 21:04:04 +08:00
#ifndef __CONFIG_PARSER_H__
#define __CONFIG_PARSER_H__
#include <string>
#include <vector>
#include "cocos2d.h"
2014-05-07 20:50:29 +08:00
#include "json/document.h"
2014-12-27 02:21:55 +08:00
#include "ProjectConfig/SimulatorConfig.h"
#include "ProjectConfig/ProjectConfig.h"
2014-05-05 21:04:04 +08:00
using namespace std;
USING_NS_CC;
2014-12-27 02:21:55 +08:00
#define CONFIG_FILE "config.json"
2014-05-05 21:04:04 +08:00
typedef vector<SimulatorScreenSize> ScreenSizeArray;
class ConfigParser
{
public:
static ConfigParser *getInstance(void);
static void purge();
void readConfig(const string &filepath = "");
2014-05-05 21:04:04 +08:00
// predefined screen size
int getScreenSizeCount(void);
cocos2d::Size getInitViewSize();
string getInitViewName();
2014-05-09 14:06:20 +08:00
string getEntryFile();
2014-05-07 20:50:29 +08:00
rapidjson::Document& getConfigJsonRoot();
2014-05-05 21:04:04 +08:00
const SimulatorScreenSize getScreenSize(int index);
2014-12-27 02:21:55 +08:00
void setConsolePort(int port);
void setUploadPort(int port);
2014-07-16 20:19:19 +08:00
int getConsolePort();
2014-08-29 15:05:55 +08:00
int getUploadPort();
2014-05-07 20:50:29 +08:00
bool isLanscape();
2014-07-24 10:30:39 +08:00
bool isWindowTop();
2014-05-07 20:50:29 +08:00
2014-12-27 02:21:55 +08:00
void setEntryFile(const std::string &file);
void setInitViewSize(const cocos2d::Size &size);
void setBindAddress(const std::string &address);
const std::string &getBindAddress();
2014-05-05 21:04:04 +08:00
private:
ConfigParser(void);
2014-11-26 14:58:23 +08:00
static ConfigParser *s_sharedConfigParserInstance;
2014-05-05 21:04:04 +08:00
ScreenSizeArray _screenSizeArray;
cocos2d::Size _initViewSize;
string _viewName;
2014-05-09 14:06:20 +08:00
string _entryfile;
2014-05-07 20:50:29 +08:00
bool _isLandscape;
2014-07-24 10:30:39 +08:00
bool _isWindowTop;
2014-07-16 20:19:19 +08:00
int _consolePort;
2014-08-29 15:05:55 +08:00
int _uploadPort;
2014-12-27 02:21:55 +08:00
string _bindAddress;
2014-05-07 20:50:29 +08:00
rapidjson::Document _docRootjson;
2014-05-05 21:04:04 +08:00
};
#endif // __CONFIG_PARSER_H__