mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
Added clang-format config and some reformatting.
This commit is contained in:
parent
6d4f5b3539
commit
f46f922ed5
25
.clang-format
Normal file
25
.clang-format
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: Chromium
|
||||||
|
AccessModifierOffset: '-4'
|
||||||
|
IndentWidth: '4'
|
||||||
|
ColumnLimit: 256
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: true
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
BeforeCatch: true
|
||||||
|
BeforeElse: true
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
|
||||||
|
...
|
30
filesystem.h
30
filesystem.h
@ -160,9 +160,9 @@ public:
|
|||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
path(InputIterator first, InputIterator last, format fmt = auto_format);
|
path(InputIterator first, InputIterator last, format fmt = auto_format);
|
||||||
template <class Source, typename = path_from_string<Source>>
|
template <class Source, typename = path_from_string<Source>>
|
||||||
path(const Source& source, const std::locale &loc, format fmt = auto_format);
|
path(const Source& source, const std::locale& loc, format fmt = auto_format);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
path(InputIterator first, InputIterator last, const std::locale &loc, format fmt = auto_format);
|
path(InputIterator first, InputIterator last, const std::locale& loc, format fmt = auto_format);
|
||||||
~path();
|
~path();
|
||||||
|
|
||||||
// 30.10.8.4.2 assignments
|
// 30.10.8.4.2 assignments
|
||||||
@ -555,7 +555,7 @@ public:
|
|||||||
class proxy
|
class proxy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const directory_entry& operator*() const & noexcept { return _dir_entry; }
|
const directory_entry& operator*() const& noexcept { return _dir_entry; }
|
||||||
directory_entry operator*() && noexcept { return std::move(_dir_entry); }
|
directory_entry operator*() && noexcept { return std::move(_dir_entry); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1648,21 +1648,21 @@ inline path::path(string_type&& source, format fmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Source, typename>
|
template <class Source, typename>
|
||||||
inline path::path(const Source& source, const std::locale &loc, format fmt)
|
inline path::path(const Source& source, const std::locale& loc, format fmt)
|
||||||
: path(source, fmt)
|
: path(source, fmt)
|
||||||
{
|
{
|
||||||
std::string locName = loc.name();
|
std::string locName = loc.name();
|
||||||
if (!(locName.length() >= 5 && (locName.substr(locName.length()-5) == "UTF-8" || locName.substr(locName.length()-5) == "utf-8"))) {
|
if (!(locName.length() >= 5 && (locName.substr(locName.length() - 5) == "UTF-8" || locName.substr(locName.length() - 5) == "utf-8"))) {
|
||||||
throw filesystem_error("This implementation only supports UTF-8 locales!", path(_path), detail::make_error_code(detail::portable_error::not_supported));
|
throw filesystem_error("This implementation only supports UTF-8 locales!", path(_path), detail::make_error_code(detail::portable_error::not_supported));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
inline path::path(InputIterator first, InputIterator last, const std::locale &loc, format fmt)
|
inline path::path(InputIterator first, InputIterator last, const std::locale& loc, format fmt)
|
||||||
: path(std::basic_string<typename std::iterator_traits<InputIterator>::value_type>(first, last), fmt)
|
: path(std::basic_string<typename std::iterator_traits<InputIterator>::value_type>(first, last), fmt)
|
||||||
{
|
{
|
||||||
std::string locName = loc.name();
|
std::string locName = loc.name();
|
||||||
if (!(locName.length() >= 5 && (locName.substr(locName.length()-5) == "UTF-8" || locName.substr(locName.length()-5) == "utf-8"))) {
|
if (!(locName.length() >= 5 && (locName.substr(locName.length() - 5) == "UTF-8" || locName.substr(locName.length() - 5) == "utf-8"))) {
|
||||||
throw filesystem_error("This implementation only supports UTF-8 locales!", path(_path), detail::make_error_code(detail::portable_error::not_supported));
|
throw filesystem_error("This implementation only supports UTF-8 locales!", path(_path), detail::make_error_code(detail::portable_error::not_supported));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2695,7 +2695,7 @@ inline void copy(const path& from, const path& to, copy_options options, std::er
|
|||||||
std::error_code tec;
|
std::error_code tec;
|
||||||
file_status fs_from, fs_to;
|
file_status fs_from, fs_to;
|
||||||
ec.clear();
|
ec.clear();
|
||||||
if ((options & (copy_options::skip_symlinks|copy_options::copy_symlinks|copy_options::create_symlinks)) != copy_options::none) {
|
if ((options & (copy_options::skip_symlinks | copy_options::copy_symlinks | copy_options::create_symlinks)) != copy_options::none) {
|
||||||
fs_from = symlink_status(from, ec);
|
fs_from = symlink_status(from, ec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2707,7 +2707,7 @@ inline void copy(const path& from, const path& to, copy_options options, std::er
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((options & (copy_options::skip_symlinks|copy_options::create_symlinks)) != copy_options::none) {
|
if ((options & (copy_options::skip_symlinks | copy_options::create_symlinks)) != copy_options::none) {
|
||||||
fs_to = symlink_status(to, tec);
|
fs_to = symlink_status(to, tec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2750,7 +2750,7 @@ inline void copy(const path& from, const path& to, copy_options options, std::er
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const directory_entry& x : directory_iterator(from)) {
|
for (const directory_entry& x : directory_iterator(from)) {
|
||||||
copy(x.path(), to/x.path().filename(), options | static_cast<copy_options>(0x8000));
|
copy(x.path(), to / x.path().filename(), options | static_cast<copy_options>(0x8000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -3476,13 +3476,13 @@ inline void permissions(const path& p, perms prms, perm_options opts, std::error
|
|||||||
}
|
}
|
||||||
#ifdef GHC_OS_WINDOWS
|
#ifdef GHC_OS_WINDOWS
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
if ((prms & perms::owner_read) == perms::owner_read) {
|
if ((prms & perms::owner_read) == perms::owner_read) {
|
||||||
mode |= _S_IREAD;
|
mode |= _S_IREAD;
|
||||||
}
|
}
|
||||||
if ((prms & perms::owner_write) == perms::owner_write) {
|
if ((prms & perms::owner_write) == perms::owner_write) {
|
||||||
mode |= _S_IWRITE;
|
mode |= _S_IWRITE;
|
||||||
}
|
}
|
||||||
if(::_wchmod(p.wstring().c_str(), mode) != 0) {
|
if (::_wchmod(p.wstring().c_str(), mode) != 0) {
|
||||||
ec = std::error_code(::GetLastError(), std::system_category());
|
ec = std::error_code(::GetLastError(), std::system_category());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -4187,8 +4187,8 @@ inline bool directory_entry::operator>=(const directory_entry& rhs) const noexce
|
|||||||
return _path >= rhs._path;
|
return _path >= rhs._path;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 30.10.13 class directory_iterator
|
// 30.10.13 class directory_iterator
|
||||||
|
|
||||||
#ifdef GHC_OS_WINDOWS
|
#ifdef GHC_OS_WINDOWS
|
||||||
class directory_iterator::impl
|
class directory_iterator::impl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user