Go to the documentation of this file.00001 #ifndef __STRING_COLLECTIONS_CPP__
00002 #define __STRING_COLLECTIONS_CPP__
00003
00004 #include <vector>
00005
00006 #include <utilities/exception.h>
00007 #include <utilities/mvc/string_collection.h>
00008 #include <utilities/string_utilities.h>
00009
00010 namespace nitro
00011 {
00012
00013 int StringCollection::GetValueAsInteger( const char * StringName )
00014 {
00015 try
00016 {
00017 return( nitro::Converters::atoi( std::string( GetValueAsString( StringName ) ) ) );
00018 }
00019 catch( nitro::exception e )
00020 {
00021 throw( nitro::exception( std::string( "StringCollection::GetValueAsInteger( const char * StringName )::" )+ e.what() , e.code() ) );
00022 }
00023 catch( ... )
00024 {
00025 throw( nitro::exception( "StringCollection::GetValueAsInteger( const char * StringName )::An error occured" , 1 ) );
00026 }
00027 }
00028
00029 double StringCollection::GetValueAsFloat( const char * StringName )
00030 {
00031 try
00032 {
00033 return( nitro::Converters::atof( std::string( GetValueAsString( StringName ) ) ) );
00034 }
00035 catch( nitro::exception e )
00036 {
00037 throw( nitro::exception( std::string( "StringCollection::GetValueAsFloat( const char * StringName )::" )+ e.what() , e.code() ) );
00038 }
00039 catch( ... )
00040 {
00041 throw( nitro::exception( "StringCollection::GetValueAsFloat( const char * StringName )::An error occured" , 1 ) );
00042 }
00043 }
00044
00045 const char * StringCollection::GetValueAsString( std::size_t i )
00046 {
00047 try
00048 {
00049 return( GetValueAsString( GetStringName( i ) ) );
00050 }
00051 catch( nitro::exception e )
00052 {
00053 throw( nitro::exception( std::string( "StringCollection::GetStringValue( std::size_t i )::" )+ e.what() , e.code() ) );
00054 }
00055 catch( ... )
00056 {
00057 throw( nitro::exception( "StringCollection::GetStringValue( std::size_t i )::An error occured" , 1 ) );
00058 }
00059 }
00060
00061 int StringCollection::GetValueAsInteger( std::size_t i )
00062 {
00063 try
00064 {
00065 return( nitro::Converters::atoi( std::string( GetValueAsString( GetStringName( i ) ) ) ) );
00066 }
00067 catch( nitro::exception e )
00068 {
00069 throw( nitro::exception( std::string( "StringCollection::GetStringValue( std::size_t i )::" )+ e.what() , e.code() ) );
00070 }
00071 catch( ... )
00072 {
00073 throw( nitro::exception( "StringCollection::GetStringValue( std::size_t i )::An error occured" , 1 ) );
00074 }
00075 }
00076
00077 double StringCollection::GetValueAsFloat( std::size_t i )
00078 {
00079 try
00080 {
00081 return( nitro::Converters::atof( std::string( GetValueAsString( GetStringName( i ) ) ) ) );
00082 }
00083 catch( nitro::exception e )
00084 {
00085 throw( nitro::exception( std::string( "StringCollection::GetValueAsFloat( std::size_t i )::" )+ e.what() , e.code() ) );
00086 }
00087 catch( ... )
00088 {
00089 throw( nitro::exception( "StringCollection::GetValueAsFloat( std::size_t i )::An error occured" , 1 ) );
00090 }
00091 }
00092
00093 };
00094
00095 #endif