Esempio n. 1
0
 public TextLinesCursor(TextLinesCursor InCsr)
 {
     mLines     = InCsr.mLines;
     mLinesNode = InCsr.mLinesNode;
     mLineOx    = InCsr.mLineOx;
     mRltv      = InCsr.mRltv;
 }
Esempio n. 2
0
 public TextLinesCursor()
 {
     mLines     = null;
     mLinesNode = null;
     mLineOx    = -1;
     mRltv      = RelativePosition.None;
 }
Esempio n. 3
0
        public void LineAdvance(TextLines InLines)
        {
            switch (mRltv)
            {
            case RelativePosition.Begin:
                mLinesNode = InLines.FirstLine;
                break;

            case RelativePosition.Before:
                break;

            case RelativePosition.At:
                mLinesNode = mLinesNode.Next;
                break;

            case RelativePosition.After:
                mLinesNode = mLinesNode.Next;
                break;

            default:
                mLinesNode = null;
                break;
            }

            if (mLinesNode == null)
            {
                mRltv = RelativePosition.None;
            }
            else
            {
                mRltv   = RelativePosition.At;
                mLineOx = 0;
            }
        }
Esempio n. 4
0
 public TextLinesCursor(
     LinkedListNode <TextLine> InLinesNode, int InLineOx, RelativePosition InRltv)
 {
     mLines     = null;
     mLinesNode = InLinesNode;
     mLineOx    = InLineOx;
     mRltv      = InRltv;
 }
Esempio n. 5
0
        public TextLinesCursor(
            TextLines InLines, RelativePosition InRltv)
        {
            mLines     = InLines;
            mLinesNode = null;
            mLineOx    = -1;
            mRltv      = InRltv;

            if ((InRltv != RelativePosition.Begin) &&
                (InRltv != RelativePosition.End) &&
                (InRltv != RelativePosition.None))
            {
                throw new ApplicationException(
                          "only pos bgn and pos end allowed thru this constructor");
            }
        }
Esempio n. 6
0
        private static TextLinesCursor Scanner_InitialCursorSetup(
            TextLines InLines, TextLinesCursor InCsr)
        {
            TextLinesCursor csr = new TextLinesCursor(InCsr);

            if (csr.Position == RelativePosition.Begin)
            {
                csr.LineAdvance(InLines);
            }
            else if (csr.EndOfLine == true)
            {
                csr.LineAdvance(InLines);
            }

            return(csr);
        }
Esempio n. 7
0
        public static TextLines FileToTextLines(string InPath)
        {
            TextLines     lines = new TextLines();
            StringBuilder sb    = new StringBuilder(20000);

            using (StreamReader sr = new StreamReader(InPath))
            {
                while (true)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    lines.AddLast(line);
                }
            }
            return(lines);
        }