Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2b1d6ad3
Commit
2b1d6ad3
authored
Jul 18, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/{,Allocated}Path: add typedef Traits
parent
641447bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+12
-11
Path.hxx
src/fs/Path.hxx
+7
-6
No files found.
src/fs/AllocatedPath.hxx
View file @
2b1d6ad3
...
...
@@ -36,10 +36,11 @@
* stored.
*/
class
AllocatedPath
{
typedef
PathTraitsFS
::
string
string
;
typedef
PathTraitsFS
::
value_type
value_type
;
typedef
PathTraitsFS
::
pointer_type
pointer_type
;
typedef
PathTraitsFS
::
const_pointer_type
const_pointer_type
;
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
;
string
value
;
...
...
@@ -52,7 +53,7 @@ class AllocatedPath {
static
AllocatedPath
Build
(
const_pointer_type
a
,
size_t
a_size
,
const_pointer_type
b
,
size_t
b_size
)
{
return
AllocatedPath
(
PathTraitsFS
::
Build
(
a
,
a_size
,
b
,
b_size
));
return
AllocatedPath
(
Traits
::
Build
(
a
,
a_size
,
b
,
b_size
));
}
public
:
/**
...
...
@@ -88,8 +89,8 @@ public:
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer_type
a
,
const_pointer_type
b
)
noexcept
{
return
Build
(
a
,
PathTraitsFS
::
GetLength
(
a
),
b
,
PathTraitsFS
::
GetLength
(
b
));
return
Build
(
a
,
Traits
::
GetLength
(
a
),
b
,
Traits
::
GetLength
(
b
));
}
gcc_pure
gcc_nonnull_all
...
...
@@ -105,7 +106,7 @@ public:
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer_type
a
,
const
AllocatedPath
&
b
)
noexcept
{
return
Build
(
a
,
PathTraitsFS
::
GetLength
(
a
),
return
Build
(
a
,
Traits
::
GetLength
(
a
),
b
.
value
.
c_str
(),
b
.
value
.
size
());
}
...
...
@@ -113,7 +114,7 @@ public:
static
AllocatedPath
Build
(
const
AllocatedPath
&
a
,
const_pointer_type
b
)
noexcept
{
return
Build
(
a
.
value
.
c_str
(),
a
.
value
.
size
(),
b
,
PathTraitsFS
::
GetLength
(
b
));
b
,
Traits
::
GetLength
(
b
));
}
gcc_pure
...
...
@@ -260,7 +261,7 @@ public:
*/
gcc_pure
const_pointer_type
Relative
(
Path
other_fs
)
const
noexcept
{
return
PathTraitsFS
::
Relative
(
c_str
(),
other_fs
.
c_str
());
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
/**
...
...
@@ -270,7 +271,7 @@ public:
gcc_pure
bool
IsAbsolute
()
const
noexcept
{
return
PathTraitsFS
::
IsAbsolute
(
c_str
());
return
Traits
::
IsAbsolute
(
c_str
());
}
};
...
...
src/fs/Path.hxx
View file @
2b1d6ad3
...
...
@@ -37,7 +37,8 @@ class AllocatedPath;
* instance lives, the string must not be invalidated.
*/
class
Path
:
public
PathTraitsFS
::
Pointer
{
typedef
PathTraitsFS
::
Pointer
Base
;
using
Traits
=
PathTraitsFS
;
typedef
Traits
::
Pointer
Base
;
constexpr
Path
(
const_pointer_type
_value
)
:
Base
(
_value
)
{}
...
...
@@ -93,7 +94,7 @@ public:
size_t
length
()
const
noexcept
{
assert
(
!
IsNull
());
return
PathTraitsFS
::
GetLength
(
c_str
());
return
Traits
::
GetLength
(
c_str
());
}
/**
...
...
@@ -122,7 +123,7 @@ public:
*/
gcc_pure
bool
HasNewline
()
const
noexcept
{
return
PathTraitsFS
::
Find
(
c_str
(),
'\n'
)
!=
nullptr
;
return
Traits
::
Find
(
c_str
(),
'\n'
)
!=
nullptr
;
}
/**
...
...
@@ -139,7 +140,7 @@ public:
*/
gcc_pure
Path
GetBase
()
const
noexcept
{
return
FromFS
(
PathTraitsFS
::
GetBase
(
c_str
()));
return
FromFS
(
Traits
::
GetBase
(
c_str
()));
}
/**
...
...
@@ -157,12 +158,12 @@ public:
*/
gcc_pure
const_pointer_type
Relative
(
Path
other_fs
)
const
noexcept
{
return
PathTraitsFS
::
Relative
(
c_str
(),
other_fs
.
c_str
());
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
gcc_pure
bool
IsAbsolute
()
const
noexcept
{
return
PathTraitsFS
::
IsAbsolute
(
c_str
());
return
Traits
::
IsAbsolute
(
c_str
());
}
gcc_pure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment