2006-11-06 11:57:37 +01:00
|
|
|
#ifndef _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
|
|
|
|
#define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
|
|
|
|
|
|
|
|
#include "interfaces/ITextParsers.h"
|
|
|
|
|
|
|
|
using namespace SourceMod;
|
|
|
|
|
2006-11-07 01:53:06 +01:00
|
|
|
inline unsigned int _GetUTF8CharBytes(const char *stream)
|
2006-11-06 11:57:37 +01:00
|
|
|
{
|
2006-11-07 01:53:06 +01:00
|
|
|
unsigned char c = *(unsigned char *)stream;
|
|
|
|
if (c & (1<<7))
|
|
|
|
{
|
|
|
|
if (c & (1<<5))
|
|
|
|
{
|
|
|
|
if (c & (1<<4))
|
|
|
|
{
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2006-11-06 11:57:37 +01:00
|
|
|
|
2006-11-07 01:53:06 +01:00
|
|
|
class CTextParsers : public ITextParsers
|
|
|
|
{
|
2006-11-06 11:57:37 +01:00
|
|
|
public:
|
|
|
|
CTextParsers();
|
|
|
|
public:
|
|
|
|
virtual bool ParseFile_INI(const char *file,
|
|
|
|
ITextListener_INI *ini_listener,
|
|
|
|
unsigned int *line,
|
|
|
|
unsigned int *col);
|
|
|
|
|
|
|
|
virtual bool ParseFile_SMC(const char *file,
|
|
|
|
ITextListener_SMC *smc_listener,
|
|
|
|
unsigned int *line,
|
2006-11-08 07:30:20 +01:00
|
|
|
unsigned int *col,
|
|
|
|
bool strict);
|
2006-11-07 01:53:06 +01:00
|
|
|
|
|
|
|
virtual unsigned int GetUTF8CharBytes(const char *stream);
|
2006-11-06 11:57:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CTextParsers g_TextParse;
|
|
|
|
|
|
|
|
#endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_H_
|