5#include <boost/lexical_cast.hpp>
6#include <boost/algorithm/string.hpp>
30 ss << std::fixed <<
value;
35 string::string(
const char*
s,
int l) :my(
s,
l){ }
37 string::string(
const fc::string& c ):my(*c.my) { }
38 string::string(
string&& m ):my(
fc::move(*m.my)) {}
39 string::string(
const char* c ):my(c){}
40 string::string( const_iterator b, const_iterator e ):my(b,e){}
41 string::string(
const std::string&
s ):my(
s) {}
42 string::string( std::string&&
s ):my(
fc::move(
s)) {}
44 string::operator std::string&() {
return *my; }
45 string::operator
const std::string&()
const {
return *my; }
46 char* string::data() {
return &my->front(); }
48 string::iterator string::begin() {
return &(*this)[0]; }
49 string::iterator string::end() {
return &(*this)[size()]; }
50 string::const_iterator string::begin()
const {
return my->c_str(); }
51 string::const_iterator string::end()
const {
return my->c_str() + my->size(); }
53 char& string::operator[](
size_t idx) {
return (*my)[idx]; }
54 const char& string::operator[](
size_t idx)
const {
return (*my)[idx]; }
56 void string::reserve(
size_t r) { my->reserve(
r); }
57 size_t string::size()
const {
return my->size(); }
58 size_t string::find(
char c,
size_t p)
const {
return my->find(c,
p); }
59 size_t string::find(
const fc::string& str,
size_t pos )
const {
return my->find(str, pos); }
60 size_t string::find(
const char*
s,
size_t pos )
const {
return my->find(
s,pos); }
61 size_t string::rfind(
char c,
size_t p)
const {
return my->rfind(c,
p); }
62 size_t string::rfind(
const char* c,
size_t p)
const {
return my->rfind(c,
p); }
63 size_t string::rfind(
const fc::string& c,
size_t p)
const {
return my->rfind(c,
p); }
64 size_t string::find_first_of(
const fc::string& str,
size_t pos )
const {
return my->find_first_of(str, pos); }
65 size_t string::find_first_of(
const char*
s,
size_t pos )
const {
return my->find_first_of(
s, pos); }
67 fc::string& string::replace(
size_t pos,
size_t len,
const string& str) { my->replace(pos,
len, str);
return *
this; }
68 fc::string& string::replace(
size_t pos,
size_t len,
const char*
s) { my->replace(pos,
len,
s);
return *
this; }
70 void string::clear() { my->clear(); }
71 void string::resize(
size_t s ) { my->resize(
s); }
73 fc::string string::substr(
size_t start,
size_t len )
const {
return my->substr(start,
len); }
74 const char* string::c_str()
const {
return my->c_str(); }
76 bool string::operator == (
const char*
s )
const {
return *my ==
s; }
77 bool string::operator == (
const string&
s )
const {
return *my == *
s.my; }
78 bool string::operator != (
const string&
s )
const {
return *my != *
s.my; }
80 string& string::operator =(
const string& c ) { *my = *c.my;
return *
this; }
81 string& string::operator =(
string&& c ) { *my = fc::move( *c.my );
return *
this; }
83 string& string::operator+=(
const string&
s ) { *my += *
s.my;
return *
this; }
84 string& string::operator+=(
char c ) { *my += c;
return *
this; }
86 bool operator < (
const string&
a,
const string& b ) {
return *
a.my < *b.my; }
87 string operator + (
const string&
s,
const string& c ) {
return string(
s) += c; }
88 string operator + (
const string&
s,
char c ) {
return string(
s) += c; }
96 return boost::lexical_cast<int64_t>(i.c_str(), i.size());
98 catch(
const boost::bad_lexical_cast& e )
109 return boost::lexical_cast<uint64_t>(i.c_str(), i.size());
111 catch(
const boost::bad_lexical_cast& e )
122 return boost::lexical_cast<double>(i.c_str(), i.size());
124 catch(
const boost::bad_lexical_cast& e )
134 std::stringstream ss;
135 ss << std::setprecision(std::numeric_limits<double>::digits10 + 2) << std::fixed <<
d;
141 return boost::lexical_cast<std::string>(
d);
146 return boost::lexical_cast<std::string>(
d);
150 return boost::lexical_cast<std::string>(
d);
152 std::string
trim(
const std::string&
s )
154 return boost::algorithm::trim_copy(
s);
164 boost::algorithm::to_lower(tmp);
169 string result = boost::algorithm::trim_copy(
s );
170 while( result.find(
" " ) != result.npos )
171 boost::algorithm::replace_all( result,
" ",
" " );
bool operator<(const CBigNum &a, const CBigNum &b)
const CBigNum operator+(const CBigNum &a, const CBigNum &b)
virtual char do_thousands_sep() const
virtual std::string do_grouping() const
Defines exception's used by fc.
#define FC_CAPTURE_AND_RETHROW(...)
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
std::string to_pretty_string(int64_t)
string trim_and_normalize_spaces(const string &s)
double to_double(const fc::string &)
uint64_t to_uint64(const fc::string &)
fc::string to_lower(const fc::string &)
fc::string trim(const fc::string &)
int64_t to_int64(const fc::string &)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
unsigned __int64 uint64_t