NDEVR
API Documentation
GenericOption

Stores a generic option of any type as well as some information about how the user might interact with that type. More...

Collaboration diagram for GenericOption:
[legend]

Public Member Functions

 GenericOption ()
 Constructs a default GenericOption with no values set.
 GenericOption (const GenericOption &option)
 Copy constructor.
 GenericOption (const StringView &id, const TranslatedString &name, const StringView &value)
 Constructs a GenericOption with the given identifier, display name, and string value.
template<class t_type>
 GenericOption (const StringView &id, const TranslatedString &name, const t_type &value)
 Constructs a GenericOption with the given identifier, display name, and typed value.
template<class t_type>
t_type getAs () const
 Retrieves the current value converted to the requested type.
bool operator!= (const GenericOption &option) const
 Checks inequality by comparing the current string values of two options.
GenericOptionoperator= (const GenericOption &option)
 Copy assignment operator.
bool operator== (const GenericOption &option) const
 Checks equality by comparing the current string values of two options.
void set (const String &new_value)
 Sets the option value from a String.
void set (const StringView &new_value)
 Sets the option value from a StringView.
template<class t_type>
void set (const t_type &new_value)
 Sets the option value from the given typed value by converting it to a String.
void setToDefault ()
 Resets the option value back to its default.
void setupForDelimiter ()
 Sets this option up for being a delimiter, commas, tabs, etc or custom.
void setupForFile (const StringView &extensions=StringView())
 Sets this option up for being a file, including the regax and extension.
void setupForFolder ()
 Sets this option up for being a folder, including the regax and extension.

Public Attributes

bool allow_custom_option = false
 Whether the user may enter a custom value outside the predefined choices.
bool allow_multi_line = false
 Whether the option value supports multi-line text input.
Buffer< std::pair< TranslatedString, StringAllocatingView > > available_options
 The set of predefined choices available for this option.
String default_value
 The default value to revert to when resetting the option.
TranslatedString description
 A user-facing description of what this option controls.
String file_extensions
 Allowed file extensions for file-type options. If blank, the option is not a file.
String icon
 The icon name associated with this option for display purposes.
String id
 A unique identifier string for this option.
bool is_create_file = false
 Whether this option represents a file path for creating a new file.
bool is_editable = true
 Whether the user is allowed to edit this option.
bool is_password = false
 Whether this option represents a password and should be masked.
bool is_viewable = true
 Whether this option is visible in the user interface.
TranslatedString name
 The user-facing display name of the option.
TypeInfo parameter_type
 The type information describing the underlying data type of this option.
String password_encode_key
 The key used for password encoding when this option is a password.
String regex
 A regular expression used to validate the option value.
bool show_resolved_links = false
 Whether to display resolved link paths instead of raw values.
ConstPointer< Unitunit
 The unit of measurement associated with this option value.
Resource< Stringvalue
 The current value of the option stored as a string Resource.
Bounds< 1, fltp08value_bounds = Constant<Bounds<1, fltp08>>::Invalid
 The numeric bounds constraining valid values for this option.

Detailed Description

Stores a generic option of any type as well as some information about how the user might interact with that type.


Definition at line 57 of file GenericOptions.h.

Constructor & Destructor Documentation

◆ GenericOption() [1/3]

GenericOption::GenericOption ( const StringView & id,
const TranslatedString & name,
const StringView & value )

Constructs a GenericOption with the given identifier, display name, and string value.

Parameters
[in]idThe unique identifier for this option.
[in]nameThe user-facing display name.
[in]valueThe initial string value of the option.

References name, and value.

◆ GenericOption() [2/3]

template<class t_type>
GenericOption::GenericOption ( const StringView & id,
const TranslatedString & name,
const t_type & value )
inline

Constructs a GenericOption with the given identifier, display name, and typed value.

Parameters
[in]idThe unique identifier for this option.
[in]nameThe user-facing display name.
[in]valueThe initial value, which is converted to a String for storage.

Definition at line 97 of file GenericOptions.h.

References default_value, GetTypeInfo(), id, name, parameter_type, and value.

◆ GenericOption() [3/3]

GenericOption::GenericOption ( const GenericOption & option)

Copy constructor.

Creates a GenericOption by copying another.

Parameters
[in]optionThe GenericOption to copy from.

References GenericOption().

Member Function Documentation

◆ getAs()

template<class t_type>
t_type GenericOption::getAs ( ) const
inlinenodiscard

Retrieves the current value converted to the requested type.

Returns
The current value converted to t_type.

Definition at line 114 of file GenericOptions.h.

References value.

◆ operator!=()

bool GenericOption::operator!= ( const GenericOption & option) const
inline

Checks inequality by comparing the current string values of two options.

Parameters
[in]optionThe GenericOption to compare against.
Returns
True if the options have different current values.

Definition at line 186 of file GenericOptions.h.

References GenericOption(), and value.

◆ operator=()

GenericOption & GenericOption::operator= ( const GenericOption & option)

Copy assignment operator.

Parameters
[in]optionThe GenericOption to copy from.
Returns
A reference to this GenericOption after assignment.

References GenericOption().

◆ operator==()

bool GenericOption::operator== ( const GenericOption & option) const
inline

Checks equality by comparing the current string values of two options.

Parameters
[in]optionThe GenericOption to compare against.
Returns
True if both options have the same current value.

Definition at line 177 of file GenericOptions.h.

References GenericOption(), and value.

◆ set() [1/3]

void GenericOption::set ( const String & new_value)
inline

Sets the option value from a String.

Parameters
[in]new_valueThe new string value to set.

Definition at line 139 of file GenericOptions.h.

References value.

◆ set() [2/3]

void GenericOption::set ( const StringView & new_value)
inline

Sets the option value from a StringView.

Parameters
[in]new_valueThe new string value to set.

Definition at line 131 of file GenericOptions.h.

References value.

◆ set() [3/3]

template<class t_type>
void GenericOption::set ( const t_type & new_value)
inline

Sets the option value from the given typed value by converting it to a String.

Parameters
[in]new_valueThe new value to set.

Definition at line 123 of file GenericOptions.h.

References value.

◆ setupForFile()

void GenericOption::setupForFile ( const StringView & extensions = StringView())

Sets this option up for being a file, including the regax and extension.

Parameters
[in]extensionsand extensions, seperated by a comma, for example .wav or .wav,.frag

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