Пример #1
0
        public ValueTable Copy()
        {
            ValueTable tableCopy = new ValueTable();

            this.Rewind();
            ValueTableItem item = Next();

            while (item != null)
            {
                tableCopy.Insert(item.Key, item.Value);
                item = Next();
            }

            return(tableCopy);
        }
Пример #2
0
        /*--------------------------------------------------------------*/

        public IValue GetVal(IValue v)
        {
            // deref. value
            // get a valule from the table item
            // TYPE_TABLEDATAREF -> value
            if (v.TypeOf() == ValueTypeID.TYPE_TABLEDATAREF)
            {
                ValueTableItem dti = (ValueTableItem)v.GetObjectValue();

                return(dti.Value);
            }
            // TYPE_STOREREF -> value
            else if (v.TypeOf() == ValueTypeID.TYPE_STOREREF)
            {
                ValueStore vstore = (ValueStore)v.GetObjectValue();
                return((IValue)vstore.Value);
            }

            // all other types are passed throught unchanged
            return(v);
        }
Пример #3
0
        public ValueTableItem Insert(string key, IValue value)
        {
            ValueTableItem newVTItem;
            ObjectListItem <ValueTableItem> newItem;

            if (htab.ContainsKey(key) == true)
            {
                newItem         = htab[key];
                newVTItem       = newItem.Data;
                newVTItem.Value = value;
            }
            else
            {
                newVTItem = new ValueTableItem(this, null, key, value);
                newItem   = list.Append(newVTItem);
                htab.Add(key, newItem);
                newVTItem.ListItem = newItem;
            }

            return(newVTItem);
        }