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

Class defining basic string conversion methods. More...

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

Public Member Functions

def __init__ (self)
 Method to initialize the CMLConverter object. More...
 

Static Public Member Functions

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...
 

Detailed Description

Class defining basic string conversion methods.

Constructor & Destructor Documentation

◆ __init__()

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

Method to initialize the CMLConverter object.

Member Function Documentation

◆ convert()

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

Tries to convert a given string.

Note
This is just a method interface, a NotImplementedError will be raised when the method is called.
Parameters
sThe string to be converted
Exceptions
NotImplementedError

◆ is_identifier()

def carputils.cml.cmlconverter.CMLConverter.is_identifier (   s)
static

Checks whether the given string is a valid identifier or not.

Parameters
sThe string to be checked
Returns
True if the given object is a valid string, False otherwise

◆ is_valid_string()

def carputils.cml.cmlconverter.CMLConverter.is_valid_string (   s)
static

Checks whether the given string is a valid string or not.

Parameters
sThe string to be checked
Returns
True if the given object is a valid string, False otherwise

◆ make_identifier()

def carputils.cml.cmlconverter.CMLConverter.make_identifier (   s,
  substitute = '_' 
)
static

Tries to convert the given string to a valid identifier.

Parameters
sThe string to be converted
substituteA valid identifier string used to replace invalid characters in the s string
Returns
The identifier string
Exceptions
AttributeError

◆ to_float()

def carputils.cml.cmlconverter.CMLConverter.to_float (   s)
static

Tries to convert a given string to a float.

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 state is False)

◆ to_int()

def carputils.cml.cmlconverter.CMLConverter.to_int (   s)
static

Tries to convert a given string to an integer.

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

◆ to_string()

def carputils.cml.cmlconverter.CMLConverter.to_string (   s)
static

Tries to convert a given string to a string.

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 state is False)

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