00001 #ifndef _FV_CONV_UTL_H_
00002 #define _FV_CONV_UTLS_H_
00003
00004 #include <ios>
00005 #include <string>
00006 #include <sstream>
00007 #include "fv_exception.h"
00008
00009 template <typename Type>
00010 inline
00011 Type Str2T(std::string & str_)
00012 {
00013 std::istringstream _isstr(str_);
00014 Type _value;
00015 _isstr >> _value;
00016 if(_isstr.fail())
00017 throw fv_exception("Error while parsing to type");
00018 return static_cast<Type>(_value);
00019 }
00020
00021 template <typename Type>
00022 inline
00023 std::string T2Str(Type value_)
00024 {
00025 std::stringstream _sstr;
00026 _sstr << value_;
00027 if(_sstr.fail())
00028 throw fv_exception("Error while parsing to string");
00029 return _sstr.str();
00030 }
00031
00032 extern bool IsDig(std::string &str);
00033 extern bool IsCyfr(std::string &str);
00034
00035 extern void int2bin(unsigned int nr,unsigned int size,char buff[]);
00036 extern void int2bin2(unsigned int n, unsigned int buffer_size, char *buffer);
00037
00038
00039
00040 #endif
00041