bpmn++
A BPMN parser library, written in C++
XML::Value Struct Reference

A struct representing the value of an XML-node attribute. More...

Detailed Description

The Value struct stores a value and provides implicit conversion and assignment operators to facilitate easy conversion between different types and convenient assignment of values.

Example usage:

value = std::to_string("a_string"); // Assignment using a std::string.
value = true; // Assignment using a bool.
value = 42; // Assignment using an int.
value = 3.14; // Assignment using a double.
std::string stringValue = value; // Implicit conversion to std::string.
bool booleanValue = value; // Implicit conversion to bool.
int integerValue = value; // Implicit conversion to int.
double realValue = value; // Implicit conversion to double.
Value(const std::string &s)
Definition: XMLObject.h:59
std::string value
Definition: XMLObject.h:49

Definition at line 48 of file XMLObject.h.

#include <XMLObject.h>

Public Member Functions

 operator std::string_view () const
 
 operator std::string () const
 
 operator bool () const
 
 operator int () const
 
 operator double () const
 
Valueoperator= (const std::string &s)
 
Valueoperator= (bool b)
 
Valueoperator= (int i)
 
Valueoperator= (double d)
 
 Value (const std::string &s)
 
 Value (bool b)
 
 Value (int i)
 
 Value (double d)
 

Public Attributes

std::string value
 

Static Public Attributes

static std::string True = "true"
 
static std::string False = "false"
 

Constructor & Destructor Documentation

◆ Value() [1/4]

XML::Value::Value ( const std::string &  s)
inline

Definition at line 59 of file XMLObject.h.

◆ Value() [2/4]

XML::Value::Value ( bool  b)
inline

Definition at line 60 of file XMLObject.h.

◆ Value() [3/4]

XML::Value::Value ( int  i)
inline

Definition at line 61 of file XMLObject.h.

◆ Value() [4/4]

XML::Value::Value ( double  d)
inline

Definition at line 62 of file XMLObject.h.

Member Function Documentation

◆ operator bool()

XML::Value::operator bool ( ) const
inline

Definition at line 52 of file XMLObject.h.

◆ operator double()

XML::Value::operator double ( ) const
inline

Definition at line 54 of file XMLObject.h.

◆ operator int()

XML::Value::operator int ( ) const
inline

Definition at line 53 of file XMLObject.h.

◆ operator std::string()

XML::Value::operator std::string ( ) const
inline

Definition at line 51 of file XMLObject.h.

◆ operator std::string_view()

XML::Value::operator std::string_view ( ) const
inline

Definition at line 50 of file XMLObject.h.

◆ operator=() [1/4]

Value& XML::Value::operator= ( bool  b)
inline

Definition at line 56 of file XMLObject.h.

◆ operator=() [2/4]

Value& XML::Value::operator= ( const std::string &  s)
inline

Definition at line 55 of file XMLObject.h.

◆ operator=() [3/4]

Value& XML::Value::operator= ( double  d)
inline

Definition at line 58 of file XMLObject.h.

◆ operator=() [4/4]

Value& XML::Value::operator= ( int  i)
inline

Definition at line 57 of file XMLObject.h.

Member Data Documentation

◆ False

std::string XML::Value::False = "false"
inlinestatic

Definition at line 64 of file XMLObject.h.

◆ True

std::string XML::Value::True = "true"
inlinestatic

Definition at line 63 of file XMLObject.h.

◆ value

std::string XML::Value::value

Definition at line 49 of file XMLObject.h.


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