diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebf8d16..fbf1ca0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,12 +233,9 @@ set( fc_sources
src/io/sstream.cpp
src/io/json.cpp
src/io/varint.cpp
- src/io/console.cpp
src/filesystem.cpp
src/interprocess/signals.cpp
src/interprocess/file_mapping.cpp
- src/interprocess/mmap_struct.cpp
- src/interprocess/file_mutex.cpp
src/rpc/cli.cpp
src/rpc/http_api.cpp
src/rpc/json_connection.cpp
diff --git a/fc.natvis b/fc.natvis
index 7188bfa..81d74d6 100644
--- a/fc.natvis
+++ b/fc.natvis
@@ -31,12 +31,6 @@
-
- {my}
-
- my
-
-
invalid
@@ -54,4 +48,4 @@
-
\ No newline at end of file
+
diff --git a/include/fc/actor.hpp b/include/fc/actor.hpp
deleted file mode 100644
index 920d742..0000000
--- a/include/fc/actor.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#pragma once
-#include
-#include
-
-namespace fc {
-
- namespace detail {
- struct actor_member {
- #if 1 // BOOST_NO_VARIADIC_TEMPLATES
- #define RPC_MEMBER_FUNCTOR(z,n,IS_CONST) \
- template \
- static std::function( BOOST_PP_ENUM_PARAMS(n,A) ) > \
- functor( P p, R (C::*mem_func)(BOOST_PP_ENUM_PARAMS(n,A)) IS_CONST, fc::thread* c = 0) { \
- return [=](BOOST_PP_ENUM_BINARY_PARAMS(n,A,a))->fc::future{ \
- return c->async( [=](){ return (p->*mem_func)(BOOST_PP_ENUM_PARAMS(n,a)); } ); }; \
- }
- BOOST_PP_REPEAT( 8, RPC_MEMBER_FUNCTOR, const )
- BOOST_PP_REPEAT( 8, RPC_MEMBER_FUNCTOR, BOOST_PP_EMPTY() )
- #undef RPC_MEMBER_FUNCTOR
-
- #else // g++ has a bug that prevents lambdas and varidic templates from working together (G++ Bug 41933)
-
- template
- static std::function(Args...)> functor( P&& p, R (C::*mem_func)(Args...), fc::thread* c ) {
- return [=](Args... args)->fc::future{ c->async( [=]()->R { return p->*mem_func( fc::forward(args)... ); } ) };
- }
- template
- static std::function(Args...)> functor( P&& p, R (C::*mem_func)(Args...)const, fc::thread* c ){
- return [=](Args... args)->fc::future{ c->async( [=]()->R { return p->*mem_func( fc::forward(args)... ); } ) };
- }
- #endif
- };
-
- template
- struct actor_vtable_visitor {
- template
- actor_vtable_visitor( fc::thread* t, U&& u ):_thread(t),_this( fc::forward(u) ){}
-
- template
- void operator()( const char* name, Function& memb, MemberPtr m )const {
- memb = actor_member::functor( _this, m, _thread );
- }
- fc::thread* _thread;
- ThisPtr _this;
- };
- }
-
- /**
- * Posts all method calls to another thread and
- * returns a future.
- */
- template
- class actor : public api {
- public:
- actor(){}
-
- template
- actor( InterfaceType* p, fc::thread* t = &fc::thread::current() )
- {
- this->_vtable.reset(new detail::vtable() );
- this->_vtable->template visit( detail::actor_vtable_visitor(t, p) );
- }
- };
-
-} // namespace fc
diff --git a/include/fc/aligned.hpp b/include/fc/aligned.hpp
deleted file mode 100644
index b107ed1..0000000
--- a/include/fc/aligned.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-namespace fc {
-
- template
- struct aligned {
- union {
- T _align;
- char _data[S];
- } _store;
- operator char*() { return _store._data; }
- operator const char*()const { return _store._data; }
- };
-
-}
diff --git a/include/fc/any.hpp b/include/fc/any.hpp
deleted file mode 100644
index 022d29e..0000000
--- a/include/fc/any.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-#include
-
-namespace fc {
- // TODO: define this without using boost
- typedef boost::any any;
-}
diff --git a/include/fc/api.hpp b/include/fc/api.hpp
index 06414b1..3f68750 100644
--- a/include/fc/api.hpp
+++ b/include/fc/api.hpp
@@ -1,7 +1,7 @@
#pragma once
#include
-#include
#include
+#include
#include
// ms visual c++ (as of 2013) doesn't accept the standard syntax for calling a
@@ -75,7 +75,7 @@ namespace fc {
api( const T& p )
:_vtable( std::make_shared() )
{
- _data = std::make_shared(p);
+ _data = std::make_shared(p);
T& ptr = boost::any_cast(*_data);
auto& pointed_at = *ptr;
typedef typename std::remove_reference::type source_vtable_type;
@@ -95,7 +95,7 @@ namespace fc {
protected:
std::shared_ptr _vtable;
- std::shared_ptr _data;
+ std::shared_ptr _data;
};
} // namespace fc
diff --git a/include/fc/array.hpp b/include/fc/array.hpp
index 541cd69..687b175 100644
--- a/include/fc/array.hpp
+++ b/include/fc/array.hpp
@@ -112,7 +112,7 @@ namespace fc {
std::vector ve = v.as< std::vector >( 1 );
if( ve.size() )
{
- memcpy(&bi, ve.data(), fc::min(ve.size(),sizeof(bi)) );
+ memcpy(&bi, ve.data(), std::min(ve.size(),sizeof(bi)) );
}
else
memset( &bi, char(0), sizeof(bi) );
diff --git a/include/fc/asio.hpp b/include/fc/asio.hpp
index 3d11a38..06ba2f8 100644
--- a/include/fc/asio.hpp
+++ b/include/fc/asio.hpp
@@ -282,7 +282,7 @@ namespace asio {
{
public:
istream( std::shared_ptr str )
- :_stream( fc::move(str) ){}
+ :_stream( std::move(str) ){}
virtual size_t readsome( char* buf, size_t len )
{
@@ -302,7 +302,7 @@ namespace asio {
{
public:
ostream( std::shared_ptr str )
- :_stream( fc::move(str) ){}
+ :_stream( std::move(str) ){}
virtual size_t writesome( const char* buf, size_t len )
{
diff --git a/include/fc/compress/zlib.hpp b/include/fc/compress/zlib.hpp
index 10a3a0e..cd08ccf 100644
--- a/include/fc/compress/zlib.hpp
+++ b/include/fc/compress/zlib.hpp
@@ -1,10 +1,10 @@
#pragma once
-#include
+#include
namespace fc
{
- string zlib_compress(const string& in);
+std::string zlib_compress(const std::string& in);
} // namespace fc
diff --git a/include/fc/container/deque_fwd.hpp b/include/fc/container/deque_fwd.hpp
deleted file mode 100644
index 71df18d..0000000
--- a/include/fc/container/deque_fwd.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-
-#include
-#include
-
-namespace fc {
-
- namespace raw {
- template
- void pack( Stream& s, const std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
- template
- void unpack( Stream& s, std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
- }
-} // namespace fc
diff --git a/include/fc/crypto/base36.hpp b/include/fc/crypto/base36.hpp
index aeb9c35..1cd158e 100644
--- a/include/fc/crypto/base36.hpp
+++ b/include/fc/crypto/base36.hpp
@@ -1,10 +1,9 @@
#pragma once
-#include
-#include
+#include
namespace fc
{
- std::vector from_base36( const fc::string& b36 );
- fc::string to_base36( const std::vector& vec );
- fc::string to_base36( const char* data, size_t len );
+ std::vector from_base36( const std::string& b36 );
+ std::string to_base36( const std::vector& vec );
+ std::string to_base36( const char* data, size_t len );
}
diff --git a/include/fc/crypto/base58.hpp b/include/fc/crypto/base58.hpp
index 2f4fb38..17d52ea 100644
--- a/include/fc/crypto/base58.hpp
+++ b/include/fc/crypto/base58.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include
+#include
#include
namespace fc {
diff --git a/include/fc/crypto/bigint.hpp b/include/fc/crypto/bigint.hpp
index 58703a1..1fdee13 100644
--- a/include/fc/crypto/bigint.hpp
+++ b/include/fc/crypto/bigint.hpp
@@ -1,7 +1,7 @@
#pragma once
#include
-#include
-#include
+#include
+#include
struct bignum_st;
typedef bignum_st BIGNUM;
@@ -55,7 +55,7 @@ namespace fc {
bigint operator--(int);
bigint& operator--();
- operator fc::string()const;
+ operator std::string()const;
// returns bignum as bigendian bytes
operator std::vector()const;
diff --git a/include/fc/crypto/elliptic.hpp b/include/fc/crypto/elliptic.hpp
index 3bc16b7..7ca2ec6 100644
--- a/include/fc/crypto/elliptic.hpp
+++ b/include/fc/crypto/elliptic.hpp
@@ -153,9 +153,9 @@ namespace fc {
extended_key_data serialize_extended() const;
static extended_public_key deserialize( const extended_key_data& data );
- fc::string str() const;
- fc::string to_base58() const { return str(); }
- static extended_public_key from_base58( const fc::string& base58 );
+ std::string str() const;
+ std::string to_base58() const { return str(); }
+ static extended_public_key from_base58( const std::string& base58 );
private:
sha256 c;
@@ -177,10 +177,10 @@ namespace fc {
extended_key_data serialize_extended() const;
static extended_private_key deserialize( const extended_key_data& data );
- fc::string str() const;
- fc::string to_base58() const { return str(); }
- static extended_private_key from_base58( const fc::string& base58 );
- static extended_private_key generate_master( const fc::string& seed );
+ std::string str() const;
+ std::string to_base58() const { return str(); }
+ static extended_private_key from_base58( const std::string& base58 );
+ static extended_private_key generate_master( const std::string& seed );
static extended_private_key generate_master( const char* seed, uint32_t seed_len );
private:
diff --git a/include/fc/crypto/hex.hpp b/include/fc/crypto/hex.hpp
index 201f167..fd60d84 100644
--- a/include/fc/crypto/hex.hpp
+++ b/include/fc/crypto/hex.hpp
@@ -1,15 +1,15 @@
#pragma once
-#include
-#include
+#include
+#include
#include
namespace fc {
uint8_t from_hex( char c );
- fc::string to_hex( const char* d, uint32_t s );
+ std::string to_hex( const char* d, uint32_t s );
std::string to_hex( const std::vector& data );
/**
* @return the number of bytes decoded
*/
- size_t from_hex( const fc::string& hex_str, char* out_data, size_t out_data_len );
+ size_t from_hex( const std::string& hex_str, char* out_data, size_t out_data_len );
}
diff --git a/include/fc/crypto/sha1.hpp b/include/fc/crypto/sha1.hpp
index 01c6ca8..46b76e4 100644
--- a/include/fc/crypto/sha1.hpp
+++ b/include/fc/crypto/sha1.hpp
@@ -1,8 +1,8 @@
#pragma once
#include
-#include
#include
+#include
namespace fc{
@@ -10,16 +10,16 @@ class sha1
{
public:
sha1();
- explicit sha1( const string& hex_str );
+ explicit sha1( const std::string& hex_str );
- string str()const;
- operator string()const;
+ std::string str()const;
+ operator std::string()const;
char* data()const;
size_t data_size()const { return 20; }
static sha1 hash( const char* d, uint32_t dlen );
- static sha1 hash( const string& );
+ static sha1 hash( const std::string& );
template
static sha1 hash( const T& t )
diff --git a/include/fc/crypto/sha224.hpp b/include/fc/crypto/sha224.hpp
index 20d484f..97a36b8 100644
--- a/include/fc/crypto/sha224.hpp
+++ b/include/fc/crypto/sha224.hpp
@@ -2,7 +2,6 @@
#include
#include
#include
-#include
namespace fc
{
diff --git a/include/fc/crypto/sha256.hpp b/include/fc/crypto/sha256.hpp
index 33a2bfc..bdc6737 100644
--- a/include/fc/crypto/sha256.hpp
+++ b/include/fc/crypto/sha256.hpp
@@ -1,6 +1,5 @@
#pragma once
#include
-#include
#include
#include
diff --git a/include/fc/crypto/sha512.hpp b/include/fc/crypto/sha512.hpp
index a6c4a36..9751a56 100644
--- a/include/fc/crypto/sha512.hpp
+++ b/include/fc/crypto/sha512.hpp
@@ -1,6 +1,5 @@
#pragma once
#include
-#include
namespace fc
{
diff --git a/include/fc/exception/exception.hpp b/include/fc/exception/exception.hpp
index ec100f4..b9b6d8e 100644
--- a/include/fc/exception/exception.hpp
+++ b/include/fc/exception/exception.hpp
@@ -240,9 +240,9 @@ namespace fc
TYPE( const std::string& what_value, const fc::log_messages& m ) \
:BASE( m, CODE, BOOST_PP_STRINGIZE(TYPE), what_value ){} \
TYPE( fc::log_message&& m ) \
- :BASE( fc::move(m), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ){}\
+ :BASE( std::move(m), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ){}\
TYPE( fc::log_messages msgs ) \
- :BASE( fc::move( msgs ), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ) {} \
+ :BASE( std::move( msgs ), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ) {} \
TYPE( const TYPE& c ) \
:BASE(c){} \
TYPE( const BASE& c ) \
diff --git a/include/fc/filesystem.hpp b/include/fc/filesystem.hpp
index 38fb74a..bd1aa5d 100644
--- a/include/fc/filesystem.hpp
+++ b/include/fc/filesystem.hpp
@@ -2,7 +2,6 @@
#include
#include
-#include
#include
#include
#include
@@ -228,37 +227,5 @@ namespace fc {
temp_directory(const fc::path& tempFolder = fc::temp_directory_path());
};
-
-#if !defined(__APPLE__)
- // this code is known to work on linux and windows. It may work correctly on mac,
- // or it may need slight tweaks or extra includes. It's disabled now to avoid giving
- // a false sense of security.
-# define FC_HAS_SIMPLE_FILE_LOCK
-#endif
-#ifdef FC_HAS_SIMPLE_FILE_LOCK
- /** simple class which only allows one process to open any given file.
- * approximate usage:
- * int main() {
- * fc::simple_file_lock instance_lock("~/.my_app/.lock");
- * if (!instance_lock.try_lock()) {
- * elog("my_app is already running");
- * return 1;
- * }
- * // do stuff here, file will be unlocked when instance_lock goes out of scope
- * }
- */
- class simple_lock_file
- {
- public:
- simple_lock_file(const path& lock_file_path);
- ~simple_lock_file();
- bool try_lock();
- void unlock();
- private:
- class impl;
- std::unique_ptr my;
- };
-#endif // FC_HAS_SIMPLE_FILE_LOCK
-
}
diff --git a/include/fc/fixed_string.hpp b/include/fc/fixed_string.hpp
deleted file mode 100644
index a91b651..0000000
--- a/include/fc/fixed_string.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#pragma once
-#include
-
-
-namespace fc {
-
-
- /**
- * This class is designed to offer in-place memory allocation of a string up to Length equal to
- * sizeof(Storage).
- *
- * The string will serialize the same way as std::string for variant and raw formats
- * The string will sort according to the comparison operators defined for Storage, this enables effecient
- * sorting.
- */
- template >
- class fixed_string {
- public:
- fixed_string(){}
- fixed_string( const fixed_string& c ):data(c.data){}
-
- fixed_string( const std::string& str ) {
- if( str.size() <= sizeof(data) )
- memcpy( (char*)&data, str.c_str(), str.size() );
- else {
- memcpy( (char*)&data, str.c_str(), sizeof(data) );
- }
- }
- fixed_string( const char* str ) {
- auto l = strlen(str);
- if( l <= sizeof(data) )
- memcpy( (char*)&data, str, l );
- else {
- memcpy( (char*)&data, str, sizeof(data) );
- }
- }
-
- operator std::string()const {
- const char* self = (const char*)&data;
- return std::string( self, self + size() );
- }
-
- uint32_t size()const {
- if( *(((const char*)&data)+sizeof(data) - 1) )
- return sizeof(data);
- return strnlen( (const char*)&data, sizeof(data) );
- }
- uint32_t length()const { return size(); }
-
- fixed_string& operator=( const fixed_string& str ) {
- data = str.data;
- return *this;
- }
- fixed_string& operator=( const char* str ) {
- return *this = fixed_string(str);
- }
-
- fixed_string& operator=( const std::string& str ) {
- if( str.size() <= sizeof(data) ) {
- data = Storage();
- memcpy( (char*)&data, str.c_str(), str.size() );
- }
- else {
- memcpy( (char*)&data, str.c_str(), sizeof(data) );
- }
- return *this;
- }
-
- friend std::string operator + ( const fixed_string& a, const std::string& b ) {
- return std::string(a) + b;
- }
- friend std::string operator + ( const std::string& a, const fixed_string& b ) {
- return a + std::string(b);
- }
-
- friend bool operator < ( const fixed_string& a, const fixed_string& b ) {
- return a.data < b.data;
- }
- friend bool operator <= ( const fixed_string& a, const fixed_string& b ) {
- return a.data <= b.data;
- }
- friend bool operator > ( const fixed_string& a, const fixed_string& b ) {
- return a.data > b.data;
- }
- friend bool operator >= ( const fixed_string& a, const fixed_string& b ) {
- return a.data >= b.data;
- }
- friend bool operator == ( const fixed_string& a, const fixed_string& b ) {
- return a.data == b.data;
- }
- friend bool operator != ( const fixed_string& a, const fixed_string& b ) {
- return a.data != b.data;
- }
- //private:
- Storage data;
- };
-
- namespace raw
- {
- template
- inline void pack( Stream& s, const fc::fixed_string& u, uint32_t _max_depth=FC_PACK_MAX_DEPTH ) {
- FC_ASSERT( _max_depth > 0 );
- unsigned_int size = u.size();
- pack( s, size, _max_depth - 1 );
- s.write( (const char*)&u.data, size );
- }
-
- template
- inline void unpack( Stream& s, fc::fixed_string& u, uint32_t _max_depth=FC_PACK_MAX_DEPTH ) {
- FC_ASSERT( _max_depth > 0 );
- unsigned_int size;
- fc::raw::unpack( s, size, _max_depth - 1 );
- if( size.value > 0 ) {
- if( size.value > sizeof(Storage) ) {
- s.read( (char*)&u.data, sizeof(Storage) );
- char buf[1024];
- size_t left = size.value - sizeof(Storage);
- while( left >= 1024 )
- {
- s.read( buf, 1024 );
- left -= 1024;
- }
- s.read( buf, left );
- } else {
- s.read( (char*)&u.data, size.value );
- }
- }
- }
- }
-}
-
-#include
-namespace fc {
- template
- void to_variant( const fixed_string& s, variant& v, uint32_t max_depth = 1 ) {
- v = std::string(s);
- }
-
- template
- void from_variant( const variant& v, fixed_string& s, uint32_t max_depth = 1 ) {
- s = v.as_string();
- }
-}
diff --git a/include/fc/fwd.hpp b/include/fc/fwd.hpp
index ccf0828..b1a4006 100644
--- a/include/fc/fwd.hpp
+++ b/include/fc/fwd.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include
namespace fc {
@@ -37,7 +36,7 @@ class fwd {
~fwd();
private:
- aligned _store;
+ alignas(Align) char _store[S];
};
diff --git a/include/fc/fwd_impl.hpp b/include/fc/fwd_impl.hpp
index 639085a..1c8155d 100644
--- a/include/fc/fwd_impl.hpp
+++ b/include/fc/fwd_impl.hpp
@@ -3,31 +3,32 @@
#include
#include
#include
+#include
namespace fc {
namespace detail {
template
struct add {
- typedef decltype( *((A*)0) + *((typename fc::remove_reference::type*)0) ) type;
+ typedef decltype( *((A*)0) + *((typename std::remove_reference::type*)0) ) type;
};
template
struct add_eq {
- typedef decltype( *((A*)0) += *((typename fc::remove_reference::type*)0) ) type;
+ typedef decltype( *((A*)0) += *((typename std::remove_reference::type*)0) ) type;
};
template
struct sub {
- typedef decltype( *((A*)0) - *((typename fc::remove_reference::type*)0) ) type;
+ typedef decltype( *((A*)0) - *((typename std::remove_reference::type*)0) ) type;
};
template
struct sub_eq {
- typedef decltype( *((A*)0) -= *((typename fc::remove_reference::type*)0) ) type;
+ typedef decltype( *((A*)0) -= *((typename std::remove_reference::type*)0) ) type;
};
template
struct insert_op {
- typedef decltype( *((A*)0) << *((typename fc::remove_reference::type*)0) ) type;
+ typedef decltype( *((A*)0) << *((typename std::remove_reference::type*)0) ) type;
};
template
struct extract_op {
@@ -91,7 +92,7 @@ namespace fc {
template
fwd::fwd( fwd&& f ){
check_size();
- new (this) T( fc::move(*f) );
+ new (this) T( std::move(*f) );
}
@@ -124,7 +125,7 @@ namespace fc {
template
T& fwd::operator = ( fwd&& u ) {
- return **this = fc::move(*u);
+ return **this = std::move(*u);
}
template
T& fwd::operator = ( const fwd& u ) {
diff --git a/include/fc/interprocess/container.hpp b/include/fc/interprocess/container.hpp
deleted file mode 100644
index a1a4658..0000000
--- a/include/fc/interprocess/container.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace fc {
-
- namespace bip = boost::interprocess;
-
- template
- void to_variant( const bip::deque< T... >& t, fc::variant& v, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- std::vector vars(t.size());
- for( size_t i = 0; i < t.size(); ++i ) {
- to_variant( t[i], vars[i], max_depth );
- }
- v = std::move(vars);
- }
-
- template
- void from_variant( const fc::variant& v, bip::deque< T, A... >& d, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- const variants& vars = v.get_array();
- d.clear();
- d.resize( vars.size() );
- for( uint32_t i = 0; i < vars.size(); ++i ) {
- from_variant( vars[i], d[i], max_depth );
- }
- }
-
- template
- void to_variant( const bip::map< K, V, T... >& var, fc::variant& vo, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- std::vector< variant > vars(var.size());
- size_t i = 0;
- for( auto itr = var.begin(); itr != var.end(); ++itr, ++i )
- vars[i] = fc::variant( *itr, max_depth );
- vo = vars;
- }
-
- template
- void to_variant( const bip::vector< T... >& t, fc::variant& v, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- std::vector vars(t.size());
- for( size_t i = 0; i < t.size(); ++i ) {
- to_variant( t[i], vars[i], max_depth );
- }
- v = std::move(vars);
- }
-
- template
- void from_variant( const fc::variant& v, bip::vector< T, A... >& d, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- const variants& vars = v.get_array();
- d.clear();
- d.resize( vars.size() );
- for( uint32_t i = 0; i < vars.size(); ++i ) {
- from_variant( vars[i], d[i], max_depth );
- }
- }
-
- template
- void to_variant( const bip::set< T... >& t, fc::variant& v, uint32_t max_depth ) {
- FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
- --max_depth;
- std::vector vars;
- vars.reserve(t.size());
- for( const auto& item : t ) {
- vars.emplace_back( variant( item, max_depth ) );
- }
- v = std::move(vars);
- }
-
- template
- void to_variant( const bip::vector& t, fc::variant& v, uint32_t max_depth = 1 )
- {
- if( t.size() )
- v = variant(fc::to_hex(t.data(), t.size()));
- else
- v = "";
- }
-
- template
- void from_variant( const fc::variant& v, bip::vector& d, uint32_t max_depth = 1 )
- {
- auto str = v.as_string();
- d.resize( str.size() / 2 );
- if( d.size() )
- {
- size_t r = fc::from_hex( str, d.data(), d.size() );
- FC_ASSERT( r == d.size() );
- }
- }
-}
diff --git a/include/fc/interprocess/file_mapping.hpp b/include/fc/interprocess/file_mapping.hpp
index e6b6817..369e6fa 100644
--- a/include/fc/interprocess/file_mapping.hpp
+++ b/include/fc/interprocess/file_mapping.hpp
@@ -1,6 +1,7 @@
#pragma once
#include
-#include
+#include
+#include
namespace boost {
namespace interprocess {
@@ -24,7 +25,7 @@ namespace fc {
#ifdef _WIN64
fc::fwd my;
#else
- fc::fwd my;
+ fc::fwd my;
#endif
};
diff --git a/include/fc/interprocess/file_mutex.hpp b/include/fc/interprocess/file_mutex.hpp
deleted file mode 100644
index 6041824..0000000
--- a/include/fc/interprocess/file_mutex.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-#include
-#include
-
-#include
-
-namespace fc {
- class microseconds;
- class time_point;
- class path;
- struct context;
-
- namespace detail { class file_mutex_impl; }
-
- /**
- * The purpose of this class is to support synchronization of
- * processes, threads, and coop-threads.
- *
- * Before grabbing the lock for a thread or coop, a file_mutex will first
- * grab a process-level lock. After grabbing the process level lock, it will
- * synchronize in the same way as a local process lock.
- */
- class file_mutex {
- public:
- file_mutex( const fc::path& filename );
- ~file_mutex();
-
- bool try_lock();
- bool try_lock_for( const microseconds& rel_time );
- bool try_lock_until( const time_point& abs_time );
- void lock();
- void unlock();
-
- void lock_shared();
- void unlock_shared();
- bool try_lock_shared();
-
- int readers()const;
-
- private:
- std::unique_ptr my;
- };
-
-} // namespace fc
diff --git a/include/fc/interprocess/iprocess.hpp b/include/fc/interprocess/iprocess.hpp
deleted file mode 100644
index c7f8c4e..0000000
--- a/include/fc/interprocess/iprocess.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#pragma once
-#include
-#include
-#include
-#include
-#include
-
-namespace fc
-{
- /**
- * @brief abstract interface for interacting with external processes
- *
- * At the very least we have ssh::process and direct child processes, and
- * there may be other processes that need to implement this protocol.
- */
- class iprocess
- {
- public:
- enum exec_opts {
- open_none = 0,
- open_stdin = 0x01,
- open_stdout = 0x02,
- open_stderr = 0x04,
- open_all = open_stdin|open_stdout|open_stderr,
- suppress_console = 0x08
- };
-
- virtual ~iprocess(){}
-
- /**
- *
- * @return *this
- */
- virtual iprocess& exec( const path& exe, std::vector args,
- const path& work_dir = path(), int opts = open_all ) = 0;
-
- /**
- * @return blocks until the process exits
- */
- virtual int result(const microseconds& timeout = microseconds::maximum()) = 0;
-
-
- /**
- * Forcefully kills the process.
- */
- virtual void kill() = 0;
-
- /**
- * @brief returns a stream that writes to the process' stdin
- */
- virtual buffered_ostream_ptr in_stream() = 0;
-
- /**
- * @brief returns a stream that reads from the process' stdout
- */
- virtual buffered_istream_ptr out_stream() = 0;
- /**
- * @brief returns a stream that reads from the process' stderr
- */
- virtual buffered_istream_ptr err_stream() = 0;
-
- };
-
- typedef std::shared_ptr iprocess_ptr;
-
-
-} // namespace fc
diff --git a/include/fc/interprocess/mmap_struct.hpp b/include/fc/interprocess/mmap_struct.hpp
deleted file mode 100644
index 0913deb..0000000
--- a/include/fc/interprocess/mmap_struct.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-#include
-#include
-
-namespace fc
-{
- class path;
- namespace detail
- {
- /**
- * Base class used to hide common implementation details.
- */
- class mmap_struct_base
- {
- public:
- size_t size()const;
- void flush();
-
- protected:
- void open( const fc::path& file, size_t s, bool create );
- std::unique_ptr _file_mapping;
- std::unique_ptr _mapped_region;
- };
- };
-
- /**
- * @class mmap_struct
- * @brief A struct that has been mapped from a file.
- *
- * @note T must be POD
- */
- template
- class mmap_struct : public detail::mmap_struct_base
- {
- public:
- mmap_struct():_mapped_struct(nullptr){}
- /**
- * Create the file if it does not exist or is of the wrong size if create is true, then maps
- * the file to memory.
- *
- * @throw an exception if the file does not exist or is the wrong size and create is false
- */
- void open( const fc::path& file, bool create = false )
- {
- detail::mmap_struct_base::open( file, sizeof(T), create );
- _mapped_struct = (T*)_mapped_region->get_address();
- }
-
- T* operator->() { return _mapped_struct; }
- const T* operator->()const { return _mapped_struct; }
-
- T& operator*() { return *_mapped_struct; }
- const T& operator*()const { return *_mapped_struct; }
-
- private:
- T* _mapped_struct;
- };
-
-}
diff --git a/include/fc/interprocess/process.hpp b/include/fc/interprocess/process.hpp
deleted file mode 100644
index 777c154..0000000
--- a/include/fc/interprocess/process.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-#include
-
-namespace fc {
-
- fc::path find_executable_in_path( const fc::string name );
-
- /**
- * @brief start and manage an local process
- * @note this class implements reference semantics.
- */
- class process : public iprocess
- {
- public:
- process();
- ~process();
-
- virtual iprocess& exec( const fc::path& exe,
- std::vector args,
- const fc::path& work_dir = fc::path(),
- int opts = open_all );
-
-
- virtual int result(const microseconds& timeout = microseconds::maximum());
- virtual void kill();
- virtual fc::buffered_ostream_ptr in_stream();
- virtual fc::buffered_istream_ptr out_stream();
- virtual fc::buffered_istream_ptr err_stream();
-
- class impl;
- private:
- std::unique_ptr my;
- };
-
- typedef std::shared_ptr process_ptr;
-
-} // namespace fc
diff --git a/include/fc/io/console.hpp b/include/fc/io/console.hpp
deleted file mode 100644
index 11a9d47..0000000
--- a/include/fc/io/console.hpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-namespace fc
-{
- /** enables / disables echoing of console input, useful for
- * entering passwords on the console.
- */
- void set_console_echo( bool enable_echo );
-} // namespace fc
diff --git a/include/fc/io/iobuffer.hpp b/include/fc/io/iobuffer.hpp
deleted file mode 100644
index 02f919b..0000000
--- a/include/fc/io/iobuffer.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#pragma once
-#include
-#include
-
-namespace fc
-{
- /**
- * Records the size, but discards the data.
- */
- class size_stream : public virtual fc::ostream
- {
- public:
- size_stream( size_t s = 0):_size(s){}
-
- size_t size()const { return _size; }
- size_t seek( size_t pos ) { return _size = pos; }
-
- virtual size_t writesome( const char* /*ignored buf*/, size_t len )
- {
- _size += len;
- return len;
- }
-
- virtual void close(){}
- virtual void flush(){}
-
- private:
- size_t _size;
- };
-
-
- class iobuffer : public virtual fc::iostream
- {
- public:
- iobuffer( size_t s )
- :_data(s){}
-
- size_t size()const { return _data.size(); }
- size_t pos()const { return _pos; }
- size_t seek( size_t pos )
- {
- return _pos = std::min(_data.size(),pos);
- }
-
- virtual size_t readsome( char* buf, size_t len )
- {
- auto avail = std::min( _data.size()-_pos, len );
- if( avail == 0 ) throw fc::eof_exception();
- memcpy( buf, _data.data()+_pos, avail );
- _pos += avail;
- return avail;
- }
- /**
- * This method may block until at least 1 character is
- * available.
- */
- char peek()const
- {
- if( _pos == _data.size() ) throw fc::eof_exception();
- return _data[_pos];
- }
-
- virtual size_t writesome( const char* buf, size_t len )
- {
- auto avail = std::max( _data.size(), _pos + len );
- _data.resize(avail);
- memcpy( _data.data()+_pos, buf, len );
- _pos += avail;
- return avail;
- }
- char* data() { return _data.data(); }
-
- virtual void close(){}
- virtual void flush(){}
-
- private:
- std::vector _data;
- size_t _pos;
- };
-
-}
diff --git a/include/fc/io/iostream.hpp b/include/fc/io/iostream.hpp
index 1ec632f..9fa592b 100644
--- a/include/fc/io/iostream.hpp
+++ b/include/fc/io/iostream.hpp
@@ -1,6 +1,4 @@
#pragma once
-#include
-#include
#include
namespace fc {
@@ -61,7 +59,7 @@ namespace fc {
class iostream : public virtual ostream, public virtual istream {};
- fc::istream& getline( fc::istream&, fc::string&, char delim = '\n' );
+ fc::istream& getline( fc::istream&, std::string&, char delim = '\n' );
template
ostream& operator<<( ostream& o, char (&array)[N] )
@@ -72,7 +70,7 @@ namespace fc {
ostream& operator<<( ostream& o, char );
ostream& operator<<( ostream& o, const char* v );
ostream& operator<<( ostream& o, const std::string& v );
- ostream& operator<<( ostream& o, const fc::string& v );
+ ostream& operator<<( ostream& o, const std::string& v );
ostream& operator<<( ostream& o, const double& v );
ostream& operator<<( ostream& o, const float& v );
ostream& operator<<( ostream& o, const int64_t& v );
@@ -88,7 +86,7 @@ namespace fc {
#endif
istream& operator>>( istream& o, std::string& v );
- istream& operator>>( istream& o, fc::string& v );
+ istream& operator>>( istream& o, std::string& v );
istream& operator>>( istream& o, char& v );
istream& operator>>( istream& o, double& v );
istream& operator>>( istream& o, float& v );
diff --git a/include/fc/io/json.hpp b/include/fc/io/json.hpp
index f07124b..0f97c40 100644
--- a/include/fc/io/json.hpp
+++ b/include/fc/io/json.hpp
@@ -33,7 +33,7 @@ namespace fc
legacy_generator = 1
};
- static ostream& to_stream( ostream& out, const fc::string& );
+ static ostream& to_stream( ostream& out, const std::string& );
static ostream& to_stream( ostream& out, const variant& v, output_formatting format = stringify_large_ints_and_doubles, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH );
static ostream& to_stream( ostream& out, const variants& v, output_formatting format = stringify_large_ints_and_doubles, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH );
static ostream& to_stream( ostream& out, const variant_object& v, output_formatting format = stringify_large_ints_and_doubles, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH );
diff --git a/include/fc/io/json_relaxed.hpp b/include/fc/io/json_relaxed.hpp
index 9a25666..00893a3 100644
--- a/include/fc/io/json_relaxed.hpp
+++ b/include/fc/io/json_relaxed.hpp
@@ -10,7 +10,6 @@
#include
#include
#include
-#include
//#include
#include
#include
@@ -24,7 +23,7 @@ namespace fc { namespace json_relaxed
variant variant_from_stream( T& in, uint32_t max_depth );
template
- fc::string tokenFromStream( T& in )
+ std::string tokenFromStream( T& in )
{
fc::stringstream token;
try
@@ -81,7 +80,7 @@ namespace fc { namespace json_relaxed
}
template
- fc::string quoteStringFromStream( T& in )
+ std::string quoteStringFromStream( T& in )
{
fc::stringstream token;
try
@@ -107,11 +106,11 @@ namespace fc { namespace json_relaxed
try
{
if( in.peek() != q )
- return fc::string();
+ return std::string();
}
catch( const fc::eof_exception& e )
{
- return fc::string();
+ return std::string();
}
// triple quote processing
@@ -186,7 +185,7 @@ namespace fc { namespace json_relaxed
}
template
- fc::string stringFromStream( T& in )
+ std::string stringFromStream( T& in )
{
try
{
@@ -294,7 +293,7 @@ namespace fc { namespace json_relaxed
};
template
- fc::variant parseInt( const fc::string& token, size_t start )
+ fc::variant parseInt( const std::string& token, size_t start )
{
static const CharValueTable ctbl;
static const uint64_t INT64_MAX_PLUS_ONE = static_cast(INT64_MAX) + 1;
@@ -336,7 +335,7 @@ namespace fc { namespace json_relaxed
}
template
- fc::variant maybeParseInt( const fc::string& token, size_t start )
+ fc::variant maybeParseInt( const std::string& token, size_t start )
{
try
{
@@ -352,7 +351,7 @@ namespace fc { namespace json_relaxed
}
template
- fc::variant parseNumberOrStr( const fc::string& token )
+ fc::variant parseNumberOrStr( const std::string& token )
{ try {
//ilog( (token) );
size_t i = 0, n = token.length();
@@ -588,7 +587,7 @@ namespace fc { namespace json_relaxed
template
variant numberFromStream( T& in )
{ try {
- fc::string token = tokenFromStream(in);
+ std::string token = tokenFromStream(in);
variant result = json_relaxed::parseNumberOrStr( token );
if( strict && !(result.is_int64() || result.is_uint64() || result.is_double()) )
FC_THROW_EXCEPTION( parse_error_exception, "expected: number" );
@@ -598,7 +597,7 @@ namespace fc { namespace json_relaxed
template
variant wordFromStream( T& in )
{
- fc::string token = tokenFromStream(in);
+ std::string token = tokenFromStream(in);
FC_ASSERT( token.length() > 0 );
diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp
index 24aff5e..052110c 100644
--- a/include/fc/io/raw.hpp
+++ b/include/fc/io/raw.hpp
@@ -50,7 +50,7 @@ namespace fc {
fc::raw::unpack( s, what, _max_depth );
fc::raw::unpack( s, msgs, _max_depth );
- e = fc::exception( fc::move(msgs), code, name, what );
+ e = fc::exception( std::move(msgs), code, name, what );
}
template
@@ -206,7 +206,7 @@ namespace fc {
template inline void pack( Stream& s, const char* v, uint32_t _max_depth )
{
FC_ASSERT( _max_depth > 0 );
- fc::raw::pack( s, fc::string(v), _max_depth - 1 );
+ fc::raw::pack( s, std::string(v), _max_depth - 1 );
}
template
@@ -270,18 +270,18 @@ namespace fc {
}
// fc::string
- template inline void pack( Stream& s, const fc::string& v, uint32_t _max_depth ) {
+ template inline void pack( Stream& s, const std::string& v, uint32_t _max_depth ) {
FC_ASSERT( _max_depth > 0 );
fc::raw::pack( s, unsigned_int(v.size()), _max_depth - 1 );
if( v.size() ) s.write( v.c_str(), v.size() );
}
- template inline void unpack( Stream& s, fc::string& v, uint32_t _max_depth ) {
+ template inline void unpack( Stream& s, std::string& v, uint32_t _max_depth ) {
FC_ASSERT( _max_depth > 0 );
std::vector tmp; fc::raw::unpack( s, tmp, _max_depth - 1 );
if( tmp.size() )
- v = fc::string( tmp.data(), tmp.data()+tmp.size() );
- else v = fc::string();
+ v = std::string( tmp.data(), tmp.data()+tmp.size() );
+ else v = std::string();
}
// bool
diff --git a/include/fc/io/raw_fwd.hpp b/include/fc/io/raw_fwd.hpp
index df80768..17f2395 100644
--- a/include/fc/io/raw_fwd.hpp
+++ b/include/fc/io/raw_fwd.hpp
@@ -1,7 +1,6 @@
#pragma once
#include
#include
-#include
#include
#include
#include
@@ -31,15 +30,11 @@ namespace fc {
namespace ip { class endpoint; }
namespace ecc { class public_key; class private_key; }
- template class fixed_string;
namespace raw {
template
inline size_t pack_size( const T& v );
- template inline void pack( Stream& s, const fc::fixed_string& u, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
- template inline void unpack( Stream& s, fc::fixed_string& u, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
-
template
inline void pack( Stream& s, const fc::enum_type& tp, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template
@@ -58,8 +53,8 @@ namespace fc {
//template inline void pack( Stream& s, const flat_set& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
//template inline void unpack( Stream& s, flat_set& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
- //template inline void pack( Stream& s, const std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
- //template inline void unpack( Stream& s, std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
+ template inline void pack( Stream& s, const std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
+ template inline void unpack( Stream& s, std::deque& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template inline void pack( Stream& s, const std::unordered_map& value, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template