mirror of
https://github.com/allankoechke/cparse.git
synced 2026-12-03 09:13:53 +00:00
Add const qualifier to some functions
The `Function::call()` second argument is now qualified as `const`, this makes the function usable even if the Function* is const. The function `TokenMap::find()` now has a const version that return a `const packToken*`.
This commit is contained in:
16
objects.cpp
16
objects.cpp
@@ -110,7 +110,7 @@ MapData_t& MapData_t::operator=(const MapData_t& other) {
|
||||
|
||||
/* * * * * TokenMap Class: * * * * */
|
||||
|
||||
packToken* TokenMap::find(std::string key) {
|
||||
packToken* TokenMap::find(const std::string& key) {
|
||||
TokenMap_t::iterator it = map().find(key);
|
||||
|
||||
if (it != map().end()) {
|
||||
@@ -122,7 +122,19 @@ packToken* TokenMap::find(std::string key) {
|
||||
}
|
||||
}
|
||||
|
||||
TokenMap* TokenMap::findMap(std::string key) {
|
||||
const packToken* TokenMap::find(const std::string& key) const {
|
||||
TokenMap_t::const_iterator it = map().find(key);
|
||||
|
||||
if (it != map().end()) {
|
||||
return &it->second;
|
||||
} else if (parent()) {
|
||||
return parent()->find(key);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
TokenMap* TokenMap::findMap(const std::string& key) {
|
||||
TokenMap_t::iterator it = map().find(key);
|
||||
|
||||
if (it != map().end()) {
|
||||
|
||||
Reference in New Issue
Block a user