mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
74 lines
1.6 KiB
C++
Executable File
74 lines
1.6 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
|
|
|
|
#include "CString.h"
|
|
#include "CList.h"
|
|
|
|
// *****************************************************
|
|
// class Vault
|
|
// *****************************************************
|
|
|
|
class Vault
|
|
{
|
|
struct Obj
|
|
{
|
|
String key;
|
|
String value;
|
|
|
|
int number;
|
|
Obj *next;
|
|
Obj(const char* k, const char* v);
|
|
} *head;
|
|
|
|
String 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); }
|
|
String& key() const { return a->key; }
|
|
String& value() const { return a->value; }
|
|
};
|
|
|
|
inline iterator begin() const { return iterator(head); }
|
|
inline iterator end() const { return iterator(0); }
|
|
};
|
|
|
|
#endif //VAULT_CUSTOM_H
|