![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
the idea with this file is to create something similar to the ms-windows .ini files functions. More...
#include <KFilterDev>#include "bugs.h"#include "deprecations.h"#include "fcintl.h"#include "inputfile.h"#include "log.h"#include "registry.h"#include "section_file.h"#include "shared.h"#include "support.h"#include "registry_ini.h"
Include dependency graph for registry_ini.cpp:Go to the source code of this file.
Classes | |
| struct | entry |
Macros | |
| #define | MAX_LEN_SECPATH 1024 |
| #define | SAVE_TABLES true |
Functions | |
| static bool | entry_used (const struct entry *pentry) |
| Returns TRUE if this entry has been used. More... | |
| static void | entry_use (struct entry *pentry) |
| Increase the used count. More... | |
| static bool | entry_to_file (const struct entry *pentry, QIODevice *fs) |
| Push an entry into a file stream. More... | |
| static void | entry_from_inf_token (struct section *psection, const QString &name, const QString &tok, struct inputfile *inf) |
| Creates a new entry from the token. More... | |
| static struct entry * | section_entry_filereference_new (struct section *psection, const char *name, const char *value) |
| Returns a new entry of type ENTRY_FILEREFERENCE. More... | |
| static QString | datafilename (const QString &filename) |
| Simplification of fileinfoname(). More... | |
| static bool | is_secfile_entry_name_valid (const QString &name) |
| Ensure name is correct to use it as section or entry name. More... | |
| static bool | secfile_hash_insert (struct section_file *secfile, struct entry *pentry) |
| Insert an entry into the hash table. More... | |
| static bool | secfile_hash_delete (struct section_file *secfile, struct entry *pentry) |
| Delete an entry from the hash table. More... | |
| static struct section_file * | secfile_from_input_file (struct inputfile *inf, const QString &filename, const QString §ion, bool allow_duplicates) |
| Base function to load a section file. More... | |
| struct section_file * | secfile_load_section (const QString &filename, const QString §ion, bool allow_duplicates) |
| Create a section file from a file, read only one particular section. More... | |
| struct section_file * | secfile_from_stream (QIODevice *stream, bool allow_duplicates) |
| Create a section file from a stream. More... | |
| static bool | is_legal_table_entry_name (char c, bool num) |
| Returns TRUE iff the character is legal in a table entry name. More... | |
| bool | secfile_save (const struct section_file *secfile, QString filename) |
| Save the previously filled in section_file to disk. More... | |
| void | secfile_check_unused (const struct section_file *secfile) |
| Print log messages for any entries in the file which have not been looked up – ie, unused or unrecognised entries. More... | |
| const char * | secfile_name (const struct section_file *secfile) |
| Return the filename the section file was loaded as, or "(anonymous)" if this sectionfile was created rather than loaded from file. More... | |
| static struct section * | secfile_insert_base (struct section_file *secfile, const char *path, const char **pent_name) |
| Seperates the section and entry names. More... | |
| struct entry * | secfile_insert_bool_full (struct section_file *secfile, bool value, const char *comment, bool allow_replace, const char *path,...) |
| Insert a boolean entry. More... | |
| size_t | secfile_insert_bool_vec_full (struct section_file *secfile, const bool *values, size_t dim, const char *comment, bool allow_replace, const char *path,...) |
| Insert 'dim' boolean entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_insert_int_full (struct section_file *secfile, int value, const char *comment, bool allow_replace, const char *path,...) |
| Insert a integer entry. More... | |
| size_t | secfile_insert_int_vec_full (struct section_file *secfile, const int *values, size_t dim, const char *comment, bool allow_replace, const char *path,...) |
| Insert 'dim' integer entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_insert_float_full (struct section_file *secfile, float value, const char *comment, bool allow_replace, const char *path,...) |
| Insert a floating entry. More... | |
| struct section * | secfile_insert_include (struct section_file *secfile, const char *filename) |
| Insert a include entry. More... | |
| struct section * | secfile_insert_long_comment (struct section_file *secfile, const char *comment) |
| Insert a long comment entry. More... | |
| struct entry * | secfile_insert_str_full (struct section_file *secfile, const char *str, const char *comment, bool allow_replace, bool no_escape, enum entry_special_type stype, const char *path,...) |
| Insert a string entry. More... | |
| size_t | secfile_insert_str_vec_full (struct section_file *secfile, const char *const *strings, size_t dim, const char *comment, bool allow_replace, bool no_escape, const char *path,...) |
| Insert 'dim' string entries at 'path,0', 'path,1' etc. More... | |
| size_t | secfile_insert_str_vec_full (struct section_file *secfile, const QVector< QString > &strings, size_t dim, const char *comment, bool allow_replace, bool no_escape, const char *path,...) |
| Insert up to 'dim' string entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_insert_filereference (struct section_file *secfile, const char *filename, const char *path,...) |
| Insert a read-from-a-file string entry. More... | |
| struct entry * | secfile_insert_plain_enum_full (struct section_file *secfile, int enumerator, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...) |
| Insert a enumerator entry. More... | |
| size_t | secfile_insert_plain_enum_vec_full (struct section_file *secfile, const int *enumurators, size_t dim, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...) |
| Insert 'dim' string entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_insert_bitwise_enum_full (struct section_file *secfile, int bitwise_val, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...) |
| Insert a bitwise value entry. More... | |
| size_t | secfile_insert_bitwise_enum_vec_full (struct section_file *secfile, const int *bitwise_vals, size_t dim, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...) |
| Insert 'dim' string entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_insert_enum_data_full (struct section_file *secfile, int value, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...) |
| Insert an enumerator value entry that we only have a name accessor function. More... | |
| size_t | secfile_insert_enum_vec_data_full (struct section_file *secfile, const int *values, size_t dim, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...) |
| Insert 'dim' entries at 'path,0', 'path,1' etc. More... | |
| struct entry * | secfile_entry_by_path (const struct section_file *secfile, const char *path) |
| Returns the entry by the name or nullptr if not matched. More... | |
| bool | secfile_entry_delete (struct section_file *secfile, const char *path,...) |
| Delete an entry. More... | |
| struct entry * | secfile_entry_lookup (const struct section_file *secfile, const char *path,...) |
| Returns the entry at "fullpath" or nullptr if not matched. More... | |
| bool | secfile_lookup_bool (const struct section_file *secfile, bool *bval, const char *path,...) |
| Lookup a boolean value in the secfile. More... | |
| bool | secfile_lookup_bool_default (const struct section_file *secfile, bool def, const char *path,...) |
| Lookup a boolean value in the secfile. More... | |
| bool | secfile_lookup_int (const struct section_file *secfile, int *ival, const char *path,...) |
| Lookup a integer value in the secfile. More... | |
| int | secfile_lookup_int_default (const struct section_file *secfile, int def, const char *path,...) |
| Lookup a integer value in the secfile. More... | |
| int | secfile_lookup_int_def_min_max (const struct section_file *secfile, int defval, int minval, int maxval, const char *path,...) |
| Lookup a integer value in the secfile. More... | |
| int * | secfile_lookup_int_vec (const struct section_file *secfile, size_t *dim, const char *path,...) |
| Lookup a integer vector in the secfile. More... | |
| const char * | secfile_lookup_str (const struct section_file *secfile, const char *path,...) |
| Lookup a string value in the secfile. More... | |
| const char * | secfile_lookup_str_default (const struct section_file *secfile, const char *def, const char *path,...) |
| Lookup a string value in the secfile. More... | |
| const char ** | secfile_lookup_str_vec (const struct section_file *secfile, size_t *dim, const char *path,...) |
| Lookup a string vector in the secfile. More... | |
| bool | secfile_lookup_plain_enum_full (const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup an enumerator value in the secfile. More... | |
| int | secfile_lookup_plain_enum_default_full (const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup an enumerator value in the secfile. More... | |
| int * | secfile_lookup_plain_enum_vec_full (const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup a enumerator vector in the secfile. More... | |
| bool | secfile_lookup_bitwise_enum_full (const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup a bitwise enumerator value in the secfile. More... | |
| int | secfile_lookup_bitwise_enum_default_full (const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup an enumerator value in the secfile. More... | |
| int * | secfile_lookup_bitwise_enum_vec_full (const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) |
| Lookup a enumerator vector in the secfile. More... | |
| bool | secfile_lookup_enum_data (const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...) |
| Lookup a value saved as string in the secfile. More... | |
| int | secfile_lookup_enum_default_data (const struct section_file *secfile, int defval, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...) |
| Lookup a value saved as string in the secfile. More... | |
| struct section * | secfile_section_by_name (const struct section_file *secfile, const QString &name) |
| Returns the first section matching the name. More... | |
| struct section * | secfile_section_lookup (const struct section_file *secfile, const char *path,...) |
| Find a section by path. More... | |
| const struct section_list * | secfile_sections (const struct section_file *secfile) |
| Returns the list of sections. More... | |
| struct section_list * | secfile_sections_by_name_prefix (const struct section_file *secfile, const char *prefix) |
| Returns the list of sections which match the name prefix. More... | |
| struct section * | secfile_section_new (struct section_file *secfile, const QString &name) |
| Create a new section in the secfile. More... | |
| void | section_destroy (struct section *psection) |
| Remove this section from the secfile. More... | |
| void | section_clear_all (struct section *psection) |
| Remove all entries. More... | |
| const struct entry_list * | section_entries (const struct section *psection) |
| Returns a list containing all the entries. More... | |
| struct entry * | section_entry_by_name (const struct section *psection, const QString &name) |
| Returns the first entry matching the name. More... | |
| static entry * | entry_new (struct section *psection, const QString &name) |
| Returns a new entry. More... | |
| struct entry * | section_entry_int_new (struct section *psection, const QString &name, int value) |
| Returns a new entry of type ENTRY_INT. More... | |
| struct entry * | section_entry_bool_new (struct section *psection, const QString &name, bool value) |
| Returns a new entry of type ENTRY_BOOL. More... | |
| struct entry * | section_entry_float_new (struct section *psection, const QString &name, float value) |
| Returns a new entry of type ENTRY_FLOAT. More... | |
| struct entry * | section_entry_str_new (struct section *psection, const QString &name, const QString &value, bool escaped) |
| Returns a new entry of type ENTRY_STR. More... | |
| void | entry_destroy (struct entry *pentry) |
| Entry structure destructor. More... | |
| struct section * | entry_section (const struct entry *pentry) |
| Returns the parent section of this entry. More... | |
| enum entry_type | entry_type_get (const struct entry *pentry) |
| Returns the type of this entry or ENTRY_ILLEGAL or error. More... | |
| int | entry_path (const struct entry *pentry, char *buf, size_t buf_len) |
| Build the entry path. More... | |
| const char * | entry_name (const struct entry *pentry) |
| Returns the name of this entry. More... | |
| bool | entry_set_name (struct entry *pentry, const char *name) |
| Sets the name of the entry. More... | |
| const char * | entry_comment (const struct entry *pentry) |
| Returns the comment associated to this entry. More... | |
| void | entry_set_comment (struct entry *pentry, const QString &comment) |
| Sets a comment for the entry. More... | |
| bool | entry_bool_get (const struct entry *pentry, bool *value) |
| Gets an boolean value. More... | |
| bool | entry_bool_set (struct entry *pentry, bool value) |
| Sets an boolean value. More... | |
| bool | entry_float_get (const struct entry *pentry, float *value) |
| Gets an floating value. More... | |
| bool | entry_float_set (struct entry *pentry, float value) |
| Sets an floating value. More... | |
| bool | entry_int_get (const struct entry *pentry, int *value) |
| Gets an integer value. More... | |
| bool | entry_int_set (struct entry *pentry, int value) |
| Sets an integer value. More... | |
| bool | entry_str_get (const struct entry *pentry, const char **value) |
| Gets an string value. More... | |
| bool | entry_str_set (struct entry *pentry, const char *value) |
| Sets an string value. More... | |
| bool | entry_str_set_gt_marking (struct entry *pentry, bool gt_marking) |
| Sets if the string should get gettext marking. More... | |
the idea with this file is to create something similar to the ms-windows .ini files functions.
however the interface is nice. ie: secfile_lookup_str(file, "player%d.unit%d.name", plrno, unitno);
(This is based on a format by the original authors, with various incremental extensions. –dwp)
Within a section, lines have one of the following forms: subname = "stringvalue" subname = -digits subname = digits subname = TRUE sunname = FALSE for a value with given name and string, negative integer, and positive integer values, respectively. These entries are referenced in the following functions as "sectionname.subname". The section name should not contain any dots ('.'); the subname can, but they have no particular significance. There can be optional whitespace before and/or after the equals sign. You can put a newline after (but not before) the equals sign.
Backslash is an escape character in strings (double-quoted strings only, not names); recognised escapes are \n, \\, and \". (Any other \<char> is just treated as <char>.)
Gettext markings: You can surround strings like so:
foo = _("stringvalue")
The registry just ignores these extra markings, but this is useful for marking strings for translations via gettext tools.
Multiline strings: Strings can have embeded newlines, eg:
foo = _(" This is a string over multiple lines ")
This is equivalent to:
foo = _("\\nThis is a string\\nover multiple lines\\n")
Note that if you missplace the trailing doublequote you can easily end up with strange errors reading the file...
Tabular format: The lines: foo = { "bar", "baz", "bax" "wow", 10, -5 "cool", "str" "hmm", 314, 99, 33, 11 } are equivalent to the following: foo0.bar = "wow" foo0.baz = 10 foo0.bax = -5 foo1.bar = "cool" foo1.baz = "str" foo2.bar = "hmm" foo2.baz = 314 foo2.bax = 99 foo2.bax,1 = 33 foo2.bax,2 = 11 The first line specifies the base name and the column names, and the subsequent lines have data. Again it is possible to mix string and integer values in a column, and have either more or less values in a row than there are column headings, but the code which uses this information (via the registry) may set more stringent conditions. If a row has more entries than column headings, the last column is treated as a vector (as above). You can optionally put a newline after '=' and/or after '{'.
The equivalence above between the new and old formats is fairly direct: internally, data is converted to the old format. In principle it could be a good idea to represent the data as a table (2-d array) internally, but the current method seems sufficient and relatively simple...
There is a limited ability to save data in tabular: So long as the section_file is constructed in an expected way, tabular data (with no missing or extra values) can be saved in tabular form. (See section_file_save().)
(by dwp)
Definition in file registry_ini.cpp.
| #define MAX_LEN_SECPATH 1024 |
Definition at line 173 of file registry_ini.cpp.
| #define SAVE_TABLES true |
Definition at line 176 of file registry_ini.cpp.
|
static |
Simplification of fileinfoname().
Definition at line 226 of file registry_ini.cpp.
Referenced by secfile_from_stream(), and secfile_load_section().
| bool entry_bool_get | ( | const struct entry * | pentry, |
| bool * | value | ||
| ) |
Gets an boolean value.
Returns TRUE on success. On old saved files, 0 and 1 can also be considered as bool.
Definition at line 3111 of file registry_ini.cpp.
Referenced by lookup_req_list(), secfile_lookup_bool(), secfile_lookup_bool_default(), and settable_options_load().
| bool entry_bool_set | ( | struct entry * | pentry, |
| bool | value | ||
| ) |
Sets an boolean value.
Returns TRUE on success.
Definition at line 3136 of file registry_ini.cpp.
Referenced by secfile_insert_bool_full().
| const char* entry_comment | ( | const struct entry * | pentry | ) |
Returns the comment associated to this entry.
Definition at line 3076 of file registry_ini.cpp.
Referenced by secfile_save().
| void entry_destroy | ( | struct entry * | pentry | ) |
Entry structure destructor.
Definition at line 2945 of file registry_ini.cpp.
Referenced by secfile_entry_delete(), secfile_insert_bitwise_enum_full(), secfile_insert_bool_full(), secfile_insert_enum_data_full(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_plain_enum_full(), secfile_insert_str_full(), and secfile_section_new().
| bool entry_float_get | ( | const struct entry * | pentry, |
| float * | value | ||
| ) |
| bool entry_float_set | ( | struct entry * | pentry, |
| float | value | ||
| ) |
Sets an floating value.
Returns TRUE on success.
Definition at line 3165 of file registry_ini.cpp.
Referenced by secfile_insert_float_full().
|
static |
Creates a new entry from the token.
Definition at line 3310 of file registry_ini.cpp.
Referenced by secfile_from_input_file().
| bool entry_int_get | ( | const struct entry * | pentry, |
| int * | value | ||
| ) |
Gets an integer value.
Returns TRUE on success.
Definition at line 3179 of file registry_ini.cpp.
Referenced by load_action_range_max(), lookup_req_list(), secfile_lookup_int(), secfile_lookup_int_def_min_max(), secfile_lookup_int_default(), and settable_options_load().
| bool entry_int_set | ( | struct entry * | pentry, |
| int | value | ||
| ) |
Sets an integer value.
Returns TRUE on success.
Definition at line 3194 of file registry_ini.cpp.
Referenced by secfile_insert_int_full().
| const char* entry_name | ( | const struct entry * | pentry | ) |
Returns the name of this entry.
Definition at line 3020 of file registry_ini.cpp.
Referenced by compat_load_020400(), entry_path(), fcdb_load_config(), load_action_ui_name(), options_dialogs_load(), save_action_ui_name(), secfile_check_unused(), secfile_lookup_bitwise_enum_full(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), secfile_lookup_plain_enum_full(), secfile_save(), section_entry_by_name(), and settable_options_load().
Returns a new entry.
Definition at line 2813 of file registry_ini.cpp.
Referenced by section_entry_bool_new(), section_entry_filereference_new(), section_entry_float_new(), section_entry_int_new(), and section_entry_str_new().
| int entry_path | ( | const struct entry * | pentry, |
| char * | buf, | ||
| size_t | buf_len | ||
| ) |
Build the entry path.
Returns like snprintf().
Definition at line 3010 of file registry_ini.cpp.
Referenced by secfile_hash_delete(), and secfile_hash_insert().
Returns the parent section of this entry.
Definition at line 2994 of file registry_ini.cpp.
Referenced by entry_path(), secfile_hash_insert(), secfile_lookup_bitwise_enum_full(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), secfile_lookup_int_def_min_max(), and secfile_lookup_plain_enum_full().
| void entry_set_comment | ( | struct entry * | pentry, |
| const QString & | comment | ||
| ) |
Sets a comment for the entry.
Pass nullptr to remove the current one.
Definition at line 3084 of file registry_ini.cpp.
Referenced by secfile_insert_bitwise_enum_full(), secfile_insert_bool_full(), secfile_insert_enum_data_full(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_plain_enum_full(), and secfile_insert_str_full().
| bool entry_set_name | ( | struct entry * | pentry, |
| const char * | name | ||
| ) |
Sets the name of the entry.
Returns TRUE on success.
Definition at line 3028 of file registry_ini.cpp.
Referenced by compat_load_020400().
| bool entry_str_get | ( | const struct entry * | pentry, |
| const char ** | value | ||
| ) |
Gets an string value.
Returns TRUE on success.
Definition at line 3207 of file registry_ini.cpp.
Referenced by fcdb_load_config(), load_action_range_max(), lookup_req_list(), secfile_lookup_bitwise_enum_default_full(), secfile_lookup_bitwise_enum_full(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), secfile_lookup_plain_enum_default_full(), secfile_lookup_plain_enum_full(), secfile_lookup_str(), secfile_lookup_str_default(), and settable_options_load().
| bool entry_str_set | ( | struct entry * | pentry, |
| const char * | value | ||
| ) |
Sets an string value.
Returns TRUE on success.
Definition at line 3222 of file registry_ini.cpp.
Referenced by secfile_insert_bitwise_enum_full(), secfile_insert_enum_data_full(), secfile_insert_plain_enum_full(), and secfile_insert_str_full().
| bool entry_str_set_gt_marking | ( | struct entry * | pentry, |
| bool | gt_marking | ||
| ) |
Sets if the string should get gettext marking.
Returns TRUE on success.
Definition at line 3243 of file registry_ini.cpp.
Referenced by save_game_ruleset(), save_name_translation(), and sg_save_scenario().
|
static |
Push an entry into a file stream.
Definition at line 3257 of file registry_ini.cpp.
Referenced by secfile_save().
| enum entry_type entry_type_get | ( | const struct entry * | pentry | ) |
Returns the type of this entry or ENTRY_ILLEGAL or error.
Definition at line 2994 of file registry_ini.cpp.
Referenced by fcdb_load_config(), load_action_range_max(), lookup_req_list(), secfile_insert_bitwise_enum_full(), secfile_insert_bool_full(), secfile_insert_enum_data_full(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_plain_enum_full(), secfile_insert_str_full(), and settable_options_load().
|
inlinestatic |
Increase the used count.
Definition at line 3105 of file registry_ini.cpp.
Referenced by secfile_entry_by_path(), secfile_hash_insert(), and section_entry_by_name().
|
inlinestatic |
Returns TRUE if this entry has been used.
Definition at line 3097 of file registry_ini.cpp.
Referenced by secfile_check_unused().
|
static |
Returns TRUE iff the character is legal in a table entry name.
Definition at line 595 of file registry_ini.cpp.
Referenced by secfile_save().
|
static |
Ensure name is correct to use it as section or entry name.
Definition at line 234 of file registry_ini.cpp.
Referenced by entry_new(), entry_set_name(), and secfile_section_new().
| void secfile_check_unused | ( | const struct section_file * | secfile | ) |
Print log messages for any entries in the file which have not been looked up – ie, unused or unrecognised entries.
To mark an entry as used without actually doing anything with it, you could do something like: section_file_lookup(&file, "foo.bar"); / * unused * /
Definition at line 857 of file registry_ini.cpp.
Referenced by boot_help_texts(), comments_load(), load_command(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_governments(), load_ruleset_nations(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_rulesetdir(), scan_specfile(), and tileset_read_toplevel().
| struct entry* secfile_entry_by_path | ( | const struct section_file * | secfile, |
| const char * | path | ||
| ) |
Returns the entry by the name or nullptr if not matched.
Definition at line 1718 of file registry_ini.cpp.
Referenced by load_building_names(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_nations(), load_style_names(), load_tech_names(), load_terrain_names(), load_unit_names(), secfile_entry_delete(), secfile_entry_lookup(), secfile_lookup_bitwise_enum_default_full(), secfile_lookup_bitwise_enum_full(), secfile_lookup_bool(), secfile_lookup_bool_default(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), secfile_lookup_int(), secfile_lookup_int_def_min_max(), secfile_lookup_int_default(), secfile_lookup_plain_enum_default_full(), secfile_lookup_plain_enum_full(), secfile_lookup_str(), secfile_lookup_str_default(), sg_load_random(), and sg_load_savefile().
| bool secfile_entry_delete | ( | struct section_file * | secfile, |
| const char * | path, | ||
| ... | |||
| ) |
Delete an entry.
Definition at line 1765 of file registry_ini.cpp.
Referenced by compat_load_020400(), and compat_load_020600().
| struct entry* secfile_entry_lookup | ( | const struct section_file * | secfile, |
| const char * | path, | ||
| ... | |||
| ) |
Returns the entry at "fullpath" or nullptr if not matched.
Definition at line 1791 of file registry_ini.cpp.
Referenced by load_action_auto_actions(), load_action_auto_uflag_block(), load_action_range_max(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_nations(), lookup_req_list(), scan_specfile(), secfile_lookup_bitwise_enum_vec_full(), secfile_lookup_int_vec(), secfile_lookup_plain_enum_vec_full(), secfile_lookup_str_vec(), sg_load_player_city(), and sg_load_player_unit().
|
static |
Base function to load a section file.
Note it closes the inputfile.
Definition at line 298 of file registry_ini.cpp.
Referenced by secfile_from_stream(), and secfile_load_section().
| struct section_file* secfile_from_stream | ( | QIODevice * | stream, |
| bool | allow_duplicates | ||
| ) |
Create a section file from a stream.
Returns nullptr on error.
Definition at line 585 of file registry_ini.cpp.
Referenced by netfile_get_section_file(), and parse_metaserver_data().
|
static |
Delete an entry from the hash table.
Returns TRUE on success.
Definition at line 279 of file registry_ini.cpp.
Referenced by entry_destroy(), and entry_set_name().
|
static |
Insert an entry into the hash table.
Returns TRUE on success.
Definition at line 249 of file registry_ini.cpp.
Referenced by entry_new(), entry_set_name(), and secfile_from_input_file().
|
static |
Seperates the section and entry names.
Create the section if missing.
Definition at line 900 of file registry_ini.cpp.
Referenced by secfile_insert_bitwise_enum_full(), secfile_insert_bool_full(), secfile_insert_enum_data_full(), secfile_insert_filereference(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_plain_enum_full(), and secfile_insert_str_full().
| struct entry* secfile_insert_bitwise_enum_full | ( | struct section_file * | secfile, |
| int | bitwise_val, | ||
| secfile_enum_name_fn_t | name_fn, | ||
| secfile_enum_iter_fn_t | begin_fn, | ||
| secfile_enum_iter_fn_t | end_fn, | ||
| secfile_enum_next_fn_t | next_fn, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a bitwise value entry.
Definition at line 1486 of file registry_ini.cpp.
Referenced by secfile_insert_bitwise_enum_vec_full().
| size_t secfile_insert_bitwise_enum_vec_full | ( | struct section_file * | secfile, |
| const int * | bitwise_vals, | ||
| size_t | dim, | ||
| secfile_enum_name_fn_t | name_fn, | ||
| secfile_enum_iter_fn_t | begin_fn, | ||
| secfile_enum_iter_fn_t | end_fn, | ||
| secfile_enum_next_fn_t | next_fn, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' string entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1557 of file registry_ini.cpp.
| struct entry* secfile_insert_bool_full | ( | struct section_file * | secfile, |
| bool | value, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a boolean entry.
Definition at line 931 of file registry_ini.cpp.
Referenced by secfile_insert_bool_vec_full().
| size_t secfile_insert_bool_vec_full | ( | struct section_file * | secfile, |
| const bool * | values, | ||
| size_t | dim, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' boolean entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 982 of file registry_ini.cpp.
| struct entry* secfile_insert_enum_data_full | ( | struct section_file * | secfile, |
| int | value, | ||
| bool | bitwise, | ||
| secfile_enum_name_data_fn_t | name_fn, | ||
| secfile_data_t | data, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert an enumerator value entry that we only have a name accessor function.
Definition at line 1603 of file registry_ini.cpp.
Referenced by secfile_insert_enum_vec_data_full().
| size_t secfile_insert_enum_vec_data_full | ( | struct section_file * | secfile, |
| const int * | values, | ||
| size_t | dim, | ||
| bool | bitwise, | ||
| secfile_enum_name_data_fn_t | name_fn, | ||
| secfile_data_t | data, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1678 of file registry_ini.cpp.
| struct entry* secfile_insert_filereference | ( | struct section_file * | secfile, |
| const char * | filename, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a read-from-a-file string entry.
Definition at line 1351 of file registry_ini.cpp.
Referenced by save_game_ruleset().
| struct entry* secfile_insert_float_full | ( | struct section_file * | secfile, |
| float | value, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a floating entry.
Definition at line 1109 of file registry_ini.cpp.
| struct section* secfile_insert_include | ( | struct section_file * | secfile, |
| const char * | filename | ||
| ) |
Insert a include entry.
Definition at line 1159 of file registry_ini.cpp.
Referenced by save_nations_ruleset().
| struct entry* secfile_insert_int_full | ( | struct section_file * | secfile, |
| int | value, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a integer entry.
Definition at line 1020 of file registry_ini.cpp.
Referenced by secfile_insert_int_vec_full().
| size_t secfile_insert_int_vec_full | ( | struct section_file * | secfile, |
| const int * | values, | ||
| size_t | dim, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' integer entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1071 of file registry_ini.cpp.
| struct section* secfile_insert_long_comment | ( | struct section_file * | secfile, |
| const char * | comment | ||
| ) |
Insert a long comment entry.
Definition at line 1184 of file registry_ini.cpp.
Referenced by comment_write().
| struct entry* secfile_insert_plain_enum_full | ( | struct section_file * | secfile, |
| int | enumerator, | ||
| secfile_enum_name_fn_t | name_fn, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a enumerator entry.
Definition at line 1387 of file registry_ini.cpp.
Referenced by secfile_insert_plain_enum_vec_full().
| size_t secfile_insert_plain_enum_vec_full | ( | struct section_file * | secfile, |
| const int * | enumurators, | ||
| size_t | dim, | ||
| secfile_enum_name_fn_t | name_fn, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' string entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1444 of file registry_ini.cpp.
| struct entry* secfile_insert_str_full | ( | struct section_file * | secfile, |
| const char * | str, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| bool | no_escape, | ||
| enum entry_special_type | stype, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert a string entry.
Definition at line 1210 of file registry_ini.cpp.
Referenced by secfile_insert_include(), secfile_insert_long_comment(), and secfile_insert_str_vec_full().
| size_t secfile_insert_str_vec_full | ( | struct section_file * | secfile, |
| const char *const * | strings, | ||
| size_t | dim, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| bool | no_escape, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert 'dim' string entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1271 of file registry_ini.cpp.
| size_t secfile_insert_str_vec_full | ( | struct section_file * | secfile, |
| const QVector< QString > & | strings, | ||
| size_t | dim, | ||
| const char * | comment, | ||
| bool | allow_replace, | ||
| bool | no_escape, | ||
| const char * | path, | ||
| ... | |||
| ) |
Insert up to 'dim' string entries at 'path,0', 'path,1' etc.
Returns the number of entries inserted or replaced.
Definition at line 1311 of file registry_ini.cpp.
| struct section_file* secfile_load_section | ( | const QString & | filename, |
| const QString & | section, | ||
| bool | allow_duplicates | ||
| ) |
Create a section file from a file, read only one particular section.
Returns nullptr on error.
Definition at line 573 of file registry_ini.cpp.
Referenced by secfile_load(), show_scenarios(), page_load::slot_selection_changed(), and page_scenario::update_scenarios_page().
| int secfile_lookup_bitwise_enum_default_full | ( | const struct section_file * | secfile, |
| int | defval, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup an enumerator value in the secfile.
Returns 'defval' on error.
Definition at line 2330 of file registry_ini.cpp.
| bool secfile_lookup_bitwise_enum_full | ( | const struct section_file * | secfile, |
| int * | penumerator, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a bitwise enumerator value in the secfile.
Returns FALSE on error.
Definition at line 2263 of file registry_ini.cpp.
Referenced by secfile_lookup_bitwise_enum_vec_full().
| int* secfile_lookup_bitwise_enum_vec_full | ( | const struct section_file * | secfile, |
| size_t * | dim, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a enumerator vector in the secfile.
Returns nullptr on error. This vector is not owned by the registry module, and should be free by the user.
Definition at line 2393 of file registry_ini.cpp.
| bool secfile_lookup_bool | ( | const struct section_file * | secfile, |
| bool * | bval, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a boolean value in the secfile.
Returns TRUE on success.
Definition at line 1809 of file registry_ini.cpp.
Referenced by client_option_load(), compat_load_020600(), compat_load_030000(), load_ruleset_cities(), options_dialogs_load(), setting_ruleset_one(), settings_game_load(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_researches(), sg_load_scenario(), and tileset_read_toplevel().
| bool secfile_lookup_bool_default | ( | const struct section_file * | secfile, |
| bool | def, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a boolean value in the secfile.
On failure, use the default value.
Definition at line 1834 of file registry_ini.cpp.
Referenced by compat_load_020400(), compat_load_020500(), compat_load_020600(), compat_load_030000(), dai_city_load(), global_worklist_load(), insert_server_side_agent(), load_action_actor_consuming_always(), load_cma_preset(), load_ruleset_cities(), load_ruleset_game(), load_ruleset_nations(), load_ruleset_terrain(), lookup_cbonus_list(), setting_ruleset_one(), settings_game_load(), sg_load_game(), sg_load_map(), sg_load_map_known(), sg_load_map_startpos(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_vision(), sg_load_player_vision_city(), sg_load_players(), sg_load_players_basic(), sg_load_random(), sg_load_savefile(), sg_load_scenario(), sg_load_treaties(), show_scenarios(), page_load::slot_selection_changed(), tileset_read_toplevel(), tileset_setup_options(), and page_scenario::update_scenarios_page().
| bool secfile_lookup_enum_data | ( | const struct section_file * | secfile, |
| int * | pvalue, | ||
| bool | bitwise, | ||
| secfile_enum_name_data_fn_t | name_fn, | ||
| secfile_data_t | data, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a value saved as string in the secfile.
Returns FALSE on error.
Definition at line 2449 of file registry_ini.cpp.
Referenced by client_option_load(), compat_load_020500(), setting_ruleset_one(), and settings_game_load().
| int secfile_lookup_enum_default_data | ( | const struct section_file * | secfile, |
| int | defval, | ||
| bool | bitwise, | ||
| secfile_enum_name_data_fn_t | name_fn, | ||
| secfile_data_t | data, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a value saved as string in the secfile.
Returns 'defval' on error.
Definition at line 2531 of file registry_ini.cpp.
Referenced by settings_game_load().
| bool secfile_lookup_int | ( | const struct section_file * | secfile, |
| int * | ival, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a integer value in the secfile.
Returns TRUE on success.
Definition at line 1862 of file registry_ini.cpp.
Referenced by client_option_load(), compat_load_020400(), compat_load_020500(), compat_load_020600(), load_ruleset_buildings(), load_ruleset_governments(), load_ruleset_nations(), load_ruleset_terrain(), load_ruleset_units(), lookup_cbonus_list(), lookup_time(), rgbcolor_load(), rscompat_check_capabilities(), scan_specfile(), secfile_lookup_int_default_min_max(), secfile_lookup_int_vec(), setting_ruleset_one(), settings_game_load(), sg_load_game(), sg_load_map_startpos(), sg_load_player_attributes(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_units(), sg_load_player_units_transport(), sg_load_player_vision_city(), sg_load_players_basic(), sg_load_random(), sg_load_researches(), tileset_invalid_offsets(), and tileset_read_toplevel().
| int secfile_lookup_int_def_min_max | ( | const struct section_file * | secfile, |
| int | defval, | ||
| int | minval, | ||
| int | maxval, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a integer value in the secfile.
The value will be arranged to match the interval [minval, maxval]. On failure, use the default value.
Definition at line 1917 of file registry_ini.cpp.
Referenced by load_ruleset_game(), and tileset_read_toplevel().
| int secfile_lookup_int_default | ( | const struct section_file * | secfile, |
| int | def, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a integer value in the secfile.
On failure, use the default value.
Definition at line 1887 of file registry_ini.cpp.
Referenced by compat_load_020400(), compat_load_020600(), compat_load_030000(), compat_load_030100(), dai_city_load(), dai_player_load_relations(), dai_unit_load(), effect_to_enabler(), event_cache_load(), global_worklist_load(), increase_secfile_turn_int(), insert_server_side_agent(), load_action_range(), load_cma_preset(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), parse_metaserver_data(), ruleset_load_traits(), scan_specfile(), settings_game_load(), sg_load_compat(), sg_load_game(), sg_load_history(), sg_load_map_startpos(), sg_load_mapimg(), sg_load_player_attributes(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_city_citizens(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_units_transport(), sg_load_player_vision(), sg_load_player_vision_city(), sg_load_players_basic(), sg_load_researches(), sg_load_ruledata(), sg_load_ruleset(), sg_load_savefile(), sg_load_scenario(), sg_load_treaties(), page_load::slot_selection_changed(), tileset_read_toplevel(), tileset_set_offsets(), page_scenario::update_scenarios_page(), and worklist_load().
| int* secfile_lookup_int_vec | ( | const struct section_file * | secfile, |
| size_t * | dim, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a integer vector in the secfile.
Returns nullptr on error. This vector is not owned by the registry module, and should be free by the user.
Definition at line 1964 of file registry_ini.cpp.
Referenced by load_ruleset_game(), load_ruleset_veteran(), and sg_load_researches().
| int secfile_lookup_plain_enum_default_full | ( | const struct section_file * | secfile, |
| int | defval, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup an enumerator value in the secfile.
Returns 'defval' on error.
Definition at line 2166 of file registry_ini.cpp.
| bool secfile_lookup_plain_enum_full | ( | const struct section_file * | secfile, |
| int * | penumerator, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup an enumerator value in the secfile.
Returns FALSE on error.
Definition at line 2122 of file registry_ini.cpp.
Referenced by secfile_lookup_plain_enum_vec_full().
| int* secfile_lookup_plain_enum_vec_full | ( | const struct section_file * | secfile, |
| size_t * | dim, | ||
| secfile_enum_is_valid_fn_t | is_valid_fn, | ||
| secfile_enum_by_name_fn_t | by_name_fn, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a enumerator vector in the secfile.
Returns nullptr on error. This vector is not owned by the registry module, and should be free by the user.
Definition at line 2208 of file registry_ini.cpp.
| const char* secfile_lookup_str | ( | const struct section_file * | secfile, |
| const char * | path, | ||
| ... | |||
| ) |
Lookup a string value in the secfile.
Returns nullptr on error.
Definition at line 2012 of file registry_ini.cpp.
Referenced by audio_play_tag(), boot_help_texts(), check_audiofile_capstr(), check_tilespec_capabilities(), client_option_load(), compat_load_020400(), compat_load_020500(), compat_load_020600(), ensure_big_sprite(), event_cache_load(), handle_single_want_hack_req(), load_install_info_list(), load_nation_names(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_nations(), load_ruleset_styles(), load_ruleset_terrain(), load_ruleset_units(), load_terrain_names(), lookup_cbonus_list(), lookup_req_list(), lookup_string(), lookup_terrain(), rscompat_check_capabilities(), ruleset_load_names(), savegame_load(), scan_specfile(), secfile_lookup_str_vec(), setting_ruleset_one(), settings_game_load(), sg_load_history(), sg_load_map_owner(), sg_load_map_startpos(), sg_load_map_tiles(), sg_load_map_worked(), sg_load_mapimg(), sg_load_player_attributes(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_units(), sg_load_player_vision(), sg_load_player_vision_city(), sg_load_players_basic(), sg_load_random(), sg_load_researches(), sg_load_savefile(), sg_load_treaties(), technology_load(), tileset_read_toplevel(), and worklist_load().
| const char* secfile_lookup_str_default | ( | const struct section_file * | secfile, |
| const char * | def, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a string value in the secfile.
On failure, use the default value.
Definition at line 2042 of file registry_ini.cpp.
Referenced by api_luadata_get_str(), compat_load_020400(), compat_load_020600(), compat_load_030000(), compat_load_030100(), global_worklist_load(), load_action_ui_name(), load_cma_preset(), load_install_info_list(), load_nation_names(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_game(), load_ruleset_nations(), load_ruleset_styles(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_tech_names(), load_terrain_names(), load_unit_names(), lookup_building(), lookup_cbonus_list(), lookup_government(), lookup_req_list(), lookup_tech(), lookup_unit_type(), luascript_vars_load(), parse_metaserver_data(), scan_specfile(), script_client_code_load(), script_server_code_load(), settings_game_load(), settings_ruleset(), sg_load_game(), sg_load_map_owner(), sg_load_map_tiles(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_vision_city(), sg_load_ruledata(), sg_load_ruleset(), sg_load_savefile(), sg_load_scenario(), sg_load_treaties(), page_load::slot_selection_changed(), tileset_read_toplevel(), tileset_setup_options(), page_scenario::update_scenarios_page(), and worklist_load().
| const char** secfile_lookup_str_vec | ( | const struct section_file * | secfile, |
| size_t * | dim, | ||
| const char * | path, | ||
| ... | |||
| ) |
Lookup a string vector in the secfile.
Returns nullptr on error. This vector is not owned by the registry module, and should be free by the user, but the string pointers stored inside the vector shouldn't be free.
Definition at line 2074 of file registry_ini.cpp.
Referenced by boot_help_texts(), load_city_name_list(), load_ruleset_buildings(), load_ruleset_game(), load_ruleset_nations(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_ruleset_veteran(), lookup_building_list(), lookup_strvec(), lookup_tech_list(), lookup_unit_list(), scan_specfile(), sg_load_player_main(), sg_load_savefile(), and tileset_read_toplevel().
| const char* secfile_name | ( | const struct section_file * | secfile | ) |
Return the filename the section file was loaded as, or "(anonymous)" if this sectionfile was created rather than loaded from file.
The memory is managed internally, and should not be altered, nor used after secfile_destroy() called for the section file.
Definition at line 886 of file registry_ini.cpp.
Referenced by load_building_names(), load_city_name_list(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_nations(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_ruleset_veteran(), load_style_names(), load_tech_names(), load_terrain_names(), load_unit_names(), lookup_cbonus_list(), lookup_req_list(), lookup_terrain(), ruleset_load_names(), secfile_log(), and settings_ruleset().
| bool secfile_save | ( | const struct section_file * | secfile, |
| QString | filename | ||
| ) |
Save the previously filled in section_file to disk.
There is now limited ability to save in the new tabular format (to give smaller savefiles). The start of a table is detected by an entry with name of the form: (alphabetical_component)(zero)(period)(alphanumeric_component) Eg: u0.id, or c0.id, in the freeciv savefile. The alphabetical component is taken as the "name" of the table, and the component after the period as the first column name. This should be followed by the other column values for u0, and then subsequent u1, u2, etc, in strict order with no omissions, and with all of the columns for all uN in the same order as for u0.
Definition at line 614 of file registry_ini.cpp.
Referenced by options_save(), save_luadata(), save_ruleset_file(), save_thread_run(), and send_client_wants_hack().
| struct section* secfile_section_by_name | ( | const struct section_file * | secfile, |
| const QString & | name | ||
| ) |
Returns the first section matching the name.
Definition at line 2613 of file registry_ini.cpp.
Referenced by compat_load_020400(), fcdb_load_config(), options_dialogs_load(), secfile_entry_by_path(), secfile_from_input_file(), secfile_insert_base(), secfile_insert_include(), secfile_insert_long_comment(), secfile_section_lookup(), secfile_section_new(), settable_options_load(), and settings_ruleset().
| struct section* secfile_section_lookup | ( | const struct section_file * | secfile, |
| const char * | path, | ||
| ... | |||
| ) |
Find a section by path.
Definition at line 2632 of file registry_ini.cpp.
Referenced by compat_load_020400(), compat_load_020600(), compat_load_030000(), compat_load_030100(), insert_server_side_agent(), sg_load_players_basic(), and sg_load_scenario().
| struct section* secfile_section_new | ( | struct section_file * | secfile, |
| const QString & | name | ||
| ) |
Create a new section in the secfile.
Definition at line 2694 of file registry_ini.cpp.
Referenced by secfile_from_input_file(), secfile_insert_base(), secfile_insert_include(), and secfile_insert_long_comment().
| const struct section_list* secfile_sections | ( | const struct section_file * | secfile | ) |
Returns the list of sections.
This list is owned by the registry module and shouldn't be modified and destroyed.
Definition at line 2652 of file registry_ini.cpp.
Referenced by secfile_check_unused().
| struct section_list* secfile_sections_by_name_prefix | ( | const struct section_file * | secfile, |
| const char * | prefix | ||
| ) |
Returns the list of sections which match the name prefix.
Returns nullptr if no section was found. This list is not owned by the registry module and the user must destroy it when he finished to work with it.
Definition at line 2663 of file registry_ini.cpp.
Referenced by boot_help_texts(), load_building_names(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_nations(), load_ruleset_styles(), load_ruleset_techs(), load_ruleset_units(), load_style_names(), load_tech_names(), load_terrain_names(), load_unit_names(), scan_specfile(), tileset_read_toplevel(), and tileset_setup_options().
| void section_clear_all | ( | struct section * | psection | ) |
Remove all entries.
Definition at line 2766 of file registry_ini.cpp.
Referenced by section_destroy().
| void section_destroy | ( | struct section * | psection | ) |
Remove this section from the secfile.
Definition at line 2739 of file registry_ini.cpp.
Referenced by secfile_new().
| const struct entry_list* section_entries | ( | const struct section * | psection | ) |
Returns a list containing all the entries.
This list is owned by the secfile, so don't modify or destroy it.
Definition at line 2784 of file registry_ini.cpp.
Referenced by compat_load_020400(), fcdb_load_config(), options_dialogs_load(), secfile_check_unused(), secfile_from_input_file(), secfile_save(), and settable_options_load().
| struct entry* section_entry_bool_new | ( | struct section * | psection, |
| const QString & | name, | ||
| bool | value | ||
| ) |
Returns a new entry of type ENTRY_BOOL.
Definition at line 2876 of file registry_ini.cpp.
Referenced by entry_from_token(), and secfile_insert_bool_full().
Returns the first entry matching the name.
Definition at line 2792 of file registry_ini.cpp.
Referenced by entry_new(), entry_set_name(), load_ruleset_units(), secfile_entry_by_path(), secfile_insert_bitwise_enum_full(), secfile_insert_bool_full(), secfile_insert_enum_data_full(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_plain_enum_full(), and secfile_insert_str_full().
|
static |
Returns a new entry of type ENTRY_FILEREFERENCE.
Definition at line 2929 of file registry_ini.cpp.
Referenced by secfile_insert_filereference().
| struct entry* section_entry_float_new | ( | struct section * | psection, |
| const QString & | name, | ||
| float | value | ||
| ) |
Returns a new entry of type ENTRY_FLOAT.
Definition at line 2892 of file registry_ini.cpp.
Referenced by entry_from_token(), and secfile_insert_float_full().
Returns a new entry of type ENTRY_INT.
Definition at line 2860 of file registry_ini.cpp.
Referenced by entry_from_token(), and secfile_insert_int_full().
| struct entry* section_entry_str_new | ( | struct section * | psection, |
| const QString & | name, | ||
| const QString & | value, | ||
| bool | escaped | ||
| ) |
Returns a new entry of type ENTRY_STR.
Definition at line 2908 of file registry_ini.cpp.
Referenced by entry_from_token(), secfile_insert_bitwise_enum_full(), secfile_insert_enum_data_full(), secfile_insert_plain_enum_full(), and secfile_insert_str_full().