expanded filesystem api + value api

This commit is contained in:
Daniel Larimer 2012-11-15 12:08:31 -05:00
parent 34a723cf7a
commit 53bb959c5d
2 changed files with 11 additions and 2 deletions

View file

@ -76,5 +76,5 @@ namespace fc {
bool is_regular_file( const path& p ) { return boost::filesystem::is_regular_file(p); } bool is_regular_file( const path& p ) { return boost::filesystem::is_regular_file(p); }
uint64_t file_size( const path& p ) { return boost::filesystem::file_size(p); } uint64_t file_size( const path& p ) { return boost::filesystem::file_size(p); }
void copy( const path& f, const path& t ) { boost::filesystem::copy( f, t ); } void copy( const path& f, const path& t ) { boost::filesystem::copy( f, t ); }
void remove( const path& f ) { boost::filesystem::remove( f, t ); } bool remove( const path& f ) { return boost::filesystem::remove( f ); }
} }

View file

@ -185,7 +185,7 @@ value::value( char* c ) {
new (holder) detail::value_holder_impl<fc::string>( c ); new (holder) detail::value_holder_impl<fc::string>( c );
} }
value::~value() { value::~value() {
gh(holder)->~value_holder_impl<void>(); gh(holder)->~value_holder();
} }
value::value( int8_t v){ value::value( int8_t v){
static_assert( sizeof(holder) >= sizeof( detail::value_holder_impl<int8_t> ), "size check" ); static_assert( sizeof(holder) >= sizeof( detail::value_holder_impl<int8_t> ), "size check" );
@ -364,5 +364,14 @@ void value::visit( value::const_visitor&& v )const {
auto h = ((detail::value_holder*)&holder[0]); auto h = ((detail::value_holder*)&holder[0]);
h->visit( fc::move(v) ); h->visit( fc::move(v) );
} }
/* sets the subkey key with v and return *this */
value& value::set( const char* key, fc::value v ) {
(*this)[key] = fc::move(v);
return *this;
}
value& value::set( const fc::string& key, fc::value v ) {
(*this)[key.c_str()] = fc::move(v);
return *this;
}
} // namepace fc } // namepace fc