creating json for new user
This commit is contained in:
parent
ddb1c277a3
commit
99e34a1faa
18
user.cpp
18
user.cpp
@ -1,8 +1,24 @@
|
|||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
user::user(fs::path)
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
user::user(fs::path user_data)
|
||||||
{
|
{
|
||||||
// json stuff go here
|
// json stuff go here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user::user(std::string name, fs::path user_dir)
|
||||||
|
: name(name)
|
||||||
|
{
|
||||||
|
json user;
|
||||||
|
user["mails"] = json::array();
|
||||||
|
user["name"] = name;
|
||||||
|
|
||||||
|
std::ofstream ofs(user_dir/(name+".json"));
|
||||||
|
ofs << user;
|
||||||
|
}
|
||||||
|
|
||||||
user::~user() {}
|
user::~user() {}
|
||||||
5
user.h
5
user.h
@ -17,9 +17,8 @@ typedef std::set<mail*, decltype(ptr_cmp<int>)> maillist;
|
|||||||
class user {
|
class user {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
user(fs::path);
|
user(fs::path user_data);
|
||||||
user(std::string name)
|
user(std::string name, fs::path user_dir);
|
||||||
: name(name) {};
|
|
||||||
|
|
||||||
~user();
|
~user();
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user