tudocomp
– The TU Dortmund Compression Framework
|
A const view into a slice of memory. More...
#include <GenericConstU8View.hpp>
Public Types | |
using | value_type = typename Super::value_type |
using | const_reference = typename Super::const_reference |
using | const_pointer = typename Super::const_pointer |
using | const_iterator = typename Super::const_iterator |
using | const_reverse_iterator = typename Super::const_reverse_iterator |
using | difference_type = typename Super::difference_type |
using | size_type = typename Super::size_type |
Public Member Functions | |
ConstGenericView () | |
Construct a empty View. More... | |
ConstGenericView (const uliteral_t *data, size_t len) | |
Construct a View pointing at len elements starting from data More... | |
ConstGenericView (const ConstGenericView &other) | |
Construct a View as a copy of other More... | |
ConstGenericView (const GenericView< uliteral_t > &other) | |
Construct a View as a copy of other More... | |
ConstGenericView (const std::vector< uliteral_t > &other) | |
Construct a View pointing at the contents of a vector. More... | |
template<size_t N> | |
ConstGenericView (const std::array< uliteral_t, N > &other) | |
Construct a View pointing at the contents of a array. More... | |
operator std::vector< uliteral_t > () const | |
Construct a vector with the contents of this View. More... | |
const_iterator | begin () const |
Begin of iterator. More... | |
const_iterator | end () const |
End of iterator. More... | |
const_reverse_iterator | rbegin () const |
Begin of reverse iterator. More... | |
const_reverse_iterator | rend () const |
End of reverse iterator. More... | |
const_iterator | cbegin () const |
Begin of const iterator. More... | |
const_iterator | cend () const |
End of const iterator. More... | |
const_reverse_iterator | crbegin () const |
Begin of const reverse iterator. More... | |
const_reverse_iterator | crend () const |
End of const reverse iterator. More... | |
size_type | size () const |
Returns size of the View. More... | |
size_type | max_size () const |
Returns max size of the View. Always the same as size() More... | |
bool | empty () const |
Returns true if empty. More... | |
const_reference | operator[] (size_type pos) const |
Access the element at pos More... | |
const_reference | at (size_type pos) const |
Access the element at pos More... | |
const_reference | front () const |
Access the first element. More... | |
const_reference | back () const |
Access the last element. More... | |
const value_type * | data () const noexcept |
The backing memory location. More... | |
void | pop_back () |
Remove the last element from the View. More... | |
void | pop_front () |
Remove the first element from the View. More... | |
void | swap (ConstGenericView &other) |
Swap two Views. More... | |
void | clear () |
Sets the size to 0. More... | |
ConstGenericView | substr (size_type pos, size_type len=npos) const |
Construct a new View that is a sub view into the current one. More... | |
ConstGenericView | slice (size_type from, size_type to=npos) const |
Construct a new View that is a sub view into the current one. More... | |
void | remove_prefix (size_type n) |
Removes the first n elements from the View. More... | |
void | remove_suffix (size_type n) |
Removes the last n elements from the View. More... | |
bool | starts_with (const uliteral_t &other) const |
Returns true if the View starts with the literal other More... | |
bool | starts_with (const ConstGenericView< uliteral_t > &other) const |
Returns true if the View starts with the sequence of literals contained in other . More... | |
bool | ends_with (const uliteral_t &other) const |
Returns true if the View ends with the literal other More... | |
bool | ends_with (const ConstGenericView< uliteral_t > &other) const |
Returns true if the View ends with the sequence of literals contained in other . More... | |
ConstGenericView (const std::string &other) | |
Construct a View pointing at the contents of a string. More... | |
ConstGenericView (const char *other) | |
Construct a View pointing at a C-style null terminated string. More... | |
ConstGenericView (const char *data, size_t len) | |
Construct a View pointing at len elements starting from data More... | |
operator std::string () const | |
Construct a string with the contents of this View. More... | |
Static Public Attributes | |
static const size_type | npos = Super::npos |
Sentinel value indicating a index at the end of the view. More... | |
Friends | |
class | GenericView< uliteral_t > |
template<class U > | |
void | swap (ConstGenericView< U > &lhs, ConstGenericView< U > &rhs) |
bool | operator== (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
bool | operator!= (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
bool | operator< (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
bool | operator<= (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
bool | operator> (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
bool | operator>= (const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs) |
A const view into a slice of memory.
This is an abstraction around a const pointer to T
and a size, and represents N elements consecutive in memory.
Creating/Copying/Modifying a View will not copy any of the data it points at. Its API mostly mirrors that of a std::vector<T>
.
Definition at line 31 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::const_iterator = typename Super::const_iterator |
Definition at line 46 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::const_pointer = typename Super::const_pointer |
Definition at line 45 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::const_reference = typename Super::const_reference |
Definition at line 44 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::const_reverse_iterator = typename Super::const_reverse_iterator |
Definition at line 47 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::difference_type = typename Super::difference_type |
Definition at line 48 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::size_type = typename Super::size_type |
Definition at line 49 of file GenericConstU8View.hpp.
using tdc::ConstGenericView< uliteral_t >::value_type = typename Super::value_type |
Definition at line 43 of file GenericConstU8View.hpp.
|
inline |
Construct a empty View.
Definition at line 55 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at len
elements starting from data
Definition at line 59 of file GenericConstU8View.hpp.
|
inline |
Construct a View as a copy of other
Definition at line 63 of file GenericConstU8View.hpp.
|
inline |
Construct a View as a copy of other
Definition at line 67 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at the contents of a vector.
Definition at line 71 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at the contents of a array.
Definition at line 76 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at the contents of a string.
Definition at line 271 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at a C-style null terminated string.
Can be used to construct from a string literal
Definition at line 277 of file GenericConstU8View.hpp.
|
inline |
Construct a View pointing at len
elements starting from data
Definition at line 281 of file GenericConstU8View.hpp.
|
inline |
Access the element at pos
This method is always bounds checked
Definition at line 149 of file GenericConstU8View.hpp.
|
inline |
Access the last element.
Definition at line 159 of file GenericConstU8View.hpp.
|
inline |
Begin of iterator.
Definition at line 85 of file GenericConstU8View.hpp.
|
inline |
Begin of const iterator.
Definition at line 105 of file GenericConstU8View.hpp.
|
inline |
End of const iterator.
Definition at line 110 of file GenericConstU8View.hpp.
|
inline |
Sets the size to 0.
Definition at line 184 of file GenericConstU8View.hpp.
|
inline |
Begin of const reverse iterator.
Definition at line 115 of file GenericConstU8View.hpp.
|
inline |
End of const reverse iterator.
Definition at line 120 of file GenericConstU8View.hpp.
|
inlinenoexcept |
The backing memory location.
Definition at line 164 of file GenericConstU8View.hpp.
|
inline |
Returns true
if empty.
Definition at line 135 of file GenericConstU8View.hpp.
|
inline |
End of iterator.
Definition at line 90 of file GenericConstU8View.hpp.
|
inline |
Returns true
if the View ends with the literal other
Definition at line 242 of file GenericConstU8View.hpp.
|
inline |
Returns true
if the View ends with the sequence of literals contained in other
.
Definition at line 248 of file GenericConstU8View.hpp.
|
inline |
Access the first element.
Definition at line 154 of file GenericConstU8View.hpp.
|
inline |
Returns max size of the View. Always the same as size()
Definition at line 130 of file GenericConstU8View.hpp.
|
inline |
Construct a string with the contents of this View.
Definition at line 285 of file GenericConstU8View.hpp.
|
inline |
Construct a vector with the contents of this View.
Definition at line 80 of file GenericConstU8View.hpp.
|
inline |
Access the element at pos
This method is bounds checked in debug builds
Definition at line 142 of file GenericConstU8View.hpp.
|
inline |
Remove the last element from the View.
Definition at line 169 of file GenericConstU8View.hpp.
|
inline |
Remove the first element from the View.
Definition at line 174 of file GenericConstU8View.hpp.
|
inline |
Begin of reverse iterator.
Definition at line 95 of file GenericConstU8View.hpp.
|
inline |
Removes the first n
elements from the View.
Definition at line 221 of file GenericConstU8View.hpp.
|
inline |
Removes the last n
elements from the View.
Definition at line 226 of file GenericConstU8View.hpp.
|
inline |
End of reverse iterator.
Definition at line 100 of file GenericConstU8View.hpp.
|
inline |
Returns size of the View.
Definition at line 125 of file GenericConstU8View.hpp.
|
inline |
Construct a new View that is a sub view into the current one.
The returned view will be a "from-to" slice, and cover the bytes starting at from
and ending just before to
. T.slice(a,b) gives T[a..b-1]
Passing npos
to to
will create a slice until the end of the View
View("abcd").slice(1, 3) == View("bc")
Definition at line 216 of file GenericConstU8View.hpp.
|
inline |
Returns true
if the View starts with the literal other
Definition at line 231 of file GenericConstU8View.hpp.
|
inline |
Returns true
if the View starts with the sequence of literals contained in other
.
Definition at line 237 of file GenericConstU8View.hpp.
|
inline |
Construct a new View that is a sub view into the current one.
The returned view will be a "position-length" slice, and cover the bytes starting at pos
and ending at pos + len
.
Passing npos
to len
will create a slice until the end of the View
This method covers the same basic operation as slice()
, but mirrors the semantic of std::string::substr
.
View("abcd").substr(1, 2) == View("bc")
Definition at line 201 of file GenericConstU8View.hpp.
|
inline |
Swap two Views.
Definition at line 179 of file GenericConstU8View.hpp.
|
friend |
Definition at line 34 of file GenericConstU8View.hpp.
|
friend |
Definition at line 296 of file GenericConstU8View.hpp.
|
friend |
Definition at line 301 of file GenericConstU8View.hpp.
|
friend |
Definition at line 306 of file GenericConstU8View.hpp.
|
friend |
Definition at line 291 of file GenericConstU8View.hpp.
|
friend |
Definition at line 311 of file GenericConstU8View.hpp.
|
friend |
Definition at line 316 of file GenericConstU8View.hpp.
|
friend |
|
static |
Sentinel value indicating a index at the end of the view.
Definition at line 52 of file GenericConstU8View.hpp.