Exemplo n.º 1
0
    private void  fromJSONAllSizes(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 AllSizes of FoodJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <FoodSizeJSON> vector_AllSizes1 = new List <FoodSizeJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            FoodSizeJSON convert_classy = FoodSizeJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_AllSizes1.Add(convert_classy);
        }
        initAllSizes();
        for (int num1 = 0; num1 < vector_AllSizes1.Count; ++num1)
        {
            appendAllSizes(vector_AllSizes1[num1]);
        }
        for (int num1 = 0; num1 < vector_AllSizes1.Count; ++num1)
        {
        }
    }
Exemplo n.º 2
0
        protected override void finish()
        {
            FoodSizeJSON result = new FoodSizeJSON();

            Debug.Assert(result != null);
            finish(result);
            handle_result(result);
        }
Exemplo n.º 3
0
 public void appendAllSizes(FoodSizeJSON to_append)
 {
     if (!flagHasAllSizes)
     {
         flagHasAllSizes = true;
         storeAllSizes.Clear();
     }
     Debug.Assert(flagHasAllSizes);
     storeAllSizes.Add(to_append);
 }
Exemplo n.º 4
0
 protected void finish(FoodSizeJSON result)
 {
     if (fieldGeneratorWrittenSing.have_value)
     {
         result.setWrittenSing(fieldGeneratorWrittenSing.value);
         fieldGeneratorWrittenSing.have_value = false;
     }
     else if ((!(result.hasWrittenSing())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"WrittenSing\" field was missing.");
     }
     if (fieldGeneratorWrittenPlur.have_value)
     {
         result.setWrittenPlur(fieldGeneratorWrittenPlur.value);
         fieldGeneratorWrittenPlur.have_value = false;
     }
     else if ((!(result.hasWrittenPlur())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"WrittenPlur\" field was missing.");
     }
     if (fieldGeneratorSpokenSizeAndFoodSing.have_value)
     {
         result.setSpokenSizeAndFoodSing(fieldGeneratorSpokenSizeAndFoodSing.value);
         fieldGeneratorSpokenSizeAndFoodSing.have_value = false;
     }
     else if ((!(result.hasSpokenSizeAndFoodSing())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"SpokenSizeAndFoodSing\" field was missing.");
     }
     if (fieldGeneratorSpokenSizeAndFoodPlur.have_value)
     {
         result.setSpokenSizeAndFoodPlur(fieldGeneratorSpokenSizeAndFoodPlur.value);
         fieldGeneratorSpokenSizeAndFoodPlur.have_value = false;
     }
     else if ((!(result.hasSpokenSizeAndFoodPlur())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"SpokenSizeAndFoodPlur\" field was missing.");
     }
     if (fieldGeneratorGrams.have_value)
     {
         result.setGramsText(fieldGeneratorGrams.value);
         fieldGeneratorGrams.have_value = false;
     }
     else if ((!(result.hasGrams())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Grams\" field was missing.");
     }
 }
Exemplo n.º 5
0
 protected override void handle_result(FoodSizeJSON result)
 {
     top.value.Add(result);
 }
Exemplo n.º 6
0
        protected override void handle_result(FoodSizeJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
Exemplo n.º 7
0
 protected abstract void handle_result(FoodSizeJSON new_result);