util/{Const,Writable}Buffer: drop "_type" from type names
Behave like STL.
This commit is contained in:
parent
53f8053188
commit
4937d77cb6
@ -48,7 +48,7 @@
|
||||
|
||||
gcc_pure
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept
|
||||
SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept
|
||||
{
|
||||
return name_fs[0] == '.' &&
|
||||
(name_fs[1] == 0 ||
|
||||
|
@ -38,23 +38,22 @@ class AllocatedPath {
|
||||
using Traits = PathTraitsFS;
|
||||
typedef Traits::string string;
|
||||
typedef Traits::value_type value_type;
|
||||
typedef Traits::pointer_type pointer_type;
|
||||
typedef Traits::const_pointer_type const_pointer_type;
|
||||
typedef Traits::pointer pointer;
|
||||
typedef Traits::const_pointer const_pointer;
|
||||
|
||||
string value;
|
||||
|
||||
explicit AllocatedPath(const_pointer_type _value) noexcept
|
||||
explicit AllocatedPath(const_pointer _value) noexcept
|
||||
:value(_value) {}
|
||||
|
||||
AllocatedPath(const_pointer_type _begin,
|
||||
const_pointer_type _end) noexcept
|
||||
AllocatedPath(const_pointer _begin, const_pointer _end) noexcept
|
||||
:value(_begin, _end) {}
|
||||
|
||||
AllocatedPath(string &&_value) noexcept
|
||||
:value(std::move(_value)) {}
|
||||
|
||||
static AllocatedPath Build(const_pointer_type a, size_t a_size,
|
||||
const_pointer_type b, size_t b_size) noexcept {
|
||||
static AllocatedPath Build(const_pointer a, size_t a_size,
|
||||
const_pointer b, size_t b_size) noexcept {
|
||||
return AllocatedPath(Traits::Build(a, a_size, b, b_size));
|
||||
}
|
||||
public:
|
||||
@ -91,14 +90,13 @@ public:
|
||||
* Join two path components with the path separator.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static AllocatedPath Build(const_pointer_type a,
|
||||
const_pointer_type b) noexcept {
|
||||
static AllocatedPath Build(const_pointer a, const_pointer b) noexcept {
|
||||
return Build(a, Traits::GetLength(a),
|
||||
b, Traits::GetLength(b));
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static AllocatedPath Build(Path a, const_pointer_type b) noexcept {
|
||||
static AllocatedPath Build(Path a, const_pointer b) noexcept {
|
||||
return Build(a.c_str(), b);
|
||||
}
|
||||
|
||||
@ -108,7 +106,7 @@ public:
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static AllocatedPath Build(const_pointer_type a,
|
||||
static AllocatedPath Build(const_pointer a,
|
||||
const AllocatedPath &b) noexcept {
|
||||
return Build(a, Traits::GetLength(a),
|
||||
b.value.c_str(), b.value.size());
|
||||
@ -116,7 +114,7 @@ public:
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static AllocatedPath Build(const AllocatedPath &a,
|
||||
const_pointer_type b) noexcept {
|
||||
const_pointer b) noexcept {
|
||||
return Build(a.value.c_str(), a.value.size(),
|
||||
b, Traits::GetLength(b));
|
||||
}
|
||||
@ -138,13 +136,13 @@ public:
|
||||
* character set to a #Path instance.
|
||||
*/
|
||||
gcc_pure
|
||||
static AllocatedPath FromFS(const_pointer_type fs) noexcept {
|
||||
static AllocatedPath FromFS(const_pointer fs) noexcept {
|
||||
return AllocatedPath(fs);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
static AllocatedPath FromFS(const_pointer_type _begin,
|
||||
const_pointer_type _end) noexcept {
|
||||
static AllocatedPath FromFS(const_pointer _begin,
|
||||
const_pointer _end) noexcept {
|
||||
return AllocatedPath(_begin, _end);
|
||||
}
|
||||
|
||||
@ -247,7 +245,7 @@ public:
|
||||
* instance ends.
|
||||
*/
|
||||
gcc_pure
|
||||
const_pointer_type c_str() const noexcept {
|
||||
const_pointer c_str() const noexcept {
|
||||
return value.c_str();
|
||||
}
|
||||
|
||||
@ -256,7 +254,7 @@ public:
|
||||
* null-terminated.
|
||||
*/
|
||||
gcc_pure
|
||||
const_pointer_type data() const noexcept {
|
||||
const_pointer data() const noexcept {
|
||||
return value.data();
|
||||
}
|
||||
|
||||
@ -290,12 +288,12 @@ public:
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure
|
||||
const_pointer_type Relative(Path other_fs) const noexcept {
|
||||
const_pointer Relative(Path other_fs) const noexcept {
|
||||
return Traits::Relative(c_str(), other_fs.c_str());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
const_pointer_type GetSuffix() const noexcept {
|
||||
const_pointer GetSuffix() const noexcept {
|
||||
return ((Path)*this).GetSuffix();
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ FixSeparators(PathTraitsUTF8::string &&s)
|
||||
}
|
||||
|
||||
PathTraitsUTF8::string
|
||||
PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
|
||||
PathToUTF8(PathTraitsFS::const_pointer path_fs)
|
||||
{
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
@ -117,7 +117,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
|
||||
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
|
||||
|
||||
PathTraitsFS::string
|
||||
PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
|
||||
PathFromUTF8(PathTraitsUTF8::const_pointer path_utf8)
|
||||
{
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
|
@ -46,7 +46,7 @@ DeinitFSCharset() noexcept;
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
PathTraitsUTF8::string
|
||||
PathToUTF8(PathTraitsFS::const_pointer_type path_fs);
|
||||
PathToUTF8(PathTraitsFS::const_pointer path_fs);
|
||||
|
||||
/**
|
||||
* Convert the path from UTF-8.
|
||||
@ -55,6 +55,6 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs);
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
PathTraitsFS::string
|
||||
PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8);
|
||||
PathFromUTF8(PathTraitsUTF8::const_pointer path_utf8);
|
||||
|
||||
#endif
|
||||
|
@ -36,10 +36,10 @@ class DirectoryReader {
|
||||
bool first = true;
|
||||
|
||||
class MakeWildcardPath {
|
||||
PathTraitsFS::pointer_type path;
|
||||
PathTraitsFS::pointer path;
|
||||
|
||||
public:
|
||||
MakeWildcardPath(PathTraitsFS::const_pointer_type _path) {
|
||||
MakeWildcardPath(PathTraitsFS::const_pointer _path) {
|
||||
auto l = _tcslen(_path);
|
||||
path = new PathTraitsFS::value_type[l + 3];
|
||||
_tcscpy(path, _path);
|
||||
@ -52,7 +52,7 @@ class DirectoryReader {
|
||||
delete[] path;
|
||||
}
|
||||
|
||||
operator PathTraitsFS::const_pointer_type() const {
|
||||
operator PathTraitsFS::const_pointer() const {
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ class AllocatedPath;
|
||||
* Wrapper for fopen() that uses #Path names.
|
||||
*/
|
||||
static inline FILE *
|
||||
FOpen(Path file, PathTraitsFS::const_pointer_type mode)
|
||||
FOpen(Path file, PathTraitsFS::const_pointer mode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return _tfopen(file.c_str(), mode);
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "system/Error.hxx"
|
||||
|
||||
gcc_pure
|
||||
static PathTraitsFS::pointer_type
|
||||
FindSlash(PathTraitsFS::pointer_type p, size_t i) noexcept
|
||||
static PathTraitsFS::pointer
|
||||
FindSlash(PathTraitsFS::pointer p, size_t i) noexcept
|
||||
{
|
||||
for (; i > 0; --i)
|
||||
if (p[i] == '/')
|
||||
@ -38,7 +38,7 @@ LookupFile(Path pathname)
|
||||
PathTraitsFS::string buffer(pathname.c_str());
|
||||
size_t idx = buffer.size();
|
||||
|
||||
PathTraitsFS::pointer_type slash = nullptr;
|
||||
PathTraitsFS::pointer slash = nullptr;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
|
@ -41,7 +41,7 @@ class NarrowPath {
|
||||
#else
|
||||
typedef StringPointer<> Value;
|
||||
#endif
|
||||
typedef typename Value::const_pointer_type const_pointer_type;
|
||||
typedef typename Value::const_pointer const_pointer;
|
||||
|
||||
Value value;
|
||||
|
||||
@ -57,11 +57,11 @@ public:
|
||||
explicit NarrowPath(Path _path):value(_path.c_str()) {}
|
||||
#endif
|
||||
|
||||
operator const_pointer_type() const {
|
||||
operator const_pointer() const {
|
||||
return c_str();
|
||||
}
|
||||
|
||||
const_pointer_type c_str() const {
|
||||
const_pointer c_str() const {
|
||||
return value.c_str();
|
||||
}
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ Path::ToUTF8Throw() const
|
||||
return ::PathToUTF8(c_str());
|
||||
}
|
||||
|
||||
Path::const_pointer_type
|
||||
Path::const_pointer
|
||||
Path::GetSuffix() const noexcept
|
||||
{
|
||||
const auto base = GetBase().c_str();
|
||||
|
@ -39,7 +39,7 @@ class Path : public PathTraitsFS::Pointer {
|
||||
using Traits = PathTraitsFS;
|
||||
typedef Traits::Pointer Base;
|
||||
|
||||
constexpr Path(const_pointer_type _value) noexcept:Base(_value) {}
|
||||
constexpr Path(const_pointer _value) noexcept:Base(_value) {}
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -59,7 +59,7 @@ public:
|
||||
* Create a new instance pointing to the specified path
|
||||
* string.
|
||||
*/
|
||||
static constexpr Path FromFS(const_pointer_type fs) noexcept {
|
||||
static constexpr Path FromFS(const_pointer fs) noexcept {
|
||||
return Path(fs);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* pointer is invalidated whenever the value of life of this
|
||||
* instance ends.
|
||||
*/
|
||||
constexpr const_pointer_type c_str() const noexcept {
|
||||
constexpr const_pointer c_str() const noexcept {
|
||||
return Base::c_str();
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
* Returns a pointer to the raw value, not necessarily
|
||||
* null-terminated.
|
||||
*/
|
||||
constexpr const_pointer_type data() const noexcept {
|
||||
constexpr const_pointer data() const noexcept {
|
||||
return c_str();
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public:
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure
|
||||
const_pointer_type Relative(Path other_fs) const noexcept {
|
||||
const_pointer Relative(Path other_fs) const noexcept {
|
||||
return Traits::Relative(c_str(), other_fs.c_str());
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
const_pointer_type GetSuffix() const noexcept;
|
||||
const_pointer GetSuffix() const noexcept;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -87,20 +87,20 @@ public:
|
||||
|
||||
#ifndef ANDROID
|
||||
static inline bool
|
||||
IsValidPathString(PathTraitsFS::const_pointer_type path)
|
||||
IsValidPathString(PathTraitsFS::const_pointer path)
|
||||
{
|
||||
return path != nullptr && *path != '\0';
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidDir(PathTraitsFS::const_pointer_type dir)
|
||||
IsValidDir(PathTraitsFS::const_pointer dir)
|
||||
{
|
||||
return PathTraitsFS::IsAbsolute(dir) &&
|
||||
DirectoryExists(Path::FromFS(dir));
|
||||
}
|
||||
|
||||
static inline AllocatedPath
|
||||
SafePathFromFS(PathTraitsFS::const_pointer_type dir)
|
||||
SafePathFromFS(PathTraitsFS::const_pointer dir)
|
||||
{
|
||||
if (IsValidPathString(dir) && IsValidDir(dir))
|
||||
return AllocatedPath::FromFS(dir);
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
template<typename Traits>
|
||||
typename Traits::string
|
||||
BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size,
|
||||
typename Traits::const_pointer_type b, size_t b_size) noexcept
|
||||
BuildPathImpl(typename Traits::const_pointer a, size_t a_size,
|
||||
typename Traits::const_pointer b, size_t b_size) noexcept
|
||||
{
|
||||
assert(a != nullptr);
|
||||
assert(b != nullptr);
|
||||
@ -52,15 +52,15 @@ BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size,
|
||||
}
|
||||
|
||||
template<typename Traits>
|
||||
typename Traits::const_pointer_type
|
||||
GetBasePathImpl(typename Traits::const_pointer_type p) noexcept
|
||||
typename Traits::const_pointer
|
||||
GetBasePathImpl(typename Traits::const_pointer p) noexcept
|
||||
{
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
#endif
|
||||
|
||||
typename Traits::const_pointer_type sep = Traits::FindLastSeparator(p);
|
||||
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
||||
return sep != nullptr
|
||||
? sep + 1
|
||||
: p;
|
||||
@ -68,14 +68,14 @@ GetBasePathImpl(typename Traits::const_pointer_type p) noexcept
|
||||
|
||||
template<typename Traits>
|
||||
typename Traits::string
|
||||
GetParentPathImpl(typename Traits::const_pointer_type p) noexcept
|
||||
GetParentPathImpl(typename Traits::const_pointer p) noexcept
|
||||
{
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
#endif
|
||||
|
||||
typename Traits::const_pointer_type sep = Traits::FindLastSeparator(p);
|
||||
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
||||
if (sep == nullptr)
|
||||
return typename Traits::string(Traits::CURRENT_DIRECTORY);
|
||||
if (sep == p)
|
||||
@ -88,9 +88,9 @@ GetParentPathImpl(typename Traits::const_pointer_type p) noexcept
|
||||
}
|
||||
|
||||
template<typename Traits>
|
||||
typename Traits::const_pointer_type
|
||||
RelativePathImpl(typename Traits::const_pointer_type base,
|
||||
typename Traits::const_pointer_type other) noexcept
|
||||
typename Traits::const_pointer
|
||||
RelativePathImpl(typename Traits::const_pointer base,
|
||||
typename Traits::const_pointer other) noexcept
|
||||
{
|
||||
assert(base != nullptr);
|
||||
assert(other != nullptr);
|
||||
@ -122,32 +122,32 @@ RelativePathImpl(typename Traits::const_pointer_type base,
|
||||
}
|
||||
|
||||
PathTraitsFS::string
|
||||
PathTraitsFS::Build(const_pointer_type a, size_t a_size,
|
||||
const_pointer_type b, size_t b_size) noexcept
|
||||
PathTraitsFS::Build(const_pointer a, size_t a_size,
|
||||
const_pointer b, size_t b_size) noexcept
|
||||
{
|
||||
return BuildPathImpl<PathTraitsFS>(a, a_size, b, b_size);
|
||||
}
|
||||
|
||||
PathTraitsFS::const_pointer_type
|
||||
PathTraitsFS::GetBase(PathTraitsFS::const_pointer_type p) noexcept
|
||||
PathTraitsFS::const_pointer
|
||||
PathTraitsFS::GetBase(PathTraitsFS::const_pointer p) noexcept
|
||||
{
|
||||
return GetBasePathImpl<PathTraitsFS>(p);
|
||||
}
|
||||
|
||||
PathTraitsFS::string
|
||||
PathTraitsFS::GetParent(PathTraitsFS::const_pointer_type p) noexcept
|
||||
PathTraitsFS::GetParent(PathTraitsFS::const_pointer p) noexcept
|
||||
{
|
||||
return GetParentPathImpl<PathTraitsFS>(p);
|
||||
}
|
||||
|
||||
PathTraitsFS::const_pointer_type
|
||||
PathTraitsFS::Relative(const_pointer_type base, const_pointer_type other) noexcept
|
||||
PathTraitsFS::const_pointer
|
||||
PathTraitsFS::Relative(const_pointer base, const_pointer other) noexcept
|
||||
{
|
||||
return RelativePathImpl<PathTraitsFS>(base, other);
|
||||
}
|
||||
|
||||
PathTraitsFS::string
|
||||
PathTraitsFS::Apply(const_pointer_type base, const_pointer_type path) noexcept
|
||||
PathTraitsFS::Apply(const_pointer base, const_pointer path) noexcept
|
||||
{
|
||||
// TODO: support the Windows syntax (absolute path with or without drive, drive with relative path)
|
||||
|
||||
@ -161,27 +161,27 @@ PathTraitsFS::Apply(const_pointer_type base, const_pointer_type path) noexcept
|
||||
}
|
||||
|
||||
PathTraitsUTF8::string
|
||||
PathTraitsUTF8::Build(const_pointer_type a, size_t a_size,
|
||||
const_pointer_type b, size_t b_size) noexcept
|
||||
PathTraitsUTF8::Build(const_pointer a, size_t a_size,
|
||||
const_pointer b, size_t b_size) noexcept
|
||||
{
|
||||
return BuildPathImpl<PathTraitsUTF8>(a, a_size, b, b_size);
|
||||
}
|
||||
|
||||
PathTraitsUTF8::const_pointer_type
|
||||
PathTraitsUTF8::GetBase(const_pointer_type p) noexcept
|
||||
PathTraitsUTF8::const_pointer
|
||||
PathTraitsUTF8::GetBase(const_pointer p) noexcept
|
||||
{
|
||||
return GetBasePathImpl<PathTraitsUTF8>(p);
|
||||
}
|
||||
|
||||
PathTraitsUTF8::string
|
||||
PathTraitsUTF8::GetParent(const_pointer_type p) noexcept
|
||||
PathTraitsUTF8::GetParent(const_pointer p) noexcept
|
||||
{
|
||||
return GetParentPathImpl<PathTraitsUTF8>(p);
|
||||
}
|
||||
|
||||
PathTraitsUTF8::const_pointer_type
|
||||
PathTraitsUTF8::Relative(const_pointer_type base,
|
||||
const_pointer_type other) noexcept
|
||||
PathTraitsUTF8::const_pointer
|
||||
PathTraitsUTF8::Relative(const_pointer base,
|
||||
const_pointer other) noexcept
|
||||
{
|
||||
return RelativePathImpl<PathTraitsUTF8>(base, other);
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ struct PathTraitsFS {
|
||||
typedef string::traits_type char_traits;
|
||||
typedef char_traits::char_type value_type;
|
||||
typedef StringPointer<value_type> Pointer;
|
||||
typedef Pointer::pointer_type pointer_type;
|
||||
typedef Pointer::const_pointer_type const_pointer_type;
|
||||
typedef Pointer::pointer pointer;
|
||||
typedef Pointer::const_pointer const_pointer;
|
||||
|
||||
#ifdef _WIN32
|
||||
static constexpr value_type SEPARATOR = '\\';
|
||||
@ -60,7 +60,7 @@ struct PathTraitsFS {
|
||||
static constexpr value_type SEPARATOR = '/';
|
||||
#endif
|
||||
|
||||
static constexpr const_pointer_type CURRENT_DIRECTORY = PATH_LITERAL(".");
|
||||
static constexpr const_pointer CURRENT_DIRECTORY = PATH_LITERAL(".");
|
||||
|
||||
static constexpr bool IsSeparator(value_type ch) noexcept {
|
||||
return
|
||||
@ -71,14 +71,14 @@ struct PathTraitsFS {
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
|
||||
static const_pointer FindLastSeparator(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
const_pointer_type pos = p + GetLength(p);
|
||||
const_pointer pos = p + GetLength(p);
|
||||
while (p != pos && !IsSeparator(*pos))
|
||||
--pos;
|
||||
return IsSeparator(*pos) ? pos : nullptr;
|
||||
@ -89,13 +89,13 @@ struct PathTraitsFS {
|
||||
|
||||
#ifdef _WIN32
|
||||
gcc_pure gcc_nonnull_all
|
||||
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
||||
static constexpr bool IsDrive(const_pointer p) noexcept {
|
||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||
}
|
||||
#endif
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static bool IsAbsolute(const_pointer_type p) noexcept {
|
||||
static bool IsAbsolute(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
@ -109,12 +109,12 @@ struct PathTraitsFS {
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static size_t GetLength(const_pointer_type p) noexcept {
|
||||
static size_t GetLength(const_pointer p) noexcept {
|
||||
return StringLength(p);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
|
||||
static const_pointer Find(const_pointer p, value_type ch) noexcept {
|
||||
return StringFind(p, ch);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ struct PathTraitsFS {
|
||||
* The return value points inside the given string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type GetBase(const_pointer_type p) noexcept;
|
||||
static const_pointer GetBase(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the "parent" file name of the given native path.
|
||||
@ -131,7 +131,7 @@ struct PathTraitsFS {
|
||||
* separator in the given input string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string GetParent(const_pointer_type p) noexcept;
|
||||
static string GetParent(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the relative part of the given path to this
|
||||
@ -140,8 +140,8 @@ struct PathTraitsFS {
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type Relative(const_pointer_type base,
|
||||
const_pointer_type other) noexcept;
|
||||
static const_pointer Relative(const_pointer base,
|
||||
const_pointer other) noexcept;
|
||||
|
||||
/**
|
||||
* Constructs the path from the given components.
|
||||
@ -150,11 +150,11 @@ struct PathTraitsFS {
|
||||
* If both components are empty strings, empty string is returned.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string Build(const_pointer_type a, size_t a_size,
|
||||
const_pointer_type b, size_t b_size) noexcept;
|
||||
static string Build(const_pointer a, size_t a_size,
|
||||
const_pointer b, size_t b_size) noexcept;
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string Build(const_pointer_type a, const_pointer_type b) noexcept {
|
||||
static string Build(const_pointer a, const_pointer b) noexcept {
|
||||
return Build(a, GetLength(a), b, GetLength(b));
|
||||
}
|
||||
|
||||
@ -163,8 +163,8 @@ struct PathTraitsFS {
|
||||
* base, and return the concatenated path.
|
||||
*/
|
||||
gcc_pure
|
||||
static string Apply(const_pointer_type base,
|
||||
const_pointer_type path) noexcept;
|
||||
static string Apply(const_pointer base,
|
||||
const_pointer path) noexcept;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -174,19 +174,19 @@ struct PathTraitsUTF8 {
|
||||
typedef std::string string;
|
||||
typedef string::traits_type char_traits;
|
||||
typedef char_traits::char_type value_type;
|
||||
typedef value_type *pointer_type;
|
||||
typedef const value_type *const_pointer_type;
|
||||
typedef value_type *pointer;
|
||||
typedef const value_type *const_pointer;
|
||||
|
||||
static constexpr value_type SEPARATOR = '/';
|
||||
|
||||
static constexpr const_pointer_type CURRENT_DIRECTORY = ".";
|
||||
static constexpr const_pointer CURRENT_DIRECTORY = ".";
|
||||
|
||||
static constexpr bool IsSeparator(value_type ch) {
|
||||
return ch == SEPARATOR;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
|
||||
static const_pointer FindLastSeparator(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
@ -197,13 +197,13 @@ struct PathTraitsUTF8 {
|
||||
|
||||
#ifdef _WIN32
|
||||
gcc_pure gcc_nonnull_all
|
||||
static constexpr bool IsDrive(const_pointer_type p) noexcept {
|
||||
static constexpr bool IsDrive(const_pointer p) noexcept {
|
||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||
}
|
||||
#endif
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static bool IsAbsolute(const_pointer_type p) noexcept {
|
||||
static bool IsAbsolute(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
assert(p != nullptr);
|
||||
@ -217,12 +217,12 @@ struct PathTraitsUTF8 {
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static size_t GetLength(const_pointer_type p) noexcept {
|
||||
static size_t GetLength(const_pointer p) noexcept {
|
||||
return StringLength(p);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
|
||||
static const_pointer Find(const_pointer p, value_type ch) noexcept {
|
||||
return StringFind(p, ch);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ struct PathTraitsUTF8 {
|
||||
* The return value points inside the given string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type GetBase(const_pointer_type p) noexcept;
|
||||
static const_pointer GetBase(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the "parent" file name of the given UTF-8 path.
|
||||
@ -239,7 +239,7 @@ struct PathTraitsUTF8 {
|
||||
* separator in the given input string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string GetParent(const_pointer_type p) noexcept;
|
||||
static string GetParent(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the relative part of the given path to this
|
||||
@ -248,8 +248,8 @@ struct PathTraitsUTF8 {
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static const_pointer_type Relative(const_pointer_type base,
|
||||
const_pointer_type other) noexcept;
|
||||
static const_pointer Relative(const_pointer base,
|
||||
const_pointer other) noexcept;
|
||||
|
||||
/**
|
||||
* Constructs the path from the given components.
|
||||
@ -258,11 +258,11 @@ struct PathTraitsUTF8 {
|
||||
* If both components are empty strings, empty string is returned.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string Build(const_pointer_type a, size_t a_size,
|
||||
const_pointer_type b, size_t b_size) noexcept;
|
||||
static string Build(const_pointer a, size_t a_size,
|
||||
const_pointer b, size_t b_size) noexcept;
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static string Build(const_pointer_type a, const_pointer_type b) noexcept {
|
||||
static string Build(const_pointer a, const_pointer b) noexcept {
|
||||
return Build(a, GetLength(a), b, GetLength(b));
|
||||
}
|
||||
};
|
||||
|
@ -32,12 +32,12 @@ template<typename T>
|
||||
class CancellablePointer
|
||||
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
||||
public:
|
||||
typedef T *pointer_type;
|
||||
typedef T *pointer;
|
||||
typedef T &reference_type;
|
||||
typedef const T &const_reference_type;
|
||||
|
||||
private:
|
||||
pointer_type p;
|
||||
pointer p;
|
||||
|
||||
public:
|
||||
explicit CancellablePointer(reference_type _p):p(&_p) {}
|
||||
|
@ -146,7 +146,7 @@ LocalStorage::OpenDirectory(const char *uri_utf8)
|
||||
|
||||
gcc_pure
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept
|
||||
SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept
|
||||
{
|
||||
return name_fs[0] == '.' &&
|
||||
(name_fs[1] == 0 ||
|
||||
|
@ -307,7 +307,7 @@ NfsStorage::GetInfo(const char *uri_utf8, bool follow)
|
||||
|
||||
gcc_pure
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer_type name) noexcept
|
||||
SkipNameFS(PathTraitsFS::const_pointer name) noexcept
|
||||
{
|
||||
return name[0] == '.' &&
|
||||
(name[1] == 0 ||
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
template<>
|
||||
AllocatedString<char>
|
||||
AllocatedString<char>::Duplicate(const_pointer_type src)
|
||||
AllocatedString<char>::Duplicate(const_pointer src)
|
||||
{
|
||||
return Duplicate(src, StringLength(src));
|
||||
}
|
||||
@ -41,7 +41,7 @@ AllocatedString<char>::Duplicate(const_pointer_type src)
|
||||
|
||||
template<>
|
||||
AllocatedString<wchar_t>
|
||||
AllocatedString<wchar_t>::Duplicate(const_pointer_type src)
|
||||
AllocatedString<wchar_t>::Duplicate(const_pointer src)
|
||||
{
|
||||
return Duplicate(src, StringLength(src));
|
||||
}
|
||||
|
@ -46,16 +46,16 @@ public:
|
||||
typedef typename StringPointer<T>::value_type value_type;
|
||||
typedef typename StringPointer<T>::reference_type reference_type;
|
||||
typedef typename StringPointer<T>::const_reference_type const_reference_type;
|
||||
typedef typename StringPointer<T>::pointer_type pointer_type;
|
||||
typedef typename StringPointer<T>::const_pointer_type const_pointer_type;
|
||||
typedef typename StringPointer<T>::pointer pointer;
|
||||
typedef typename StringPointer<T>::const_pointer const_pointer;
|
||||
typedef std::size_t size_type;
|
||||
|
||||
static constexpr value_type SENTINEL = '\0';
|
||||
|
||||
private:
|
||||
pointer_type value;
|
||||
pointer value;
|
||||
|
||||
explicit AllocatedString(pointer_type _value)
|
||||
explicit AllocatedString(pointer _value)
|
||||
:value(_value) {}
|
||||
|
||||
public:
|
||||
@ -68,7 +68,7 @@ public:
|
||||
delete[] value;
|
||||
}
|
||||
|
||||
static AllocatedString Donate(pointer_type value) {
|
||||
static AllocatedString Donate(pointer value) {
|
||||
return AllocatedString(value);
|
||||
}
|
||||
|
||||
@ -82,16 +82,16 @@ public:
|
||||
return Donate(p);
|
||||
}
|
||||
|
||||
static AllocatedString Duplicate(const_pointer_type src);
|
||||
static AllocatedString Duplicate(const_pointer src);
|
||||
|
||||
static AllocatedString Duplicate(const_pointer_type begin,
|
||||
const_pointer_type end) {
|
||||
static AllocatedString Duplicate(const_pointer begin,
|
||||
const_pointer end) {
|
||||
auto p = new value_type[end - begin + 1];
|
||||
*std::copy(begin, end, p) = SENTINEL;
|
||||
return Donate(p);
|
||||
}
|
||||
|
||||
static AllocatedString Duplicate(const_pointer_type begin,
|
||||
static AllocatedString Duplicate(const_pointer begin,
|
||||
size_type length) {
|
||||
auto p = new value_type[length + 1];
|
||||
*std::copy_n(begin, length, p) = SENTINEL;
|
||||
@ -115,7 +115,7 @@ public:
|
||||
return value == nullptr;
|
||||
}
|
||||
|
||||
constexpr const_pointer_type c_str() const {
|
||||
constexpr const_pointer c_str() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public:
|
||||
return *value == SENTINEL;
|
||||
}
|
||||
|
||||
constexpr pointer_type data() const {
|
||||
constexpr pointer data() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ public:
|
||||
return value[i];
|
||||
}
|
||||
|
||||
pointer_type Steal() {
|
||||
pointer Steal() {
|
||||
return std::exchange(value, nullptr);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ struct FunctionTraits<R(Args...) noexcept(NoExcept)> {
|
||||
* A function pointer type which describes the "plain"
|
||||
* function signature.
|
||||
*/
|
||||
typedef R (*pointer_type)(Args...)
|
||||
typedef R (*pointer)(Args...)
|
||||
#if !GCC_OLDER_THAN(7,0)
|
||||
noexcept(NoExcept)
|
||||
#endif
|
||||
@ -289,12 +289,12 @@ struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function>
|
||||
: BindFunctionWrapperGenerator2<NoExcept, P, function, R, Args...> {
|
||||
};
|
||||
|
||||
template<typename T, typename T::pointer_type function>
|
||||
template<typename T, typename T::pointer function>
|
||||
typename MethodWrapperWithSignature<typename T::function_type>::function_pointer
|
||||
MakeBindFunctionWrapper() noexcept
|
||||
{
|
||||
return BindFunctionWrapperGenerator<typename T::function_type,
|
||||
typename T::pointer_type,
|
||||
typename T::pointer,
|
||||
function>::Invoke;
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ BindMethod(T &_instance) noexcept
|
||||
* @param T the #FunctionTraits class
|
||||
* @param function the function pointer
|
||||
*/
|
||||
template<typename T, typename T::pointer_type function>
|
||||
template<typename T, typename T::pointer function>
|
||||
constexpr BoundMethod<typename T::function_type>
|
||||
BindFunction() noexcept
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ template<typename T>
|
||||
class CircularBuffer {
|
||||
public:
|
||||
typedef WritableBuffer<T> Range;
|
||||
typedef typename Range::pointer_type pointer_type;
|
||||
typedef typename Range::pointer pointer;
|
||||
typedef typename Range::size_type size_type;
|
||||
|
||||
protected:
|
||||
@ -66,10 +66,10 @@ protected:
|
||||
size_type tail;
|
||||
|
||||
const size_type capacity;
|
||||
const pointer_type data;
|
||||
const pointer data;
|
||||
|
||||
public:
|
||||
constexpr CircularBuffer(pointer_type _data, size_type _capacity)
|
||||
constexpr CircularBuffer(pointer _data, size_type _capacity)
|
||||
:head(0), tail(0), capacity(_capacity), data(_data) {}
|
||||
|
||||
CircularBuffer(const CircularBuffer &other) = delete;
|
||||
|
@ -45,12 +45,12 @@ template<>
|
||||
struct ConstBuffer<void> {
|
||||
typedef std::size_t size_type;
|
||||
typedef void value_type;
|
||||
typedef const void *pointer_type;
|
||||
typedef pointer_type const_pointer_type;
|
||||
typedef pointer_type iterator;
|
||||
typedef pointer_type const_iterator;
|
||||
typedef const void *pointer;
|
||||
typedef pointer const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef pointer const_iterator;
|
||||
|
||||
pointer_type data;
|
||||
pointer data;
|
||||
size_type size;
|
||||
|
||||
ConstBuffer() = default;
|
||||
@ -58,7 +58,7 @@ struct ConstBuffer<void> {
|
||||
constexpr ConstBuffer(std::nullptr_t) noexcept
|
||||
:data(nullptr), size(0) {}
|
||||
|
||||
constexpr ConstBuffer(pointer_type _data, size_type _size) noexcept
|
||||
constexpr ConstBuffer(pointer _data, size_type _size) noexcept
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr static ConstBuffer<void> FromVoid(ConstBuffer<void> other) noexcept {
|
||||
@ -95,12 +95,12 @@ struct ConstBuffer {
|
||||
typedef T value_type;
|
||||
typedef const T &reference_type;
|
||||
typedef reference_type const_reference_type;
|
||||
typedef const T *pointer_type;
|
||||
typedef pointer_type const_pointer_type;
|
||||
typedef pointer_type iterator;
|
||||
typedef pointer_type const_iterator;
|
||||
typedef const T *pointer;
|
||||
typedef pointer const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef pointer const_iterator;
|
||||
|
||||
pointer_type data;
|
||||
pointer data;
|
||||
size_type size;
|
||||
|
||||
ConstBuffer() = default;
|
||||
@ -108,10 +108,10 @@ struct ConstBuffer {
|
||||
constexpr ConstBuffer(std::nullptr_t) noexcept
|
||||
:data(nullptr), size(0) {}
|
||||
|
||||
constexpr ConstBuffer(pointer_type _data, size_type _size) noexcept
|
||||
constexpr ConstBuffer(pointer _data, size_type _size) noexcept
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr ConstBuffer(pointer_type _data, pointer_type _end) noexcept
|
||||
constexpr ConstBuffer(pointer _data, pointer _end) noexcept
|
||||
:data(_data), size(_end - _data) {}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ struct ConstBuffer {
|
||||
*/
|
||||
static constexpr ConstBuffer<T> FromVoidFloor(ConstBuffer<void> other) noexcept {
|
||||
static_assert(sizeof(T) > 0, "Empty base type");
|
||||
return ConstBuffer<T>(pointer_type(other.data),
|
||||
return ConstBuffer<T>(pointer(other.data),
|
||||
other.size / sizeof(T));
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ struct ConstBuffer {
|
||||
* Move the front pointer to the given address, and adjust the
|
||||
* size attribute to retain the old end address.
|
||||
*/
|
||||
void MoveFront(pointer_type new_data) noexcept {
|
||||
void MoveFront(pointer new_data) noexcept {
|
||||
#ifndef NDEBUG
|
||||
assert(IsNull() == (new_data == nullptr));
|
||||
assert(new_data <= end());
|
||||
@ -296,7 +296,7 @@ struct ConstBuffer {
|
||||
* Move the end pointer to the given address (by adjusting the
|
||||
* size).
|
||||
*/
|
||||
void SetEnd(pointer_type new_end) noexcept {
|
||||
void SetEnd(pointer new_end) noexcept {
|
||||
#ifndef NDEBUG
|
||||
assert(IsNull() == (new_end == nullptr));
|
||||
assert(new_end >= begin());
|
||||
|
@ -41,8 +41,8 @@ template<typename T>
|
||||
class DynamicFifoBuffer : protected ForeignFifoBuffer<T> {
|
||||
public:
|
||||
using typename ForeignFifoBuffer<T>::size_type;
|
||||
using typename ForeignFifoBuffer<T>::pointer_type;
|
||||
using typename ForeignFifoBuffer<T>::const_pointer_type;
|
||||
using typename ForeignFifoBuffer<T>::pointer;
|
||||
using typename ForeignFifoBuffer<T>::const_pointer;
|
||||
using typename ForeignFifoBuffer<T>::Range;
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* Write data to the buffer, growing it as needed. Returns a
|
||||
* writable pointer.
|
||||
*/
|
||||
pointer_type Write(size_type n) noexcept {
|
||||
pointer Write(size_type n) noexcept {
|
||||
WantWrite(n);
|
||||
return Write().data;
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
/**
|
||||
* Append data to the buffer, growing it as needed.
|
||||
*/
|
||||
void Append(const_pointer_type p, size_type n) noexcept {
|
||||
void Append(const_pointer p, size_type n) noexcept {
|
||||
std::copy_n(p, n, Write(n));
|
||||
Append(n);
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ class ForeignFifoBuffer {
|
||||
public:
|
||||
using size_type = std::size_t;
|
||||
using Range = WritableBuffer<T>;
|
||||
using pointer_type = typename Range::pointer_type;
|
||||
using const_pointer_type = typename Range::const_pointer_type;
|
||||
using pointer = typename Range::pointer;
|
||||
using const_pointer = typename Range::const_pointer;
|
||||
|
||||
protected:
|
||||
size_type head = 0, tail = 0, capacity;
|
||||
@ -211,7 +211,7 @@ public:
|
||||
head += n;
|
||||
}
|
||||
|
||||
size_type Read(pointer_type p, size_type n) noexcept {
|
||||
size_type Read(pointer p, size_type n) noexcept {
|
||||
auto range = Read();
|
||||
if (n > range.size)
|
||||
n = range.size;
|
||||
|
@ -39,17 +39,17 @@ public:
|
||||
typedef T value_type;
|
||||
typedef T &reference_type;
|
||||
typedef const T &const_reference_type;
|
||||
typedef T *pointer_type;
|
||||
typedef const T *const_pointer_type;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
|
||||
static constexpr value_type SENTINEL = '\0';
|
||||
|
||||
private:
|
||||
const_pointer_type value;
|
||||
const_pointer value;
|
||||
|
||||
public:
|
||||
StringPointer() = default;
|
||||
constexpr StringPointer(const_pointer_type _value)
|
||||
constexpr StringPointer(const_pointer _value)
|
||||
:value(_value) {}
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ public:
|
||||
return value == nullptr;
|
||||
}
|
||||
|
||||
constexpr const_pointer_type c_str() const {
|
||||
constexpr const_pointer c_str() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ template<typename T>
|
||||
struct BasicStringView : ConstBuffer<T> {
|
||||
using typename ConstBuffer<T>::size_type;
|
||||
using typename ConstBuffer<T>::value_type;
|
||||
using typename ConstBuffer<T>::pointer_type;
|
||||
using typename ConstBuffer<T>::pointer;
|
||||
|
||||
using ConstBuffer<T>::data;
|
||||
using ConstBuffer<T>::size;
|
||||
@ -57,14 +57,13 @@ struct BasicStringView : ConstBuffer<T> {
|
||||
explicit constexpr BasicStringView(ConstBuffer<void> src)
|
||||
:ConstBuffer<T>(ConstBuffer<T>::FromVoid(src)) {}
|
||||
|
||||
constexpr BasicStringView(pointer_type _data, size_type _size) noexcept
|
||||
constexpr BasicStringView(pointer _data, size_type _size) noexcept
|
||||
:ConstBuffer<T>(_data, _size) {}
|
||||
|
||||
constexpr BasicStringView(pointer_type _begin,
|
||||
pointer_type _end) noexcept
|
||||
constexpr BasicStringView(pointer _begin, pointer _end) noexcept
|
||||
:ConstBuffer<T>(_begin, _end - _begin) {}
|
||||
|
||||
BasicStringView(pointer_type _data) noexcept
|
||||
BasicStringView(pointer _data) noexcept
|
||||
:ConstBuffer<T>(_data,
|
||||
_data != nullptr ? StringLength(_data) : 0) {}
|
||||
|
||||
@ -90,12 +89,12 @@ struct BasicStringView : ConstBuffer<T> {
|
||||
using ConstBuffer<T>::skip_front;
|
||||
|
||||
gcc_pure
|
||||
pointer_type Find(value_type ch) const noexcept {
|
||||
pointer Find(value_type ch) const noexcept {
|
||||
return StringFind(data, ch, this->size);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
pointer_type FindLast(value_type ch) const noexcept {
|
||||
pointer FindLast(value_type ch) const noexcept {
|
||||
return StringFindLast(data, ch, size);
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,12 @@ template<>
|
||||
struct WritableBuffer<void> {
|
||||
typedef std::size_t size_type;
|
||||
typedef void value_type;
|
||||
typedef void *pointer_type;
|
||||
typedef const void *const_pointer_type;
|
||||
typedef pointer_type iterator;
|
||||
typedef const_pointer_type const_iterator;
|
||||
typedef void *pointer;
|
||||
typedef const void *const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
|
||||
pointer_type data;
|
||||
pointer data;
|
||||
size_type size;
|
||||
|
||||
WritableBuffer() = default;
|
||||
@ -59,7 +59,7 @@ struct WritableBuffer<void> {
|
||||
constexpr WritableBuffer(std::nullptr_t) noexcept
|
||||
:data(nullptr), size(0) {}
|
||||
|
||||
constexpr WritableBuffer(pointer_type _data, size_type _size) noexcept
|
||||
constexpr WritableBuffer(pointer _data, size_type _size) noexcept
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr operator ConstBuffer<void>() const noexcept {
|
||||
@ -94,12 +94,12 @@ struct WritableBuffer {
|
||||
typedef T value_type;
|
||||
typedef T &reference_type;
|
||||
typedef const T &const_reference_type;
|
||||
typedef T *pointer_type;
|
||||
typedef const T *const_pointer_type;
|
||||
typedef pointer_type iterator;
|
||||
typedef const_pointer_type const_iterator;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
|
||||
pointer_type data;
|
||||
pointer data;
|
||||
size_type size;
|
||||
|
||||
WritableBuffer() = default;
|
||||
@ -107,11 +107,10 @@ struct WritableBuffer {
|
||||
constexpr WritableBuffer(std::nullptr_t) noexcept
|
||||
:data(nullptr), size(0) {}
|
||||
|
||||
constexpr WritableBuffer(pointer_type _data, size_type _size) noexcept
|
||||
constexpr WritableBuffer(pointer _data, size_type _size) noexcept
|
||||
:data(_data), size(_size) {}
|
||||
|
||||
constexpr WritableBuffer(pointer_type _data,
|
||||
pointer_type _end) noexcept
|
||||
constexpr WritableBuffer(pointer _data, pointer _end) noexcept
|
||||
:data(_data), size(_end - _data) {}
|
||||
|
||||
/**
|
||||
@ -131,7 +130,7 @@ struct WritableBuffer {
|
||||
*/
|
||||
static constexpr WritableBuffer<T> FromVoidFloor(WritableBuffer<void> other) noexcept {
|
||||
static_assert(sizeof(T) > 0, "Empty base type");
|
||||
return WritableBuffer<T>(pointer_type(other.data),
|
||||
return WritableBuffer<T>(pointer(other.data),
|
||||
other.size / sizeof(T));
|
||||
}
|
||||
|
||||
@ -272,7 +271,7 @@ struct WritableBuffer {
|
||||
* Move the front pointer to the given address, and adjust the
|
||||
* size attribute to retain the old end address.
|
||||
*/
|
||||
void MoveFront(pointer_type new_data) noexcept {
|
||||
void MoveFront(pointer new_data) noexcept {
|
||||
#ifndef NDEBUG
|
||||
assert(IsNull() == (new_data == nullptr));
|
||||
assert(new_data <= end());
|
||||
@ -286,7 +285,7 @@ struct WritableBuffer {
|
||||
* Move the end pointer to the given address (by adjusting the
|
||||
* size).
|
||||
*/
|
||||
void SetEnd(pointer_type new_end) noexcept {
|
||||
void SetEnd(pointer new_end) noexcept {
|
||||
#ifndef NDEBUG
|
||||
assert(IsNull() == (new_end == nullptr));
|
||||
assert(new_end >= begin());
|
||||
|
Loading…
Reference in New Issue
Block a user