Skip to main content
Version: 🚧 Nightly

Class f3d::options

Definition: options.h (line 31)

Class used to control the different options.

A class to control the different options of f3d.

Inner classes

Members

Constructors

Function options

f3d::options::options()

Default/Copy/move constructors/operators.

Return type:

Function ~options

f3d::options::~options()

Default/Copy/move constructors/operators.

Return type:

Function options

f3d::options::options(const options &opt)

Default/Copy/move constructors/operators.

Parameters:

Return type:

Function operator=

options & f3d::options::operator=(const options &opt)

Default/Copy/move constructors/operators.

Parameters:

Return type: options &

Function options

f3d::options::options(options &&other) noexcept

Default/Copy/move constructors/operators.

Parameters:

Return type:

Function operator=

options & f3d::options::operator=(options &&other) noexcept

Default/Copy/move constructors/operators.

Parameters:

Return type: options &

Public attributes

Variable domain_style

Definition: options.h (line 39)

enum F3D_EXPORT f3d::options::domain_style

Enum class used by options::hasDomain to provide information about the style of domain being used for a specific option

Type: enum F3D_EXPORT

Variable ENUM

Definition: options.h (line 42)

enum F3D_EXPORT f3d::options::ENUM = 2

Type: enum F3D_EXPORT

Variable INDEX

Definition: options.h (line 43)

enum F3D_EXPORT f3d::options::INDEX = 3

Type: enum F3D_EXPORT

Variable option_type

Definition: options.h (line 49)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::option_type

Enumeration of the possible types of an option.

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable INT

Definition: options.h (line 52)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::INT

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable DOUBLE

Definition: options.h (line 53)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::DOUBLE

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable RATIO

Definition: options.h (line 54)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::RATIO

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable STRING

Definition: options.h (line 55)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::STRING

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable PATH

Definition: options.h (line 56)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::PATH

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable COLOR

Definition: options.h (line 57)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::COLOR

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable DIRECTION

Definition: options.h (line 58)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::DIRECTION

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable COLORMAP

Definition: options.h (line 59)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::COLORMAP

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable TRANSFORM2D

Definition: options.h (line 60)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::TRANSFORM2D

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable DOUBLE_VECTOR

Definition: options.h (line 61)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::DOUBLE_VECTOR

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable INT_VECTOR

Definition: options.h (line 62)

enum F3D_EXPORT enum F3D_EXPORT f3d::options::INT_VECTOR

Type: enum F3D_EXPORT enum F3D_EXPORT

Variable interactor

Definition: options.h (line 346)

struct f3d::options::interactor f3d::options::interactor

Type: struct f3d::options::interactor

Variable model

Definition: options.h (line 409)

struct f3d::options::model f3d::options::model

Type: struct f3d::options::model

Variable render

Definition: options.h (line 473)

struct f3d::options::render f3d::options::render

Type: struct f3d::options::render

Variable scene

Definition: options.h (line 490)

struct f3d::options::scene f3d::options::scene

Type: struct f3d::options::scene

Variable ui

Definition: options.h (line 534)

struct f3d::options::ui f3d::options::ui

Type: struct f3d::options::ui

Variable domains

Definition: options.h (line 661)

struct f3d::options::domains f3d::options::domains

Type: struct f3d::options::domains

Public functions

Function set

options & f3d::options::set(std::string_view name, const option_variant_t &value)

Set an option as a variant based on its name Please note that, on Windows, using an explicit std::string may be required: https://stackoverflow.com/questions/60681710/prefer-stdstring-in-stdvariantbool-stdstring-for-const-char

Throws an options::inexistent_exception if option does not exist. Throws an options::incompatible_exception if value is not compatible with option.

Parameters:

  • std::string_view name
  • const option_variant_t & value

Return type: options &

Function get

option_variant_t f3d::options::get(std::string_view name) const

Get an option as a variant based on its name

Throws an options::inexistent_exception if option does not exist. Throws an options::no_value_exception if option has not been set.

Parameters:

  • std::string_view name

Return type: option_variant_t

Function setAsString

options & f3d::options::setAsString(std::string_view name, const std::string &str)

Set an option as a string based on its name Use dedicated parsing code, see the related doc in PARSING.md.

Throws an options::inexistent_exception if option does not exist. Throws an options::parsing_exception if parsing failed.

Parameters:

  • std::string_view name
  • const std::string & str

Return type: options &

Function getAsString

std::string f3d::options::getAsString(std::string_view name) const

Get an option as a string based on its name

Throws an options::inexistent_exception if option does not exist. Throws an options::no_value_exception if option has not been set.

Parameters:

  • std::string_view name

Return type: std::string

