/**
* 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();
}
/**
* @return Number of variables available.
*/
-int RS_VariableDict::count()
+int VariableDict::count()
{
return variables.count();
}
* Activates the given block.
* Listeners are notified.
*/
-//void RS_VariableDict::activateBlock(const QString& name) {
+//void VariableDict::activateBlock(const QString& name) {
// activateBlock(findBlock(name));
//}
* 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; i<blockListListeners.count(); ++i) {
- RS_VariableDictListener* l = blockListListeners.at(i);
+ VariableDictListener* l = blockListListeners.at(i);
l->blockActivated(activeBlock);
}
* 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));
}
/**
* @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;
* @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;
}
* @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;
* @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;
* used after adding a lot of variables without auto-update.
*/
/*
-void RS_VariableDict::addBlockNotification() {
+void VariableDict::addBlockNotification() {
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_VariableDictListener* l = blockListListeners.at(i);
+ VariableDictListener* l = blockListListeners.at(i);
l->blockAdded(NULL);
}
}
* 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_Variable> & RS_VariableDict::getVariableDict()
-QMultiHash<QString, RS_Variable *> & RS_VariableDict::getVariableDict()
+//Q3Dict<Variable> & VariableDict::getVariableDict()
+QMultiHash<QString, Variable *> & VariableDict::getVariableDict()
{
return variables;
}
/**
* 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<RS_Variable> it(d.variables);
- QHashIterator<QString, RS_Variable *> it(d.variables);
+// Q3DictIterator<Variable> it(d.variables);
+ QHashIterator<QString, Variable *> it(d.variables);
while (it.hasNext())
{