Класс для конвертированием различных значений из/в строки. Подробнее...
#include <utilities/string_utilities.h>
Открытые статические члены | |
static int | atoi (const std::string &StringValue, const std::size_t &Mode=nitro::DECIMAL) |
template<class str_type > | |
static double | atof (str_type StringValue) |
static double | atof (const char *StringValue) |
template<class str_type > | |
static str_type | itoa (int Value, str_type &RetValue, const std::size_t &Mode=nitro::DECIMAL) |
static void | itoa (int Value, char *OutputBuffer, const std::size_t &Mode=nitro::DECIMAL) |
template<class str_type > | |
static str_type | ftoa (double Value, str_type &RetValue) |
static void | ftoa (double Value, char *OutputBuffer) |
Класс для конвертированием различных значений из/в строки.
См. определение в файле string_utilities.h строка 1881
double nitro::Converters::atof | ( | str_type | StringValue | ) | [static] |
Функция для конвертации строки в вещественное число.
StringValue | - Строковое представление числа. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.h строка 2074
Перекрестные ссылки nitro::exception::code() и nitro::exception::what().
Используется в atof() и nitro::StringCollection::GetValueAsFloat().
{ try { return( ::atof( StringValue.c_str() ) ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::atof( str_type StringValue )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::atof( str_type StringValue )::An error occured" ) , 0 ) ); } }
double nitro::Converters::atof | ( | const char * | StringValue | ) | [static] |
Функция для конвертации строки в вещественное число.
StringValue | - Строковое представление числа. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.cpp строка 1049
Перекрестные ссылки atof(), nitro::exception::code() и nitro::exception::what().
{ try { return( ::atof( StringValue ) ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::atof( const char * StringValue )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::atof( const char * StringValue )::An error occured " ) , 1 ) ); } }
int nitro::Converters::atoi | ( | const std::string & | StringValue, | |
const std::size_t & | Mode = nitro::DECIMAL | |||
) | [static] |
Функция для конвертации строки в целое число.
StringValue | - Строковое представление числа. | |
Mode | - Режим преобразования. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.cpp строка 1016
Перекрестные ссылки nitro::exception::code(), nitro::DECIMAL, nitro::HEXADECIMAL, nitro::OCTAL и nitro::exception::what().
Используется в nitro::MySQLDatabase::Connect(), nitro::UnTARAbstraction::ExtractFile(), nitro::UnTARAbstraction::GetCountOfFiles(), nitro::StringCollection::GetValueAsInteger() и nitro::UnTARAbstraction::SetReadCursor().
{ try { int Result( 0 ); switch( Mode ) { case( nitro::OCTAL ): sscanf( StringValue.c_str() , "%o" , & Result ); break; case( nitro::DECIMAL ): sscanf( StringValue.c_str() , "%d" , & Result ); break; case( nitro::HEXADECIMAL ): sscanf( StringValue.c_str() , "%x" , & Result ); break; } return( Result ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::atoi( const std::string & StringValue , const std::size_t & Mode /* = nitro::Converters::DECIMAL */ )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::atoi( const std::string & StringValue , const std::size_t & Mode )::An error occured" ) , 0 ) ); } }
str_type nitro::Converters::ftoa | ( | double | Value, | |
str_type & | RetValue | |||
) | [static] |
Функция конвертаци вещественного числа в строку.
Value | - Конвертируемое значение. | |
RetValue | - Буффер, в который будем выводить строку. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.h строка 2114
Перекрестные ссылки nitro::exception::code() и nitro::exception::what().
{ try { char Buffer[ 128 ]; memset( Buffer , 0 , 128 ); ftoa( Value , Buffer ); RetValue = Buffer; return( RetValue ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::ftoa( double Value , str_type & RetValue )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::ftoa( double Value , str_type & RetValue )::An error occured" ) , 0 ) ); } } }
void nitro::Converters::ftoa | ( | double | Value, | |
char * | OutputBuffer | |||
) | [static] |
Функция конвертаци вещественного числа в строку.
Value | - Конвертируемое значение. | |
OutputBuffer | - Буффер, в который будем выводить строку. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.cpp строка 1096
Перекрестные ссылки nitro::exception::code() и nitro::exception::what().
{ try { OutputBuffer[ 0 ] = '\0'; sprintf( OutputBuffer , "%f" , Value ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::ftoa( double Value , char * OutputBuffer )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::ftoa( double Value , char * OutputBuffer )::An error occured " ) , 1 ) ); } }
str_type nitro::Converters::itoa | ( | int | Value, | |
str_type & | RetValue, | |||
const std::size_t & | Mode = nitro::DECIMAL | |||
) | [static] |
Функция конвертаци целого числа в строку.
Value | - Конвертируемое значение. | |
RetValue | - Буффер, в который будем выводить строку. | |
Mode | - Режим преобразования. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.h строка 2090
Перекрестные ссылки nitro::exception::code() и nitro::exception::what().
Используется в nitro::XMLTag::operator[]().
{ try { char Buffer[ 128 ]; memset( Buffer , 0 , 128 ); itoa( Value , Buffer , Mode ); RetValue = Buffer; return( RetValue ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::itoa( int Value , str_type & RetValue , const std::size_t & Mode /* = nitro::DECIMAL */ )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::itoa( int Value , str_type & RetValue , const std::size_t & Mode /* = nitro::DECIMAL */ )::An error occured" ) , 0 ) ); } }
void nitro::Converters::itoa | ( | int | Value, | |
char * | OutputBuffer, | |||
const std::size_t & | Mode = nitro::DECIMAL | |||
) | [static] |
Функция конвертаци целого числа в строку.
Value | - Конвертируемое значение. | |
OutputBuffer | - Буффер, в который будем выводить строку. | |
Mode | - Режим преобразования. |
nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле string_utilities.cpp строка 1065
Перекрестные ссылки nitro::exception::code(), nitro::DECIMAL, nitro::HEXADECIMAL, nitro::OCTAL и nitro::exception::what().
{ try { OutputBuffer[ 0 ] = '\0'; switch( Mode ) { case( nitro::OCTAL ): sprintf( OutputBuffer , "%o" , Value ); break; case( nitro::DECIMAL ): sprintf( OutputBuffer , "%d" , Value ); break; case( nitro::HEXADECIMAL ): sprintf( OutputBuffer , "%x" , Value ); break; } } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Converters::itoa( int Value , char * OutputBuffer , const std::size_t & Mode /* = nitro::DECIMAL */ )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "Converters::itoa( int Value , char * OutputBuffer , const std::size_t & Mode /* = nitro::DECIMAL */ )::An error occured " ) , 1 ) ); } }