"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/include/astyle/ASStreamIterator.h" (12 May 2020, 2518 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    2  *
    3  *   Copyright (C) 2006-2008 by Jim Pattee <jimp03@email.com>
    4  *   Copyright (C) 1998-2002 by Tal Davidson
    5  *   <http://www.gnu.org/licenses/lgpl-3.0.html>
    6  *
    7  *   This file is a part of Artistic Style - an indentation and
    8  *   reformatting tool for C, C++, C# and Java source files.
    9  *   <http://astyle.sourceforge.net>
   10  *
   11  *   Artistic Style is free software: you can redistribute it and/or modify
   12  *   it under the terms of the GNU Lesser General Public License as published
   13  *   by the Free Software Foundation, either version 3 of the License, or
   14  *   (at your option) any later version.
   15  *
   16  *   Artistic Style is distributed in the hope that it will be useful,
   17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19  *   GNU Lesser General Public License for more details.
   20  *
   21  *   You should have received a copy of the GNU Lesser General Public License
   22  *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.
   23  *
   24  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   25  */
   26 
   27 
   28 #ifndef ASSTREAMITERATOR_H
   29 #define ASSTREAMITERATOR_H
   30 
   31 #include "astyle.h"
   32 #include <iostream>
   33 
   34 namespace astyle
   35 {
   36 
   37 class ASStreamIterator : public ASSourceIterator
   38 {
   39     public:
   40         bool checkForEmptyLine;
   41 
   42         // function declarations
   43         ASStreamIterator(istream *in);
   44         virtual ~ASStreamIterator();
   45         string nextLine(bool emptyLineWasDeleted);
   46         string peekNextLine();
   47         void peekReset();
   48         void saveLastInputLine();
   49 
   50         // inline functions
   51         bool compareToInputBuffer(const string &nextLine) const { return nextLine == prevBuffer; }
   52         const char* getOutputEOL() const { return outputEOL; }
   53         bool hasMoreLines() const { return !inStream->eof(); }
   54         
   55         int getStreamLength() const { return 0; }
   56         streamoff tellg() { return 0; }
   57         
   58         streamoff getPeekStart() const  { return 0; }
   59 
   60     private:
   61         istream * inStream;          // pointer to the input stream
   62         string buffer;         // current input line
   63         string prevBuffer;     // previous input line
   64         int eolWindows;        // number of Windows line endings (CRLF)
   65         int eolLinux;          // number of Linux line endings (LF)
   66         int eolMacOld;         // number of old Mac line endings (CR)
   67         int peekStart;         // starting position for peekNextLine()
   68         char outputEOL[4];     // output end of line char
   69         bool prevLineDeleted;  // the previous input line was deleted
   70 };
   71 
   72 }
   73 
   74 #endif