The class for realloc
-based implementations of C string vectors.
More...
#include "nn/nlib/ReallocVec.h"
|
| ReallocCstringVec () noexcept |
| Uses std::realloc with the default constructor.
|
|
| ReallocCstringVec (ReallocFunc func) noexcept |
| Enables the user to specify the realloc function with the constructor. More...
|
|
void | swap (ReallocCstringVec &rhs) noexcept |
| Swaps vectors. More...
|
|
ReallocFunc | GetRealloc () const noexcept |
| Gets the specified realloc function. More...
|
|
bool | push_back (const char *str) noexcept |
| Adds a C string to the end. More...
|
|
bool | push_back (const char *startchar_ptr, const char *endchar_ptr) noexcept |
| Adds a (sub)string to the end. More...
|
|
bool | pop_back () noexcept |
| Deletes a string from the end of the vector. More...
|
|
char * | operator[] (size_t idx) noexcept |
| Gets the nth string, where n is specified by idx. More...
|
|
char * | front () noexcept |
| Gets the first string. More...
|
|
char * | back () noexcept |
| Gets the last string. More...
|
|
size_t | size () const noexcept |
| Gets the size of the vector. More...
|
|
size_t | capacity () const noexcept |
| Gets the maximum number of elements that can be stored without expanding the vector. More...
|
|
bool | empty () const noexcept |
| Determines whether the vector is empty. More...
|
|
bool | reserve (size_t n) noexcept |
| Makes it possible to store as many as n elements without expanding the vector. More...
|
|
The class for realloc
-based implementations of C string vectors.
Definition at line 290 of file ReallocVec.h.
◆ ReallocCstringVec()
nn::nlib::ReallocCstringVec::ReallocCstringVec |
( |
ReallocFunc |
func | ) |
|
|
inlineexplicitnoexcept |
Enables the user to specify the realloc
function with the constructor.
- Parameters
-
[in] | func | The realloc function. |
Definition at line 296 of file ReallocVec.h.
◆ back()
nn::nlib::ReallocCstringVec::back |
( |
| ) |
|
|
inlinenoexcept |
Gets the last string.
- Returns
- The last string.
Definition at line 346 of file ReallocVec.h.
◆ capacity()
nn::nlib::ReallocCstringVec::capacity |
( |
| ) |
const |
|
inlinenoexcept |
Gets the maximum number of elements that can be stored without expanding the vector.
- Returns
- The number of elements.
- Description
- Note that memory is allocated when additions are made to the string itself.
Definition at line 349 of file ReallocVec.h.
◆ empty()
nn::nlib::ReallocCstringVec::empty |
( |
| ) |
const |
|
inlinenoexcept |
Determines whether the vector is empty.
- Returns
- Returns
true
if empty.
Definition at line 350 of file ReallocVec.h.
◆ front()
nn::nlib::ReallocCstringVec::front |
( |
| ) |
|
|
inlinenoexcept |
Gets the first string.
- Returns
- The first string.
Definition at line 344 of file ReallocVec.h.
◆ GetRealloc()
nn::nlib::ReallocCstringVec::GetRealloc |
( |
| ) |
const |
|
inlinenoexcept |
Gets the specified realloc
function.
- Returns
- The
realloc
function.
Definition at line 320 of file ReallocVec.h.
◆ operator[]()
nn::nlib::ReallocCstringVec::operator[] |
( |
size_t |
idx | ) |
|
|
inlinenoexcept |
Gets the nth string, where n is specified by idx.
- Parameters
-
- Returns
- The nth string (where n is set in idx).
Definition at line 340 of file ReallocVec.h.
◆ pop_back()
nn::nlib::ReallocCstringVec::pop_back |
( |
| ) |
|
|
inlinenoexcept |
Deletes a string from the end of the vector.
- Returns
- Returns
true
when successful.
- Description
- The memory region for the deleted string is released.
Definition at line 334 of file ReallocVec.h.
◆ push_back() [1/2]
nn::nlib::ReallocCstringVec::push_back |
( |
const char * |
str | ) |
|
|
inlinenoexcept |
Adds a C string to the end.
- Parameters
-
- Returns
- Returns
true
when successful.
- Description
- The string is duplicated and added to a vector.
Definition at line 321 of file ReallocVec.h.
◆ push_back() [2/2]
nn::nlib::ReallocCstringVec::push_back |
( |
const char * |
startchar_ptr, |
|
|
const char * |
endchar_ptr |
|
) |
| |
|
inlinenoexcept |
Adds a (sub)string to the end.
- Parameters
-
[in] | startchar_ptr | The pointer to the first character. |
[in] | endchar_ptr | The pointer to beyond the last character. |
- Returns
- Returns
true
when successful.
- Description
- The string is duplicated, appended with the null character, and then added to a vector.
Definition at line 324 of file ReallocVec.h.
◆ reserve()
nn::nlib::ReallocCstringVec::reserve |
( |
size_t |
n | ) |
|
|
inlinenoexcept |
Makes it possible to store as many as n elements without expanding the vector.
- Parameters
-
- Returns
- Returns
true
when successful.
- Description
- Note that memory is allocated when additions are made to the string itself.
Definition at line 351 of file ReallocVec.h.
◆ size()
nn::nlib::ReallocCstringVec::size |
( |
| ) |
const |
|
inlinenoexcept |
Gets the size of the vector.
- Returns
- The size of the vector.
Definition at line 348 of file ReallocVec.h.
◆ swap()
Swaps vectors.
- Parameters
-
[in] | rhs | The vector to swap. |
- Deprecated:
- This function will be deleted in a future release.
Definition at line 316 of file ReallocVec.h.
The documentation for this class was generated from the following files: