MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / InitCopy

Method InitCopy

source/script_object.cpp:1664–1686  ·  view source on GitHub ↗

Copy a value from a Variant into this uninitialized Variant.

Source from the content-addressed store, hash-verified

1662
1663// Copy a value from a Variant into this uninitialized Variant.
1664bool Object::Variant::InitCopy(Variant &val)
1665{
1666 switch (symbol = val.symbol)
1667 {
1668 case SYM_STRING:
1669 new (&string) String();
1670 return Assign(val.string, val.string.Length(), true); // Pass true to conserve memory (no space is allowed for future expansion).
1671 case SYM_OBJECT:
1672 (object = val.object)->AddRef();
1673 break;
1674 case SYM_DYNAMIC:
1675 prop = new Property();
1676 prop->SetGetter(val.prop->Getter());
1677 prop->SetSetter(val.prop->Setter());
1678 prop->SetMethod(val.prop->Method());
1679 break;
1680 //case SYM_INTEGER:
1681 //case SYM_FLOAT:
1682 default:
1683 n_int64 = val.n_int64; // Union copy.
1684 }
1685 return true;
1686}
1687
1688// Return value, knowing Variant will be kept around.
1689// Copying of value can be skipped.

Callers 1

CloneToMethod · 0.80

Calls 8

SetGetterMethod · 0.80
GetterMethod · 0.80
SetSetterMethod · 0.80
SetterMethod · 0.80
SetMethodMethod · 0.80
MethodMethod · 0.80
LengthMethod · 0.45
AddRefMethod · 0.45

Tested by

no test coverage detected