2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is not open source and may not be copied without explicit
7 * written permission of AlliedModders LLC. This file may not be redistributed
8 * in whole or significant part.
9 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
14 #ifndef _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
15 #define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
17 #include <ITextParsers.h>
18 #include "sm_globals.h"
20 using namespace SourceMod;
22 inline unsigned int _GetUTF8CharBytes(const char *stream)
24 unsigned char c = *(unsigned char *)stream;
40 bool IsWhitespace(const char *stream);
43 * @param void * IN: Stream pointer
44 * @param char * IN/OUT: Stream buffer
45 * @param size_t IN: Maximum size of buffer
46 * @param unsigned int * OUT: Number of bytes read (0 = end of stream)
47 * @return True on success, false on failure
49 typedef bool (*STREAMREADER)(void *, char *, size_t, unsigned int *);
57 public: //SMGlobalClass
58 void OnSourceModAllInitialized();
60 bool ParseFile_INI(const char *file,
61 ITextListener_INI *ini_listener,
65 SMCParseError ParseFile_SMC(const char *file,
66 ITextListener_SMC *smc_listener,
70 unsigned int GetUTF8CharBytes(const char *stream);
72 const char *GetSMCErrorString(SMCParseError err);
74 SMCParseError ParseString_SMC(const char *stream,
75 ITextListener_SMC *smc,
78 SMCParseError ParseStream_SMC(void *stream,
80 ITextListener_SMC *smc,
86 extern TextParsers g_TextParser;
88 #endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_H_