Medical Imaging Interaction Toolkit
2025.12.02
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
:
34
QuestionWithOtherOption
();
35
~QuestionWithOtherOption
()
override
;
36
37
std::vector<std::string>
GetResponsesAsStrings
()
const override
;
38
void
ClearResponses
()
override
;
39
40
bool
IsComplete
()
const override
;
41
44
bool
HasOtherOption
()
const
;
45
50
void
EnableOtherOption
();
51
52
protected
:
53
void
SetResponse
(
size_t
i)
override
;
54
60
void
AddOtherResponse
(
const
std::string& response);
61
64
void
RemoveOtherResponse
();
65
68
void
SetOtherResponse
(
const
std::string& response);
69
70
private
:
71
bool
m_HasOtherOption;
72
std::optional<std::string> m_OtherResponse;
73
};
74
75
MITKFORMS_EXPORT
void
from_json
(
const
nlohmann::ordered_json& j,
QuestionWithOtherOption
& q);
76
MITKFORMS_EXPORT
void
to_json
(nlohmann::ordered_json& j,
const
QuestionWithOtherOption
& q);
77
}
78
79
#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 if a question is considered to be answered completely.
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 the/all response(s).
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 one of the possible answer options as the single response.
mitk::Forms::QuestionWithOtherOption::EnableOtherOption
void EnableOtherOption()
Switch on the "Other" option.
mitk::Forms::QuestionWithOtherOption::QuestionWithOtherOption
QuestionWithOtherOption()
mitk::Forms::QuestionWithOtherOption::~QuestionWithOtherOption
~QuestionWithOtherOption() override
mitk::Forms::QuestionWithOtherOption::GetResponsesAsStrings
std::vector< std::string > GetResponsesAsStrings() const override
Return the question's response(s) as strings.
mitkQuestionWithOptions.h
mitk::Forms
Definition:
mitkCheckboxesQuestion.h:19
mitk::Forms::to_json
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
mitk::Forms::from_json
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
src
MITK
Modules
Forms
include
mitkQuestionWithOtherOption.h
Generated on Mon Feb 23 2026 23:28:11 for Medical Imaging Interaction Toolkit by
1.9.1