Esempio n. 1
0
        }   // private void ReportNewError


        /// <summary>
        /// Although its name, SaveFormatItem, suggests that its sole task is to
        /// save the populated FormatItem into the collection, it performs some
        /// related tasks, each of which is noted in the argument comments.
        /// </summary>
        /// <param name="prenmState">
        /// The State enumeration, which governs the behavior of the parsing
        /// engine, is set to ProcessingLiterals to indicate that processing is
        /// between format items. 
        /// 
        /// Since this method changes its value, and it is a value type (Any
        /// enumeration is really an integer in handcuffs.), it is passed by 
		/// reference, so that the change is reflected in the caller's address
		/// space.
        /// </param>
        /// <param name="pintCharPos">
        /// Since this integer is used, but not changed, it can be safely passed
        /// by value.
        /// </param>
        /// <param name="prfiCurrent">
        /// After the FormatItem is copied into a FormatItemsCollection object,
        /// the locally scoped copy is discarded. Sooner or later, this would
        /// happen on its own, but I like to discard objects as soon as I know
        /// that I am finished with them, especially if their lingering presence
        /// could cause confusion about the current state of affairs.
        /// </param>
        private void SaveFormatItem (
            ref State prenmState ,
            int pintCharPos ,
            ref FormatItem prfiCurrent )
        {
            prfiCurrent.SetRawLength ( pintCharPos );

            if ( _ficoll == null )
            {   // Create collection on first use.
                _ficoll = new FormatItemsCollection ( );
            }   // if ( _ficoll == null )

            if ( prfiCurrent.Index > _intHighestFormatItemIndex )
            {   // This is the ideal place to update the ighestFormatItemIndex.
                _intHighestFormatItemIndex = prfiCurrent.Index;
            }   // if ( prfiCurrent.Index > _intHighestFormatItemIndex )

            _ficoll.Add ( prfiCurrent );
            prfiCurrent = null;
            prenmState = State.ProcessingLiterals;
        }   // private void SaveFormatItem