예제 #1
0
        private void  fromJSONTimers(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 Timers of TypeNativeDataJSON is not an array.");
            }
            int count1 = json_array1.componentCount();

            if (count1 < 1)
            {
                throw new Exception("The value for field Timers of TypeNativeDataJSON has too few elements.");
            }
            List <TimerJSON> vector_Timers1 = new List <TimerJSON>(count1);

            for (int num1 = 0; num1 < count1; ++num1)
            {
                TimerJSON convert_classy = TimerJSON.from_json(json_array1.component(num1), ignore_extras, true);
                vector_Timers1.Add(convert_classy);
            }
            Debug.Assert(vector_Timers1.Count >= 1);
            initTimers();
            for (int num1 = 0; num1 < vector_Timers1.Count; ++num1)
            {
                appendTimers(vector_Timers1[num1]);
            }
            for (int num1 = 0; num1 < vector_Timers1.Count; ++num1)
            {
            }
        }
예제 #2
0
        private void  fromJSONTimer(JSONValue json_value, bool ignore_extras)
        {
            Debug.Assert(json_value != null);
            TimerJSON convert_classy = TimerJSON.from_json(json_value, ignore_extras, true);

            setTimer(convert_classy);
        }
예제 #3
0
 public void setTimer(TimerJSON new_value)
 {
     if (flagHasTimer)
     {
     }
     flagHasTimer = true;
     storeTimer   = new_value;
 }
예제 #4
0
 public void appendTimers(TimerJSON to_append)
 {
     if (!flagHasTimers)
     {
         flagHasTimers = true;
         storeTimers.Clear();
     }
     Debug.Assert(flagHasTimers);
     storeTimers.Add(to_append);
 }
예제 #5
0
        protected override void finish()
        {
            TimerJSON result = new TimerJSON();

            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.extraTimerAppendPair(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);
        }
예제 #6
0
 protected override void handle_result(TimerJSON result)
 {
     top.value.Add(result);
 }
예제 #7
0
        protected override void handle_result(TimerJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
예제 #8
0
 protected abstract void handle_result(TimerJSON new_result);
예제 #9
0
 protected void finish(TimerJSON result)
 {
     if (fieldGeneratorTitle.have_value)
     {
         result.setTitle(fieldGeneratorTitle.value);
         fieldGeneratorTitle.have_value = false;
     }
     if (fieldGeneratorCenturies.have_value)
     {
         result.setCenturies(fieldGeneratorCenturies.value);
         fieldGeneratorCenturies.have_value = false;
     }
     else if ((!(result.hasCenturies())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Centuries\" field was missing.");
     }
     if (fieldGeneratorDecades.have_value)
     {
         result.setDecades(fieldGeneratorDecades.value);
         fieldGeneratorDecades.have_value = false;
     }
     else if ((!(result.hasDecades())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Decades\" field was missing.");
     }
     if (fieldGeneratorYears.have_value)
     {
         result.setYears(fieldGeneratorYears.value);
         fieldGeneratorYears.have_value = false;
     }
     else if ((!(result.hasYears())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Years\" field was missing.");
     }
     if (fieldGeneratorMonths.have_value)
     {
         result.setMonths(fieldGeneratorMonths.value);
         fieldGeneratorMonths.have_value = false;
     }
     else if ((!(result.hasMonths())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Months\" field was missing.");
     }
     if (fieldGeneratorWeeks.have_value)
     {
         result.setWeeks(fieldGeneratorWeeks.value);
         fieldGeneratorWeeks.have_value = false;
     }
     else if ((!(result.hasWeeks())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Weeks\" field was missing.");
     }
     if (fieldGeneratorDays.have_value)
     {
         result.setDays(fieldGeneratorDays.value);
         fieldGeneratorDays.have_value = false;
     }
     else if ((!(result.hasDays())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Days\" field was missing.");
     }
     if (fieldGeneratorHours.have_value)
     {
         result.setHours(fieldGeneratorHours.value);
         fieldGeneratorHours.have_value = false;
     }
     else if ((!(result.hasHours())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Hours\" field was missing.");
     }
     if (fieldGeneratorMinutes.have_value)
     {
         result.setMinutes(fieldGeneratorMinutes.value);
         fieldGeneratorMinutes.have_value = false;
     }
     else if ((!(result.hasMinutes())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Minutes\" field was missing.");
     }
     if (fieldGeneratorSeconds.have_value)
     {
         result.setSeconds(fieldGeneratorSeconds.value);
         fieldGeneratorSeconds.have_value = false;
     }
     else if ((!(result.hasSeconds())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Seconds\" field was missing.");
     }
     if (fieldGeneratorDurationInSeconds.have_value)
     {
         result.setDurationInSeconds(fieldGeneratorDurationInSeconds.value);
         fieldGeneratorDurationInSeconds.have_value = false;
     }
     else if ((!(result.hasDurationInSeconds())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"DurationInSeconds\" field was missing.");
     }
     if (fieldGeneratorIsCountdown.have_value)
     {
         result.setIsCountdown(fieldGeneratorIsCountdown.value);
         fieldGeneratorIsCountdown.have_value = false;
     }
     else if ((!(result.hasIsCountdown())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"IsCountdown\" field was missing.");
     }
 }