Split INI/SMC API.
This commit is contained in:
@@ -1,33 +1,13 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet:
|
||||
*
|
||||
* AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
* Copyright (C) The AMX Mod X Development Team.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
* Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
* https://alliedmods.net/amxmodx-license
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_TEXTPARSE_H_
|
||||
#define _INCLUDE_TEXTPARSE_H_
|
||||
@@ -43,37 +23,31 @@ public:
|
||||
ParseInfo()
|
||||
{
|
||||
parse_start = -1;
|
||||
parse_end = -1;
|
||||
parse_end = -1;
|
||||
new_section = -1;
|
||||
key_value = -1;
|
||||
key_value = -1;
|
||||
end_section = -1;
|
||||
raw_line = -1;
|
||||
handle = -1;
|
||||
ini_format = false;
|
||||
raw_line = -1;
|
||||
handle = -1;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* SMC CONFIG.
|
||||
*/
|
||||
|
||||
void ReadSMC_ParseStart()
|
||||
{
|
||||
if (parse_start != -1)
|
||||
executeForwards(parse_start, handle);
|
||||
}
|
||||
void ReadINI_ParseStart()
|
||||
{
|
||||
if (parse_start != -1)
|
||||
executeForwards(parse_start, handle);
|
||||
}
|
||||
|
||||
void ReadSMC_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
if (parse_end != -1)
|
||||
executeForwards(parse_end, handle, halted ? 1 : 0, failed ? 1 : 0);
|
||||
}
|
||||
void ReadINI_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
if (parse_end != -1)
|
||||
executeForwards(parse_end, handle, halted ? 1 : 0, failed ? 1 : 0);
|
||||
}
|
||||
|
||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||
{
|
||||
@@ -82,13 +56,6 @@ public:
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
SMCResult ReadINI_NewSection(const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok)
|
||||
{
|
||||
if (new_section != -1)
|
||||
return (SMCResult)executeForwards(new_section, handle, section, invalid_tokens, close_bracket, extra_tokens, *curtok);
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
|
||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
||||
{
|
||||
@@ -97,13 +64,6 @@ public:
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
SMCResult ReadINI_KeyValue(const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok)
|
||||
{
|
||||
if (key_value != -1)
|
||||
return (SMCResult)executeForwards(key_value, handle, key, value, invalid_tokens, equal_token, quotes, *curtok);
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
|
||||
SMCResult ReadSMC_LeavingSection(const SMCStates *states)
|
||||
{
|
||||
@@ -120,12 +80,46 @@ public:
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
SMCResult ReadINI_RawLine(const char *line, unsigned int lineno, unsigned int *curtok)
|
||||
|
||||
|
||||
/**
|
||||
* INI CONFIG.
|
||||
*/
|
||||
|
||||
void ReadINI_ParseStart()
|
||||
{
|
||||
if (parse_start != -1)
|
||||
executeForwards(parse_start, handle);
|
||||
}
|
||||
|
||||
void ReadINI_ParseEnd(bool halted)
|
||||
{
|
||||
if (parse_end != -1)
|
||||
executeForwards(parse_end, handle, halted ? 1 : 0);
|
||||
}
|
||||
|
||||
bool ReadINI_NewSection(const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok)
|
||||
{
|
||||
if (new_section != -1)
|
||||
return executeForwards(new_section, handle, section, invalid_tokens, close_bracket, extra_tokens, *curtok) > 0 ? false : true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadINI_KeyValue(const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok)
|
||||
{
|
||||
if (key_value != -1)
|
||||
return executeForwards(key_value, handle, key, value, invalid_tokens, equal_token, quotes, *curtok) > 0 ? false : true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadINI_RawLine(const char *line, unsigned int *curtok)
|
||||
{
|
||||
if (raw_line != -1)
|
||||
return (SMCResult)executeForwards(raw_line, handle, line, lineno, *curtok);
|
||||
return executeForwards(raw_line, handle, line, *curtok) > 0 ? false : true;
|
||||
|
||||
return SMCResult_Continue;
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
int parse_start;
|
||||
@@ -135,7 +129,6 @@ public:
|
||||
int end_section;
|
||||
int raw_line;
|
||||
int handle;
|
||||
bool ini_format;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user