Beispiel #1
0
 // ------------------------ operator[] ------------------------------
 public CsvString.Value this[int InValueIx]
 {
     get
     {
         CsvString.Value v = null;
         if (CurrentValueNx == InValueIx)
         {
             v = CurrentValue.Clone( );
         }
         else
         {
             if ((CurrentValueNx >= InValueIx) ||
                 (CurrentValueNx == -1))
             {
                 BeginValue( );
             }
             while (true)
             {
                 v = NextValue( );
                 if (v == null)
                 {
                     break;
                 }
                 else if (CurrentValueNx == InValueIx)
                 {
                     break;
                 }
             }
         }
         return(v);
     }
 }
Beispiel #2
0
 // --------------------------- Empty ------------------------------
 private CsvString Empty( )
 {
     mCurrentValue = null;
     mWip          = null;
     mValueCx      = -1;
     mString       = null;
     return(this);
 }
Beispiel #3
0
 /// <summary>
 /// Position at begin of sequence of comma delim values.
 /// </summary>
 /// <returns></returns>
 public CsvString.Value BeginValue( )
 {
     mCurrentValue           = new CsvString.Value( );
     mCurrentValue.CsvString = this;
     mCurrentValue.BeginValue( );
     CsvString.Value vlu = mCurrentValue.Clone( );
     return(vlu);
 }
Beispiel #4
0
 /// <summary>
 /// advance the CsvString value cursor to the next value.
 /// </summary>
 /// <returns></returns>
 public CsvString.Value NextValue( )
 {
     CsvString.Value vlu = Clone( );
     vlu.AdvanceNextValue( );
     if (vlu.IsAtValue == true)
     {
         return(vlu);
     }
     else
     {
         return(null);
     }
 }
Beispiel #5
0
 public CsvString.Value NextValue( )
 {
     if (mCurrentValue == null)
     {
         BeginValue( );
     }
     mCurrentValue.AdvanceNextValue( );
     if (mCurrentValue.IsAtValue)
     {
         return(mCurrentValue.Clone( ));
     }
     else
     {
         mCurrentValue = null;
         return(null);
     }
 }
Beispiel #6
0
        public string[] ToStringArray( )
        {
            string[]        arr = new string[Count];
            CsvString.Value vlu = BeginValue( );
            int             Ix  = 0;

            while (true)
            {
                vlu.AdvanceNextValue( );
                if (vlu.IsAtValue == false)
                {
                    break;
                }
                arr[Ix] = vlu.ToString( );
                ++Ix;
            }
            return(arr);
        }
Beispiel #7
0
        /// <summary>
        /// private function ( for now ). Add a string, as is, to the CsvString.
        /// </summary>
        /// <param name="InValue"></param>
        private void AddString(string InValue)
        {
            // adding a value to string invalidates the current value cursor.
            mCurrentValue = null;
            mValueCx      = -1;

            // switch to wip mode.
            if (mWip == null)
            {
                mWip = new StringBuilder( );
                if (mString != null)
                {
                    mWip.Append(mString);
                    mString = null;
                }
            }

            // add the value to the string.
            if (mWip.Length > 0)
            {
                mWip.Append(", ");
            }
            mWip.Append(InValue);
        }