HOPS
HOPS class reference
Public Member Functions | List of all members
hops::MHO_VexTokenProcessor Class Reference

Class MHO_VexTokenProcessor. More...

#include <MHO_VexTokenProcessor.hh>

Public Member Functions

 MHO_VexTokenProcessor ()
 
virtual ~MHO_VexTokenProcessor ()
 
bool ContainsWhitespace (std::string value)
 Checks if a given string contains whitespace characters. More...
 
mho_json ProcessInt (const std::string &element_name, mho_json &format, std::vector< std::string > &tokens)
 Converts first token to integer and returns as mho_json. More...
 
mho_json ProcessListInt (const std::string &element_name, mho_json &format, std::vector< std::string > &tokens)
 Converts a list of string tokens into integers and stores them in an mho_json object. More...
 
mho_json ProcessListReal (const std::string &element_name, mho_json &format, std::vector< std::string > &tokens)
 Processes a list of real numbers as strings and converts them into a JSON object with values and optional units. More...
 
mho_json ProcessListString (const std::string &element_name, mho_json &format, std::vector< std::string > &tokens)
 Processes a list string into a JSON object and stores tokens. More...
 
mho_json ProcessReal (const std::string &element_name, mho_json &format, std::vector< std::string > &tokens)
 Processes a real number value from tokens and returns it as an mho_json object. More...
 

Detailed Description

Class MHO_VexTokenProcessor.

Converts vex tokens (strings) into values of a specific type.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Mon Jun 13 22:27:21 2022 -0400

Constructor & Destructor Documentation

◆ MHO_VexTokenProcessor()

hops::MHO_VexTokenProcessor::MHO_VexTokenProcessor ( )

◆ ~MHO_VexTokenProcessor()

hops::MHO_VexTokenProcessor::~MHO_VexTokenProcessor ( )
virtual

Member Function Documentation

◆ ContainsWhitespace()

bool hops::MHO_VexTokenProcessor::ContainsWhitespace ( std::string  value)

Checks if a given string contains whitespace characters.

Parameters
valueInput string to be checked for whitespace.
Returns
True if string contains whitespace, false otherwise.

◆ ProcessInt()

mho_json hops::MHO_VexTokenProcessor::ProcessInt ( const std::string &  element_name,
mho_json format,
std::vector< std::string > &  tokens 
)

Converts first token to integer and returns as mho_json.

Parameters
element_nameName of the element being processed
formatReference to the format object (not used in this function)
tokensVector of strings containing tokens for processing
Returns
First token converted to integer as mho_json

◆ ProcessListInt()

mho_json hops::MHO_VexTokenProcessor::ProcessListInt ( const std::string &  element_name,
mho_json format,
std::vector< std::string > &  tokens 
)

Converts a list of string tokens into integers and stores them in an mho_json object.

Parameters
element_nameName of the element being processed
formatReference to an mho_json object for formatting purposes (not used)
tokensVector of strings containing integer values to be converted
Returns
mho_json object containing the converted integers as a vector of ints

◆ ProcessListReal()

mho_json hops::MHO_VexTokenProcessor::ProcessListReal ( const std::string &  element_name,
mho_json format,
std::vector< std::string > &  tokens 
)

Processes a list of real numbers as strings and converts them into a JSON object with values and optional units.

Parameters
element_nameThe name of the element being processed.
formatAn mho_json reference used internally for formatting.
tokensA vector of string tokens representing numerical values or value-unit pairs.
Returns
An mho_json object containing 'values' (a vector of doubles) and optionally 'units'.

◆ ProcessListString()

mho_json hops::MHO_VexTokenProcessor::ProcessListString ( const std::string &  element_name,
mho_json format,
std::vector< std::string > &  tokens 
)

Processes a list string into a JSON object and stores tokens.

Parameters
element_nameThe name of the element to process.
formatReference to an mho_json object for formatting.
tokensReference to a vector of strings containing tokens.
Returns
A JSON object containing the processed list string.

◆ ProcessReal()

mho_json hops::MHO_VexTokenProcessor::ProcessReal ( const std::string &  element_name,
mho_json format,
std::vector< std::string > &  tokens 
)

Processes a real number value from tokens and returns it as an mho_json object.

Parameters
element_nameName of the element being processed
formatReference to the format object for processing
tokensVector of strings containing token values
Returns
mho_json object containing 'value' and optionally 'units'

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