CBuild
C++ build system with scripts written in c++
|
Simple map implementation with some stack operation added. More...
#include <map.hpp>
Public Member Functions | |
map () | |
Construct a new map object. | |
map (map const &)=default | |
Copy constructor. | |
map (std::initializer_list< lib::mapData< _K, _D > > init_list) | |
Consruct a new map object and initialize it. | |
void | push_back (lib::mapData< _K, _D > element) |
Push new element to map, stack operation ! Dangerous not perform chak if this elemnt exists in map. | |
void | push_back (_K key, _D data) |
Push new element to map, stack operation ! Dangerous not perform chak if this elemnt exists in map. | |
void | push_back_check (lib::mapData< _K, _D > element) |
Add data, but check if key exists, if exist - trow exception. | |
void | push_back_check (_K key, _D data) |
Add data, but check if key exists, if exist - trow exception. | |
lib::mapData< _K, _D > | pop_back () |
Pop last element, remove it and return back it's copy. | |
const _D * | get (_K key) |
Get element by it's key. | |
lib::mapData< _K, _D > * | get_ptr (_K key) |
Get reference to key and value of map. | |
bool | contains_key (_K key) |
Does map contains some key. | |
bool | contains (_D value) |
Does map contains some value. | |
void | clear () |
Erase all elements (simmilar to std::vector::clear()) | |
lib::mapData< _K, _D > | at (__SIZE_TYPE__ i) |
Array operation, get element at index. | |
lib::mapData< _K, _D > * | ptr_at (__SIZE_TYPE__ i) |
Array operation, get pointer to an element at specified index. | |
void | remove (__SIZE_TYPE__ idx) |
Remove element from map and return copy of this element. | |
void | remove (_K key) |
Remove element with given key. | |
std::vector< _K > | keys () |
Get keys list. | |
__SIZE_TYPE__ | size () |
Size of map. | |
lib::mapData< _K, _D > | operator[] (__SIZE_TYPE__ i) |
Typical array operation, simmilar to at but using operator []. | |
lib::map< _K, _D > | operator+ (lib::mapData< _K, _D > val) |
Add one elment to map. | |
lib::map< _K, _D > | operator+= (lib::mapData< _K, _D > val) |
Add one element to map, modify it. | |
lib::map< _K, _D > | operator+ (lib::map< _K, _D > val) |
Add another map to this map. | |
lib::map< _K, _D > | operator+= (lib::map< _K, _D > val) |
Add another map to this, modify it. | |
lib::map< _K, _D > | operator= (lib::map< _K, _D > val) |
Copy content of second map to first. | |
lib::map< _K, _D > | operator= (lib::mapData< _K, _D > val) |
Reset map, set first it's element to val. | |
bool | operator== (lib::map< _K, _D > val) |
Check if content of two maps is equal. | |
std::vector< mapData< _K, _D > >::iterator | begin () |
Begin iterator. | |
std::vector< mapData< _K, _D > >::iterator | end () |
End iterator. | |
std::vector< mapData< _K, _D > >::const_iterator | begin () const |
Begin const iterator. | |
std::vector< mapData< _K, _D > >::const_iterator | end () const |
End const iterator. | |
bool | empty () |
Simmilar to std::vector::empty. | |
void | erase (_K key) |
Private Attributes | |
std::vector< mapData< _K, _D > > | content |
Simple map implementation with some stack operation added.
_K | -> Key, must have "==" operator implemented |
_D | -> Value All types must implement "=" operator |
|
inline |
Construct a new map object.
Definition at line 87 of file map.hpp.
Referenced by lib::map< _K, _D >::operator+(), lib::map< _K, _D >::operator+(), lib::map< _K, _D >::operator+=(), and lib::map< _K, _D >::operator+=().
Copy constructor.
|
inline |
|
inline |
Array operation, get element at index.
i | => size_t -> index |
Definition at line 223 of file map.hpp.
Referenced by CBuild::gcc_hash_impl(), CBuild::Toolchain::gen_file_list(), CBuild::ccj_out::generate(), and CBuild::loop().
|
inline |
Erase all elements (simmilar to std::vector::clear())
Definition at line 215 of file map.hpp.
Referenced by CBuild::Toolchain::gen_file_list().
|
inline |
Does map contains some value.
value | => _D -> Value |
Definition at line 205 of file map.hpp.
References lib::map< _K, _D >::content.
|
inline |
Does map contains some key.
key | => _K -> Key |
Definition at line 192 of file map.hpp.
References lib::map< _K, _D >::content.
|
inline |
|
inline |
|
inline |
Get element by it's key.
key | => _D -> Key |
Definition at line 159 of file map.hpp.
References lib::mapData< _K, _D >::data, and lib::mapData< _K, _D >::key.
Referenced by check_mismatch_recursive(), check_mismatch_recursive(), CBuild::ccj_out::generate(), CBuild::makefile_out::generate(), CBuild::loop(), lib::map< _K, _D >::push_back_check(), and lib::map< _K, _D >::push_back_check().
|
inline |
Get reference to key and value of map.
key | => _K -> key that is needed |
Definition at line 175 of file map.hpp.
References lib::mapData< _K, _D >::key.
Referenced by CBuild::build_handler(), CBuild::ccj_out::generate(), CBuild::generator_handler(), CBuild::loop(), CBuild::out_handler(), and CBuild::task_handler().
|
inline |
Get keys list.
Definition at line 264 of file map.hpp.
References lib::map< _K, _D >::content.
|
inline |
Add another map to this map.
val | => lib::map<_K, _D> -> another map |
Definition at line 314 of file map.hpp.
References lib::map< _K, _D >::content, and lib::map< _K, _D >::map().
|
inline |
Add one elment to map.
val | => lib::mapData<_K, _D> -> element |
Definition at line 291 of file map.hpp.
References lib::map< _K, _D >::content, and lib::map< _K, _D >::map().
|
inline |
Add another map to this, modify it.
val | => lib::map<_K, _D> -> another map |
Definition at line 327 of file map.hpp.
References lib::map< _K, _D >::content, and lib::map< _K, _D >::map().
|
inline |
Add one element to map, modify it.
val | => lib::mapData<_K, _D> -> element |
Definition at line 302 of file map.hpp.
References lib::map< _K, _D >::content, and lib::map< _K, _D >::map().
|
inline |
Copy content of second map to first.
val | => lib::map<_K, _D> -> another map |
Definition at line 341 of file map.hpp.
References lib::map< _K, _D >::content.
|
inline |
Check if content of two maps is equal.
val | => lib::map<_K, _D> -> map variable |
Definition at line 360 of file map.hpp.
References lib::map< _K, _D >::content.
|
inline |
|
inline |
|
inline |
Array operation, get pointer to an element at specified index.
i | => size_t -> Index |
Definition at line 232 of file map.hpp.
Referenced by CBuild::gcc_hash_impl(), and CBuild::CBuildHashV2::get_files_for_recompilation().
|
inline |
|
inline |
Push new element to map, stack operation ! Dangerous not perform chak if this elemnt exists in map.
element | => lib::mapData<_K, _D> -> mapData object, that pack key and value to one variable |
Definition at line 111 of file map.hpp.
Referenced by CBuild::gcc_hash_impl(), CBuild::Toolchain::gen_file_list(), CBuild::ccj_out::generate(), CBuild::CBuildHashV2::get_files_for_recompilation(), CBuild::CBuildHash::get_files_for_recompilation(), lib::map< _K, _D >::push_back_check(), and lib::map< _K, _D >::push_back_check().
|
inline |
Add data, but check if key exists, if exist - trow exception.
runtime_error | -> string with error descitption |
key | => _K -> key |
data | => _D -> Data |
Definition at line 140 of file map.hpp.
References lib::map< _K, _D >::get(), and lib::map< _K, _D >::push_back().
|
inline |
Add data, but check if key exists, if exist - trow exception.
runtime_error | -> string with error descitption |
element | => lib::mapData<_K, _D> -> New element to push |
Definition at line 129 of file map.hpp.
References lib::map< _K, _D >::get(), lib::mapData< _K, _D >::key, and lib::map< _K, _D >::push_back().
Referenced by CBuild::arg_handler(), CBuild::build_handler(), CBuild::force_handler(), CBuild::gcc_hash_impl(), CBuild::generator_handler(), CBuild::out_handler(), CBuild::parse(), parse_file(), CBuild::rebuild_handler(), and CBuild::task_handler().
|
inline |
|
inline |
Remove element with given key.
key | => _K -> Key of elent that is needed to be removed |
Definition at line 248 of file map.hpp.
References lib::mapData< _K, _D >::key.
|
inline |
Size of map.
Definition at line 275 of file map.hpp.
Referenced by CBuild::gcc_hash_impl(), CBuild::Toolchain::gen_file_list(), CBuild::ccj_out::generate(), CBuild::CBuildHashV2::get_files_for_recompilation(), and CBuild::loop().
Definition at line 81 of file map.hpp.
Referenced by lib::map< _K, _D >::contains(), lib::map< _K, _D >::contains_key(), lib::map< _K, _D >::keys(), lib::map< _K, _D >::operator+(), lib::map< _K, _D >::operator+(), lib::map< _K, _D >::operator+=(), lib::map< _K, _D >::operator+=(), lib::map< _K, _D >::operator=(), and lib::map< _K, _D >::operator==().