carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
carputils.cml.cmlconverter.CMLConverterYAML Class Reference

Class defining YAML conform string conversion methods. More...

Inheritance diagram for carputils.cml.cmlconverter.CMLConverterYAML:
carputils.cml.cmlconverter.CMLConverter

Public Member Functions

def __init__ (self)
 Method to initialize the CMLConverterYAML object. More...
 
- Public Member Functions inherited from carputils.cml.cmlconverter.CMLConverter
def __init__ (self)
 Method to initialize the CMLConverter object. More...
 

Static Public Member Functions

def to_bool (s)
 Tries to convert a given string to a boolean. More...
 
def to_none (s)
 Tries to convert a given string to None. More...
 
def convert (s)
 Convert a given string, the type is auto-detected. More...
 
- Static Public Member Functions inherited from carputils.cml.cmlconverter.CMLConverter
def is_valid_string (s)
 Checks whether the given string is a valid string or not. More...
 
def is_identifier (s)
 Checks whether the given string is a valid identifier or not. More...
 
def make_identifier (s, substitute='_')
 Tries to convert the given string to a valid identifier. More...
 
def to_int (s)
 Tries to convert a given string to an integer. More...
 
def to_float (s)
 Tries to convert a given string to a float. More...
 
def to_string (s)
 Tries to convert a given string to a string. More...
 
def convert (s)
 Tries to convert a given string. More...
 

Static Public Attributes

dictionary BOOL_DICT = {'true': True, 'yes': True, 'false': False, 'no': False}
 Dictionary holding all strings which are converted to True/False. More...
 
tuple NONE_LIST = ('none', 'null', 'nil')
 Tuple holding all strings which are converted to None. More...
 

Detailed Description

Class defining YAML conform string conversion methods.

Constructor & Destructor Documentation

◆ __init__()

def carputils.cml.cmlconverter.CMLConverterYAML.__init__ (   self)

Method to initialize the CMLConverterYAML object.

Member Function Documentation

◆ convert()

def carputils.cml.cmlconverter.CMLConverterYAML.convert (   s)
static

Convert a given string, the type is auto-detected.

Parameters
sThe string to be converted
Returns
The converted value

◆ to_bool()

def carputils.cml.cmlconverter.CMLConverterYAML.to_bool (   s)
static

Tries to convert a given string to a boolean.

Parameters
sThe string to be converted
Returns
A tuple (state, value) with
state ... The state of the conversion (True or False)
value ... The converted value (None if the conversion failed)

◆ to_none()

def carputils.cml.cmlconverter.CMLConverterYAML.to_none (   s)
static

Tries to convert a given string to None.

Parameters
sThe string to be converted
Returns
A tuple (state, value) with
state ... The state of the conversion (True or False)
value ... The converted value (None if the conversion failed)

Member Data Documentation

◆ BOOL_DICT

dictionary carputils.cml.cmlconverter.CMLConverterYAML.BOOL_DICT = {'true': True, 'yes': True, 'false': False, 'no': False}
static

Dictionary holding all strings which are converted to True/False.

◆ NONE_LIST

tuple carputils.cml.cmlconverter.CMLConverterYAML.NONE_LIST = ('none', 'null', 'nil')
static

Tuple holding all strings which are converted to None.


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