HoverRace  2.0
Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Util::yaml::ScalarNode Class Reference

Wrapper for LibYAML scalar nodes. More...

#include <ScalarNode.h>

+ Inheritance diagram for HoverRace::Util::yaml::ScalarNode:

Public Member Functions

 ScalarNode (yaml_document_t *doc, yaml_node_t *node)
 Constructor. More...
 
virtual ~ScalarNode ()
 Destructor. More...
 
bool AsBool (bool def) const
 Convert this scalar to a boolean value. More...
 
double AsDouble (double def, double min, double max) const
 Convert this scalar to a double floating-point value. More...
 
float AsFloat (float def, float min, float max) const
 Convert this scalar to a floating-point value. More...
 
int AsInt (int def, int min=INT_MIN, int max=INT_MAX) const
 Convert this scalar to an integer value. More...
 
HoverRace::Util::OS::path_t AsPath () const
 Convert this scalar to a path. More...
 
std::string AsString () const
 Returns the string value. More...
 
- Public Member Functions inherited from HoverRace::Util::yaml::Node
 Node (yaml_document_t *doc, yaml_node_t *node)
 
virtual ~Node ()
 

Private Types

using SUPER = Node
 

Private Attributes

char * value
 

Additional Inherited Members

- Protected Member Functions inherited from HoverRace::Util::yaml::Node
yaml_document_t * GetDocument () const
 
yaml_node_t * GetNode () const
 

Detailed Description

Wrapper for LibYAML scalar nodes.

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Util::yaml::ScalarNode::ScalarNode ( yaml_document_t *  doc,
yaml_node_t *  node 
)

Constructor.

Parameters
docThe containing document.
nodeThe underlying LibYAML node (may not be NULL).
HoverRace::Util::yaml::ScalarNode::~ScalarNode ( )
virtual

Destructor.

Member Function Documentation

bool HoverRace::Util::yaml::ScalarNode::AsBool ( bool  def) const

Convert this scalar to a boolean value.

Parameters
defThe default value if the value cannot be converted to a boolean.
Returns
The converted value.
double HoverRace::Util::yaml::ScalarNode::AsDouble ( double  def,
double  min,
double  max 
) const

Convert this scalar to a double floating-point value.

Parameters
defThe default value if the value cannot be converted to a double.
minMinimum clamp value.
maxMaximum clamp value.
Returns
The converted value.
float HoverRace::Util::yaml::ScalarNode::AsFloat ( float  def,
float  min,
float  max 
) const

Convert this scalar to a floating-point value.

Parameters
defThe default value if the value cannot be converted to a float.
minMinimum clamp value.
maxMaximum clamp value.
Returns
The converted value.
int HoverRace::Util::yaml::ScalarNode::AsInt ( int  def,
int  min = INT_MIN,
int  max = INT_MAX 
) const

Convert this scalar to an integer value.

Parameters
defThe default value if the value cannot be converted to a integer.
min(Optional) Minimum clamp value.
max(Optinoal) Maximum clamp value.
Returns
The converted value.
OS::path_t HoverRace::Util::yaml::ScalarNode::AsPath ( ) const

Convert this scalar to a path.

Returns
The path.
std::string HoverRace::Util::yaml::ScalarNode::AsString ( ) const

Returns the string value.

Returns
The value.

Member Data Documentation

char* HoverRace::Util::yaml::ScalarNode::value
private

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