Function toggle

options & f3d::options::toggle(std::string_view name)

A boolean option specific method to toggle it. If the option has not been set yet, set it to true.

Throws an options::inexistent_exception if option does not exist. Throws an options::incompatible_exception if option is not boolean.

Parameters:

  • std::string_view name

Return type: options &

Function isSame

bool f3d::options::isSame(const options &other, std::string_view name) const

Compare an option between this and a provided other. Return true if they are the same value, false otherwise.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • const options & other
  • std::string_view name

Return type: bool

Function hasValue

bool f3d::options::hasValue(std::string_view name) const

Return true if an option has a value, false otherwise Always returns true for non-optional options.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: bool

Function copy

options & f3d::options::copy(const options &other, std::string_view name)

Copy the value of an option from this to the provided other.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • const options & other
  • std::string_view name

Return type: options &

Function getNames

std::vector< std::string > f3d::options::getNames() const

Get all option names that currently have values.

Return type: std::vector< std::string >

Function getType

option_type f3d::options::getType(std::string_view name) const

Get the type of an option based on its name.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: option_type

Function getClosestOption

std::pair< std::string, unsigned int > f3d::options::getClosestOption(std::string_view option) const

Get the closest option name and its Levenshtein distance.

Parameters:

  • std::string_view option

Return type: std::pair< std::string, unsigned int >

Function isOptional

bool f3d::options::isOptional(std::string_view option) const

Returns true if the option is optional else returns false.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view option

Return type: bool

Function reset

options & f3d::options::reset(std::string_view name)

Resets the option to default value.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: options &

Function removeValue

options & f3d::options::removeValue(std::string_view name)

Unset the option if it is optional else throws options::incompatible_exception.

Throws an options::inexistent_exception if option does not exist. Throws an options::incompatible_exception if option is not an optional.

Parameters:

  • std::string_view name

Return type: options &

Function hasDomain

bool f3d::options::hasDomain(std::string_view name) const

Return true if an option has a domain, false otherwise. Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: bool

Function getDomainStyle

domain_style f3d::options::getDomainStyle(std::string_view name) const

Return the domain_style of provided option Throw options::incompatible_exception if option doesn't have an enumeration domain. Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: domain_style

Function getEnumDomain

std::vector< std::string > f3d::options::getEnumDomain(std::string_view name) const

Return a the enumeration of the enum domain of provided option. The enumeration is provided as is in string form. Throw options::incompatible_exception if option doesn't have an enumeration domain. Throws an options::inexistent_exception if option does not exist. Note: The is no string API to recover a range or index domain yet.

Parameters:

  • std::string_view name

Return type: std::vector< std::string >

Function getRangeDomain

DomainRange< option_variant_t > f3d::options::getRangeDomain(std::string_view name) const

Return the range domain of provided option as a DomainRange<option_variant_t>. Its min, max and increment each hold a variant version of the domain corresponding to the option type. Throw options::incompatible_exception if option doesn't have a range domain. Throws an options::inexistent_exception if option does not exist. Note: There is no variant API to recover an enum or index domain yet.

Parameters:

  • std::string_view name

Return type: DomainRange< option_variant_t >

Function increase

options & f3d::options::increase(std::string_view name)

Increase an option value if it has a range or index domain, else throws options::incompatible_exception. Increasing above the max is capped at the maximum. Increasing an optional option without a value set it to the domain minimum.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: options &

Function decrease

options & f3d::options::decrease(std::string_view name)

Decrease an option value if it has a range or index domain, else throws options::incompatible_exception. Decreasing below the min is capped at the minimum. Decreasing an optional option without a value set it to the domain maximum.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: options &

Function cycle

options & f3d::options::cycle(std::string_view name)

Cycle an option value if it has an enumeration or index domain, else throws options::incompatible_exception. Loops over the beginning of the enumeration domain when reaching the end. Cycling an optional option with a value set it to the first in the enumeration domain. Looping an optional option removes the value.

Throws an options::inexistent_exception if option does not exist.

Parameters:

  • std::string_view name

Return type: options &

Public static functions

Function getAllNames

static std::vector< std::string > f3d::options::getAllNames()

Get all available option names.

Return type: std::vector< std::string >

Function parse

static T f3d::options::parse(const std::string &str)

Templated parsing method used internally to parse strings. Implemented for the different supported types, see PARSING.md for more info.

Throws an options::parsing_exception if parsing failed.

Parameters:

  • const std::string & str

Return type: T

Function format

static std::string f3d::options::format(const T &var)

Templated parsing method used internally to format var into strings. Implemented for the different supported types,

see PARSING.md for more info.

Parameters:

  • const T & var

Return type: std::string