コード例 #1
0
 protected void finish(UnitConversionErrorJSON result)
 {
     if (fieldGeneratorType.have_value)
     {
         result.setType(fieldGeneratorType.value);
         fieldGeneratorType.have_value = false;
     }
     else if ((!(result.hasType())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Type\" field was missing.");
     }
     if (fieldGeneratorInputUnit.have_value)
     {
         result.initInputUnit();
         int count = fieldGeneratorInputUnit.value.Count;
         for (int num = 0; num < count; ++num)
         {
             result.appendInputUnit(fieldGeneratorInputUnit.value[num]);
         }
         fieldGeneratorInputUnit.value.Clear();
         fieldGeneratorInputUnit.have_value = false;
     }
     if (fieldGeneratorOutputUnit.have_value)
     {
         result.initOutputUnit();
         int count = fieldGeneratorOutputUnit.value.Count;
         for (int num = 0; num < count; ++num)
         {
             result.appendOutputUnit(fieldGeneratorOutputUnit.value[num]);
         }
         fieldGeneratorOutputUnit.value.Clear();
         fieldGeneratorOutputUnit.have_value = false;
     }
 }
コード例 #2
0
    private void  fromJSONErrors(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 Errors of UnitConverterInformationNuggetJSON is not an array.");
        }
        int count1 = json_array1.componentCount();

        if (count1 < 1)
        {
            throw new Exception("The value for field Errors of UnitConverterInformationNuggetJSON has too few elements.");
        }
        List <UnitConversionErrorJSON> vector_Errors1 = new List <UnitConversionErrorJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            UnitConversionErrorJSON convert_classy = UnitConversionErrorJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_Errors1.Add(convert_classy);
        }
        Debug.Assert(vector_Errors1.Count >= 1);
        initErrors();
        for (int num2 = 0; num2 < vector_Errors1.Count; ++num2)
        {
            appendErrors(vector_Errors1[num2]);
        }
        for (int num1 = 0; num1 < vector_Errors1.Count; ++num1)
        {
        }
    }
コード例 #3
0
        protected override void finish()
        {
            UnitConversionErrorJSON result = new UnitConversionErrorJSON();

            Debug.Assert(result != null);
            finish(result);
            handle_result(result);
        }
コード例 #4
0
 public void appendErrors(UnitConversionErrorJSON to_append)
 {
     if (!flagHasErrors)
     {
         flagHasErrors = true;
         storeErrors.Clear();
     }
     Debug.Assert(flagHasErrors);
     storeErrors.Add(to_append);
 }
コード例 #5
0
        protected override void handle_result(UnitConversionErrorJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
コード例 #6
0
 protected abstract void handle_result(UnitConversionErrorJSON new_result);
コード例 #7
0
 protected override void handle_result(UnitConversionErrorJSON result)
 {
     top.value.Add(result);
 }