本文整理汇总了C++中fc::path::to_native_ansi_path方法的典型用法代码示例。如果您正苦于以下问题:C++ path::to_native_ansi_path方法的具体用法?C++ path::to_native_ansi_path怎么用?C++ path::to_native_ansi_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fc::path
的用法示例。
在下文中一共展示了path::to_native_ansi_path方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db
std::vector<fc::ecc::private_key> import_bitcoin_wallet( const fc::path& wallet_dat, const std::string& passphrase )
{ try {
wallet_db db( wallet_dat.to_native_ansi_path().c_str() );
return collect_keys( db, passphrase );
} FC_RETHROW_EXCEPTIONS( warn, "" ) }
示例2: wallet
std::vector<fc::ecc::private_key> import_electrum_wallet( const fc::path& wallet_dat, const std::string& passphrase )
{ try {
std::vector<fc::ecc::private_key> keys;
electrumwallet wallet( wallet_dat.to_native_ansi_path());
if( !wallet.ok() ) FC_THROW_EXCEPTION( fc::invalid_arg_exception, "invalid electrum wallet");
wallet.derivekeys( passphrase );
return wallet.keys();
} FC_RETHROW_EXCEPTIONS( warn, "" ) }
示例3: open
void open( const fc::path& dir, bool create = true, size_t cache_size = 0 )
{ try {
FC_ASSERT( !is_open(), "Database is already open!" );
ldb::Options opts;
opts.comparator = &_comparer;
opts.create_if_missing = create;
opts.max_open_files = 64;
opts.compression = leveldb::kNoCompression;
if( cache_size > 0 )
{
opts.write_buffer_size = cache_size / 4; // up to two write buffers may be held in memory simultaneously
_cache.reset( leveldb::NewLRUCache( cache_size / 2 ) );
opts.block_cache = _cache.get();
}
if( ldb::kMajorVersion > 1 || ( leveldb::kMajorVersion == 1 && leveldb::kMinorVersion >= 16 ) )
{
// LevelDB versions before 1.16 consider short writes to be corruption. Only trigger error
// on corruption in later versions.
opts.paranoid_checks = true;
}
_read_options.verify_checksums = true;
_iter_options.verify_checksums = true;
_iter_options.fill_cache = false;
_sync_options.sync = true;
// Given path must exist to succeed toNativeAnsiPath
fc::create_directories( dir );
std::string ldbPath = dir.to_native_ansi_path();
ldb::DB* ndb = nullptr;
const auto ntrxstat = ldb::DB::Open( opts, ldbPath.c_str(), &ndb );
if( !ntrxstat.ok() )
{
elog( "Failure opening database: ${db}\nStatus: ${msg}", ("db",dir)("msg",ntrxstat.ToString()) );
FC_THROW_EXCEPTION( level_pod_map_open_failure, "Failure opening database: ${db}\nStatus: ${msg}",
("db",dir)("msg",ntrxstat.ToString()) );
}
_db.reset( ndb );
try_upgrade_db( dir, ndb, fc::get_typename<Value>::name(), sizeof( Value ) );
} FC_CAPTURE_AND_RETHROW( (dir)(create)(cache_size) ) }
示例4: open
void open( const fc::path& dir, bool create = true, size_t cache_size = 0 )
{ try {
ldb::Options opts;
opts.comparator = &_comparer;
opts.create_if_missing = create;
if (cache_size) {
_cache.reset(leveldb::NewLRUCache(cache_size));
opts.block_cache = _cache.get();
}
/*
if( ldb::kMajorVersion > 1 || ( leveldb::kMajorVersion == 1 && leveldb::kMinorVersion >= 16 ) )
{
// LevelDB versions before 1.16 consider short writes to be corruption. Only trigger error
// on corruption in later versions.
opts.paranoid_checks = true;
}
opts.max_open_files = 64;
_read_options.verify_checksums = true;
_iter_options.verify_checksums = true;
_iter_options.fill_cache = false;
_sync_options.sync = true;
*/
/// \warning Given path must exist to succeed toNativeAnsiPath
fc::create_directories(dir);
std::string ldbPath = dir.to_native_ansi_path();
ldb::DB* ndb = nullptr;
auto ntrxstat = ldb::DB::Open( opts, ldbPath.c_str(), &ndb );
if( !ntrxstat.ok() )
{
FC_THROW_EXCEPTION( db_in_use_exception, "Unable to open database ${db}\n\t${msg}",
("db",dir)
("msg",ntrxstat.ToString())
);
}
_db.reset(ndb);
try_upgrade_db( dir,ndb, fc::get_typename<Value>::name(),sizeof(Value) );
} FC_RETHROW_EXCEPTIONS( warn, "" ) }
示例5: open
void mmap_struct_base::open( const fc::path& file, size_t s, bool create )
{
if( !fc::exists( file ) || fc::file_size(file) != s )
{
fc::ofstream out( file );
char buffer[1024];
memset( buffer, 0, sizeof(buffer) );
size_t bytes_left = s;
while( bytes_left > 0 )
{
size_t to_write = std::min<size_t>(bytes_left, sizeof(buffer) );
out.write( buffer, to_write );
bytes_left -= to_write;
}
}
std::string filePath = file.to_native_ansi_path();
_file_mapping.reset( new fc::file_mapping( filePath.c_str(), fc::read_write ) );
_mapped_region.reset( new fc::mapped_region( *_file_mapping, fc::read_write, 0, s ) );
}
示例6: open
void open( const fc::path& dir, bool create = true )
{
ldb::Options opts;
opts.create_if_missing = create;
opts.comparator = & _comparer;
/// \waring Given path must exist to succeed toNativeAnsiPath
fc::create_directories(dir);
std::string ldbPath = dir.to_native_ansi_path();
ldb::DB* ndb = nullptr;
auto ntrxstat = ldb::DB::Open( opts, ldbPath.c_str(), &ndb );
if( !ntrxstat.ok() )
{
FC_THROW_EXCEPTION( db_in_use_exception, "Unable to open database ${db}\n\t${msg}",
("db",dir)
("msg",ntrxstat.ToString())
);
}
_db.reset(ndb);
UpgradeDbIfNecessary(dir,ndb, fc::get_typename<Value>::name(),sizeof(Value));
}