Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
mitkQuestionWithOtherOption.h
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#ifndef mitkQuestionWithOtherOption_h
14
#define mitkQuestionWithOtherOption_h
15
16
#include <
mitkQuestionWithOptions.h
>
17
#include <optional>
18
19
namespace
mitk::Forms
20
{
31
class
MITKFORMS_EXPORT
QuestionWithOtherOption
:
public
QuestionWithOptions
32
{
33
public
:
38
QuestionWithOtherOption
();
39
42
~QuestionWithOtherOption
()
override
;
43
49
std::vector<std::string>
GetResponsesAsStrings
()
const override
;
50
53
void
ClearResponses
()
override
;
54
59
bool
IsComplete
()
const override
;
60
65
bool
HasOtherOption
()
const
;
66
71
void
EnableOtherOption
();
72
73
protected
:
78
void
SetResponse
(
size_t
i)
override
;
79
90
void
AddOtherResponse
(
const
std::string& response);
91
94
void
RemoveOtherResponse
();
95
106
void
SetOtherResponse
(
const
std::string& response);
107
108
private
:
109
bool
m_HasOtherOption;
110
std::optional<std::string> m_OtherResponse;
111
};
112
123
MITKFORMS_EXPORT
void
from_json
(
const
nlohmann::ordered_json& j,
QuestionWithOtherOption
& q);
124
134
MITKFORMS_EXPORT
void
to_json
(nlohmann::ordered_json& j,
const
QuestionWithOtherOption
& q);
135
}
136
137
#endif
MITKFORMS_EXPORT
#define MITKFORMS_EXPORT
Definition:
MitkFormsExports.h:15
mitk::Forms::QuestionWithOptions
Base class for questions with options to choose from as response.
Definition:
mitkQuestionWithOptions.h:29
mitk::Forms::QuestionWithOtherOption
Base class for questions with options that may also have a free text option.
Definition:
mitkQuestionWithOtherOption.h:32
mitk::Forms::QuestionWithOtherOption::RemoveOtherResponse
void RemoveOtherResponse()
Remove the "Other" response from the list of already given responses.
mitk::Forms::QuestionWithOtherOption::IsComplete
bool IsComplete() const override
Check whether at least one response (regular or "Other") has been given.
mitk::Forms::QuestionWithOtherOption::SetOtherResponse
void SetOtherResponse(const std::string &response)
Set the "Other" response as single exclusive response to this question.
mitk::Forms::QuestionWithOtherOption::AddOtherResponse
void AddOtherResponse(const std::string &response)
Add the free text given as "Other" option to the list of responses.
mitk::Forms::QuestionWithOtherOption::ClearResponses
void ClearResponses() override
Clear all selected responses, including the "Other" response.
mitk::Forms::QuestionWithOtherOption::HasOtherOption
bool HasOtherOption() const
Query whether this question actually has an "Other" option.
mitk::Forms::QuestionWithOtherOption::SetResponse
void SetResponse(size_t i) override
Set a regular option as the single response and clear any "Other" response.
mitk::Forms::QuestionWithOtherOption::EnableOtherOption
void EnableOtherOption()
Switch on the "Other" option.
mitk::Forms::QuestionWithOtherOption::QuestionWithOtherOption
QuestionWithOtherOption()
Constructor.
mitk::Forms::QuestionWithOtherOption::~QuestionWithOtherOption
~QuestionWithOtherOption() override
Virtual destructor.
mitk::Forms::QuestionWithOtherOption::GetResponsesAsStrings
std::vector< std::string > GetResponsesAsStrings() const override
Return all selected responses as strings, including the "Other" response if set.
mitkQuestionWithOptions.h
mitk::Forms
Definition:
mitkCheckboxesQuestion.h:19
mitk::Forms::to_json
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
Serialize a CheckboxesQuestion to JSON.
mitk::Forms::from_json
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
Deserialize a CheckboxesQuestion from JSON.
src
MITK
Modules
Forms
include
mitkQuestionWithOtherOption.h
Generated by
1.9.1