OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::Variant Class Reference

#include <Variant.hpp>

Public Member Functions

bool isTrueish () const
 
bool valueAsBoolean () const
 get value as a bool
 
double valueAsDouble () const
 get value as double
 
int valueAsInteger () const
 get value as int
 
Json::Value valueAsJSON () const
 
std::string valueAsString () const
 get value as string
 
 Variant ()
 constructors
 
 Variant (bool value)
 
 Variant (const char *value)
 
 Variant (const std::string &value)
 
 Variant (double value)
 
 Variant (int value)
 
VariantType variantType () const
 get the variant value type
 

Related Symbols

(Note that these are not member symbols.)

using OptionalVariant = std::optional<Variant>
 
using VariantVector = std::vector<Variant>
 

Detailed Description

A Variant is a flexible type that can hold several types of values.

Constructor & Destructor Documentation

◆ Variant() [1/6]

openstudio::Variant::Variant ( )
explicit

constructors

◆ Variant() [2/6]

openstudio::Variant::Variant ( bool value)
explicit

◆ Variant() [3/6]

openstudio::Variant::Variant ( double value)
explicit

◆ Variant() [4/6]

openstudio::Variant::Variant ( int value)
explicit

◆ Variant() [5/6]

openstudio::Variant::Variant ( const char * value)
explicit

◆ Variant() [6/6]

openstudio::Variant::Variant ( const std::string & value)
explicit

Member Function Documentation

◆ isTrueish()

bool openstudio::Variant::isTrueish ( ) const

◆ valueAsBoolean()

bool openstudio::Variant::valueAsBoolean ( ) const

get value as a bool

◆ valueAsDouble()

double openstudio::Variant::valueAsDouble ( ) const

get value as double

◆ valueAsInteger()

int openstudio::Variant::valueAsInteger ( ) const

get value as int

◆ valueAsJSON()

Json::Value openstudio::Variant::valueAsJSON ( ) const

◆ valueAsString()

std::string openstudio::Variant::valueAsString ( ) const

get value as string

◆ variantType()

VariantType openstudio::Variant::variantType ( ) const

get the variant value type

Friends And Related Symbol Documentation

◆ OptionalVariant

using OptionalVariant = std::optional<Variant>
related

◆ VariantVector

using VariantVector = std::vector<Variant>
related