cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
cppcore::TStringView< T > Class Template Reference

#include <TStringView.h>

Public Types

using const_iterator = const T*

Public Member Functions

 TStringView ()=default
 The default constructor.
 TStringView (const T *ptr, size_t len)
 The constructor with the buffer.
 ~TStringView ()=default
 The class destructor.
size_t size () const
 Will return the size of the view.
const T * data (size_t offset=0) const
 Will return the data with an offset, if given.
bool isEmpty () const
 Will return true, if there is no string to view.
const_iterator begin () const
 Will return the first entry.
const_iterator end () const
 Will return the end entry.

Detailed Description

template<class T>
class cppcore::TStringView< T >

Definition at line 36 of file TStringView.h.

Member Typedef Documentation

◆ const_iterator

template<class T>
using cppcore::TStringView< T >::const_iterator = const T*

Definition at line 38 of file TStringView.h.

Constructor & Destructor Documentation

◆ TStringView() [1/2]

template<class T>
cppcore::TStringView< T >::TStringView ( )
default

The default constructor.

◆ TStringView() [2/2]

template<class T>
cppcore::TStringView< T >::TStringView ( const T * ptr,
size_t len )
inline

The constructor with the buffer.

Parameters
ptrPointer to the buffer
lenThe buffer size

Definition at line 78 of file TStringView.h.

◆ ~TStringView()

template<class T>
cppcore::TStringView< T >::~TStringView ( )
default

The class destructor.

Member Function Documentation

◆ begin()

template<class T>
TStringView< T >::const_iterator cppcore::TStringView< T >::begin ( ) const
inline

Will return the first entry.

Returns
The first entry

Definition at line 102 of file TStringView.h.

References end(), and isEmpty().

◆ data()

template<class T>
const T * cppcore::TStringView< T >::data ( size_t offset = 0) const
inline

Will return the data with an offset, if given.

Parameters
offsetThe offset in the view.
Returns
Pointer to the data

Definition at line 89 of file TStringView.h.

◆ end()

template<class T>
TStringView< T >::const_iterator cppcore::TStringView< T >::end ( ) const
inline

Will return the end entry.

Returns
The end entry

Definition at line 110 of file TStringView.h.

Referenced by begin().

◆ isEmpty()

template<class T>
bool cppcore::TStringView< T >::isEmpty ( ) const
inline

Will return true, if there is no string to view.

Returns
true for empty

Definition at line 97 of file TStringView.h.

Referenced by begin().

◆ size()

template<class T>
size_t cppcore::TStringView< T >::size ( ) const
inline

Will return the size of the view.

Returns
The size of the view

Definition at line 84 of file TStringView.h.


The documentation for this class was generated from the following file: