Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the optional class and fix code smells #245

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/fc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ namespace fc {

private:
#ifdef _WIN64
fwd<boost::filesystem::path,40> _p;
fwd<boost::filesystem::path,40> _p;
#else
fwd<boost::filesystem::path,32> _p;
fwd<boost::filesystem::path,32> _p;
#endif
};

Expand Down Expand Up @@ -123,7 +123,7 @@ namespace fc {
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;
fwd<boost::filesystem::directory_iterator,16> _p;
};
class recursive_directory_iterator {
public:
Expand All @@ -141,7 +141,7 @@ namespace fc {
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;
fwd<boost::filesystem::recursive_directory_iterator,16> _p;
};

bool exists( const path& p );
Expand All @@ -158,7 +158,7 @@ namespace fc {
void copy( const path& from, const path& to );
void rename( const path& from, const path& to );
void resize_file( const path& file, size_t s );

// setuid, setgid not implemented.
// translates octal permission like 0755 to S_ stuff defined in sys/stat.h
// no-op on Windows.
Expand All @@ -172,7 +172,7 @@ namespace fc {
/** @return the home directory on Linux and OS X and the Profile directory on Windows */
const path& home_path();

/** @return the home_path() on Linux, home_path()/Library/Application Support/ on OS X,
/** @return the home_path() on Linux, home_path()/Library/Application Support/ on OS X,
* and APPDATA on windows
*/
const path& app_path();
Expand Down
50 changes: 25 additions & 25 deletions include/fc/network/url.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace fc {
namespace detail { class url_impl; }

class mutable_url;

/**
* Used to pass an immutable URL and
* query its parts.
*/
class url
class url
{
public:
url();
Expand All @@ -29,25 +29,25 @@ namespace fc {
url( mutable_url&& c );
url( const mutable_url& c );
~url();

url& operator=( const url& c );
url& operator=( url&& c );

url& operator=( const mutable_url& c );
url& operator=( mutable_url&& c );

bool operator==( const url& cmp )const;

operator string()const;

//// file, ssh, tcp, http, ssl, etc...
string proto()const;
ostring host()const;
ostring user()const;
ostring pass()const;
opath path()const;
ovariant_object args()const;
fc::optional<uint16_t> port()const;
const string& proto()const;
const ostring& host()const;
const ostring& user()const;
const ostring& pass()const;
const opath& path()const;
const ovariant_object& args()const;
const fc::optional<uint16_t>& port()const;

private:
friend class mutable_url;
Expand All @@ -69,25 +69,25 @@ namespace fc {
mutable_url( const url& c );
mutable_url( mutable_url&& c );
~mutable_url();

mutable_url& operator=( const url& c );
mutable_url& operator=( const mutable_url& c );
mutable_url& operator=( mutable_url&& c );

bool operator==( const mutable_url& cmp )const;
bool operator==( const url& cmp )const;

operator string()const;

//// file, ssh, tcp, http, ssl, etc...
string proto()const;
ostring host()const;
ostring user()const;
ostring pass()const;
opath path()const;
ovariant_object args()const;
fc::optional<uint16_t> port()const;
const string& proto()const;
const ostring& host()const;
const ostring& user()const;
const ostring& pass()const;
const opath& path()const;
const ovariant_object& args()const;
const fc::optional<uint16_t>& port()const;

void set_proto( string );
void set_host( string );
void set_user( string );
Expand Down
Loading