Medical Imaging Interaction Toolkit  2024.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkQuestionWithOptions.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 mitkQuestionWithOptions_h
14 #define mitkQuestionWithOptions_h
15 
16 #include <mitkQuestion.h>
17 #include <set>
18 
19 namespace mitk::Forms
20 {
29  {
30  public:
31  ~QuestionWithOptions() override;
32 
33  std::vector<std::string> GetResponsesAsStrings() const override;
34  void ClearResponses() override;
35 
36  bool IsComplete() const override;
37 
44  size_t AddOption(const std::string& option);
45 
46  std::vector<std::string> GetOptions() const;
47 
48  protected:
55  void AddResponse(size_t i);
56 
61  void RemoveResponse(size_t i);
62 
67  virtual void SetResponse(size_t i);
68 
69  private:
70  std::vector<std::string> m_Options;
71  std::set<size_t> m_Responses;
72  };
73 
74  MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json& j, QuestionWithOptions& q);
75  MITKFORMS_EXPORT void to_json(nlohmann::ordered_json& j, const QuestionWithOptions& q);
76 }
77 
78 #endif
mitkQuestion.h
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)
mitk::Forms::Question
Abstract base class for all types of questions used in a Form.
Definition: mitkQuestion.h:31
MITKFORMS_EXPORT
#define MITKFORMS_EXPORT
Definition: MitkFormsExports.h:15