📄 records.h
字号:
//PK 2007/02/01 - 03/09
//PK Recite
#pragma once
#include "ItemInfo.h"
namespace boost {
namespace serialization {
template<class Archive>
void save(Archive & ar, const fs::path & p, const unsigned int version)
{
ar & p.string();
}
template<class Archive>
void load(Archive & ar, fs::path & p, const unsigned int version)
{
string str;
ar & str;
p = fs::path(str);
}
template<class Archive>
void save(Archive & ar, const date & d, const unsigned int version)
{
if (d.is_not_a_date()) ar & string("null");
else ar & to_iso_string(d);
}
template<class Archive>
void load(Archive & ar, date & d, const unsigned int version)
{
string str;
ar & str;
if (str == string("null")) d = date();
else d = from_undelimited_string(str);
}
}
}
BOOST_SERIALIZATION_SPLIT_FREE(fs::path)
BOOST_SERIALIZATION_SPLIT_FREE(date)
class CRecords
{
public:
CRecords();
~CRecords();
unsigned int size() { return _infos.size(); }
bool load();
bool save();
void file_name(fs::path fn);
const fs::path & file_name() { return _file_name; }
bool remove_info(const string & title);
void change_record_name(const string & src, const string & tar);
CItemInfo * get_info(const string & name);
void dirty() { _is_dirty = true; }
typedef set<string> t_names;
void trim(t_names & names);
private:
void _print() const;
typedef map<string, CItemInfo*> t_infos;
friend sr::access;
template <class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & _infos;
}
bool _is_dirty;
fs::path _file_name;
t_infos _infos;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -