forked from metin2/client
95 lines
1.9 KiB
C
95 lines
1.9 KiB
C
|
#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>.
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> GetError <EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD> Ȯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ִ<EFBFBD>.
|
|||
|
*
|
|||
|
* @param stSource <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> false
|
|||
|
*/
|
|||
|
bool Create(const std::string & stSource);
|
|||
|
|
|||
|
/** <20><><EFBFBD>ɾ <20><EFBFBD> <20>ҵ<DEBC>
|
|||
|
*
|
|||
|
* @param cmd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ɾ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ȴ<EFBFBD>.
|
|||
|
* @return <EFBFBD><EFBFBD><EFBFBD>ɾ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ִٸ<EFBFBD> true, <EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD> false
|
|||
|
*/
|
|||
|
bool GetCmd(TCmd & cmd);
|
|||
|
|
|||
|
/*
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ɾ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʴ´<EFBFBD>.
|
|||
|
*/
|
|||
|
bool ReadCmd(TCmd & cmd);
|
|||
|
|
|||
|
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20>ҵ<DEBC>
|
|||
|
*
|
|||
|
* @return stError <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ȴ<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
|