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

Method Insert

source/script_object.cpp:2425–2440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2423}
2424
2425Object::FieldType *Object::Insert(name_t name, index_t at)
2426// Inserts a single field with the given key at the given offset.
2427// Caller must ensure 'at' is the correct offset for this key.
2428{
2429 if (mFields.Length() == mFields.Capacity() && !Expand() // Attempt to expand if at capacity.
2430 || !(name = _tcsdup(name))) // Attempt to duplicate key-string.
2431 { // Out of memory.
2432 return nullptr;
2433 }
2434 // There is now definitely room in mFields for a new field.
2435 FieldType &field = *mFields.InsertUninitialized(at, 1);
2436 field.key_c = ctolower(*name);
2437 field.name = name; // Above has already copied string or called key.p->AddRef() as appropriate.
2438 field.Minit(); // Initialize to default value. Caller will likely reassign.
2439 return &field;
2440}
2441
2442Map::Pair *Map::Insert(SymbolType key_type, Key key, index_t at)
2443// Inserts a single item with the given key at the given offset.

Callers

nothing calls this directly

Calls 5

ctolowerFunction · 0.85
MinitMethod · 0.80
LengthMethod · 0.45
CapacityMethod · 0.45
AddRefMethod · 0.45

Tested by

no test coverage detected