コード例 #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);
     }
 }
コード例 #2
0
 // --------------------------- Empty ------------------------------
 private CsvString Empty( )
 {
     mCurrentValue = null;
     mWip          = null;
     mValueCx      = -1;
     mString       = null;
     return(this);
 }
コード例 #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);
 }
コード例 #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);
     }
 }
コード例 #5
0
 public CsvString.Value NextValue( )
 {
     if (mCurrentValue == null)
     {
         BeginValue( );
     }
     mCurrentValue.AdvanceNextValue( );
     if (mCurrentValue.IsAtValue)
     {
         return(mCurrentValue.Clone( ));
     }
     else
     {
         mCurrentValue = null;
         return(null);
     }
 }
コード例 #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);
        }
コード例 #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);
        }