Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitk::Forms::TextQuestion Class Reference

#include <mitkTextQuestion.h>

Inheritance diagram for mitk::Forms::TextQuestion:
Collaboration diagram for mitk::Forms::TextQuestion:

Public Member Functions

 ~TextQuestion () override
 
std::vector< std::string > GetResponsesAsStrings () const override
 Return the question's response(s) as strings. More...
 
void ClearResponses () override
 Clear the/all response(s). More...
 
bool IsComplete () const override
 Check if a question is considered to be answered completely. More...
 
std::string GetResponse () const
 
void SetResponse (const std::string &response)
 
- Public Member Functions inherited from mitk::Forms::Question
 Question ()
 
virtual ~Question ()
 
std::string GetQuestionText () const
 Get the literal question. More...
 
void SetQuestionText (const std::string &question)
 Set the literal question. More...
 
bool IsRequired () const
 Check whether a response to this question is required to complete a form. More...
 
void SetRequired (bool required=true)
 Set whether a resonse to this question is required to complete a form. More...
 
virtual std::string GetRequiredText () const
 Get the text that should be displayed to clearly mark a question as required. More...
 
virtual bool HasFileResponses () const
 Query whether the responses given to this question are file paths. More...
 
virtual std::vector< fs::path > SubmitFileResponses (const fs::path &basePath) const
 Attach response files to submission. More...
 
virtual std::string GetType () const =0
 Return the type of a question as string, e.g. "Multiple choice" or "Drop-down". More...
 
virtual QuestionCreateAnother () const =0
 Create a new instance of the derived question class type. More...
 
virtual void FromJSON (const nlohmann::ordered_json &j)=0
 Deserialize from JSON. More...
 
virtual void ToJSON (nlohmann::ordered_json &j) const =0
 Serialize to JSON. More...
 

Detailed Description

Definition at line 20 of file mitkTextQuestion.h.

Constructor & Destructor Documentation

◆ ~TextQuestion()

mitk::Forms::TextQuestion::~TextQuestion ( )
override

Member Function Documentation

◆ ClearResponses()

void mitk::Forms::TextQuestion::ClearResponses ( )
overridevirtual

Clear the/all response(s).

Implements mitk::Forms::Question.

◆ GetResponse()

std::string mitk::Forms::TextQuestion::GetResponse ( ) const

◆ GetResponsesAsStrings()

std::vector<std::string> mitk::Forms::TextQuestion::GetResponsesAsStrings ( ) const
overridevirtual

Return the question's response(s) as strings.

This is the single common generic interface for retrieving responses from all types of questions. It is typically used to store responses in text-based formats like CSV.

It is implemented as vector since certain types of questions like a checkboxes question may support multiple responses. Otherwise, return a vector with a single element.

std::vector<std::string> RhetoricalQuestion::GetResponsesAsStrings() const
{
return { m_Response };
}

Implements mitk::Forms::Question.

◆ IsComplete()

bool mitk::Forms::TextQuestion::IsComplete ( ) const
overridevirtual

Check if a question is considered to be answered completely.

This method is typically called when IsRequired() returns true to determine whether the requirements are fulfilled.

Implements mitk::Forms::Question.

◆ SetResponse()

void mitk::Forms::TextQuestion::SetResponse ( const std::string &  response)

The documentation for this class was generated from the following file: