12#ifndef settings_Database_declared
13#define settings_Database_declared
40 class container_of_settings;
44 struct data_of_settings
47 std::vector<char> field_value_of_dark_mode;
48 std::vector<std::string> field_value_of_host;
49 std::vector<std::string> field_value_of_user;
53 size_t size()
const {
return freedom_keeper.
size();}
55 void resize(
size_t new_size)
57 field_value_of_dark_mode.resize(new_size);
58 field_value_of_host.resize(new_size);
59 field_value_of_user.resize(new_size);
60 freedom_keeper.
resize(new_size);
74 template<
typename E = joedb::Exception>
77 throw E(
"settings: " + message);
109 bool field_value_of_dark_mode
113 storage_of_settings.field_value_of_dark_mode[to_underlying(record_id)] = field_value_of_dark_mode;
124 char *target = &
storage_of_settings.field_value_of_dark_mode.data()[to_underlying(record_id)];
126 std::copy_n(value, size, target);
132 const std::string& field_value_of_host
143 const std::string *value
147 std::string *target = &
storage_of_settings.field_value_of_host.data()[to_underlying(record_id)];
149 std::copy_n(value, size, target);
155 const std::string& field_value_of_user
166 const std::string *value
170 std::string *target = &
storage_of_settings.field_value_of_user.data()[to_underlying(record_id)];
172 std::copy_n(value, size, target);
194 template<
class Comparator>
195 std::vector<id_of_settings>
sorted_settings(Comparator comparator)
const;
240 iterator(
const detail::data_of_settings &data): fk(&data.freedom_keeper), index(
joedb::Freedom_Keeper_Constants::used_list) {}
273 template<
class Comparator>
276 std::vector<id_of_settings> result;
278 result.emplace_back(x);
279 std::sort(result.begin(), result.end(), comparator);
void resize(Record_Id new_size)
Record_Id get_previous(Record_Id index) const
Record_Id get_next(Record_Id index) const
Store all the tables of the database.
bool is_valid_record_id_for_settings(Record_Id record_id) const
void internal_update_vector_settings__dark_mode(Record_Id record_id, size_t size, const char *value)
bool is_valid(id_of_settings id) const
static constexpr id_of_settings the_settings()
void internal_update_settings__dark_mode(Record_Id record_id, bool field_value_of_dark_mode)
void internal_insert_settings(Record_Id record_id)
friend class id_of_settings
std::vector< id_of_settings > sorted_settings(Comparator comparator) const
friend class container_of_settings
void internal_vector_insert_settings(Record_Id record_id, size_t size)
void internal_delete_settings(Record_Id record_id)
static id_of_settings null_settings()
id_of_settings next(id_of_settings id) const
const std::string & get_host(id_of_settings record=id_of_settings{0}) const
void internal_update_vector_settings__user(Record_Id record_id, size_t size, const std::string *value)
static void throw_exception(const std::string &message)
bool get_dark_mode(id_of_settings record=id_of_settings{0}) const
const std::string & get_user(id_of_settings record=id_of_settings{0}) const
id_of_settings previous(id_of_settings id) const
void internal_update_settings__host(Record_Id record_id, const std::string &field_value_of_host)
void internal_update_vector_settings__host(Record_Id record_id, size_t size, const std::string *value)
detail::data_of_settings storage_of_settings
void internal_update_settings__user(Record_Id record_id, const std::string &field_value_of_user)
container_of_settings get_settings_table() const
Implement the joedb::Readable interface for a compiled database.
std::forward_iterator_tag iterator_category
bool operator==(const iterator &i) const
id_of_settings value_type
id_of_settings operator*() const
std::ptrdiff_t difference_type
bool operator!=(const iterator &i) const
returned by Database::get_settings_table
bool is_valid_at(size_t i)
id_of_settings last() const
joedb::index_t get_size() const
static id_of_settings get_at(size_t i)
id_of_settings get_end() const
id_of_settings first() const
Strongly-typed wrapper around an integer representing a row of the settings table.
#define JOEDB_RELEASE_ASSERT(x)
always-tested assertion (release and debug mode)
constexpr const char * get_version()
Automatically generated by joedbc.