amxmodx/amxmodx/CVault.h
Karol Szuster 123246cc84 Port code to AMTL (#427)
* Remove CQueue

* Remove duplicated files

* Move sh_tinyhash to public/

* Remove sm_queue

Make NVault use of ke::Deque

* Remove sh_string (unused)

* Remove CList dependency from CTask

* Remove CList dependency from CEvent

* Remove CList dependency from modules' functions

* Remove CList dependency ForceObject

* Remove CList dependency Player Auth

* Remove left CList dependencies

* Fix msvc project files

* Update AMTL

* Use InlineList for CScript

* Use InlineList for CModule

* Use Vector for Player Auth
2017-04-14 19:36:59 +02:00

71 lines
1.5 KiB
C++
Executable File

// 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 VAULT_CUSTOM_H
#define VAULT_CUSTOM_H
// *****************************************************
// class Vault
// *****************************************************
class Vault
{
struct Obj
{
ke::AString key;
ke::AString value;
int number;
Obj *next;
Obj(const char* k, const char* v);
} *head;
ke::AString path;
Obj** find(const char* n);
public:
Vault() { head = 0; }
~Vault() { clear(); }
// Interface
bool exists(const char* k);
void put(const char* k, const char* v);
void remove(const char* k);
const char* get(const char* n);
int get_number(const char* n);
void setSource(const char* n);
bool loadVault();
bool saveVault();
void clear();
class iterator
{
Obj * a;
public:
iterator(Obj* aa) : a(aa) {}
iterator& operator++() { if (a) a = a->next; return *this; }
bool operator==(const iterator& b) const { return a == b.a; }
bool operator!=(const iterator& b) const { return !operator==(b); }
ke::AString& key() const { return a->key; }
ke::AString& value() const { return a->value; }
};
inline iterator begin() const { return iterator(head); }
inline iterator end() const { return iterator(0); }
};
#endif //VAULT_CUSTOM_H