TplConvertSec< E > Class Template Reference

#include <TplConvertSec.h>


Detailed Description

template<class E>
class TplConvertSec< E >

TplConvertSec The same as TplConvert, but more secure, meaning throwing less exceptions as methods do retrieve a value that is used when nothing to convert is supplied. Still, some methods do throw exceptions when f.e. something that should be a number is not.

Definition at line 47 of file TplConvertSec.h.


Static Public Member Functions

static bool _2boolSec (const E *const data, int length, bool def)
static bool _2boolSec (const E *const data, bool def)
static char * _2charpSec (const E *const data, int length, char *def)
static char * _2charpSec (const E *const data, char *def)
static int _2intSec (const E *const data, int length, int def)
static int _2intSec (const E *const data, int def)
static long _2longSec (const E *const data, int length, long def)
static long _2longSec (const E *const data, long def)
static std::string _2strSec (const E *const data, int length, const std::string &def)
static std::string _2strSec (const E *const data, const std::string &def)
static SUMOReal _2SUMORealSec (const E *const data, int length, SUMOReal def)
static SUMOReal _2SUMORealSec (const E *const data, SUMOReal def)

Member Function Documentation

template<class E>
static bool TplConvertSec< E >::_2boolSec ( const E *const   data,
int  length,
bool  def 
) [inline, static]

converts a char-type array into the SUMOReal value described by it considering the given length returns the default value if the data is empty

Definition at line 148 of file TplConvertSec.h.

References TplConvert< E >::_2bool().

00148                                                                       {
00149         if (data==0||length==0||data[0]==0) {
00150             return def;
00151         }
00152         return TplConvert<E>::_2bool(data, length);
00153     }

template<class E>
static bool TplConvertSec< E >::_2boolSec ( const E *const   data,
bool  def 
) [inline, static]

converts a 0-terminated char-type array into the SUMOReal value described by it returns true when the first char is one of the following: '1', 'x', 't', 'T' returns the default value if the data is empty

Definition at line 86 of file TplConvertSec.h.

Referenced by SUMOSAXAttributesImpl_Xerces::getBoolSecure().

00086                                                           {
00087         return _2boolSec(data, 1, def);
00088     }

template<class E>
static char* TplConvertSec< E >::_2charpSec ( const E *const   data,
int  length,
char *  def 
) [inline, static]

converts a char-type array into a 0-terminated 0-terminated c-char-string considering the given length returns the default value if the data is empty

Definition at line 159 of file TplConvertSec.h.

References TplConvert< E >::_2charp().

00159                                                                          {
00160         if (data==0||length==0) {
00161             return TplConvert<E>::copy(def);
00162         }
00163         return TplConvert<E>::_2charp(data, length);
00164     }

template<class E>
static char* TplConvertSec< E >::_2charpSec ( const E *const   data,
char *  def 
) [inline, static]

converts a 0-terminated char-type array into a 0-terminated 0-terminated c-char-string returns the default value if the data is empty

Definition at line 94 of file TplConvertSec.h.

00094                                                              {
00095         return _2charpSec(data, TplConvert<E>::getLength(data), def);
00096     }

template<class E>
static int TplConvertSec< E >::_2intSec ( const E *const   data,
int  length,
int  def 
) [inline, static]

converts a char-type array into the integer value described by it considering the given length returns the default value if the data is empty

Definition at line 115 of file TplConvertSec.h.

References TplConvert< E >::_2int().

00115                                                                    {
00116         if (data==0||length==0||data[0]==0) {
00117             return def;
00118         }
00119         return TplConvert<E>::_2int(data, length);
00120     }

template<class E>
static int TplConvertSec< E >::_2intSec ( const E *const   data,
int  def 
) [inline, static]

converts a 0-terminated char-type array into the integer value described by it returns the default value if the data is empty

Definition at line 61 of file TplConvertSec.h.

Referenced by SUMOSAXAttributesImpl_Xerces::getIntSecure(), RODFDetectorHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), and NIXMLConnectionsHandler::parseLaneBound().

00061                                                        {
00062         return _2intSec(data, INT_MAX, def);
00063     }

template<class E>
static long TplConvertSec< E >::_2longSec ( const E *const   data,
int  length,
long  def 
) [inline, static]

converts a char-type array into the long value described by it considering the given length returns the default value if the data is empty

Definition at line 126 of file TplConvertSec.h.

References TplConvert< E >::_2long().

00126                                                                       {
00127         if (data==0||length==0||data[0]==0) {
00128             return def;
00129         }
00130         return TplConvert<E>::_2long(data, length);
00131     }

template<class E>
static long TplConvertSec< E >::_2longSec ( const E *const   data,
long  def 
) [inline, static]

converts a 0-terminated char-type array into the long value described by it returns the default value if the data is empty

Definition at line 69 of file TplConvertSec.h.

00069                                                           {
00070         return _2longSec(data, INT_MAX, def);
00071     }

template<class E>
static std::string TplConvertSec< E >::_2strSec ( const E *const   data,
int  length,
const std::string &  def 
) [inline, static]

converts a char-type array into std::string considering the given length returns the default value if the data is empty

Definition at line 103 of file TplConvertSec.h.

References TplConvert< E >::_2str().

00104                                                       {
00105         if (data==0||length==0) {
00106             return def;
00107         }
00108         return TplConvert<E>::_2str(data, length);
00109     }

template<class E>
static std::string TplConvertSec< E >::_2strSec ( const E *const   data,
const std::string &  def 
) [inline, static]

converts a 0-terminated char-type array into std::string returns the default value if the data is empty

Definition at line 52 of file TplConvertSec.h.

Referenced by SUMOSAXAttributesImpl_Xerces::getStringSecure().

00053                                                       {
00054         return _2strSec(data, TplConvert<E>::getLength(data), def);
00055     }

template<class E>
static SUMOReal TplConvertSec< E >::_2SUMORealSec ( const E *const   data,
int  length,
SUMOReal  def 
) [inline, static]

converts a char-type array into the SUMOReal value described by it considering the given length returns the default value if the data is empty

Definition at line 137 of file TplConvertSec.h.

References TplConvert< E >::_2SUMOReal().

00137                                                                                   {
00138         if (data==0||length==0||data[0]==0) {
00139             return def;
00140         }
00141         return TplConvert<E>::_2SUMOReal(data, length);
00142     }

template<class E>
static SUMOReal TplConvertSec< E >::_2SUMORealSec ( const E *const   data,
SUMOReal  def 
) [inline, static]

converts a 0-terminated char-type array into the SUMOReal value described by it returns the default value if the data is empty

Definition at line 77 of file TplConvertSec.h.

Referenced by SUMOSAXAttributesImpl_Xerces::getFloatSecure(), and NIImporter_VISUM::parse_Edges().

00077                                                                       {
00078         return _2SUMORealSec(data, INT_MAX, def);
00079     }


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

Generated on Wed May 5 00:07:01 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6