An object to describe a Model.
More...
#include <constraints.h>
An object to describe a Model.
A model will contain a table basic_text -> {field: Field, required: bool}
◆ add_field()
void garlic::Model::add_field |
( |
text && |
name, |
|
|
field_pointer |
field, |
|
|
bool |
required = true |
|
) |
| |
|
inline |
Add a new field.
- Parameters
-
name | the name/key of the member. |
field | std::shared_ptr<Field> |
required | whether or not this field is required. |
- Note
- If a member by such name already exists, this function will not do anything.
◆ annotations() [1/2]
const auto& garlic::Model::annotations |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- the model's annotations map.
◆ annotations() [2/2]
auto& garlic::Model::annotations |
( |
| ) |
|
|
inlinenoexcept |
- Returns
- the model's annotations map.
◆ begin_fields()
const_field_iterator garlic::Model::begin_fields |
( |
| ) |
const |
|
inlinenoexcept |
◆ end_fields()
const_field_iterator garlic::Model::end_fields |
( |
| ) |
const |
|
inlinenoexcept |
◆ find_field()
const_field_iterator garlic::Model::find_field |
( |
const text & |
name | ) |
const |
|
inlinenoexcept |
◆ get_field()
template<typename KeyType >
field_pointer garlic::Model::get_field |
( |
KeyType && |
name | ) |
const |
|
inline |
- Returns
- a shared pointer to the Field instance or nullptr if such key is not defined yet.
◆ name()
const text& garlic::Model::name |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- name of the Model.
The documentation for this class was generated from the following file: