Updates from BitShares FC #22

Closed
nathanielhourt wants to merge 693 commits from dapp-support into latest-fc
17 changed files with 43 additions and 53 deletions
Showing only changes of commit 58e16e543d - Show all commits

View file

@ -1,8 +1,8 @@
#pragma once
#include <fc/shared_ptr.hpp>
#include <fc/filesystem.hpp>
#include <fc/io/iostream.hpp>
#include <fstream>
#include <memory>
namespace fc {
class path;
@ -21,7 +21,7 @@ namespace fc {
private:
class impl;
fc::shared_ptr<impl> my;
std::shared_ptr<impl> my;
};
class ifstream : virtual public istream {
@ -44,7 +44,7 @@ namespace fc {
bool eof()const;
private:
class impl;
fc::shared_ptr<impl> my;
std::shared_ptr<impl> my;
};
/**

View file

@ -3,14 +3,11 @@
#include <fc/io/raw_variant.hpp>
#include <fc/reflect/reflect.hpp>
#include <fc/io/datastream.hpp>
#include <fc/io/varint.hpp>
#include <fc/optional.hpp>
#include <fc/fwd.hpp>
#include <fc/array.hpp>
#include <fc/time.hpp>
#include <fc/filesystem.hpp>
#include <fc/exception/exception.hpp>
#include <fc/safe.hpp>
#include <fc/io/raw_fwd.hpp>
#include <algorithm>
#include <map>

View file

@ -6,6 +6,7 @@
#include <fc/array.hpp>
#include <fc/safe.hpp>
#include <deque>
#include <memory>
#include <vector>
#include <string>
#include <unordered_set>
@ -132,14 +133,14 @@ namespace fc {
template<typename Stream, size_t N> inline void pack( Stream& s, const fc::array<unsigned char,N>& v, uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template<typename Stream, size_t N> inline void unpack( Stream& s, fc::array<unsigned char,N>& v, uint32_t _max_depth=FC_PACK_MAX_DEPTH);
template<typename Stream, typename T> inline void pack( Stream& s, const shared_ptr<T>& v,
template<typename Stream, typename T> inline void pack( Stream& s, const std::shared_ptr<T>& v,
uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template<typename Stream, typename T> inline void unpack( Stream& s, shared_ptr<T>& v,
template<typename Stream, typename T> inline void unpack( Stream& s, std::shared_ptr<T>& v,
uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template<typename Stream, typename T> inline void pack( Stream& s, const shared_ptr<const T>& v,
template<typename Stream, typename T> inline void pack( Stream& s, const std::shared_ptr<const T>& v,
uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template<typename Stream, typename T> inline void unpack( Stream& s, shared_ptr<const T>& v,
template<typename Stream, typename T> inline void unpack( Stream& s, std::shared_ptr<const T>& v,
uint32_t _max_depth=FC_PACK_MAX_DEPTH );
template<typename Stream> inline void pack( Stream& s, const bool& v, uint32_t _max_depth=FC_PACK_MAX_DEPTH );

View file

@ -1,5 +1,5 @@
#pragma once
#include <fc/shared_ptr.hpp>
#include <memory>
#include <string>
namespace fc {
@ -7,31 +7,31 @@ namespace fc {
class log_message;
class variant;
class appender_factory : public fc::retainable {
class appender_factory {
public:
typedef fc::shared_ptr<appender_factory> ptr;
typedef std::shared_ptr<appender_factory> ptr;
virtual ~appender_factory(){};
virtual fc::shared_ptr<appender> create( const variant& args ) = 0;
virtual std::shared_ptr<appender> create( const variant& args ) = 0;
};
namespace detail {
template<typename T>
class appender_factory_impl : public appender_factory {
public:
virtual fc::shared_ptr<appender> create( const variant& args ) {
return fc::shared_ptr<appender>(new T(args));
virtual std::shared_ptr<appender> create( const variant& args ) {
return std::shared_ptr<appender>(new T(args));
}
};
}
class appender : public fc::retainable {
class appender {
public:
typedef fc::shared_ptr<appender> ptr;
typedef std::shared_ptr<appender> ptr;
template<typename T>
static bool register_appender(const std::string& type) {
return register_appender( type, new detail::appender_factory_impl<T>() );
return register_appender( type, appender_factory::ptr( new detail::appender_factory_impl<T>() ) );
}
static appender::ptr create( const std::string& name, const std::string& type, const variant& args );

View file

@ -26,7 +26,7 @@ class file_appender : public appender {
private:
class impl;
fc::shared_ptr<impl> my;
std::unique_ptr<impl> my;
};
} // namespace fc

View file

@ -24,7 +24,7 @@ namespace fc
private:
class impl;
fc::shared_ptr<impl> my;
std::unique_ptr<impl> my;
};
} // namespace fc

View file

@ -6,7 +6,6 @@
#include <fc/config.hpp>
#include <fc/time.hpp>
#include <fc/variant_object.hpp>
#include <fc/shared_ptr.hpp>
#include <memory>
#include <string>

View file

@ -1,14 +1,12 @@
#pragma once
#include <fc/config.hpp>
#include <fc/time.hpp>
#include <fc/shared_ptr.hpp>
#include <fc/log/appender.hpp>
#include <fc/log/log_message.hpp>
#include <memory>
namespace fc
{
class appender;
/**
*
*
@ -43,16 +41,16 @@ namespace fc
void set_name( const std::string& n );
const std::string& name()const;
void add_appender( const fc::shared_ptr<appender>& a );
std::vector<fc::shared_ptr<appender> > get_appenders()const;
void remove_appender( const fc::shared_ptr<appender>& a );
void add_appender( const appender::ptr& a );
std::vector<appender::ptr> get_appenders()const;
void remove_appender( const appender::ptr& a );
bool is_enabled( log_level e )const;
void log( log_message m );
private:
class impl;
fc::shared_ptr<impl> my;
std::shared_ptr<impl> my;
};
} // namespace fc

View file

@ -1,6 +1,5 @@
#pragma once
#include <fc/network/http/connection.hpp>
#include <fc/shared_ptr.hpp>
#include <functional>
#include <memory>
@ -28,7 +27,7 @@ namespace fc { namespace http {
class impl;
response();
response( const fc::shared_ptr<impl>& my);
response( const std::shared_ptr<impl>& my);
response( const response& r);
response( response&& r );
~response();
@ -42,7 +41,7 @@ namespace fc { namespace http {
void write( const char* data, uint64_t len )const;
private:
fc::shared_ptr<impl> my;
std::shared_ptr<impl> my;
};
void listen( const fc::ip::endpoint& p );

View file

@ -1,5 +1,4 @@
#pragma once
#include <fc/shared_ptr.hpp>
#include <memory>
namespace fc {
@ -35,8 +34,8 @@ namespace fc {
fc::ip::endpoint local_endpoint()const;
private:
class impl;
fc::shared_ptr<impl> my;
class impl;
std::shared_ptr<impl> my;
};
}

View file

@ -1,6 +1,6 @@
#pragma once
#include <fc/variant.hpp>
#include <fc/shared_ptr.hpp>
#include <memory>
namespace fc
{

View file

@ -13,11 +13,11 @@
using namespace std;
namespace fc {
class ofstream::impl : public fc::retainable {
class ofstream::impl {
public:
boost::filesystem::ofstream ofs;
};
class ifstream::impl : public fc::retainable {
class ifstream::impl {
public:
boost::filesystem::ifstream ifs;
};

View file

@ -13,7 +13,7 @@
namespace fc {
class file_appender::impl : public fc::retainable
class file_appender::impl
{
public:
config cfg;

View file

@ -20,7 +20,7 @@
namespace fc
{
class gelf_appender::impl : public retainable
class gelf_appender::impl
{
public:
config cfg;

View file

@ -11,7 +11,7 @@
namespace fc {
class logger::impl : public fc::retainable {
class logger::impl {
public:
impl()
:_parent(nullptr),_enabled(true),_additivity(false),_level(log_level::warn){}
@ -54,8 +54,8 @@ namespace fc {
std::swap(my,l.my);
return *this;
}
bool operator==( const logger& l, std::nullptr_t ) { return !l.my; }
bool operator!=( const logger& l, std::nullptr_t ) { return l.my; }
bool operator==( const logger& l, std::nullptr_t ) { return !(bool)l.my; }
bool operator!=( const logger& l, std::nullptr_t ) { return (bool)l.my; }
bool logger::is_enabled( log_level e )const {
return e >= my->_level;
@ -96,13 +96,10 @@ namespace fc {
log_level logger::get_log_level()const { return my->_level; }
logger& logger::set_log_level(log_level ll) { my->_level = ll; return *this; }
void logger::add_appender( const fc::shared_ptr<appender>& a )
void logger::add_appender( const appender::ptr& a )
{ my->_appenders.push_back(a); }
// void logger::remove_appender( const fc::shared_ptr<appender>& a )
// { my->_appenders.erase(a); }
std::vector<fc::shared_ptr<appender> > logger::get_appenders()const
std::vector<appender::ptr> logger::get_appenders()const
{
return my->_appenders;
}

View file

@ -9,7 +9,7 @@
namespace fc { namespace http {
class server::response::impl : public fc::retainable
class server::response::impl
{
public:
impl( const fc::http::connection_ptr& c, const std::function<void()>& cont = std::function<void()>() )
@ -112,7 +112,7 @@ namespace fc { namespace http {
{
try
{
http::server::response rep( fc::shared_ptr<response::impl>( new response::impl(c) ) );
http::server::response rep( std::shared_ptr<response::impl>( new response::impl(c) ) );
request req = c->read_request();
if( do_on_req )
do_on_req( req, rep );
@ -155,7 +155,7 @@ namespace fc { namespace http {
server::response::response(){}
server::response::response( const server::response& s ):my(s.my){}
server::response::response( server::response&& s ):my(std::move(s.my)){}
server::response::response( const fc::shared_ptr<server::response::impl>& m ):my(m){}
server::response::response( const std::shared_ptr<server::response::impl>& m ):my(m){}
server::response& server::response::operator=(const server::response& s) { my = s.my; return *this; }
server::response& server::response::operator=(server::response&& s) { std::swap(my,s.my); return *this; }

View file

@ -6,7 +6,7 @@
namespace fc {
class udp_socket::impl : public fc::retainable {
class udp_socket::impl {
public:
impl():_sock( fc::asio::default_io_service() ){}
~impl(){