Describes a single file.
Its JSON serialization contains the following:
Instances and minimal complete definitions | |
| struct | id |
| File identifier: More... | |
File fields | |
These functions allow setting the fields of a file for reading and writing If an operation has to be performed right before writing a file (such as computing something and storing it in a temporary buffer) these can be specified on the "before_write" function arguments. | |
| bool | has_field (string const &field_name) const |
| bool | has_subfield (string const &field_name, string const &subfield_name) const |
| template<typename T > | |
| file & | field (string const &field_name, T value) |
Adds field named field_name of constant value: | |
| template<typename T > | |
| bool | validate_array_field_in_file (string const &field_name, T *begin, T *end) const |
| Validates an array field present in the file: More... | |
| template<typename T > | |
| file & | field (string const &field_name, T *begin, T *end, std::function< void()> before_write=[](){}) |
Add an array [begin, end) named field_name to the file. | |
| template<typename T > | |
| file & | field (string const &field_name, T const &array, array_data_t) |
Add an array [data(array), data(array) + size) named field_name to the file. | |
| template<typename T > | |
| file & | field (string const &field_name, T *data, std::size_t size) |
Add an array [data, data + size) named field_name to the file. | |
Public Member Functions | |
| bool | has_dependency () const |
| Does the file have a dependency? | |
| string | name () const |
| File name. | |
| string | path () const |
| Full file path. | |
| string const & | group_name () const |
| Group name of the file. | |
| index_t | index () const |
| File index. | |
| void | index (index_t i) |
| Set file index. | |
| string | dependency_name () const |
| File name. | |
| string | dependency_path () const |
| Full file path. | |
| string const & | dependency_group_name () const |
| Group name of the file. | |
| index_t | dependency_index () const |
| Dependency file index. | |
| void | dependency_group_name (string const &g) |
| Dependency group name. | |
| void | dependency_index (index_t i) |
| Set dependency file index. | |
| file (string const &group_name, index_t index=index_t{}) | |
| Creates a file without a dependency. | |
| file (const char *group_name) | |
| Creates a file without a dependency. | |
| file (io::json header) | |
| Serialize from json header. | |
| bool hm3::io::file::validate_array_field_in_file | ( | string const & | field_name, |
| T * | begin, | ||
| T * | end | ||
| ) | const |
Validates an array field present in the file:
References name().