Made a member function const. Added a function for looking up the property corresponding to the change's name.

This commit is contained in:
Moritz Bunkus 2009-08-12 11:13:33 +02:00
parent 7b43a288ff
commit 724316e5cb
2 changed files with 21 additions and 2 deletions

View File

@ -27,7 +27,9 @@ change_c::validate() {
}
void
change_c::dump_info() {
change_c::dump_info()
const
{
mxinfo(boost::format(" change:\n"
" type: %1%\n"
" name: %2%\n"
@ -36,3 +38,15 @@ change_c::dump_info() {
% m_name
% m_value);
}
bool
change_c::lookup_property(std::vector<property_element_c> &table) {
std::vector<property_element_c>::iterator property_it;
mxforeach(property_it, table)
if (property_it->m_name == m_name) {
m_property = *property_it;
return true;
}
return false;
}

View File

@ -16,6 +16,7 @@
#include <string>
#include "common/smart_pointers.h"
#include "propedit/property_element.h"
class change_c {
public:
@ -28,11 +29,15 @@ public:
change_type_e m_type;
std::string m_name, m_value;
property_element_c m_property;
public:
change_c(change_type_e type, const std::string &name, const std::string &value);
void validate();
void dump_info();
void dump_info() const;
bool lookup_property(std::vector<property_element_c> &table);
};
typedef counted_ptr<change_c> change_cptr;