Medical Imaging Interaction Toolkit  2024.06.99-ccaff7ce
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 
17 #include <optional>
18 
19 namespace mitk::Forms
20 {
32  {
33  public:
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
mitk::Forms::QuestionWithOtherOption
Base class for questions with options that may also have a free text option.
Definition: mitkQuestionWithOtherOption.h:31
mitk::Forms::QuestionWithOptions
Base class for questions with options to choose from as response.
Definition: mitkQuestionWithOptions.h:28
mitk::Forms::to_json
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
mitk::Forms
Definition: mitkCheckboxesQuestion.h:18
mitk::Forms::from_json
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
mitkQuestionWithOptions.h
MITKFORMS_EXPORT
#define MITKFORMS_EXPORT
Definition: MitkFormsExports.h:15