![]() |
Yoba Perl
|
Hash reference More...
Inherits Variable.
Public Types | |
| using | Iterator = HashIterator |
| Type alias. | |
Public Member Functions | |
| Hash (Perl &perl, HV *hv, bool increase_refcount) | |
| Constructor. More... | |
Hash elements | |
| Hash & | insert (const std::string &key, const Scalar &value) |
| Add element. More... | |
| Hash & | insert (const std::pair< std::string, Scalar > &pair) |
| Hash & | insert (const std::unordered_map< std::string, Scalar > &hashmap) |
| Scalar | get (const std::string &key) |
| Fetch element. More... | |
| Scalar | remove (const std::string &key) |
| Remove element and return. More... | |
| Hash & | clear () |
| Remove all elements. More... | |
Misc | |
| I32 | getSize () const |
| Elements count. More... | |
| bool | isEmpty () const |
| Check if hash is empty. More... | |
| bool | isExists (const std::string &key) const |
| Check element exists. More... | |
| std::string | toString () const |
| Convert to C++ string. | |
| std::unordered_map< std::string, Scalar > | toMap () const |
| Convert to C++ hash map. | |
| Scalar | makeRef () const |
| Take reference. More... | |
| Hash | makeCopy () const |
| Copy each element to new hash. More... | |
| Iterator | begin () const |
| Forward iterator. | |
| Iterator | end () const |
Internals | |
| HV * | getHV () const |
| Raw hash. | |
Operators | |
| Scalar | operator[] (const std::string &key) noexcept |
| Unsafe version of get() | |
| Scalar | operator[] (const char *key) noexcept |
| 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) |
Hash reference
| Scalar get | ( | const std::string & | key | ) |
| Scalar remove | ( | const std::string & | key | ) |
Remove element and return.
| PerlException | Element not exists |
| Hash & clear | ( | ) |
| I32 getSize | ( | ) | const |
| bool isEmpty | ( | ) | const |
| bool isExists | ( | const std::string & | key | ) | const |
| Scalar makeRef | ( | ) | const |
| Hash makeCopy | ( | ) | const |