ImageEn, unit hyieutils

TIEDictionary

TIEDictionary


Declaration


TIEDictionary = class;



Description


TIEDictionary is a String->Object dictionary (hashmap).
It can import/export key-values in a JSON-like (not fully compatible yet) style.


Methods and Properties


  Create
  Clear
  Count
  Dump
  Erase
  HasKey
  Get
  GetBoolean
  GetDictionary
  GetDouble
  GetInteger
  GetList
  GetNext
  GetString
  Insert
  IsEmpty
  Parse



Example


var
  dict: TIEDictionary;
begin
  dict := TIEDictionary.Create();
  dict.Insert('doublekey', 10.1);
  dict.Insert('integerkey', 100);
  dict.Insert('stringkey', 'hello');
  dict.Insert('bool_true', true);
  dict.Insert('bool_false', false);
  dict.Insert('dict', TIEDictionary.Create());
    dict.GetDictionary('dict').Insert('one', 1);
    dict.GetDictionary('dict').Insert('two', 'two');
  dict.Insert('list', TObjectList.Create());
    dict.GetList('list').Add( TIEDictionaryValueWideString.Create('mike') );
    dict.GetList('list').Add( TIEDictionaryValueWideString.Create('robert') );
    dict.GetList('list').Add( TIEDictionaryValueWideString.Create('john') );
    dict.GetList('list').Add( TIEDictionaryValueInteger.Create(2013) );

  memo1.lines.add(dict.dump());

  dict.free;
end;