forked from metin2/client
Solution refactoring and restructuring, removed Boost dependency, removed unused tools
This commit is contained in:
94
src/EterLib/parser.h
Normal file
94
src/EterLib/parser.h
Normal file
@ -0,0 +1,94 @@
|
||||
#ifndef __INC_SCRIPT_PARSER_H__
|
||||
#define __INC_SCRIPT_PARSER_H__
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
namespace script
|
||||
{
|
||||
typedef struct SArgumet
|
||||
{
|
||||
SArgumet(const std::string& c_stName, const std::string& c_stValue)
|
||||
{
|
||||
strName = c_stName;
|
||||
strValue = c_stValue;
|
||||
}
|
||||
SArgumet(const SArgumet& c_arg)
|
||||
{
|
||||
strName = c_arg.strName;
|
||||
strValue = c_arg.strValue;
|
||||
}
|
||||
void operator=(const SArgumet& c_arg)
|
||||
{
|
||||
strName = c_arg.strName;
|
||||
strValue = c_arg.strValue;
|
||||
}
|
||||
std::string strName;
|
||||
std::string strValue;
|
||||
} TArg;
|
||||
|
||||
typedef std::list<TArg> TArgList;
|
||||
|
||||
typedef struct SCmd
|
||||
{
|
||||
std::string name;
|
||||
TArgList argList;
|
||||
|
||||
SCmd()
|
||||
{}
|
||||
SCmd(const SCmd& c_cmd)
|
||||
{
|
||||
name = c_cmd.name;
|
||||
argList = c_cmd.argList;
|
||||
}
|
||||
void operator=(const SCmd& c_cmd)
|
||||
{
|
||||
name = c_cmd.name;
|
||||
argList = c_cmd.argList;
|
||||
}
|
||||
} TCmd;
|
||||
|
||||
class Group
|
||||
{
|
||||
public:
|
||||
Group();
|
||||
~Group();
|
||||
|
||||
public:
|
||||
/** <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ <20><EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> GetError <20>ҵ<DEBC><D2B5><EFBFBD> Ȯ<><C8AE><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.
|
||||
*
|
||||
* @param stSource <20><> <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true, <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> false
|
||||
*/
|
||||
bool Create(const std::string & stSource);
|
||||
|
||||
/** <20><><EFBFBD>ɾ <20><EFBFBD> <20>ҵ<DEBC>
|
||||
*
|
||||
* @param cmd <20><><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>ü<EFBFBD><C3BC> <20><><EFBFBD>ɾ <20><><EFBFBD><EFBFBD> <20>ȴ<EFBFBD>.
|
||||
* @return <20><><EFBFBD>ɾ <20><><EFBFBD><EFBFBD> <20>ִٸ<D6B4> true, <20><><EFBFBD>ٸ<EFBFBD> false
|
||||
*/
|
||||
bool GetCmd(TCmd & cmd);
|
||||
|
||||
/*
|
||||
<09><><EFBFBD>ɾ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
*/
|
||||
bool ReadCmd(TCmd & cmd);
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20>ҵ<DEBC>
|
||||
*
|
||||
* @return stError <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ȴ<EFBFBD>.
|
||||
*/
|
||||
std::string & GetError();
|
||||
|
||||
private:
|
||||
void SetError(const char *str);
|
||||
bool GetArg(const char * c_atr_base, int arg_len, TArgList & argList);
|
||||
|
||||
std::string m_stError;
|
||||
std::list<TCmd> m_cmdList;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user