Add datastructures

- Add Database structure.
- Add Eventlog structure.
- Add OpenSSL dependency.
This commit is contained in:
realaltffour 2020-03-24 14:25:20 +03:00
parent d8c2aafaa3
commit b6d997e1aa
No known key found for this signature in database
GPG Key ID: 05B35E2E8F56C5A6
4 changed files with 70 additions and 1 deletions

View File

@ -2,7 +2,7 @@
mkdir build
cd build
conan install ..
conan install .. --build missing
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j9
cd ..

View File

@ -1,6 +1,7 @@
[requires]
zlib/1.2.11@conan/stable
boost/1.70.0
OpenSSL/1.1.1@conan/stable
[generators]
cmake

67
src/data.h Normal file
View File

@ -0,0 +1,67 @@
#ifndef DATA_H
#define DATA_H
#include <string>
#include <vector>
#include <ctime>
#include <map>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#define LOC_DB = ".db"
#define LOC_EVENTLOG = ".log"
#define LOC_SKIDID = "skid" // used as LOC_SKIDID+SKIDNUM
/////////////// DATA CONTAINING STRUCTURES ///////////////////
struct Project {
std::string _name = "";
std::string _desc = "";
boost::uuids::uuid _uuid;
int _preferredPrior = 0;
time_t _creationDate;
bool _isDone = false;
};
struct Skid {
std::vector<Project*> _projects = {};
time_t _creationDate;
};
/////////////// END OF DATA CONTAINING STRUCTURES ////////////
/////////////// HISTORY SYSTEM STRUCTURES ////////////////////
enum EventType {
Access = 0,
Creation = 1,
Modification = 2,
None = -1
};
struct Event {
int _id = -1;
EventType _type = EventType::None;
std::string _mesg = "";
};
struct EventLog {
std::vector<Event> _events;
std::string _sha512 = "";
};
/////////////// END OF HISTORY SYSTEM STRUCTURES /////////////
struct DB {
std::map<std::string, Project> _projects;
EventLog _log;
time_t _creationDate;
time_t _lastAccessTime;
};
#endif

View File

@ -6,6 +6,7 @@
#include "module.h"
#include "modules/init.h"
#include "data.h"
int main(int argc, const char* argv[]) {
using namespace boost::program_options;