return const& from attribute_by_name

This commit is contained in:
Artem Pavlenko 2005-04-13 20:20:46 +00:00
parent 8e1d34f46e
commit e3ef6b3384
2 changed files with 7 additions and 6 deletions

View file

@ -54,7 +54,7 @@ namespace mapnik
bool pass(const Feature& feature) const bool pass(const Feature& feature) const
{ {
attribute attr=feature.attribute_by_name(name_); const attribute& attr=feature.attribute_by_name(name_);
bool result=false; bool result=false;
try try
{ {
@ -95,7 +95,7 @@ namespace mapnik
bool pass(const Feature& feature) const bool pass(const Feature& feature) const
{ {
attribute attr=feature.attribute_by_name(name_); const attribute& attr=feature.attribute_by_name(name_);
bool result=false; bool result=false;
try try
{ {
@ -134,7 +134,7 @@ namespace mapnik
bool pass(const Feature& feature) const bool pass(const Feature& feature) const
{ {
attribute attr=feature.attribute_by_name(name_); const attribute& attr=feature.attribute_by_name(name_);
bool result=false; bool result=false;
try try
{ {
@ -178,7 +178,7 @@ namespace mapnik
bool pass(const Feature& feature) const bool pass(const Feature& feature) const
{ {
attribute attr=feature.attribute_by_name(name_); const attribute& attr=feature.attribute_by_name(name_);
bool result=false; bool result=false;
try try
{ {

View file

@ -92,12 +92,13 @@ namespace mapnik
attr_.insert(std::make_pair(name,attribute(value))); attr_.insert(std::make_pair(name,attribute(value)));
} }
attribute attribute_by_name(const std::string& name) const const attribute& attribute_by_name(const std::string& name) const
{ {
typename attributes::const_iterator pos=attr_.find(name); typename attributes::const_iterator pos=attr_.find(name);
if (pos!=attr_.end()) if (pos!=attr_.end())
return pos->second; return pos->second;
return attribute(); static attribute empty;
return empty;
} }
const attributes& get_attributes() const const attributes& get_attributes() const