diff options
Diffstat (limited to 'lib/kross/api/variant.cpp')
-rw-r--r-- | lib/kross/api/variant.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/lib/kross/api/variant.cpp b/lib/kross/api/variant.cpp index 92c0e3cb..e8d8bc1b 100644 --- a/lib/kross/api/variant.cpp +++ b/lib/kross/api/variant.cpp @@ -24,8 +24,8 @@ using namespace Kross::Api; -Variant::Variant(const QVariant& value) - : Value<Variant, QVariant>(value) +Variant::Variant(const TQVariant& value) + : Value<Variant, TQVariant>(value) { } @@ -33,38 +33,38 @@ Variant::~Variant() { } -const QString Variant::getClassName() const +const TQString Variant::getClassName() const { return "Kross::Api::Variant"; } -const QString Variant::toString() +const TQString Variant::toString() { return getValue().toString(); } /* -const QString Variant::getVariantType(Object::Ptr object) +const TQString Variant::getVariantType(Object::Ptr object) { switch( toVariant(object).type() ) { - case QVariant::CString: - case QVariant::String: + case TQVariant::CString: + case TQVariant::String: return "Kross::Api::Variant::String"; - case QVariant::Map: + case TQVariant::Map: return "Kross::Api::Variant::Dict"; - case QVariant::StringList: - case QVariant::List: + case TQVariant::StringList: + case TQVariant::List: return "Kross::Api::Variant::List"; - case QVariant::Double: + case TQVariant::Double: //return "Kross::Api::Variant::Double"; - case QVariant::UInt: + case TQVariant::UInt: //return "Kross::Api::Variant::UInt"; // python isn't able to differ between int and uint :-( - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::Int: + case TQVariant::LongLong: + case TQVariant::ULongLong: + case TQVariant::Int: return "Kross::Api::Variant::Integer"; - case QVariant::Bool: + case TQVariant::Bool: return "Kross::Api::Variant::Bool"; default: //Date, Time, DateTime, ByteArray, BitArray, Rect, Size, Color, Invalid, etc. return "Kross::Api::Variant"; @@ -72,97 +72,97 @@ const QString Variant::getVariantType(Object::Ptr object) } */ -const QVariant& Variant::toVariant(Object::Ptr object) +const TQVariant& Variant::toVariant(Object::Ptr object) { return Object::fromObject<Variant>( object.data() )->getValue(); } -const QString Variant::toString(Object::Ptr object) +const TQString Variant::toString(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::String)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::String expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::String)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::String expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toString(); } int Variant::toInt(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::Int)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Int expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::Int)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Int expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toInt(); } uint Variant::toUInt(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::UInt)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::UInt expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::UInt)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::UInt expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toUInt(); } double Variant::toDouble(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::Double)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Double expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::Double)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Double expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toDouble(); } -Q_LLONG Variant::toLLONG(Object::Ptr object) +TQ_LLONG Variant::toLLONG(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::LongLong)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::LLONG expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::LongLong)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::LLONG expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toLongLong(); } -Q_ULLONG Variant::toULLONG(Object::Ptr object) +TQ_ULLONG Variant::toULLONG(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::ULongLong)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::ULLONG expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::ULongLong)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::ULLONG expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toULongLong(); } bool Variant::toBool(Object::Ptr object) { - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::Bool)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Bool expected, but got %1.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::Bool)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::Bool expected, but got %1.").tqarg(variant.typeName()).latin1()) ); return variant.toBool(); } -QStringList Variant::toStringList(Object::Ptr object) +TQStringList Variant::toStringList(Object::Ptr object) { List* list = dynamic_cast< List* >( object.data() ); if(list) { - QStringList l; - QValueList<Object::Ptr> valuelist = list->getValue(); - QValueList<Object::Ptr>::Iterator it(valuelist.begin()), end(valuelist.end()); + TQStringList l; + TQValueList<Object::Ptr> valuelist = list->getValue(); + TQValueList<Object::Ptr>::Iterator it(valuelist.begin()), end(valuelist.end()); for(; it != end; ++it) l.append( toString(*it) ); return l; } - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::StringList)) - throw Exception::Ptr( new Exception(QString("Kross::Api::Variant::StringList expected, but got '%1'.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::StringList)) + throw Exception::Ptr( new Exception(TQString("Kross::Api::Variant::StringList expected, but got '%1'.").tqarg(variant.typeName()).latin1()) ); return variant.toStringList(); } -QValueList<QVariant> Variant::toList(Object::Ptr object) +TQValueList<TQVariant> Variant::toList(Object::Ptr object) { List* list = dynamic_cast< List* >( object.data() ); if(list) { - QValueList<QVariant> l; - QValueList<Object::Ptr> valuelist = list->getValue(); - QValueList<Object::Ptr>::Iterator it(valuelist.begin()), end(valuelist.end()); + TQValueList<TQVariant> l; + TQValueList<Object::Ptr> valuelist = list->getValue(); + TQValueList<Object::Ptr>::Iterator it(valuelist.begin()), end(valuelist.end()); for(; it != end; ++it) l.append( toVariant(*it) ); return l; } - const QVariant& variant = toVariant(object); - if(! variant.canCast(QVariant::List)) - throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::List expected, but got '%1'.").arg(variant.typeName()).latin1()) ); + const TQVariant& variant = toVariant(object); + if(! variant.canCast(TQVariant::List)) + throw Exception::Ptr( new Exception(i18n("Kross::Api::Variant::List expected, but got '%1'.").tqarg(variant.typeName()).latin1()) ); return variant.toList(); } |