KiCad PCB EDA Suite
filter_reader.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2007-2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef FILTER_READER_H_
26 #define FILTER_READER_H_
27 
28 #include <wx/wx.h>
29 #include <richio.h>
30 
31 
37 class FILTER_READER : public LINE_READER
38 {
40 
41 public:
42 
47  FILTER_READER( LINE_READER& aReader );
48 
50 
51  char* ReadLine() throw( IO_ERROR ) override;
52 
53  const wxString& GetSource() const override
54  {
55  return reader.GetSource();
56  }
57 
58  unsigned LineNumber() const override
59  {
60  return reader.LineNumber();
61  }
62 };
63 
64 
72 {
74 
75 public:
76 
82 
84 
85  char* ReadLine() throw( IO_ERROR ) override;
86 
87  const wxString& GetSource() const override
88  {
89  return reader.GetSource();
90  }
91 
92  unsigned LineNumber() const override
93  {
94  return reader.LineNumber();
95  }
96 };
97 
98 #endif // FILTER_READER_H_
LINE_READER & reader
Definition: filter_reader.h:39
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
virtual unsigned LineNumber() const
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: richio.h:159
Class WHITESPACE_FILTER_READER reads lines of text from another LINE_READER, but only returns non-com...
Definition: filter_reader.h:71
char * ReadLine() override
Function ReadLine reads a line of text into the buffer and increments the line number counter...
unsigned LineNumber() const override
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: filter_reader.h:92
WHITESPACE_FILTER_READER(LINE_READER &aReader)
Constructor ( LINE_READER& ) does not take ownership over aReader, so will not destroy it...
char * ReadLine() override
Function ReadLine reads a line of text into the buffer and increments the line number counter...
const wxString & GetSource() const override
Function GetSource returns the name of the source of the lines in an abstract sense.
Definition: filter_reader.h:87
virtual const wxString & GetSource() const
Function GetSource returns the name of the source of the lines in an abstract sense.
Definition: richio.h:130
unsigned LineNumber() const override
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: filter_reader.h:58
const wxString & GetSource() const override
Function GetSource returns the name of the source of the lines in an abstract sense.
Definition: filter_reader.h:53
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
Class FILTER_READER reads lines of text from another LINE_READER, but only returns non-comment lines ...
Definition: filter_reader.h:37
FILTER_READER(LINE_READER &aReader)
Constructor ( LINE_READER& ) does not take ownership over aReader, so will not destroy it...