// /// Called by EvHelp() to activate the help file with the help context ID. // void THelpFileManager::ActivateHelp(TWindow* /*window*/, int helpFileContextId, uint helpCmd) { if (helpCmd == HELP_INDEX || helpCmd == HELP_CONTENTS) helpCmd = HELP_FINDER; TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); #if !defined(NO_HTMLHELP) if(UseHTMLHelp){ if (app) HelpState = ToBool(HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(), helpCmd, helpFileContextId) != 0); else HelpState = ToBool(HtmlHelp(0, GetHelpFile().c_str(), helpCmd, helpFileContextId) != 0); } else{ #endif if (app) HelpState = ToBool(app->GetMainWindow()->WinHelp(GetHelpFile().c_str(), helpCmd, helpFileContextId)); else HelpState = ToBool(::WinHelp(0, GetHelpFile().c_str(), helpCmd, helpFileContextId)); #if !defined(NO_HTMLHELP) } #endif }
void AnimationController::PlayAnimAutoStop(const String &name, const String &fadein, const String &exclusive) { if (!name.Length()) { LogWarning("Empty animation name for PlayAnimAutoStop"); return; } float fadein_ = 0.0f; if (fadein.Length()) fadein_ = ToFloat(fadein); bool exclusive_ = false; if (exclusive.Length()) exclusive_ = ToBool(exclusive); bool success; if (exclusive_) success = EnableExclusiveAnimation(name, false, fadein_, false); else success = EnableAnimation(name, false, fadein_, false); if (!success) { StringVector anims = AvailableAnimations(); void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning; log("Failed to play animation \"" + name + "\" on entity " + ParentEntity()->Name()); log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ",")); // Enable autostop, and start always from the beginning SetAnimationAutoStop(name, true); SetAnimationTimePosition(name, 0.0f); } }
void AnimationController::PlayReverseAnim(const String &name, const String &fadein, const String &exclusive) { if (!ViewEnabled()) return; if (!name.Length()) { LogWarning("Empty animation name for PlayReverseAnim"); return; } float fadein_ = 0.0f; if (fadein.Length()) fadein_ = ToFloat(fadein); bool exclusive_ = false; if (exclusive.Length()) exclusive_ = ToBool(exclusive); bool success; if (exclusive_) success = EnableAnimation(name, true, fadein_, false); else success = EnableExclusiveAnimation(name, true, fadein_, fadein_, false); if (!success) { StringVector anims = AvailableAnimations(); void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning; log("Failed to play animation \"" + name + "\" in reverse on entity " + ParentEntity()->Name()); log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ",")); SetAnimationToEnd(name); SetAnimationSpeed(name, -1.0f); } }
bool TListViewCtrl::GetColumn(int index, LVCOLUMN* column) { PRECONDITION(column); PRECONDITION(GetHandle()); return ToBool(SendMessage(LVM_GETCOLUMN, TParam1(index), TParam2(column))); }
//-------------------------------------------------------------------------------- // @ InitializeWindow() //-------------------------------------------------------------------------------- // Initialize WINDOW //-------------------------------------------------------------------------------- static bool InitializeWindow() { //Fullscreen? std::string str; bool fullscreen = false; if (global::SETTINGS->GetValue("fullscreen", str)) { fullscreen = ToBool(str); } //Dimensions uint32 h = 200, w = 200; if (global::SETTINGS->GetValue("screen_height", str)) { StringToNumber(h, str, std::dec); } if (global::SETTINGS->GetValue("screen_width", str)) { StringToNumber(w, str, std::dec); } global::WINDOW = new WindowManager( w, h, fullscreen, "My Game"); //If everything initialized fine return true; } //End: InitializeWindow()
void SetValue(void* Pointer, const QString &Value, int Type) { if (!Pointer) return; switch (Type) { case QMetaType::Char: *((char*)Pointer) = Value.isEmpty() ? 0 : Value.at(0).toLatin1(); return; case QMetaType::UChar: *((unsigned char*)Pointer) = Value.isEmpty() ? 0 :Value.at(0).toLatin1(); return; case QMetaType::QChar: *((QChar*)Pointer) = Value.isEmpty() ? 0 : Value.at(0); return; case QMetaType::Bool: *((bool*)Pointer) = ToBool(Value); return; case QMetaType::Short: *((short*)Pointer) = Value.toShort(); return; case QMetaType::UShort: *((ushort*)Pointer) = Value.toUShort(); return; case QMetaType::Int: *((int*)Pointer) = Value.toInt(); return; case QMetaType::UInt: *((uint*)Pointer) = Value.toUInt(); return; case QMetaType::Long: *((long*)Pointer) = Value.toLong(); return; case QMetaType::ULong: *((ulong*)Pointer) = Value.toULong(); return; case QMetaType::LongLong: *((qlonglong*)Pointer) = Value.toLongLong(); return; case QMetaType::ULongLong: *((qulonglong*)Pointer) = Value.toULongLong(); return; case QMetaType::Double: *((double*)Pointer) = Value.toDouble(); return; case QMetaType::Float: *((float*)Pointer) = Value.toFloat(); return; case QMetaType::QString: *((QString*)Pointer) = Value; return; case QMetaType::QByteArray: *((QByteArray*)Pointer) = Value.toUtf8(); return; case QMetaType::QTime: *((QTime*)Pointer) = QTime::fromString(Value, Qt::ISODate); return; case QMetaType::QDate: *((QDate*)Pointer) = QDate::fromString(Value, Qt::ISODate); return; case QMetaType::QDateTime: { QDateTime dt = QDateTime::fromString(Value, Qt::ISODate); dt.setTimeSpec(Qt::UTC); *((QDateTime*)Pointer) = dt; return; } default: break; } }
bool TListViewCtrl::GetItemRect(int index, TRect& r, TItemRectType type) { PRECONDITION(GetHandle()); r.left = type; return ToBool(SendMessage(LVM_GETITEMRECT, TParam1(index), TParam2(&r))); }
void FFlagCVar::DoSet (UCVarValue value, ECVarType type) { bool newval = ToBool (value, type); // Server cvars that get changed by this need to use a special message, because // changes are not processed until the next net update. This is a problem with // exec scripts because all flags will base their changes off of the value of // the "master" cvar at the time the script was run, overriding any changes // another flag might have made to the same cvar earlier in the script. if ((ValueVar.GetFlags() & CVAR_SERVERINFO) && gamestate != GS_STARTUP && !demoplayback) { if (netgame && !players[consoleplayer].settings_controller) { Printf ("Only setting controllers can change %s\n", Name); return; } D_SendServerFlagChange (&ValueVar, BitNum, newval); } else { int val = *ValueVar; if (newval) val |= BitVal; else val &= ~BitVal; ValueVar = val; } }
bool TListViewCtrl::SortItemsEx(const TCompareFunc& comparator, LPARAM lParam) { TListCompareThunk ct; ct.This = &comparator; ct.ItemData = lParam; return ToBool(SendMessage(LVM_SORTITEMSEX, TParam1(&ct), TParam2(OwlListViewCompare))); }
bool TListViewCtrl::SetItemState(int index, uint state, uint mask) { LVITEM item; item.state = state; item.stateMask = mask; return ToBool(SendMessage(LVM_SETITEMSTATE, index, TParam2(&item))); }
//------------------------------------------------------------------------------ // bool TGadgetListBox::IsFlat() { TGadgetWindow* wnd = TYPESAFE_DOWNCAST(GetParentO(),TGadgetWindow); if(wnd) return ToBool(wnd->GetFlatStyle()&TGadgetWindow::FlatStandard); return false; }
bool TListViewCtrl::GetSubItemRect(TRect& rect, int subidx, int paridx, int flag) const { PRECONDITION(GetHandle()); rect.top = subidx; rect.left = flag; return ToBool(SendMessage(LVM_GETSUBITEMRECT, TParam1(paridx), TParam2(&rect))); }
Variant Material::ParseShaderParameterValue(const String& value) { String valueTrimmed = value.Trimmed(); if (valueTrimmed.Length() && IsAlpha(valueTrimmed[0])) return Variant(ToBool(valueTrimmed)); else return ToVectorVariant(valueTrimmed); }
bool TListViewCtrl::SetItemPosition(int index, const TPoint& pt) { PRECONDITION(GetHandle()); if (!IsRepresentable<uint16>(pt.x) || !IsRepresentable<uint16>(pt.y)) throw TXOwl(_T("TListViewCtrl:SetItemPosition: Argument is outside valid range")); return ToBool(SendMessage(LVM_SETITEMPOSITION, TParam1(index), MkParam2(pt.x, pt.y))); }
void FBoolCVar::SetGenericRepDefault (UCVarValue value, ECVarType type) { DefaultValue = ToBool (value, type); if (Flags & CVAR_ISDEFAULT) { SetGenericRep (value, type); Flags |= CVAR_ISDEFAULT; } }
bool TListViewCtrl::SetItem(const TLvItem& item, int index, int subitemIndex) { PRECONDITION(GetHandle()); if (index != -1 || subitemIndex != -1) { LVITEM temp = item; // Make s shallow copy, just to pass to LVM_INSERTITEM if (index != -1) temp.iItem = index; if (subitemIndex != -1) temp.iSubItem = subitemIndex; return ToBool(SendMessage(LVM_SETITEM, 0, TParam2(&temp))); } else return ToBool(SendMessage(LVM_SETITEM, 0, TParam2(&item))); }
BOOL CLuaBase::GetFieldToBool( int nStackPos, char* szName ) { int bValue = 0; lua_getfield( m_pLuaState, nStackPos, szName ); if( lua_isboolean( m_pLuaState, -1 ) ) bValue = ToBool( -1 ); Pop( 1 ); return (bValue == 0 ? FALSE : TRUE ); }
bool TListViewCtrl::GetItem(TLvItem& item, int index, int subitemIndex) const { PRECONDITION(GetHandle()); if (index != -1) item.iItem = index; if (subitemIndex != -1) item.iSubItem = subitemIndex; return ToBool(SendMessage(LVM_GETITEM, 0, TParam2(&item))); }
void CSMMSeqPair::XMLParameters(TiXmlNode *node) { if(node->FirstChild("IndividualLambdas")) SetIndividualLambdas(ToBool(node->FirstChild("IndividualLambdas"))); if(node->FirstChild("PairCoefCriteria")) SetPairCoefCriteria(ToUInt(node->FirstChild("PairCoefCriteria")->FirstChild("MinCount")),ToDouble(node->FirstChild("PairCoefCriteria")->FirstChild("MaxDisagrement"))); if(node->FirstChild("SMMParameters")) m_smm.XMLParameters(node->FirstChild("SMMParameters")); }
bool TListViewCtrl::Update(int index) { PRECONDITION(GetHandle()); // If the list window has LVS_AUTOARRANGE, the items are automatically // arranged to their proper locations. return ToBool(SendMessage(LVM_UPDATE, TParam1(index))); }
BOOL CLuaBase::GetGlobalBool( char* szName ) { BOOL bValue = FALSE; lua_getglobal( m_pLuaState, szName ); if( lua_isboolean( m_pLuaState, -1 ) ) bValue = ToBool( -1 ); Pop( 1 ); return bValue; }
void FFlagCVar::DoSet (UCVarValue value, ECVarType type) { bool newval = ToBool (value, type); ECVarType dummy; UCVarValue val; val = ValueVar.GetFavoriteRep (&dummy); if (newval) val.Int |= BitVal; else val.Int &= ~BitVal; ValueVar = val.Int; }
void FFlagCVar::SetGenericRepDefault (UCVarValue value, ECVarType type) { bool newdef = ToBool (value, type); ECVarType dummy; UCVarValue def; def = ValueVar.GetFavoriteRepDefault (&dummy); if (newdef) def.Int |= BitVal; else def.Int &= ~BitVal; ValueVar.SetGenericRepDefault (def, CVAR_Int); }
void* Service::ConvertToParameterPtr( int nTypeId, const QString &sParamType, void* pParam, const QString &sValue ) { // -=>NOTE: Only intrinsic or Qt type conversions should be here // All others should be added to overridden implementation. switch( nTypeId ) { case QMetaType::Bool : *(( bool *)pParam) = ToBool( sValue ); break; case QMetaType::Char : *(( char *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ).toAscii() : 0; break; case QMetaType::UChar : *(( unsigned char *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ).toAscii() : 0; break; case QMetaType::QChar : *(( QChar *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ) : 0; break; case QMetaType::Short : *(( short *)pParam) = sValue.toShort (); break; case QMetaType::UShort : *(( ushort *)pParam) = sValue.toUShort (); break; case QMetaType::Int : *(( int *)pParam) = sValue.toInt (); break; case QMetaType::UInt : *(( uint *)pParam) = sValue.toUInt (); break; case QMetaType::Long : *(( long *)pParam) = sValue.toLong (); break; case QMetaType::ULong : *(( ulong *)pParam) = sValue.toULong (); break; case QMetaType::LongLong : *(( qlonglong *)pParam) = sValue.toLongLong (); break; case QMetaType::ULongLong : *(( qulonglong *)pParam) = sValue.toULongLong (); break; case QMetaType::Double : *(( double *)pParam) = sValue.toDouble (); break; case QMetaType::Float : *(( float *)pParam) = sValue.toFloat (); break; case QMetaType::QString : *(( QString *)pParam) = sValue; break; case QMetaType::QByteArray : *(( QByteArray *)pParam) = sValue.toUtf8 (); break; case QMetaType::QDateTime : { QDateTime dt = QDateTime::fromString( sValue, Qt::ISODate ); dt.setTimeSpec(Qt::UTC); *(( QDateTime *)pParam) = dt.toLocalTime(); break; } case QMetaType::QTime : *(( QTime *)pParam) = QTime::fromString ( sValue, Qt::ISODate ); break; case QMetaType::QDate : *(( QDate *)pParam) = QDate::fromString ( sValue, Qt::ISODate ); break; } return pParam; }
// /// Constructs a TCelArray from a bitmap by slicing the bitmap into a horizontal /// array of cels of a specified size. If autoDelete is true, TCelArray can /// automatically delete the bitmap. The ShouldDelete data member defaults to true, /// ensuring that the handle will be deleted when the bitmap is destroyed. If /// numRows is 0, the number of rows is calculated using the bitmap height and the /// celSize y parameter. // TCelArray::TCelArray(TBitmap* bmp, int numCels, TSize celSize, TPoint offset, int numRows, TAutoDelete autoDelete) { PRECONDITION(bmp); NGrowBy = 1; NCels = NCelsUsed = std::max(1, numCels); NRows = std::max(1, numRows); CSize = celSize.cx && celSize.cy ? celSize : TSize(bmp->Width() / NCels, bmp->Height() / NRows); Offs = offset; NCurRow = 0; ShouldDelete = ToBool(autoDelete == AutoDelete); Bitmap = bmp; TRACEX(OwlGadget, OWL_CDLEVEL, "TCelArray constructed @" << (void*)this << " from slicing the bitmap @" << (void*)bmp); }
bool XMLElement::GetBool(const ea::string& name) const { return ToBool(GetAttribute(name)); }
void FBoolCVar::DoSet (UCVarValue value, ECVarType type) { Value = ToBool (value, type); }
void test() { // This function tests C++0x 5.16 // p1 (contextually convert to bool) int i1 = ToBool() ? 0 : 1; // p2 (one or both void, and throwing) i1 ? throw 0 : throw 1; i1 ? test() : throw 1; i1 ? throw 0 : test(); i1 ? test() : test(); i1 = i1 ? throw 0 : 0; i1 = i1 ? 0 : throw 0; i1 ? 0 : test(); // expected-error {{right operand to ? is void, but left operand is of type 'int'}} i1 ? test() : 0; // expected-error {{left operand to ? is void, but right operand is of type 'int'}} (i1 ? throw 0 : i1) = 0; // expected-error {{expression is not assignable}} (i1 ? i1 : throw 0) = 0; // expected-error {{expression is not assignable}} // p3 (one or both class type, convert to each other) // b1 (lvalues) Base base; Derived derived; Convertible conv; Base &bar1 = i1 ? base : derived; Base &bar2 = i1 ? derived : base; Base &bar3 = i1 ? base : conv; Base &bar4 = i1 ? conv : base; // these are ambiguous BadBase bb; BadDerived bd; (void)(i1 ? bb : bd); // expected-error {{conditional expression is ambiguous; 'BadBase' can be converted to 'BadDerived' and vice versa}} (void)(i1 ? bd : bb); // expected-error {{conditional expression is ambiguous}} // curiously enough (and a defect?), these are not // for rvalues, hierarchy takes precedence over other conversions (void)(i1 ? BadBase() : BadDerived()); (void)(i1 ? BadDerived() : BadBase()); // b2.1 (hierarchy stuff) extern const Base constret(); extern const Derived constder(); // should use const overload A a1((i1 ? constret() : Base()).trick()); A a2((i1 ? Base() : constret()).trick()); A a3((i1 ? constret() : Derived()).trick()); A a4((i1 ? Derived() : constret()).trick()); // should use non-const overload i1 = (i1 ? Base() : Base()).trick(); i1 = (i1 ? Base() : Base()).trick(); i1 = (i1 ? Base() : Derived()).trick(); i1 = (i1 ? Derived() : Base()).trick(); // should fail: const lost (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'const Derived')}} (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('const Derived' and 'Base')}} Priv priv; Fin fin; (void)(i1 ? Base() : Priv()); // expected-error{{private base class}} (void)(i1 ? Priv() : Base()); // expected-error{{private base class}} (void)(i1 ? Base() : Fin()); // expected-error{{ambiguous conversion from derived class 'Fin' to base class 'Base':}} (void)(i1 ? Fin() : Base()); // expected-error{{ambiguous conversion from derived class 'Fin' to base class 'Base':}} (void)(i1 ? base : priv); // expected-error {{private base class}} (void)(i1 ? priv : base); // expected-error {{private base class}} (void)(i1 ? base : fin); // expected-error {{ambiguous conversion from derived class 'Fin' to base class 'Base':}} (void)(i1 ? fin : base); // expected-error {{ambiguous conversion from derived class 'Fin' to base class 'Base':}} // b2.2 (non-hierarchy) i1 = i1 ? I() : i1; i1 = i1 ? i1 : I(); I i2(i1 ? I() : J()); I i3(i1 ? J() : I()); // "the type [it] woud have if E2 were converted to an rvalue" vfn pfn = i1 ? F() : test; pfn = i1 ? test : F(); (void)(i1 ? A() : B()); // expected-error {{conversion from 'B' to 'A' is ambiguous}} (void)(i1 ? B() : A()); // expected-error {{conversion from 'B' to 'A' is ambiguous}} (void)(i1 ? 1 : Ambig()); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} (void)(i1 ? Ambig() : 1); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} // By the way, this isn't an lvalue: &(i1 ? i1 : i2); // expected-error {{address expression must be an lvalue or a function designator}} // p4 (lvalue, same type) Fields flds; int &ir1 = i1 ? flds.i1 : flds.i2; (i1 ? flds.b1 : flds.i2) = 0; (i1 ? flds.i1 : flds.b2) = 0; (i1 ? flds.b1 : flds.b2) = 0; // p5 (conversion to built-in types) // GCC 4.3 fails these double d1 = i1 ? I() : K(); pfn = i1 ? F() : G(); DFnPtr pfm; pfm = i1 ? DFnPtr() : &Base::fn1; pfm = i1 ? &Base::fn1 : DFnPtr(); // p6 (final conversions) i1 = i1 ? i1 : ir1; int *pi1 = i1 ? &i1 : 0; pi1 = i1 ? 0 : &i1; i1 = i1 ? i1 : EVal; i1 = i1 ? EVal : i1; d1 = i1 ? 'c' : 4.0; d1 = i1 ? 4.0 : 'c'; Base *pb = i1 ? (Base*)0 : (Derived*)0; pb = i1 ? (Derived*)0 : (Base*)0; pfm = i1 ? &Base::fn1 : &Derived::fn2; pfm = i1 ? &Derived::fn2 : &Base::fn1; pfm = i1 ? &Derived::fn2 : 0; pfm = i1 ? 0 : &Derived::fn2; const int (MixedFieldsDerived::*mp1) = i1 ? &MixedFields::ci : &MixedFieldsDerived::i; const volatile int (MixedFields::*mp2) = i1 ? &MixedFields::ci : &MixedFields::cvi; (void)(i1 ? &MixedFields::ci : &MixedFields::vi); // Conversion of primitives does not result in an lvalue. &(i1 ? i1 : d1); // expected-error {{address expression must be an lvalue or a function designator}} (void)&(i1 ? flds.b1 : flds.i1); // expected-error {{address of bit-field requested}} (void)&(i1 ? flds.i1 : flds.b1); // expected-error {{address of bit-field requested}} unsigned long test0 = 5; test0 = test0 ? (long) test0 : test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} test0 = test0 ? (int) test0 : test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} test0 = test0 ? (short) test0 : test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} test0 = test0 ? test0 : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} test0 = test0 ? test0 : (short) test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) 10; test0 = test0 ? test0 : (int) 10; test0 = test0 ? test0 : (short) 10; test0 = test0 ? (long) 10 : test0; test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; int test1; test0 = test0 ? EVal : test0; test1 = test0 ? EVal : (int) test0; test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} test1 = test0 ? EVal : (int) test0; test1 = test0 ? (int) test0 : EVal; // Note the thing that this does not test: since DR446, various situations // *must* create a separate temporary copy of class objects. This can only // be properly tested at runtime, though. }
void Variant::FromString(VariantType type, const char* value) { switch (type) { case VAR_INT: *this = ToInt(value); break; case VAR_INT64: *this = ToInt64(value); break; case VAR_BOOL: *this = ToBool(value); break; case VAR_FLOAT: *this = ToFloat(value); break; case VAR_VECTOR2: *this = ToVector2(value); break; case VAR_VECTOR3: *this = ToVector3(value); break; case VAR_VECTOR4: *this = ToVector4(value); break; case VAR_QUATERNION: *this = ToQuaternion(value); break; case VAR_COLOR: *this = ToColor(value); break; case VAR_STRING: *this = value; break; case VAR_BUFFER: { SetType(VAR_BUFFER); PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(&value_)); StringToBuffer(buffer, value); } break; case VAR_VOIDPTR: // From string to void pointer not supported, set to null *this = (void*)0; break; case VAR_RESOURCEREF: { StringVector values = String::Split(value, ';'); if (values.Size() == 2) { SetType(VAR_RESOURCEREF); ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(&value_)); ref.type_ = values[0]; ref.name_ = values[1]; } } break; case VAR_RESOURCEREFLIST: { StringVector values = String::Split(value, ';', true); if (values.Size() >= 1) { SetType(VAR_RESOURCEREFLIST); ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(&value_)); refList.type_ = values[0]; refList.names_.Resize(values.Size() - 1); for (unsigned i = 1; i < values.Size(); ++i) refList.names_[i - 1] = values[i]; } } break; case VAR_INTRECT: *this = ToIntRect(value); break; case VAR_INTVECTOR2: *this = ToIntVector2(value); break; case VAR_INTVECTOR3: *this = ToIntVector3(value); break; case VAR_PTR: // From string to RefCounted pointer not supported, set to null *this = (RefCounted*)0; break; case VAR_MATRIX3: *this = ToMatrix3(value); break; case VAR_MATRIX3X4: *this = ToMatrix3x4(value); break; case VAR_MATRIX4: *this = ToMatrix4(value); break; case VAR_DOUBLE: *this = ToDouble(value); break; case VAR_RECT: *this = ToRect(value); break; default: SetType(VAR_NONE); } }
bool ToBool(const String& source) { return ToBool(source.CString()); }