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
b11c5f8d
Commit
b11c5f8d
authored
Jan 12, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/{Const,Writable}Buffer: drop more "_type" suffixes from type names
parent
44d7a1d8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
45 deletions
+45
-45
Cancellable.hxx
src/lib/nfs/Cancellable.hxx
+15
-15
AllocatedArray.hxx
src/util/AllocatedArray.hxx
+8
-8
AllocatedString.hxx
src/util/AllocatedString.hxx
+4
-4
ConstBuffer.hxx
src/util/ConstBuffer.hxx
+7
-7
HugeAllocator.hxx
src/util/HugeAllocator.hxx
+2
-2
StringPointer.hxx
src/util/StringPointer.hxx
+2
-2
WritableBuffer.hxx
src/util/WritableBuffer.hxx
+7
-7
No files found.
src/lib/nfs/Cancellable.hxx
View file @
b11c5f8d
...
...
@@ -33,14 +33,14 @@ class CancellablePointer
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
normal_link
>>
{
public
:
typedef
T
*
pointer
;
typedef
T
&
reference
_type
;
typedef
const
T
&
const_reference
_type
;
typedef
T
&
reference
;
typedef
const
T
&
const_reference
;
private
:
pointer
p
;
public
:
explicit
CancellablePointer
(
reference
_type
_p
)
:
p
(
&
_p
)
{}
explicit
CancellablePointer
(
reference
_p
)
:
p
(
&
_p
)
{}
CancellablePointer
(
const
CancellablePointer
&
)
=
delete
;
...
...
@@ -54,13 +54,13 @@ public:
p
=
nullptr
;
}
reference
_type
Get
()
{
reference
Get
()
{
assert
(
p
!=
nullptr
);
return
*
p
;
}
constexpr
bool
Is
(
const_reference
_type
other
)
const
{
constexpr
bool
Is
(
const_reference
other
)
const
{
return
p
==
&
other
;
}
};
...
...
@@ -68,8 +68,8 @@ public:
template
<
typename
T
,
typename
CT
=
CancellablePointer
<
T
>>
class
CancellableList
{
public
:
typedef
typename
CT
::
reference
_type
reference_typ
e
;
typedef
typename
CT
::
const_reference
_type
const_reference_typ
e
;
typedef
typename
CT
::
reference
referenc
e
;
typedef
typename
CT
::
const_reference
const_referenc
e
;
private
:
typedef
boost
::
intrusive
::
list
<
CT
,
...
...
@@ -79,10 +79,10 @@ private:
List
list
;
class
MatchPointer
{
const_reference
_type
p
;
const_reference
p
;
public
:
explicit
constexpr
MatchPointer
(
const_reference
_type
_p
)
explicit
constexpr
MatchPointer
(
const_reference
_p
)
:
p
(
_p
)
{}
constexpr
bool
operator
()(
const
CT
&
a
)
const
{
...
...
@@ -91,12 +91,12 @@ private:
};
gcc_pure
iterator
Find
(
reference
_type
p
)
noexcept
{
iterator
Find
(
reference
p
)
noexcept
{
return
std
::
find_if
(
list
.
begin
(),
list
.
end
(),
MatchPointer
(
p
));
}
gcc_pure
const_iterator
Find
(
const_reference
_type
p
)
const
noexcept
{
const_iterator
Find
(
const_reference
p
)
const
noexcept
{
return
std
::
find_if
(
list
.
begin
(),
list
.
end
(),
MatchPointer
(
p
));
}
...
...
@@ -123,12 +123,12 @@ public:
#endif
gcc_pure
bool
Contains
(
const_reference
_type
p
)
const
noexcept
{
bool
Contains
(
const_reference
p
)
const
noexcept
{
return
Find
(
p
)
!=
list
.
end
();
}
template
<
typename
...
Args
>
CT
&
Add
(
reference
_type
p
,
Args
&&
...
args
)
{
CT
&
Add
(
reference
p
,
Args
&&
...
args
)
{
assert
(
Find
(
p
)
==
list
.
end
());
CT
*
c
=
new
CT
(
p
,
std
::
forward
<
Args
>
(
args
)...);
...
...
@@ -144,14 +144,14 @@ public:
delete
&
ct
;
}
void
Cancel
(
reference
_type
p
)
{
void
Cancel
(
reference
p
)
{
auto
i
=
Find
(
p
);
assert
(
i
!=
list
.
end
());
i
->
Cancel
();
}
CT
&
Get
(
reference
_type
p
)
noexcept
{
CT
&
Get
(
reference
p
)
noexcept
{
auto
i
=
Find
(
p
);
assert
(
i
!=
list
.
end
());
...
...
src/util/AllocatedArray.hxx
View file @
b11c5f8d
...
...
@@ -47,8 +47,8 @@ class AllocatedArray {
public
:
typedef
typename
Buffer
::
size_type
size_type
;
typedef
typename
Buffer
::
reference
_type
reference_typ
e
;
typedef
typename
Buffer
::
const_reference
_type
const_reference_typ
e
;
typedef
typename
Buffer
::
reference
referenc
e
;
typedef
typename
Buffer
::
const_reference
const_referenc
e
;
typedef
typename
Buffer
::
iterator
iterator
;
typedef
typename
Buffer
::
const_iterator
const_iterator
;
...
...
@@ -147,33 +147,33 @@ public:
return
buffer
.
size
;
}
reference
_type
front
()
noexcept
{
reference
front
()
noexcept
{
return
buffer
.
front
();
}
const_reference
_type
front
()
const
noexcept
{
const_reference
front
()
const
noexcept
{
return
buffer
.
front
();
}
reference
_type
back
()
noexcept
{
reference
back
()
noexcept
{
return
buffer
.
back
();
}
const_reference
_type
back
()
const
noexcept
{
const_reference
back
()
const
noexcept
{
return
buffer
.
back
();
}
/**
* Returns one element. No bounds checking.
*/
reference
_type
operator
[](
size_type
i
)
noexcept
{
reference
operator
[](
size_type
i
)
noexcept
{
return
buffer
[
i
];
}
/**
* Returns one constant element. No bounds checking.
*/
const_reference
_type
operator
[](
size_type
i
)
const
noexcept
{
const_reference
operator
[](
size_type
i
)
const
noexcept
{
return
buffer
[
i
];
}
...
...
src/util/AllocatedString.hxx
View file @
b11c5f8d
...
...
@@ -44,8 +44,8 @@ template<typename T=char>
class
AllocatedString
{
public
:
typedef
typename
StringPointer
<
T
>::
value_type
value_type
;
typedef
typename
StringPointer
<
T
>::
reference
_type
reference_typ
e
;
typedef
typename
StringPointer
<
T
>::
const_reference
_type
const_reference_typ
e
;
typedef
typename
StringPointer
<
T
>::
reference
referenc
e
;
typedef
typename
StringPointer
<
T
>::
const_reference
const_referenc
e
;
typedef
typename
StringPointer
<
T
>::
pointer
pointer
;
typedef
typename
StringPointer
<
T
>::
const_pointer
const_pointer
;
typedef
std
::
size_t
size_type
;
...
...
@@ -127,11 +127,11 @@ public:
return
value
;
}
reference
_type
operator
[](
size_type
i
)
{
reference
operator
[](
size_type
i
)
{
return
value
[
i
];
}
const
reference
_type
operator
[](
size_type
i
)
const
{
const
reference
operator
[](
size_type
i
)
const
{
return
value
[
i
];
}
...
...
src/util/ConstBuffer.hxx
View file @
b11c5f8d
...
...
@@ -93,8 +93,8 @@ template<typename T>
struct
ConstBuffer
{
typedef
std
::
size_t
size_type
;
typedef
T
value_type
;
typedef
const
T
&
reference
_type
;
typedef
reference
_type
const_reference_typ
e
;
typedef
const
T
&
reference
;
typedef
reference
const_referenc
e
;
typedef
const
T
*
pointer
;
typedef
pointer
const_pointer
;
typedef
pointer
iterator
;
...
...
@@ -198,7 +198,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
operator
[](
size_type
i
)
const
noexcept
{
reference
operator
[](
size_type
i
)
const
noexcept
{
#ifndef NDEBUG
assert
(
i
<
size
);
#endif
...
...
@@ -213,7 +213,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
front
()
const
noexcept
{
reference
front
()
const
noexcept
{
#ifndef NDEBUG
assert
(
!
empty
());
#endif
...
...
@@ -227,7 +227,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
back
()
const
noexcept
{
reference
back
()
const
noexcept
{
#ifndef NDEBUG
assert
(
!
empty
());
#endif
...
...
@@ -263,8 +263,8 @@ struct ConstBuffer {
* Remove the first element and return a reference to it.
* Buffer must not be empty.
*/
reference
_type
shift
()
noexcept
{
reference
_type
result
=
front
();
reference
shift
()
noexcept
{
reference
result
=
front
();
pop_front
();
return
result
;
}
...
...
src/util/HugeAllocator.hxx
View file @
b11c5f8d
...
...
@@ -142,8 +142,8 @@ class HugeArray {
public
:
typedef
typename
Buffer
::
size_type
size_type
;
typedef
typename
Buffer
::
value_type
value_type
;
typedef
typename
Buffer
::
reference
_type
reference
;
typedef
typename
Buffer
::
const_reference
_type
const_reference
;
typedef
typename
Buffer
::
reference
reference
;
typedef
typename
Buffer
::
const_reference
const_reference
;
typedef
typename
Buffer
::
iterator
iterator
;
typedef
typename
Buffer
::
const_iterator
const_iterator
;
...
...
src/util/StringPointer.hxx
View file @
b11c5f8d
...
...
@@ -37,8 +37,8 @@ template<typename T=char>
class
StringPointer
{
public
:
typedef
T
value_type
;
typedef
T
&
reference
_type
;
typedef
const
T
&
const_reference
_type
;
typedef
T
&
reference
;
typedef
const
T
&
const_reference
;
typedef
T
*
pointer
;
typedef
const
T
*
const_pointer
;
...
...
src/util/WritableBuffer.hxx
View file @
b11c5f8d
...
...
@@ -92,8 +92,8 @@ template<typename T>
struct
WritableBuffer
{
typedef
std
::
size_t
size_type
;
typedef
T
value_type
;
typedef
T
&
reference
_type
;
typedef
const
T
&
const_reference
_type
;
typedef
T
&
reference
;
typedef
const
T
&
const_reference
;
typedef
T
*
pointer
;
typedef
const
T
*
const_pointer
;
typedef
pointer
iterator
;
...
...
@@ -191,7 +191,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
operator
[](
size_type
i
)
const
noexcept
{
reference
operator
[](
size_type
i
)
const
noexcept
{
#ifndef NDEBUG
assert
(
i
<
size
);
#endif
...
...
@@ -206,7 +206,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
front
()
const
noexcept
{
reference
front
()
const
noexcept
{
#ifndef NDEBUG
assert
(
!
empty
());
#endif
...
...
@@ -220,7 +220,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference
_type
back
()
const
noexcept
{
reference
back
()
const
noexcept
{
#ifndef NDEBUG
assert
(
!
empty
());
#endif
...
...
@@ -252,8 +252,8 @@ struct WritableBuffer {
* Remove the first element and return a reference to it.
* Buffer must not be empty.
*/
reference
_type
shift
()
noexcept
{
reference
_type
result
=
front
();
reference
shift
()
noexcept
{
reference
result
=
front
();
pop_front
();
return
result
;
}
...
...
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