void ValueArray::pushBack(CountPtr<Value>& val) { if(val->isLValue()) m_val.push_back(CountPtr<Value>(new ValueReference(val->getReferredValue()))); else m_val.push_back(CountPtr<Value>(new ValueReference(val))); }
CountPtr<Value> ValueReference::assign(CountPtr<Value> val) { ACCESS_MUTEX_LOCKER; // Pointers support; array and struct items can have two references inside ValueReference* assign_to = m_val->toValueReference(); if(assign_to == NULL) assign_to = this; if(val->isLValue()) return assign_to->m_val = val->getReferredValue(); else return assign_to->m_val = val; }
CountPtr<Value> ValueArray::setItem(uint pos, CountPtr<Value> val) { if(pos >= m_val.size()) { stringstream ss; //ss << _("Index out of bounds (size: ") << m_val.size() // << _(", index: ") << pos << _("), resizing array"); //WARN_P(ss.str()); resize(pos+1); } if(val->isLValue()) m_val[pos]->toValueReference()->assign(val->getReferredValue()); else m_val[pos]->toValueReference()->assign(val); return val; }