Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
string.hpp
Go to the documentation of this file.
1#pragma once
2#include <fc/utility.hpp>
3#include <fc/fwd.hpp>
4
5#ifndef USE_FC_STRING
6#include <optional>
7#include <string>
8namespace fc
9{
10 typedef std::string string;
11
12 int64_t to_int64( const fc::string& );
14 double to_double( const fc::string& );
15 fc::string to_string( double );
19 std::string to_pretty_string( int64_t );
20 inline fc::string to_string( int32_t v ) { return to_string( int64_t(v) ); }
21 inline fc::string to_string( uint32_t v ){ return to_string( uint64_t(v) ); }
22#ifdef __APPLE__
23 inline fc::string to_string( size_t s) { return to_string(uint64_t(s)); }
24#endif
25
26 typedef std::optional<fc::string> ostring;
27 class variant_object;
28 fc::string format_string( const fc::string&, const variant_object&, bool minimize = false );
29 fc::string trim( const fc::string& );
31 string trim_and_normalize_spaces( const string& s );
32}
33
34#else
35
41namespace std {
42 template<class Char>
43 struct char_traits;
44
45 template<class T>
46 class allocator;
47
48 template<class Char, class Traits, class Allocator>
49 class basic_string;
50
51 typedef basic_string<char, char_traits<char>, allocator<char> > string;
52}
53
54
55namespace fc {
70 class string {
71 public:
72 typedef char* iterator;
73 typedef const char* const_iterator;
74 enum { npos = size_t(-1) };
75 // static const size_t npos;// = -1;
76
77 string();
78 string( const std::string& s );
79 string( std::string&& s );
80 string( const string& c );
81 string( string&& c );
82 string( const char* c );
83 string( const char* c, int s );
84 string( const_iterator b, const_iterator e );
85 ~string();
86
87 operator std::string&();
88 operator const std::string&()const;
89
90 iterator begin();
91 iterator end();
92
93 const_iterator begin()const;
94 const_iterator end()const;
95
96 char& operator[](size_t idx);
97 const char& operator[](size_t idx)const;
98
99 string& operator =( const string& c );
100 string& operator =( string&& c );
101
102 void reserve( size_t );
103 size_t size()const;
104 size_t find( char c, size_t pos = 0 )const;
105 size_t find(const fc::string& str, size_t pos = 0) const;
106 size_t find(const char* s, size_t pos = 0) const;
107 size_t rfind( char c, size_t pos = npos )const;
108 size_t rfind( const char* c, size_t pos = npos )const;
109 size_t rfind( const fc::string& c, size_t pos = npos )const;
110 size_t find_first_of (const fc::string& str, size_t pos = 0) const;
111 size_t find_first_of (const char* s, size_t pos = 0) const;
112 string& replace(size_t pos, size_t len, const fc::string& str);
113 string& replace(size_t pos, size_t len, const char* s);
114
115 void resize( size_t s );
116 void clear();
117
118 const char* c_str()const;
119 char* data();
120
121 bool operator == ( const char* s )const;
122 bool operator == ( const string& s )const;
123 bool operator != ( const string& s )const;
124
125 friend bool operator < ( const string& a, const string& b );
126
127 string& operator+=( const string& s );
128 string& operator+=( char c );
129
130 friend string operator + ( const string&, const string& );
131 friend string operator + ( const string&, char c );
132
133 fc::string substr( size_t start, size_t len = fc::string::npos )const;
134
135 private:
137 };
138
139 int64_t to_int64( const fc::string& );
140 uint64_t to_uint64( const fc::string& );
141 double to_double( const fc::string& );
142 fc::string to_string( double );
145
146 typedef std::optional<fc::string> ostring;
147 class variant_object;
148 fc::string format_string( const fc::string&, const variant_object& );
149
150} // namespace fc
151
152#endif
Used to forward declare value types.
Definition fwd.hpp:11
auto operator+=(std::string &lhs, StringRef const &rhs) -> std::string &
RUNTIME_API Runtime::ObjectInstance * find(const std::string &name, const IR::ObjectType &type)
bip::allocator< T, pinnable_mapped_file::segment_manager > allocator
Definition chainbase.hpp:56
namespace sysio::chain
Definition authority.cpp:3
std::string string
Definition string.hpp:10
bool operator<(const array< T, N > &a, const array< T, N > &b)
Definition array.hpp:94
std::optional< fc::string > ostring
Definition url.hpp:10
auto operator+(const fwd< T, S, A > &x, U &&u) -> typename detail::add< T, U >::type
Definition fwd_impl.hpp:42
std::string to_pretty_string(int64_t)
Definition string.cpp:26
fc::string to_string(double)
Definition string.cpp:131
bool operator!=(const array< T, N > &a, const array< T, N > &b)
Definition array.hpp:102
bool operator==(const array< T, N > &a, const array< T, N > &b)
Definition array.hpp:91
string trim_and_normalize_spaces(const string &s)
Definition string.cpp:167
double to_double(const fc::string &)
Definition string.cpp:118
uint64_t to_uint64(const fc::string &)
Definition string.cpp:105
fc::string to_lower(const fc::string &)
Definition string.cpp:161
fc::string format_string(const fc::string &, const variant_object &, bool minimize=false)
Definition variant.cpp:773
fc::string trim(const fc::string &)
Definition string.cpp:152
int64_t to_int64(const fc::string &)
Definition string.cpp:92
Definition name.hpp:106
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
unsigned short uint16_t
Definition stdint.h:125
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
signed int int32_t
Definition stdint.h:123
unsigned __int64 uint64_t
Definition stdint.h:136
const uint8_t clear[]
Definition wrap_data.c:35
char * s
size_t len