![]() |
Yoba Perl
|
Array reference More...
Inherits Variable.
Public Types | |
| using | Iterator = class ArrayIterator |
| Type alias. | |
Public Member Functions | |
| Array (Perl &perl, AV *av, bool increase_refcount) | |
| Constructor. More... | |
Array elements | |
| Scalar | get (const SSize_t index) const |
| Fetch element by index. More... | |
| Scalar | getFirst () const |
| Get first element. More... | |
| Scalar | getLast () const |
| Get last element. More... | |
| Array & | replace (const SSize_t index, const Scalar &scalar) |
| Replace element. More... | |
| Array & | push (const Scalar &scalar) |
| Add element to end. More... | |
| Array & | push (const Array &array) |
| Add other array to end. More... | |
| Array & | push (const std::vector< Scalar > &scalars) |
| Array & | push (const std::list< Scalar > &scalars) |
| Array & | unshift (const Scalar &scalar) |
| Add element to begin. More... | |
| Array & | unshift (const Array &array) |
| Add other array to begin. More... | |
| Array & | unshift (const std::vector< Scalar > &scalars) |
| Array & | unshift (const std::list< Scalar > &scalars) |
| Scalar | pop () |
| Remove last element and return. More... | |
| Scalar | shift () |
| Remove first element and return. More... | |
| Array & | clear () |
| Remove all elements. More... | |
Misc | |
| int | getSize () const |
| Elements count. More... | |
| bool | isEmpty () const |
| Check if array is empty. More... | |
| bool | isExists (SSize_t index) const |
| Check element exists. More... | |
| Array & | reserve (SSize_t size) |
| Reserve space. | |
| Array | makeCopy () const |
| Copy each element to new array. More... | |
| Scalar | makeRef () const |
| Take reference. More... | |
| std::string | toString () const |
| Convert to C++ string. | |
| std::vector< Scalar > | toVector () const |
| Convert to C++ vector. | |
| std::list< Scalar > | toList () const |
| Convert to C++ list. | |
| Iterator | begin () const |
| Iterator to first element. | |
| Iterator | end () const |
| Iterator to last element + 1. | |
Internals | |
| AV * | getAV () const |
| Get raw array. | |
Operators | |
| Scalar | operator[] (const SSize_t index) const noexcept |
| Unsafe version of get() | |
| Array & | operator+= (const Scalar &scalar) |
| Alias to push() | |
| Array & | operator<< (const Scalar &scalar) |
| Alias to push() | |
| Array | operator+ (const Array &other) const |
| Merge two arrays. More... | |
| operator bool () const | |
| Alias to ! isEmpty() | |
Public Member Functions inherited from Variable | |
| Variable (Perl &perl, SV *sv, bool increase_refcount) | |
| Constructor. | |
| Variable (const Variable &to_copy) | |
| Copy constructor. More... | |
| Variable (Variable &&to_move) | |
| Move constructor. More... | |
| virtual | ~Variable () |
| Destructor. More... | |
| void | setReadOnly (bool state) |
| Add/remove readonly flag. | |
| bool | isReadOnly () const |
| Check if SV has readonly flag. | |
| Perl & | getPerl () const |
| Get Perl instance. | |
| SV * | getSV () const |
| Get raw scalar. | |
| SV * | detachSV () |
| Nullify object and return SV. More... | |
| SV * | detachMortalSV () |
| Nullify object and return mortalized SV. More... | |
| U32 | getRefcount () const |
| Get SV reference count. | |
| void | increaseRefcount () |
| Increase SV reference count. | |
| void | decreaseRefcount () |
| Decrease SV reference count. | |
| void | dump () const |
| Dump SV data to stderr. | |
| bool | operator== (const Variable &other) |
| Compare SV pointers. | |
| bool | operator!= (const Variable &other) |
Array reference
| Scalar get | ( | const SSize_t | index | ) | const |
Fetch element by index.
| PerlException | Bound check failure |
| Scalar getFirst | ( | ) | const |
Get first element.
| PerlException | Bound check failure |
| Scalar getLast | ( | ) | const |
Get last element.
| PerlException | Bound check failure |
Replace element.
| PerlException | Bound check failure |
| Scalar pop | ( | ) |
Remove last element and return.
| PerlException | Bound check failure |
| Scalar shift | ( | ) |
Remove first element and return.
| PerlException | Bound check failure |
| Array & clear | ( | ) |
| int getSize | ( | ) | const |
| bool isEmpty | ( | ) | const |
| bool isExists | ( | SSize_t | index | ) | const |
| Array makeCopy | ( | ) | const |
| Scalar makeRef | ( | ) | const |