A form consisting of questions possibly divided into multiple sections/pages.
More...
|
| | Form (const std::string &title="", const std::string &description="") |
| | Construct a form with an optional title and description for its first section. More...
|
| |
| | ~Form () |
| | Destructor. More...
|
| |
| | Form (Form &&other) noexcept |
| | Move constructor. More...
|
| |
| Form & | operator= (Form &&other) noexcept |
| | Move assignment operator. More...
|
| |
| Section & | AddSection (const std::string &title="", const std::string &description="") |
| | Add a new section to the form. More...
|
| |
| int | GetNumberOfSections () const |
| | Get the total number of sections in this form. More...
|
| |
| Section & | GetSection (int index) |
| | Get a section by its index. More...
|
| |
| const Section & | GetSection (int index) const |
| | Get a section by its index (const overload). More...
|
| |
| std::string | GetTitle () const |
| | Convenience method to get the title of the first section (the form title). More...
|
| |
| void | SetTitle (const std::string &title) |
| | Convenience method to set the title of the first section (the form title). More...
|
| |
| std::string | GetDescription () const |
| | Convenience method to get the description of the first section (the form description). More...
|
| |
| void | SetDescription (const std::string &description) |
| | Convenience method to set the description of the first section (the form description). More...
|
| |
| std::vector< Question * > | GetQuestions () const |
| | Convenience method to get all questions from the first section. More...
|
| |
| void | AddQuestion (Question *question) |
| | Convenience method to add a question to the first section. More...
|
| |
| void | AddSupplement (const std::string &key) |
| | Add extra data that is submitted together with the responses. More...
|
| |
| bool | SetSupplement (const std::string &key, const std::string &value) |
| | Set the value of a certain existing supplement. More...
|
| |
| const std::map< std::string, std::string > & | GetSupplements () const |
| | Get all supplements as a key-value map. More...
|
| |
| std::vector< Section >::const_iterator | begin () const |
| | Get a const iterator to the first section (for range-based for loops). More...
|
| |
| std::vector< Section >::const_iterator | end () const |
| | Get a const iterator past the last section (for range-based for loops). More...
|
| |
| std::vector< Section >::iterator | begin () |
| | Get an iterator to the first section (for range-based for loops). More...
|
| |
| std::vector< Section >::iterator | end () |
| | Get an iterator past the last section (for range-based for loops). More...
|
| |
A form consisting of questions possibly divided into multiple sections/pages.
A form always has at least a single section, which is also used to define the form's general title and description. Helper methods like SetTitle() or SetDescription() can be used to conveniently set these properties of the first section.
Forms can be serialized to and deserialized from JSON and submitted to CSV files.
- See also
- Question, SubmitToCSV()
Definition at line 40 of file mitkForm.h.
| void mitk::Forms::Form::AddSupplement |
( |
const std::string & |
key | ) |
|
Add extra data that is submitted together with the responses.
Supplements are a rudimentary and delicate feature to add extra data to submissions, i.e., extra columns for CSV submissions.
Supplements are key-value pairs supposed to be completely set up before the first submission. Afterwards, do not add any new supplements. Values of existing supplements can be safely modified, though.
If a supplement with the given key already exists, the call has no effect.
- Parameters
-
| [in] | key | The key (column header) for the supplement. |
- Note
- Do not add new supplements after the first submission.
-
Submissions do not clear any supplements or their values.