コード例 #1
0
    private void  fromJSONproducts(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        JSONArrayValue json_array1 = json_value.array_value();

        if (json_array1 == null)
        {
            throw new Exception("The value for field products of UberProductsResponseJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <UberProductDetailsJSON> vector_products1 = new List <UberProductDetailsJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            UberProductDetailsJSON convert_classy = UberProductDetailsJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_products1.Add(convert_classy);
        }
        initproducts();
        for (int num1 = 0; num1 < vector_products1.Count; ++num1)
        {
            appendproducts(vector_products1[num1]);
        }
        for (int num1 = 0; num1 < vector_products1.Count; ++num1)
        {
        }
    }
コード例 #2
0
 public void appendproducts(UberProductDetailsJSON to_append)
 {
     if (!flagHasproducts)
     {
         flagHasproducts = true;
         storeproducts.Clear();
     }
     Debug.Assert(flagHasproducts);
     storeproducts.Add(to_append);
 }
コード例 #3
0
        protected override void finish()
        {
            UberProductDetailsJSON result = new UberProductDetailsJSON();

            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.extraUberProductDetailsAppendPair(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);
        }
コード例 #4
0
 protected override void handle_result(UberProductDetailsJSON result)
 {
     top.value.Add(result);
 }
コード例 #5
0
        protected override void handle_result(UberProductDetailsJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
コード例 #6
0
 protected abstract void handle_result(UberProductDetailsJSON new_result);
コード例 #7
0
 protected void finish(UberProductDetailsJSON result)
 {
     if (fieldGeneratorproduct_id.have_value)
     {
         result.setproduct_id(fieldGeneratorproduct_id.value);
         fieldGeneratorproduct_id.have_value = false;
     }
     else if ((!(result.hasproduct_id())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"product_id\" field was missing.");
     }
     if (fieldGeneratordescription.have_value)
     {
         result.setdescription(fieldGeneratordescription.value);
         fieldGeneratordescription.have_value = false;
     }
     else if ((!(result.hasdescription())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"description\" field was missing.");
     }
     if (fieldGeneratordisplay_name.have_value)
     {
         result.setdisplay_name(fieldGeneratordisplay_name.value);
         fieldGeneratordisplay_name.have_value = false;
     }
     else if ((!(result.hasdisplay_name())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"display_name\" field was missing.");
     }
     if (fieldGeneratorcapacity.have_value)
     {
         result.setcapacity(fieldGeneratorcapacity.value);
         fieldGeneratorcapacity.have_value = false;
     }
     else if ((!(result.hascapacity())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"capacity\" field was missing.");
     }
     if (fieldGeneratorprice_details.have_value)
     {
         result.setprice_details(fieldGeneratorprice_details.value.referenced());
         fieldGeneratorprice_details.have_value = false;
     }
     else if ((!(result.hasprice_details())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"price_details\" field was missing.");
     }
     if (fieldGeneratorimage.have_value)
     {
         result.setimage(fieldGeneratorimage.value);
         fieldGeneratorimage.have_value = false;
     }
     else if ((!(result.hasimage())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"image\" field was missing.");
     }
     if (fieldGeneratorshared.have_value)
     {
         result.setshared(fieldGeneratorshared.value);
         fieldGeneratorshared.have_value = false;
     }
     else if ((!(result.hasshared())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"shared\" field was missing.");
     }
 }