X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fvariabledict.cpp;h=d880c58e760f08ec56d603b6ce323a94bff01f06;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=e3a32d50c14d2495757ee2c5a40c72c8caa88f5d;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/variabledict.cpp b/src/base/variabledict.cpp index e3a32d5..d880c58 100644 --- a/src/base/variabledict.cpp +++ b/src/base/variabledict.cpp @@ -19,20 +19,20 @@ /** * Constructor. */ -RS_VariableDict::RS_VariableDict() +VariableDict::VariableDict() { #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // variables.setAutoDelete(true); } -/*virtual*/ RS_VariableDict::~RS_VariableDict() +/*virtual*/ VariableDict::~VariableDict() { } /** * Removes all variables in the blocklist. */ -void RS_VariableDict::clear() +void VariableDict::clear() { variables.clear(); } @@ -40,7 +40,7 @@ void RS_VariableDict::clear() /** * @return Number of variables available. */ -int RS_VariableDict::count() +int VariableDict::count() { return variables.count(); } @@ -49,7 +49,7 @@ int RS_VariableDict::count() * Activates the given block. * Listeners are notified. */ -//void RS_VariableDict::activateBlock(const QString& name) { +//void VariableDict::activateBlock(const QString& name) { // activateBlock(findBlock(name)); //} @@ -57,11 +57,11 @@ int RS_VariableDict::count() * Activates the given block. * Listeners are notified. */ -/*void RS_VariableDict::activateBlock(RS_Block* block) { +/*void VariableDict::activateBlock(Block* block) { activeBlock = block; for (uint i=0; iblockActivated(activeBlock); } @@ -71,68 +71,68 @@ int RS_VariableDict::count() * Adds a variable to the variable dictionary. If a variable with the * same name already exists, is will be overwritten. */ -void RS_VariableDict::add(const QString & key, const QString & value, int code) +void VariableDict::add(const QString & key, const QString & value, int code) { - RS_DEBUG->print("RS_VariableDict::addVariable()"); + DEBUG->print("VariableDict::addVariable()"); if (key.isEmpty()) { - RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING); + DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING); return; } - variables.replace(key, new RS_Variable(value, code)); + variables.replace(key, new Variable(value, code)); } /** * Adds a variable to the variable dictionary. If a variable with the * same name already exists, is will be overwritten. */ -void RS_VariableDict::add(const QString & key, int value, int code) +void VariableDict::add(const QString & key, int value, int code) { - RS_DEBUG->print("RS_VariableDict::addVariable()"); + DEBUG->print("VariableDict::addVariable()"); if (key.isEmpty()) { - RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING); + DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING); return; } - variables.replace(key, new RS_Variable(value, code)); + variables.replace(key, new Variable(value, code)); } /** * Adds a variable to the variable dictionary. If a variable with the * same name already exists, is will be overwritten. */ -void RS_VariableDict::add(const QString & key, double value, int code) +void VariableDict::add(const QString & key, double value, int code) { - RS_DEBUG->print("RS_VariableDict::addVariable()"); + DEBUG->print("VariableDict::addVariable()"); if (key.isEmpty()) { - RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING); + DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING); return; } - variables.replace(key, new RS_Variable(value, code)); + variables.replace(key, new Variable(value, code)); } /** * Adds a variable to the variable dictionary. If a variable with the * same name already exists, is will be overwritten. */ -void RS_VariableDict::add(const QString & key, const Vector & value, int code) +void VariableDict::add(const QString & key, const Vector & value, int code) { - RS_DEBUG->print("RS_VariableDict::addVariable()"); + DEBUG->print("VariableDict::addVariable()"); if (key.isEmpty()) { - RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING); + DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING); return; } - variables.replace(key, new RS_Variable(value, code)); + variables.replace(key, new Variable(value, code)); } /** @@ -144,11 +144,11 @@ void RS_VariableDict::add(const QString & key, const Vector & value, int code) * @return The value for the given variable or the given default value * if the variable couldn't be found. */ -Vector RS_VariableDict::getVector(const QString & key, const Vector & def) +Vector VariableDict::getVector(const QString & key, const Vector & def) { Vector ret; -// RS_Variable * ptr = variables.find(key); - RS_Variable * ptr = variables.value(key); +// Variable * ptr = variables.find(key); + Variable * ptr = variables.value(key); if (ptr == NULL || ptr->getType() != RS2::VariableVector) ret = def; @@ -167,34 +167,34 @@ Vector RS_VariableDict::getVector(const QString & key, const Vector & def) * @return The value for the given variable or the given default value * if the variable couldn't be found. */ -QString RS_VariableDict::getString(const QString & key, const QString & def) +QString VariableDict::getString(const QString & key, const QString & def) { QString ret; - RS_DEBUG->print("RS_VariableDict::getString: 001"); - RS_DEBUG->print("RS_VariableDict::getString: key: '%s'", key.toLatin1().data()); + DEBUG->print("VariableDict::getString: 001"); + DEBUG->print("VariableDict::getString: key: '%s'", key.toLatin1().data()); -// RS_Variable * ptr = variables.find(key); - RS_Variable * ptr = variables.value(key); - RS_DEBUG->print("RS_VariableDict::getString: 002"); +// Variable * ptr = variables.find(key); + Variable * ptr = variables.value(key); + DEBUG->print("VariableDict::getString: 002"); if (ptr == NULL) { - RS_DEBUG->print("RS_VariableDict::getString: 003"); + DEBUG->print("VariableDict::getString: 003"); ret = def; } else if (ptr->getType() != RS2::VariableString) { - RS_DEBUG->print("RS_VariableDict::getString: 004"); + DEBUG->print("VariableDict::getString: 004"); ret = def; } else { - RS_DEBUG->print("RS_VariableDict::getString: 005"); + DEBUG->print("VariableDict::getString: 005"); ret = ptr->getString(); } - RS_DEBUG->print("RS_VariableDict::getString: 006"); + DEBUG->print("VariableDict::getString: 006"); return ret; } @@ -208,11 +208,11 @@ QString RS_VariableDict::getString(const QString & key, const QString & def) * @return The value for the given variable or the given default value * if the variable couldn't be found. */ -int RS_VariableDict::getInt(const QString & key, int def) +int VariableDict::getInt(const QString & key, int def) { int ret; -// RS_Variable * ptr = variables.find(key); - RS_Variable * ptr = variables.value(key); +// Variable * ptr = variables.find(key); + Variable * ptr = variables.value(key); if (ptr == NULL || ptr->getType() != RS2::VariableInt) ret = def; @@ -231,11 +231,11 @@ int RS_VariableDict::getInt(const QString & key, int def) * @return The value for the given variable or the given default value * if the variable couldn't be found. */ -double RS_VariableDict::getDouble(const QString & key, double def) +double VariableDict::getDouble(const QString & key, double def) { double ret; -// RS_Variable * ptr = variables.find(key); - RS_Variable * ptr = variables.value(key); +// Variable * ptr = variables.find(key); + Variable * ptr = variables.value(key); if (ptr == NULL || ptr->getType() != RS2::VariableDouble) ret = def; @@ -250,9 +250,9 @@ double RS_VariableDict::getDouble(const QString & key, double def) * used after adding a lot of variables without auto-update. */ /* -void RS_VariableDict::addBlockNotification() { +void VariableDict::addBlockNotification() { for (uint i=0; iblockAdded(NULL); } } @@ -263,16 +263,16 @@ void RS_VariableDict::addBlockNotification() { * TODO: Listeners are notified after the block was removed from * the list but before it gets deleted. */ -void RS_VariableDict::remove(const QString & key) +void VariableDict::remove(const QString & key) { - RS_DEBUG->print("RS_VariableDict::removeVariable()"); + DEBUG->print("VariableDict::removeVariable()"); // here the block is removed from the list but not deleted variables.remove(key); } -//Q3Dict & RS_VariableDict::getVariableDict() -QMultiHash & RS_VariableDict::getVariableDict() +//Q3Dict & VariableDict::getVariableDict() +QMultiHash & VariableDict::getVariableDict() { return variables; } @@ -280,11 +280,11 @@ QMultiHash & RS_VariableDict::getVariableDict() /** * Dumps the variables to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_VariableDict & d) +std::ostream & operator<<(std::ostream & os, VariableDict & d) { os << "Variables: \n"; -// Q3DictIterator it(d.variables); - QHashIterator it(d.variables); +// Q3DictIterator it(d.variables); + QHashIterator it(d.variables); while (it.hasNext()) {