adding support for more value serialization
This commit is contained in:
parent
12b637970e
commit
6471249bb8
5 changed files with 26 additions and 4 deletions
|
|
@ -69,5 +69,9 @@ namespace fc {
|
|||
|
||||
path unique_path();
|
||||
path temp_directory_path();
|
||||
|
||||
class value;
|
||||
void pack( fc::value& , const fc::path& );
|
||||
void unpack( const fc::value& , fc::path& );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#ifndef _FC_IP_HPP_
|
||||
#define _FC_IP_HPP_
|
||||
#pragma once
|
||||
#include <fc/string.hpp>
|
||||
|
||||
namespace fc {
|
||||
|
|
@ -47,5 +46,7 @@ namespace fc {
|
|||
uint32_t _port;
|
||||
};
|
||||
}
|
||||
class value;
|
||||
void pack( fc::value& , const fc::ip::endpoint& );
|
||||
void unpack( const fc::value& , fc::ip::endpoint& );
|
||||
}
|
||||
#endif // _FC_ENDPOINT_HPP_
|
||||
|
|
|
|||
|
|
@ -2,8 +2,15 @@
|
|||
#include <fc/fwd_impl.hpp>
|
||||
#include <fc/utility.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <fc/value_cast.hpp>
|
||||
|
||||
namespace fc {
|
||||
void pack( fc::value& v, const fc::path& s ) {
|
||||
v = s.generic_string();
|
||||
}
|
||||
void unpack( const fc::value& v, fc::path& s ) {
|
||||
s = path(fc::value_cast<fc::string>(v));
|
||||
}
|
||||
|
||||
path::path(){}
|
||||
path::~path(){};
|
||||
|
|
|
|||
11
src/ip.cpp
11
src/ip.cpp
|
|
@ -1,4 +1,5 @@
|
|||
#include <fc/ip.hpp>
|
||||
#include <fc/value_cast.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
|
|
@ -53,4 +54,12 @@ namespace fc { namespace ip {
|
|||
return string(_ip) + ':' + fc::string(boost::lexical_cast<std::string>(_port).c_str());
|
||||
}
|
||||
|
||||
} }
|
||||
}
|
||||
void pack( fc::value& v, const fc::ip::endpoint& s ) {
|
||||
v = fc::string(s);
|
||||
}
|
||||
void unpack( const fc::value& v, fc::ip::endpoint& s ) {
|
||||
s = fc::ip::endpoint::from_string(fc::value_cast<fc::string>(v));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <fc/exception.hpp>
|
||||
#include <fc/raw.hpp>
|
||||
#include <fc/value.hpp>
|
||||
#include <fc/value_cast.hpp>
|
||||
#include <fc/base58.hpp>
|
||||
#include <iostream>
|
||||
#include <fc/sha1.hpp>
|
||||
|
|
|
|||
Loading…
Reference in a new issue