// Squawk messenger. // Copyright (C) 2019 Yury Gubich // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // 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 . #ifndef CORE_TABLE_H #define CORE_TABLE_H #include "database.h" namespace Core { class DataBase::_Table { public: _Table(const std::string& name, DataBase* parent); virtual ~_Table(); public: MDB_dbi dbi; DataBase* db; const std::string name; }; template class DataBase::Table : private DataBase::_Table { friend class DataBase; private: Table(const std::string& name, DataBase* parent); ~Table() override; public: void addRecord(const K& key, const V& value); void changeRecord(const K& key, const V& value); void removeRecord(const K& key); V getRecord(const K& key) const; }; } MDB_val& operator << (MDB_val& data, const QString& value); MDB_val& operator >> (MDB_val& data, QString& value); MDB_val& operator << (MDB_val& data, const uint32_t& value); MDB_val& operator >> (MDB_val& data, uint32_t& value); namespace std { std::string to_string(const QString& str); } #include "table.hpp" #endif // CORE_TABLE_H