47 lines
1.3 KiB
C++
Executable File
47 lines
1.3 KiB
C++
Executable File
#include "file.hpp"
|
|
|
|
namespace rrr
|
|
{
|
|
file::file(std::filesystem::path path_, file_type type_, bool is_link_, bool is_hidden_) :
|
|
id{ ++hack::utils::counter<int>::id }, path{ path_ }, type{ type_ }, is_link{ is_link_ }, is_hidden{ is_hidden_ } {}
|
|
|
|
file::file(file&& f) :
|
|
id{ ++hack::utils::counter<int>::id }, path{ std::move(f.path) },
|
|
type{ std::move(f.type) }, is_link{ std::move(f.is_link) },
|
|
is_hidden{ std::move(f.is_hidden) }, is_mark{ std::move(f.is_mark) } {}
|
|
|
|
file::file(const file& f) :
|
|
id{ ++hack::utils::counter<int>::id }, path{ f.path }, type{ f.type }, is_link{ f.is_link },
|
|
is_hidden{ f.is_hidden }, is_mark{ f.is_mark } {}
|
|
|
|
file& file::operator=(const file& other)
|
|
{
|
|
if (this == &other) return *this;
|
|
|
|
path = other.path;
|
|
type = other.type;
|
|
is_link = other.is_link;
|
|
is_hidden = other.is_hidden;
|
|
is_mark = other.is_mark;
|
|
id = ++hack::utils::counter<int>::id ;
|
|
return *this;
|
|
}
|
|
|
|
bool file::operator<(const file& other) const
|
|
{
|
|
return path.string().compare(other.path.string()) < 0;
|
|
}
|
|
|
|
bool file::operator==(const file& f) const
|
|
{
|
|
if (this->path == f.path)
|
|
return true;
|
|
return false;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& os, const file& f)
|
|
{
|
|
return os << f.path << std::endl;
|
|
}
|
|
}
|