Adjusted to use new TQStringVariantMap type.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/2/head
Michele Calgaro 6 years ago
parent 04a1248521
commit 728b7db284
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -82,7 +82,7 @@ TQString KisFilterConfiguration::toString()
doc.appendChild( root ); doc.appendChild( root );
TQMap<TQString, TQVariant>::Iterator it; TQStringVariantMap::Iterator it;
for ( it = m_properties.begin(); it != m_properties.end(); ++it ) { for ( it = m_properties.begin(); it != m_properties.end(); ++it ) {
TQDomElement e = doc.createElement( "property" ); TQDomElement e = doc.createElement( "property" );
e.setAttribute( "name", it.key().latin1() ); e.setAttribute( "name", it.key().latin1() );
@ -178,7 +178,7 @@ TQString KisFilterConfiguration::getString(const TQString & name, TQString def)
void KisFilterConfiguration::dump() void KisFilterConfiguration::dump()
{ {
TQMap<TQString, TQVariant>::Iterator it; TQStringVariantMap::Iterator it;
for ( it = m_properties.begin(); it != m_properties.end(); ++it ) { for ( it = m_properties.begin(); it != m_properties.end(); ++it ) {
} }

@ -98,7 +98,7 @@ protected:
TQString m_name; TQString m_name;
TQ_INT32 m_version; TQ_INT32 m_version;
TQMap<TQString, TQVariant> m_properties; TQStringVariantMap m_properties;
}; };

@ -987,9 +987,9 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &do
savePropertyElement(tclass, domDoc, "property", "buddy", ((TQLabel*)item->widget())->buddy()->name()); savePropertyElement(tclass, domDoc, "property", "buddy", ((TQLabel*)item->widget())->buddy()->name());
// We save every property in the modifProp list of the ObjectTreeItem // We save every property in the modifProp list of the ObjectTreeItem
TQVariantMap *map = new TQVariantMap( *(item->modifiedProperties()) ); TQStringVariantMap *map = new TQStringVariantMap( *(item->modifiedProperties()) );
TQMap<TQString,TQVariant>::ConstIterator endIt = map->constEnd(); TQStringVariantMap::ConstIterator endIt = map->constEnd();
for(TQMap<TQString,TQVariant>::ConstIterator it = map->constBegin(); it != endIt; ++it) for(TQStringVariantMap::ConstIterator it = map->constBegin(); it != endIt; ++it)
{ {
const TQCString name( it.key().latin1() ); const TQCString name( it.key().latin1() );
if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "alignment") { if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "alignment") {

@ -90,7 +90,7 @@ void
ObjectTreeItem::addSubproperty(const TQCString &property, const TQVariant& value) ObjectTreeItem::addSubproperty(const TQCString &property, const TQVariant& value)
{ {
if (!m_subprops) if (!m_subprops)
m_subprops = new TQMap<TQString, TQVariant>(); m_subprops = new TQStringVariantMap();
if (!m_props.contains(property)) if (!m_props.contains(property))
m_subprops->insert( property, value ); m_subprops->insert( property, value );
} }

@ -50,12 +50,6 @@ typedef TQDict<ObjectTreeItem> ObjectTreeDict;
//! @short An iterator for ObjectTreeDict. //! @short An iterator for ObjectTreeDict.
typedef TQDictIterator<ObjectTreeItem> ObjectTreeDictIterator; typedef TQDictIterator<ObjectTreeItem> ObjectTreeDictIterator;
//! @short A TQString -> TQVarinat map.
typedef TQMap<TQString, TQVariant> TQVariantMap;
//! @short A const iterator for TQVariantMap.
typedef TQMapConstIterator<TQString, TQVariant> TQVariantMapConstIterator;
/*! /*!
@short An item representing a widget @short An item representing a widget
Holds the properties of a widget (classname, name, parent, children ..). Holds the properties of a widget (classname, name, parent, children ..).
@ -74,9 +68,9 @@ class KFORMEDITOR_EXPORT ObjectTreeItem
ObjectTreeItem* parent() const { return m_parent; } ObjectTreeItem* parent() const { return m_parent; }
ObjectTreeList* children() { return &m_children; } ObjectTreeList* children() { return &m_children; }
/*! \return a TQMap<TQString, TQVariant> of all modified properties for this widget. /*! \return a TQStringVariantMap of all modified properties for this widget.
The TQVariant is the old value (ie first value) of the property whose name is the TQString. */ The TQVariant is the old value (ie first value) of the property whose name is the TQString. */
const TQVariantMap* modifiedProperties() const { return &m_props;} const TQStringVariantMap* modifiedProperties() const { return &m_props;}
//! \return the widget's Container, or 0 if the widget is not a Container. //! \return the widget's Container, or 0 if the widget is not a Container.
Container* container() const { return m_container;} Container* container() const { return m_container;}
@ -103,7 +97,7 @@ class KFORMEDITOR_EXPORT ObjectTreeItem
/*! \return subproperties for this item, added by addSubproperty() /*! \return subproperties for this item, added by addSubproperty()
or 0 is there are no subproperties. */ or 0 is there are no subproperties. */
TQMap<TQString, TQVariant>* subproperties() const { return m_subprops; } TQStringVariantMap* subproperties() const { return m_subprops; }
void setPixmapName(const TQCString &property, const TQString &name); void setPixmapName(const TQCString &property, const TQString &name);
TQString pixmapName(const TQCString &property); TQString pixmapName(const TQCString &property);
@ -123,8 +117,8 @@ class KFORMEDITOR_EXPORT ObjectTreeItem
TQString m_name; TQString m_name;
ObjectTreeList m_children; ObjectTreeList m_children;
TQGuardedPtr<Container> m_container; TQGuardedPtr<Container> m_container;
TQMap<TQString, TQVariant> m_props; TQStringVariantMap m_props;
TQMap<TQString, TQVariant> *m_subprops; TQStringVariantMap *m_subprops;
TQString m_unknownProps; TQString m_unknownProps;
TQMap<TQCString, TQString> m_pixmapNames; TQMap<TQCString, TQString> m_pixmapNames;
ObjectTreeItem* m_parent; ObjectTreeItem* m_parent;

@ -275,8 +275,8 @@ WidgetPropertySet::createPropertiesForWidget(TQWidget *w)
if(!tree) if(!tree)
return; return;
const TQVariantMap* modifiedProperties = tree->modifiedProperties(); const TQStringVariantMap* modifiedProperties = tree->modifiedProperties();
TQVariantMapConstIterator modifiedPropertiesIt; TQStringVariantMapConstIterator modifiedPropertiesIt;
bool isTopLevel = KFormDesigner::FormManager::self()->isTopLevel(w); bool isTopLevel = KFormDesigner::FormManager::self()->isTopLevel(w);
// int count = 0; // int count = 0;
KoProperty::Property *newProp = 0; KoProperty::Property *newProp = 0;
@ -416,7 +416,7 @@ WidgetPropertySet::updatePropertyValue(ObjectTreeItem *tree, const char *propert
KoProperty::Property p( d->set[propertyName] ); KoProperty::Property p( d->set[propertyName] );
//! \todo what about set properties, and lists properties //! \todo what about set properties, and lists properties
TQMap<TQString, TQVariant>::ConstIterator it( tree->modifiedProperties()->find(propertyName) ); TQStringVariantMap::ConstIterator it( tree->modifiedProperties()->find(propertyName) );
if (it != tree->modifiedProperties()->constEnd()) { if (it != tree->modifiedProperties()->constEnd()) {
blockSignals(true); blockSignals(true);
if(meta && meta->isEnumType()) { if(meta && meta->isEnumType()) {
@ -1081,7 +1081,7 @@ WidgetPropertySet::valueCaption(const TQCString &name)
KoProperty::Property::ListData* KoProperty::Property::ListData*
WidgetPropertySet::createValueList(WidgetInfo *winfo, const TQStringList &list) WidgetPropertySet::createValueList(WidgetInfo *winfo, const TQStringList &list)
{ {
// TQMap <TQString, TQVariant> map; // TQStringVariantMap map;
TQStringList names; TQStringList names;
TQStringList::ConstIterator endIt = list.end(); TQStringList::ConstIterator endIt = list.end();
for(TQStringList::ConstIterator it = list.begin(); it != endIt; ++it) { for(TQStringList::ConstIterator it = list.begin(); it != endIt; ++it) {

@ -73,7 +73,7 @@ namespace KexiDB {
*/ */
class KEXI_DB_EXPORT RowEditBuffer { class KEXI_DB_EXPORT RowEditBuffer {
public: public:
typedef TQMap<TQString,TQVariant> SimpleMap; typedef TQStringVariantMap SimpleMap;
typedef TQMap<QueryColumnInfo*,TQVariant> DBMap; typedef TQMap<QueryColumnInfo*,TQVariant> DBMap;
RowEditBuffer(bool dbAwareBuffer); RowEditBuffer(bool dbAwareBuffer);

@ -340,8 +340,8 @@ void KexiFormView::updateValuesForSubproperties()
= dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>( it.current()->widget() ); = dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>( it.current()->widget() );
if (subpropIface && subpropIface->subwidget() && it.current()->subproperties() ) { if (subpropIface && subpropIface->subwidget() && it.current()->subproperties() ) {
TQWidget *subwidget = subpropIface->subwidget(); TQWidget *subwidget = subpropIface->subwidget();
TQMap<TQString, TQVariant>* subprops = it.current()->subproperties(); TQStringVariantMap* subprops = it.current()->subproperties();
for (TQMapConstIterator<TQString, TQVariant> subpropIt = subprops->constBegin(); subpropIt!=subprops->constEnd(); ++subpropIt) { for (TQStringVariantMapConstIterator subpropIt = subprops->constBegin(); subpropIt!=subprops->constEnd(); ++subpropIt) {
kexipluginsdbg << "KexiFormView::loadForm(): delayed setting of the subproperty: widget=" kexipluginsdbg << "KexiFormView::loadForm(): delayed setting of the subproperty: widget="
<< it.current()->widget()->name() << " prop=" << subpropIt.key() << " val=" << subpropIt.data() << endl; << it.current()->widget()->name() << " prop=" << subpropIt.key() << " val=" << subpropIt.data() << endl;

@ -436,8 +436,8 @@ class ListBox : public TQListBox
//kdDebug() << " child name=" << n << " value=" << v << endl; //kdDebug() << " child name=" << n << " value=" << v << endl;
switch( v.type() ) { switch( v.type() ) {
/* case TQVariant::Map: { /* case TQVariant::Map: {
const TQMap<TQString,TQVariant> map = v.toMap(); const TQStringVariantMap map = v.toMap();
for(TQMap<TQString,TQVariant>::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it) for(TQStringVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
m_items.append(it.key()); m_items.append(it.key());
} break; */ } break; */
case TQVariant::List: { case TQVariant::List: {

@ -318,8 +318,8 @@ tristate KexiScriptDesignView::storeData(bool /*dontAsk*/)
Kross::Api::InterpreterInfo* info = Kross::Api::Manager::scriptManager()->getInterpreterInfo(language); Kross::Api::InterpreterInfo* info = Kross::Api::Manager::scriptManager()->getInterpreterInfo(language);
if(info) { if(info) {
Kross::Api::InterpreterInfo::Option::Map defoptions = info->getOptions(); Kross::Api::InterpreterInfo::Option::Map defoptions = info->getOptions();
TQMap<TQString, TQVariant>& options = d->scriptaction->getOptions(); TQStringVariantMap& options = d->scriptaction->getOptions();
TQMap<TQString, TQVariant>::ConstIterator it, end( options.constEnd() ); TQStringVariantMap::ConstIterator it, end( options.constEnd() );
for( it = options.constBegin(); it != end; ++it) { for( it = options.constBegin(); it != end; ++it) {
if( defoptions.contains(it.key()) ) { // only remember options which the InterpreterInfo knows about... if( defoptions.contains(it.key()) ) { // only remember options which the InterpreterInfo knows about...
scriptelem.setAttribute(it.key(), it.data().toString()); scriptelem.setAttribute(it.key(), it.data().toString());

@ -270,7 +270,7 @@ SizePolicyCustomProperty::SizePolicyCustomProperty(Property *property)
: CustomProperty(property) : CustomProperty(property)
{ {
if(property && (property->type() == SizePolicy) ) { if(property && (property->type() == SizePolicy) ) {
// TQMap<TQString, TQVariant> spValues; // TQStringVariantMap spValues;
TQValueList<TQVariant> keys; TQValueList<TQVariant> keys;
keys << TQSizePolicy::Fixed keys << TQSizePolicy::Fixed
<< TQSizePolicy::Minimum << TQSizePolicy::Minimum

@ -178,7 +178,7 @@ ComboBox::setReadOnlyInternal(bool readOnly)
/*TQString /*TQString
ComboBox::keyForValue(const TQVariant &value) ComboBox::keyForValue(const TQVariant &value)
{ {
const TQMap<TQString, TQVariant> *list = property()->valueList(); const TQStringVariantMap *list = property()->valueList();
Property::ListData *list = property()->listData(); Property::ListData *list = property()->listData();
if (!list) if (!list)
@ -186,8 +186,8 @@ ComboBox::keyForValue(const TQVariant &value)
int idx = listData->keys.findIndex( value ); int idx = listData->keys.findIndex( value );
TQMap<TQString, TQVariant>::ConstIterator endIt = list->constEnd(); TQStringVariantMap::ConstIterator endIt = list->constEnd();
for(TQMap<TQString, TQVariant>::ConstIterator it = list->constBegin(); it != endIt; ++it) { for(TQStringVariantMap::ConstIterator it = list->constBegin(); it != endIt; ++it) {
if(it.data() == value) if(it.data() == value)
return it.key(); return it.key();
} }

@ -31,7 +31,7 @@
using namespace KoProperty; using namespace KoProperty;
//TQMap<TQString, TQVariant> *CursorEdit::m_spValues = 0; //TQStringVariantMap *CursorEdit::m_spValues = 0;
Property::ListData *m_cursorListData = 0; Property::ListData *m_cursorListData = 0;
@ -40,7 +40,7 @@ CursorEdit::CursorEdit(Property *property, TQWidget *parent, const char *name)
{ {
/* /*
if(!m_spValues) { if(!m_spValues) {
m_spValues = new TQMap<TQString, TQVariant>(); m_spValues = new TQStringVariantMap();
(*m_spValues)[i18n("Arrow")] = TQt::ArrowCursor; (*m_spValues)[i18n("Arrow")] = TQt::ArrowCursor;
(*m_spValues)[i18n("Up Arrow")] = TQt::UpArrowCursor; (*m_spValues)[i18n("Up Arrow")] = TQt::UpArrowCursor;
(*m_spValues)[i18n("Cross")] = TQt::CrossCursor; (*m_spValues)[i18n("Cross")] = TQt::CrossCursor;

@ -43,7 +43,7 @@ class KOPROPERTY_EXPORT CursorEdit : public ComboBox
virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value); virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value);
private: private:
static TQMap<TQString, TQVariant> *m_spValues; static TQStringVariantMap *m_spValues;
}; };
} }

@ -32,7 +32,7 @@
using namespace KoProperty; using namespace KoProperty;
TQMap<TQString, TQVariant> *SizePolicyEdit::m_spValues = 0; TQStringVariantMap *SizePolicyEdit::m_spValues = 0;
SizePolicyEdit::SizePolicyEdit(Property *property, TQWidget *parent, const char *name) SizePolicyEdit::SizePolicyEdit(Property *property, TQWidget *parent, const char *name)
: Widget(property, parent, name) : Widget(property, parent, name)
@ -50,7 +50,7 @@ SizePolicyEdit::SizePolicyEdit(Property *property, TQWidget *parent, const char
if(!m_spValues) { if(!m_spValues) {
m_spValues = new TQMap<TQString, TQVariant>(); m_spValues = new TQStringVariantMap();
(*m_spValues)[i18n("Size Policy", "Fixed")] = TQSizePolicy::Fixed; (*m_spValues)[i18n("Size Policy", "Fixed")] = TQSizePolicy::Fixed;
(*m_spValues)[i18n("Size Policy", "Minimum")] = TQSizePolicy::Minimum; (*m_spValues)[i18n("Size Policy", "Minimum")] = TQSizePolicy::Minimum;
(*m_spValues)[i18n("Size Policy", "Maximum")] = TQSizePolicy::Maximum; (*m_spValues)[i18n("Size Policy", "Maximum")] = TQSizePolicy::Maximum;
@ -105,8 +105,8 @@ SizePolicyEdit::findDescription(const TQVariant &value) const
if(!m_spValues) if(!m_spValues)
return TQString(); return TQString();
TQMap<TQString, TQVariant>::ConstIterator endIt = m_spValues->constEnd(); TQStringVariantMap::ConstIterator endIt = m_spValues->constEnd();
for (TQMap<TQString, TQVariant>::ConstIterator it = m_spValues->constBegin(); it != endIt; ++ it) { for (TQStringVariantMap::ConstIterator it = m_spValues->constBegin(); it != endIt; ++ it) {
if (it.data() == value) if (it.data() == value)
return it.key(); return it.key();
} }

@ -52,7 +52,7 @@ class KOPROPERTY_EXPORT SizePolicyEdit : public Widget
private: private:
TQVariant m_value; TQVariant m_value;
TQLabel *m_edit; TQLabel *m_edit;
static TQMap<TQString, TQVariant> *m_spValues; static TQStringVariantMap *m_spValues;
}; };
} }

@ -78,7 +78,7 @@ class PropertyPrivate
TQVariant oldValue; TQVariant oldValue;
/*! The string-to-value correspondence list of the property.*/ /*! The string-to-value correspondence list of the property.*/
Property::ListData* listData; Property::ListData* listData;
// TQMap<TQString, TQVariant> *valueList; // TQStringVariantMap *valueList;
TQString icon; TQString icon;
bool changed : 1; bool changed : 1;
@ -153,10 +153,10 @@ TQStringList Property::ListData::keysAsStringList() const
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
/* /*
KOPROPERTY_EXPORT TQMap<TQString, TQVariant> KOPROPERTY_EXPORT TQStringVariantMap
KoProperty::createValueListFromStringLists(const TQStringList &keys, const TQStringList &values) KoProperty::createValueListFromStringLists(const TQStringList &keys, const TQStringList &values)
{ {
TQMap<TQString, TQVariant> map; TQStringVariantMap map;
if(keys.count() != values.count()) if(keys.count() != values.count())
return map; return map;
@ -423,7 +423,7 @@ Property::resetValue()
} }
} }
//const TQMap<TQString, TQVariant>* //const TQStringVariantMap*
Property::ListData* Property::ListData*
Property::listData() const Property::listData() const
{ {
@ -431,10 +431,10 @@ Property::listData() const
} }
void void
Property::setListData(ListData* list) //const TQMap<TQString, TQVariant> &list) Property::setListData(ListData* list) //const TQStringVariantMap &list)
{ {
// if(!d->valueList) // if(!d->valueList)
// d->valueList = new TQMap<TQString, TQVariant>(); // d->valueList = new TQStringVariantMap();
if (list == d->listData) if (list == d->listData)
return; return;
delete d->listData; delete d->listData;
@ -448,7 +448,7 @@ Property::setListData(const TQStringList &keys, const TQStringList &names)
setListData(list); setListData(list);
// if(!d->valueList) // if(!d->valueList)
// d->valueList = new TQMap<TQString, TQVariant>(); // d->valueList = new TQStringVariantMap();
// *(d->valueList) = createValueListFromStringLists(keys, values); // *(d->valueList) = createValueListFromStringLists(keys, values);
} }
@ -590,7 +590,7 @@ Property::operator= (const Property &property)
d->options = property.d->options; d->options = property.d->options;
if(property.d->listData) { if(property.d->listData) {
d->listData = new ListData(*property.d->listData); //TQMap<TQString, TQVariant>(*(property.d->valueList)); d->listData = new ListData(*property.d->listData); //TQStringVariantMap(*(property.d->valueList));
} }
if(property.d->custom) { if(property.d->custom) {
d->custom = FactoryManager::self()->createCustomProperty(this); d->custom = FactoryManager::self()->createCustomProperty(this);

@ -56,7 +56,7 @@ class CustomProperty;
class Set; class Set;
///*! Helper function to create a value list from two string lists. */ ///*! Helper function to create a value list from two string lists. */
//KOPROPERTY_EXPORT TQMap<TQString, TQVariant> createValueListFromStringLists( //KOPROPERTY_EXPORT TQStringVariantMap createValueListFromStringLists(
// const TQStringList &keys, const TQStringList &values); // const TQStringList &keys, const TQStringList &values);
/*! PropertyType. /*! PropertyType.
@ -66,7 +66,7 @@ enum PropertyType {
//standard supported TQVariant types //standard supported TQVariant types
Auto = TQVariant::Invalid - 1, Auto = TQVariant::Invalid - 1,
Invalid = TQVariant::Invalid /**<invalid property type*/, Invalid = TQVariant::Invalid /**<invalid property type*/,
Map = TQVariant::Map /**<TQMap<TQString, TQVariant>*/, Map = TQVariant::Map /**<TQStringVariantMap*/,
List = TQVariant::List /**<TQValueList<TQVariant>*/, List = TQVariant::List /**<TQValueList<TQVariant>*/,
String = TQVariant::String /**<string*/, String = TQVariant::String /**<string*/,
StringList = TQVariant::StringList /**<string list*/, StringList = TQVariant::StringList /**<string list*/,

@ -77,7 +77,7 @@ namespace Kross { namespace Api {
* Map of options that overwritte the \a InterpreterInfo::Option::Map * Map of options that overwritte the \a InterpreterInfo::Option::Map
* standard options. * standard options.
*/ */
TQMap<TQString, TQVariant> options; TQStringVariantMap options;
}; };
@ -144,7 +144,7 @@ void ScriptContainer::setFile(const TQString& scriptfile)
d->scriptfile = scriptfile; d->scriptfile = scriptfile;
} }
TQMap<TQString, TQVariant>& ScriptContainer::getOptions() TQStringVariantMap& ScriptContainer::getOptions()
{ {
return d->options; return d->options;
} }

@ -132,7 +132,7 @@ namespace Kross { namespace Api {
* The options are returned call-by-ref, so you are able to * The options are returned call-by-ref, so you are able to
* manipulate them. * manipulate them.
*/ */
TQMap<TQString, TQVariant>& getOptions(); TQStringVariantMap& getOptions();
/** /**
* \return the value of the option defined with \p name . * \return the value of the option defined with \p name .

@ -262,13 +262,13 @@ const Py::List PythonExtension::toPyObject(const TQStringList& list)
return l; return l;
} }
const Py::Dict PythonExtension::toPyObject(const TQMap<TQString, TQVariant>& map) const Py::Dict PythonExtension::toPyObject(const TQStringVariantMap& map)
{ {
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG #ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQMap<TQString,TQVariant>)") ); krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQStringVariantMap)") );
#endif #endif
Py::Dict d; Py::Dict d;
for(TQMap<TQString, TQVariant>::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it) for(TQStringVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
d.setItem(it.key().latin1(), toPyObject(it.data())); d.setItem(it.key().latin1(), toPyObject(it.data()));
return d; return d;
} }

@ -158,7 +158,7 @@ namespace Kross { namespace Python {
* \param map The TQMap to convert. * \param map The TQMap to convert.
* \return The to a Py::Dict converted TQMap. * \return The to a Py::Dict converted TQMap.
*/ */
static const Py::Dict toPyObject(const TQMap<TQString, TQVariant>& map); static const Py::Dict toPyObject(const TQStringVariantMap& map);
/** /**
* Converts a TQValueList to a Py::List. * Converts a TQValueList to a Py::List.

@ -286,10 +286,10 @@ VALUE RubyExtension::toVALUE(TQStringList list)
} }
VALUE RubyExtension::toVALUE(TQMap<TQString, TQVariant> map) VALUE RubyExtension::toVALUE(TQStringVariantMap map)
{ {
VALUE h = rb_hash_new(); VALUE h = rb_hash_new();
for(TQMap<TQString, TQVariant>::Iterator it = map.begin(); it != map.end(); ++it) for(TQStringVariantMap::Iterator it = map.begin(); it != map.end(); ++it)
rb_hash_aset(h, toVALUE(it.key()), toVALUE(it.data()) ); rb_hash_aset(h, toVALUE(it.key()), toVALUE(it.data()) );
return h; return h;

@ -122,7 +122,7 @@ class RubyExtension{
* \param map The TQMap to convert. * \param map The TQMap to convert.
* \return The converted TQMap. * \return The converted TQMap.
*/ */
static VALUE toVALUE(TQMap<TQString, TQVariant> map); static VALUE toVALUE(TQStringVariantMap map);
/** /**
* Converts a TQValueList to a VALUE. * Converts a TQValueList to a VALUE.

@ -496,28 +496,28 @@ namespace Kross {
#if 0 #if 0
/// \internal /// \internal
template<> template<>
struct RubyType<TQVariantMap> struct RubyType<TQStringVariantMap>
{ {
inline static VALUE toVALUE(const TQVariantMap& map) { inline static VALUE toVALUE(const TQStringVariantMap& map) {
VALUE h = rb_hash_new(); VALUE h = rb_hash_new();
TQMap<TQString, TQVariant>::ConstIterator it(map.constBegin()), end(map.end()); TQStringVariantMap::ConstIterator it(map.constBegin()), end(map.end());
for(; it != end; ++it) for(; it != end; ++it)
rb_hash_aset(h, RubyType<TQString>::toVALUE(it.key()), RubyType<TQVariant>::toVALUE(it.value()) ); rb_hash_aset(h, RubyType<TQString>::toVALUE(it.key()), RubyType<TQVariant>::toVALUE(it.value()) );
return h; return h;
} }
inline static int convertHash(VALUE key, VALUE value, VALUE vmap) { inline static int convertHash(VALUE key, VALUE value, VALUE vmap) {
TQVariantMap* map; TQStringVariantMap* map;
Data_Get_Struct(vmap, TQVariantMap, map); Data_Get_Struct(vmap, TQStringVariantMap, map);
if (key != TQundef) if (key != TQundef)
map->insert(STR2CSTR(key), RubyType<TQVariant>::toVariant(value)); map->insert(STR2CSTR(key), RubyType<TQVariant>::toVariant(value));
return ST_CONTINUE; return ST_CONTINUE;
} }
inline static TQVariantMap toVariant(VALUE value) { inline static TQStringVariantMap toVariant(VALUE value) {
if( TYPE(value) != T_HASH ) { if( TYPE(value) != T_HASH ) {
rb_raise(rb_eTypeError, "TQVariantMap must be a hash"); rb_raise(rb_eTypeError, "TQStringVariantMap must be a hash");
return TQVariantMap(); return TQStringVariantMap();
} }
TQVariantMap map; TQStringVariantMap map;
VALUE vmap = Data_Wrap_Struct(rb_cObject, 0,0, &map); VALUE vmap = Data_Wrap_Struct(rb_cObject, 0,0, &map);
rb_hash_foreach(value, (int (*)(...))convertHash, vmap); rb_hash_foreach(value, (int (*)(...))convertHash, vmap);
return map; return map;

Loading…
Cancel
Save