Exemplo n.º 1
0
 protected void finish(UberRequestEstimateTripJSON result)
 {
     if (fieldGeneratordistance_estimate.have_value)
     {
         result.setdistance_estimateText(fieldGeneratordistance_estimate.value);
         fieldGeneratordistance_estimate.have_value = false;
     }
     else if ((!(result.hasdistance_estimate())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"distance_estimate\" field was missing.");
     }
     if (fieldGeneratordistance_unit.have_value)
     {
         result.setdistance_unit(fieldGeneratordistance_unit.value);
         fieldGeneratordistance_unit.have_value = false;
     }
     else if ((!(result.hasdistance_unit())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"distance_unit\" field was missing.");
     }
     if (fieldGeneratorduration_estimate.have_value)
     {
         result.setduration_estimateText(fieldGeneratorduration_estimate.value);
         fieldGeneratorduration_estimate.have_value = false;
     }
     else if ((!(result.hasduration_estimate())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"duration_estimate\" field was missing.");
     }
 }
Exemplo n.º 2
0
    private void  fromJSONtrip(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        Typetrip or_result = new Typetrip();
        bool     or_done   = false;

        if (!or_done)
        {
            try
            {
                UberRequestEstimateTripJSON convert_classy = UberRequestEstimateTripJSON.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
            {
                or_result.key = 1;
                or_done       = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field trip of EstimateUberResponseJSON is not one of the allowed values.");
        }
        settrip(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }
Exemplo n.º 3
0
        protected override void finish()
        {
            UberRequestEstimateTripJSON result = new UberRequestEstimateTripJSON();

            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.extraUberRequestEstimateTripAppendPair(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);
        }
Exemplo n.º 4
0
 protected override void handle_result(UberRequestEstimateTripJSON result)
 {
     top.value.Add(result);
 }
Exemplo n.º 5
0
        protected override void handle_result(UberRequestEstimateTripJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
Exemplo n.º 6
0
 protected abstract void handle_result(UberRequestEstimateTripJSON new_result);