本文整理汇总了C++中fc::path::generic_string方法的典型用法代码示例。如果您正苦于以下问题:C++ path::generic_string方法的具体用法?C++ path::generic_string怎么用?C++ path::generic_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fc::path
的用法示例。
在下文中一共展示了path::generic_string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_genesis
signed_transaction load_genesis( const fc::path& csv, uint64_t& total_coins )
{
total_coins = 0;
signed_transaction coinbase;
coinbase.version = 0;
// coinbase.valid_after = 0;
// coinbase.valid_blocks = 0;
std::ifstream in(csv.generic_string().c_str(), std::ios::binary);
std::string line;
std::getline( in, line );
while( in.good() )
{
std::stringstream ss(line);
std::string addr;
uint64_t amnt;
ss >> addr >> amnt;
total_coins += amnt;
coinbase.outputs.push_back(
trx_output( claim_by_pts_output( bts::pts_address(addr) ), amnt, asset::bts) );
std::getline( in, line );
}
return coinbase;
}
示例2: export_link
void cafs::export_link( const cafs::link& l, const fc::path& d ) {
try {
if( !fc::exists( d.parent_path() ) ) {
slog( "create '%s'", d.generic_string().c_str() );
fc::create_directories(d.parent_path());
}
fc::vector<char> ch = get_chunk( l.id );
derandomize( l.seed, ch );
// slog( "derandomized... '%s'", fc::to_hex( ch.data(), 16 ).c_str() );
if( ch.size() == 0 ) {
FC_THROW_MSG( "Empty Chunk!" );
}
switch( ch[0] ) {
case file_data_type: {
slog( "file data..." );
// slog( "post randomized... '%s'", fc::to_hex( ch.data(), ch.size() ).c_str() );
fc::ofstream ofile( d, fc::ofstream::binary );
ofile.write( ch.data()+1, ch.size()-1 );
break;
}
case directory_type: {
slog( "directory data..." );
fc::datastream<const char*> ds(ch.data()+1, ch.size()-1);
directory d;
fc::raw::unpack( ds, d );
slog( "%s", fc::json::to_string( d ).c_str() );
for( auto itr = d.entries.begin(); itr != d.entries.end(); ++itr ) {
slog( "entry: %s", itr->name.c_str() );
/*
fc::vector<char> fdat = get_file( itr->ref );
switch( itr->ref.type ) {
case file_data_type: {
break;
}
case directory_type: {
slog( "%s", fc::json::to_string( fc::raw::unpack<directory>(fdat) ).c_str() );
break;
}
case file_header_type: {
slog( "%s", fc::json::to_string( fc::raw::unpack<file_header>(fdat) ).c_str() );
break;
}
default:
wlog( "Unknown Type %d", int(itr->ref.type) );
}
*/
}
break;
}
case file_header_type: {
slog( "file header..." );
fc::datastream<const char*> ds(ch.data()+1, ch.size()-1);
slog( "data %s", fc::to_hex( ch.data(), 16 ).c_str() );
file_header fh;
fc::raw::unpack( ds, fh);
slog( "%s", fc::json::to_string( fh ).c_str() );
fc::ofstream ofile( d, fc::ofstream::binary );
for( auto i = fh.chunks.begin(); i != fh.chunks.end(); ++i ) {
fc::vector<char> c = get_chunk( i->hash );
derandomize( i->seed, c );
ofile.write( c.data(), c.size() );
}
break;
}
default:
FC_THROW_MSG( "Unknown File Type %s", int(ch[0]) );
}
} catch ( fc::error_report& e ) {
throw FC_REPORT_PUSH( e, "Unable to export link ${link} to ${path}", fc::value().set("link", fc::string(l)).set("path", d.generic_string() ) );
}
}
示例3: pack
inline void pack( Stream& s, const fc::path& tp )
{
fc::raw::pack( s, tp.generic_string() );
}