static void UpdateIndexMaximum(ref IndexBase index, uint value)
 {
     if (!(index is IndexRange))
     {
         index = new IndexRange();
     }
     ((IndexRange)index).Maximum = value;
 }
        void ParseMainIndexes(LocalIndexes indexes)
        {
            int         delimiter = 0;
            List <uint> designatorValues = new List <uint>(); IndexBase designator = IndexBase.Unset;
            List <uint> stringValues = new List <uint>(); IndexBase @string = IndexBase.Unset;
            List <uint> usageValues = new List <uint>(); IndexBase usage = IndexBase.Unset;

            foreach (KeyValuePair <LocalItemTag, uint> kvp in LocalItemState)
            {
                switch (kvp.Key)
                {
                case LocalItemTag.DesignatorMinimum: UpdateIndexMinimum(ref designator, kvp.Value); break;

                case LocalItemTag.StringMinimum: UpdateIndexMinimum(ref @string, kvp.Value); break;

                case LocalItemTag.UsageMinimum: UpdateIndexMinimum(ref usage, kvp.Value); break;

                case LocalItemTag.DesignatorMaximum: UpdateIndexMaximum(ref designator, kvp.Value); break;

                case LocalItemTag.StringMaximum: UpdateIndexMaximum(ref @string, kvp.Value); break;

                case LocalItemTag.UsageMaximum: UpdateIndexMaximum(ref usage, kvp.Value); break;

                case LocalItemTag.DesignatorIndex: UpdateIndexList(designatorValues, delimiter, ref designator, kvp.Value); break;

                case LocalItemTag.StringIndex: UpdateIndexList(stringValues, delimiter, ref @string, kvp.Value); break;

                case LocalItemTag.Usage: UpdateIndexList(usageValues, delimiter, ref usage, kvp.Value); break;

                case LocalItemTag.Delimiter:
                    if (kvp.Value == 1)
                    {
                        if (delimiter++ == 0)
                        {
                            designatorValues.Clear();
                            stringValues.Clear();
                            usageValues.Clear();
                        }
                    }
                    else if (kvp.Value == 0)
                    {
                        delimiter--;
                        UpdateIndexListCommit(designatorValues, delimiter, ref designator);
                        UpdateIndexListCommit(stringValues, delimiter, ref @string);
                        UpdateIndexListCommit(usageValues, delimiter, ref usage);
                    }
                    break;
                }
            }

            indexes.Designator = designator;
            indexes.String     = @string;
            indexes.Usage      = usage;
        }
 static void UpdateIndexListCommit(List <uint> values, int delimiter,
                                   ref IndexBase index)
 {
     if (delimiter != 0 || values.Count == 0)
     {
         return;
     }
     if (!(index is IndexList))
     {
         index = new IndexList();
     }
     ((IndexList)index).Indices.Add(new List <uint> (values));
     values.Clear();
 }
 static void UpdateIndexList(List <uint> values, int delimiter,
                             ref IndexBase index, uint value)
 {
     values.Add(value);
     UpdateIndexListCommit(values, delimiter, ref index);
 }
 static void UpdateIndexListCommit(List<uint> values, int delimiter,
                                   ref IndexBase index)
 {
     if (delimiter != 0 || values.Count == 0) { return; }
     if (!(index is IndexList)) { index = new IndexList(); }
     ((IndexList)index).Indices.Add(new List<uint>(values));
     values.Clear();
 }
 static void UpdateIndexList(List<uint> values, int delimiter,
                             ref IndexBase index, uint value)
 {
     values.Add(value);
     UpdateIndexListCommit(values, delimiter, ref index);
 }
 static void UpdateIndexMaximum(ref IndexBase index, uint value)
 {
     if (!(index is IndexRange)) { index = new IndexRange(); }
     ((IndexRange)index).Maximum = value;
 }
Example #8
0
 public void Clear()
 {
     Designator = null; String = null; Usage = null;
 }