예제 #1
0
 protected void finish(HoundUpdateJSON result)
 {
     if (fieldGeneratorFormat.have_value)
     {
         result.setFormat();
         fieldGeneratorFormat.have_value = false;
     }
     else if ((!(result.hasFormat())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Format\" field was missing.");
     }
     if (fieldGeneratorFormatVersion.have_value)
     {
         result.setFormatVersion();
         fieldGeneratorFormatVersion.have_value = false;
     }
     else if ((!(result.hasFormatVersion())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"FormatVersion\" field was missing.");
     }
     if (fieldGeneratorIndex.have_value)
     {
         result.setIndex(fieldGeneratorIndex.value);
         fieldGeneratorIndex.have_value = false;
     }
     else if ((!(result.hasIndex())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Index\" field was missing.");
     }
     if (fieldGeneratorResult.have_value)
     {
         result.setResult(fieldGeneratorResult.value);
         fieldGeneratorResult.have_value = false;
     }
     else if ((!(result.hasResult())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Result\" field was missing.");
     }
     if (fieldGeneratorIsFinal.have_value)
     {
         result.setIsFinal(fieldGeneratorIsFinal.value);
         fieldGeneratorIsFinal.have_value = false;
     }
     else if ((!(result.hasIsFinal())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"IsFinal\" field was missing.");
     }
 }
예제 #2
0
        protected override void finish()
        {
            HoundUpdateJSON result = new HoundUpdateJSON();

            Debug.Assert(result != null);
            finish(result);
            int extra_count = unknownFieldGenerator.field_names.Count;

            Debug.Assert(extra_count == unknownFieldGenerator.field_values.Count);
            for (int extra_num = 0; extra_num < extra_count; ++extra_num)
            {
                result.extraHoundUpdateAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]);
            }
            unknownFieldGenerator.field_names.Clear();
            unknownFieldGenerator.field_values.Clear();
            unknownFieldGenerator.index = new Dictionary <string, JSONValue>();
            handle_result(result);
        }
예제 #3
0
 protected abstract void handle_result(HoundUpdateJSON new_result);
예제 #4
0
 protected override void handle_result(HoundUpdateJSON result)
 {
     top.value.Add(result);
 }
예제 #5
0
        protected override void handle_result(HoundUpdateJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
    private void  fromJSONValue(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        TypeValue or_result = new TypeValue();
        bool      or_done   = false;

        if (!or_done)
        {
            try
            {
                HoundServerJSON convert_classy = HoundServerJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice0 = convert_classy;
                or_result.key       = 0;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            try
            {
                HoundPartialTranscriptJSON convert_classy = HoundPartialTranscriptJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice1 = convert_classy;
                or_result.key       = 1;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            try
            {
                HoundUpdateJSON convert_classy = HoundUpdateJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice2 = convert_classy;
                or_result.key       = 2;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field Value of HoundMessageJSON is not one of the allowed values.");
        }
        setValue(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        case 2:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }