public override void Get(FieldDescriptor ds_, IDataReader dr_)
		{
			switch( ds_.Pos )
			{
				case 0: Name = dr_.AsString(); break;
				case 1: dr_.AsMessage(_data??(Data = new Struct()), ds_); break;
			}
		}
		public override void Clear()
		{
			_memoized_size = 0;
			_name = null;
			_data = null;
		}
		public void ClearData() { _data = null; }
Ejemplo n.º 4
0
 private void PutStructJs(Struct data)
 {
     var comma = false;
     WriteChar('{');
     foreach (var dtk in data._get_fields())
     {
         if (comma) WriteComma(); else comma = true;
         PutString(dtk.skey);
         WriteSemic();
         var dtx = dtk.ov as Value;
         if (dtx != null) PutValueJs(dtx);
         else WriteStringA("null");
     }
     WriteChar('}');
 }
Ejemplo n.º 5
0
        protected Struct AsStructJs(Struct data)
        {
            if (_tlast != JsToken.ObjectStart)
                Expected("json object");

            var comma = false;
            while ((_tlast = Next()) != JsToken.ObjectEnd)
            {
                if (comma)
                    if (_tlast != JsToken.Comma) Expected("comma");
                    else _tlast = Next();
                else comma = true;
                if (_tlast != JsToken.String) Expected("name");
                _last_name = _sdata;
                if (Next() != JsToken.Semicolon) Expected(":");
                GetValue();
                var jdata = AsValueJs(new Value());
                data.AddFields(_last_name, jdata);
            }
            return data;
        }
Ejemplo n.º 6
0
 public Struct AddMember(string key, Struct value) { return AddFields(key, new Value { Members = value }); }