Example #1
0
QSObject QSErrorClass::construct( const QSList &args ) const
{
    QString m = !args.isEmpty() && args[0].isDefined() ?
                args[0].toString() : QString::null;

    return construct( GeneralError, m );
}
Example #2
0
QSObject QSObjectClass::construct( const QSList &args ) const
{
    if ( args.isEmpty() ) {
	return env()->dynamicClass()->createWritable();
    } else {
	// ### warn about superfluous arguments ?
	return args[0];
    }
}
QSObject QSRegExpClass::construct( const QSList &args ) const
{
    // ### regexp arguments
    QString p = args.isEmpty() ? QString::fromLatin1( "" ) : args[0].toString();

    if (args.size() < 2) {
	QSRegExpShared *sh = new QSRegExpShared(p, FALSE, FALSE);
	return env()->createShared(this, sh);
    }

    QString flags = args[1].toString();
    bool ignoreCase = (flags.find(QString::fromLatin1("i")) >= 0);
    bool global = (flags.find(QString::fromLatin1("g")) >= 0);
    QSRegExpShared *sh = new QSRegExpShared(p, ignoreCase, global); // ### apply flags
    return env()->createShared(this, sh);
}
Example #4
0
QSObject QSStringClass::construct( const QSList &args ) const
{
    QString s = args.isEmpty() ? QString::fromLatin1( "" ) : args[0].toString();

    return createString( s );
}
QSObject QSNumberClass::construct( const QSList &args ) const
{
    double n = args.isEmpty() ? 0.0 : args[0].toNumber();

    return createNumber( n );
}