winix/plugins/ticket/ticketparser.h

57 lines
1.2 KiB
C++
Executable File

#ifndef headerfile_winix_plugins_ticket_ticketparser
#define headerfile_winix_plugins_ticket_ticketparser
#include "ticketconf.h"
#define WINIX_TICKET_ERR_OK 0
#define WINIX_TICKET_ERR_UKNOWN_TYPE 1
#define WINIX_TICKET_ERR_NO_ITEM_NAME 2
#define WINIX_TICKET_ERR_SYNTAX_ERROR 3
class TicketParser
{
public:
int Parse(const char * str, TicketConf & conf);
int Parse(const std::string & str, TicketConf & conf);
private:
TicketConf * pconf;
const char * pchar;
int error; // last error code
TicketConf::TicketItem item;
std::string type;
std::string id_str;
std::string int_min, int_max;
TicketConf::TicketItem::Select select;
bool IsWhite(int c);
void SkipWhite();
void SkipWhiteLines();
void SkipLine();
void ReadTextQuoted(std::string & text);
void ReadTextSimple(std::string & text, bool comma_separator);
void ReadText(std::string & text, bool comma_separator = false);
void CheckId(int & id, bool & def);
void SetItemId();
bool CheckEndLine();
bool ReadItemType();
bool ReadItemName();
void ReadItemInteger();
void ReadItemSelect();
bool ReadItem();
void LogItemInteger(TicketConf::TicketItem & item);
void LogItemSelect(TicketConf::TicketItem & item);
void LogItem(TicketConf::TicketItem & item);
};
#endif