void CFunctionCollection::SetFunctionText(CString name, CString content) { CSLock lock(m_critsec); COHScriptObject *function = LookUp(name); if (function == NULL) { // Function does not yet exist; new one // We need to create name and text on the heap, can't point to the stack CString *my_text = new CString(content); CString *my_name = new CString(name); function = new CFunction(my_name, my_text, kNoAbsoluteLineNumberExists); Add(function); } else { function->SetText(content); } }
void CFunctionCollection::SetFunctionText(CString name, CString content) { CSLock lock(m_critsec); COHScriptObject *function = LookUp(name); if (function == NULL) { // Function does not yet exist; new one // We need to create name and text on the heap, can't point to the stack CString *my_text = new CString(content); CString *my_name = new CString(name); function = new CFunction(my_name, my_text, kUndefinedZero); Add(function); } else { write_log(preferences.debug_formula(), "[CFunctionCollection] Setting function text for %s\n", name); function->SetText(content); } }
void CFunctionCollection::SetFunctionText(CString name, CString content) { CSLock lock(m_critsec); COHScriptObject *function = LookUp(name); if (function == NULL) { // Function does not yet exist; new one // We need to create name and text on the heap, can't point to the stack CString my_text = content; CString my_name = name; // The added functions stays in the collection // until a new profile gets loaded, until it gets overwritten] // or until the ebtire collection gets released function = new CFunction(my_name, my_text, kUndefinedZero); Add(function); } else { write_log(preferences.debug_formula(), "[CFunctionCollection] Setting function text for %s\n", name); function->SetText(content); } }