peerplays-fc/include/fc/filesystem.hpp

96 lines
2.9 KiB
C++
Raw Normal View History

2012-12-16 05:31:43 +00:00
#pragma once
2012-09-08 21:37:25 +00:00
#include <fc/string.hpp>
#include <fc/fwd.hpp>
namespace boost {
namespace filesystem {
class path;
2012-10-10 01:40:29 +00:00
class directory_iterator;
2012-12-19 17:23:12 +00:00
class recursive_directory_iterator;
2012-09-08 21:37:25 +00:00
}
}
2012-09-08 06:41:28 +00:00
namespace fc {
2012-09-08 21:37:25 +00:00
class path {
public:
path();
~path();
path( const boost::filesystem::path& );
path( const fc::string& p );
2012-09-09 03:46:19 +00:00
path( const char* );
2012-09-08 21:37:25 +00:00
path( const path& p );
path( path&& p );
path& operator =( const path& );
path& operator =( path&& );
path& operator /=( const fc::path& );
friend path operator /( const fc::path& p, const fc::path& );
2012-09-14 04:56:20 +00:00
friend bool operator ==( const fc::path& p, const fc::path& );
friend bool operator !=( const fc::path& p, const fc::path& );
2012-09-08 21:37:25 +00:00
operator boost::filesystem::path& ();
operator const boost::filesystem::path& ()const;
2012-12-19 17:23:12 +00:00
void replace_extension( const fc::path& e );
2012-10-10 01:40:29 +00:00
fc::path stem()const;
fc::path extension()const;
2012-09-14 04:56:20 +00:00
fc::path filename()const;
2012-10-10 01:40:29 +00:00
fc::path parent_path()const;
2012-09-08 21:37:25 +00:00
fc::string string()const;
2012-11-08 14:44:27 +00:00
fc::string generic_string()const;
2012-09-08 21:37:25 +00:00
private:
2012-12-03 19:51:31 +00:00
fwd<boost::filesystem::path,32> _p;
2012-09-08 21:37:25 +00:00
};
2012-10-10 01:40:29 +00:00
class directory_iterator {
public:
directory_iterator( const fc::path& p );
directory_iterator();
~directory_iterator();
fc::path operator*()const;
directory_iterator& operator++(int);
directory_iterator& operator++();
friend bool operator==( const directory_iterator&, const directory_iterator& );
friend bool operator!=( const directory_iterator&, const directory_iterator& );
private:
fwd<boost::filesystem::directory_iterator,16> _p;
2012-10-10 01:40:29 +00:00
};
2012-12-19 17:23:12 +00:00
class recursive_directory_iterator {
public:
recursive_directory_iterator( const fc::path& p );
recursive_directory_iterator();
~recursive_directory_iterator();
fc::path operator*()const;
recursive_directory_iterator& operator++(int);
recursive_directory_iterator& operator++();
friend bool operator==( const recursive_directory_iterator&, const recursive_directory_iterator& );
friend bool operator!=( const recursive_directory_iterator&, const recursive_directory_iterator& );
private:
fwd<boost::filesystem::recursive_directory_iterator,16> _p;
};
2012-10-10 01:40:29 +00:00
2012-09-14 04:56:20 +00:00
bool exists( const path& p );
bool is_directory( const path& p );
2012-10-10 01:40:29 +00:00
bool is_regular_file( const path& p );
2012-09-14 04:56:20 +00:00
void create_directories( const path& p );
2012-12-12 18:26:41 +00:00
path absolute( const path& p );
2012-11-12 03:04:24 +00:00
path canonical( const path& p );
2012-12-18 19:37:14 +00:00
size_t file_size( const path& p );
2012-11-15 16:55:36 +00:00
bool remove( const path& p );
void copy( const path& from, const path& to );
2012-12-19 17:23:12 +00:00
void create_hard_link( const path& from, const path& to );
path unique_path();
path temp_directory_path();
class value;
void pack( fc::value& , const fc::path& );
void unpack( const fc::value& , fc::path& );
2012-09-08 06:41:28 +00:00
}