Last change
on this file was
7623,
checked in by westram, 14 years ago
|
- merge from dev [7450] [7452] [7456] [7457] [7458] [7459] [7460] [7461] [7464] [7465] [7466] [7467] [7468] [7469] [7482]
- tweaked compiler options
- activated -Weffc++
- postfilter warnings where Scott Meyers' advices are too general.
- base classes should not always have virtual destructors, since that renders tiny classes useless and
- members should not always be initialized via initialization list, since that often violates the DRY principle
- fix gcc's inability to detect that Noncopyable implements a private copy-ctor and op=
- this slows down complete ARB recompilation by ~5%
- added -Wold-style-cast (inactive)
- removed -Wno-non-template-friend added in [7447]
- postcompile.pl
- added option —original to show unmodified compiler output
- declared op= for classes which had a copy-ctor
- moved op= macros to arbtools.h
- derived classes containing pointers from Noncopyable (use Noncopyable virtually) or
- made them copyable if needed (awt_mask_item, KnownDB, Code, AWT_registered_itemtype, GEN_gene, PosGene, PartialSequence, PlugIn, Range, Convaln_exception)
- other related changes
- mask destruction working now
|
File size:
1.3 KB
|
Line | |
---|
1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : parser.h // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // =============================================================== // |
---|
7 | |
---|
8 | #ifndef PARSER_H |
---|
9 | #define PARSER_H |
---|
10 | |
---|
11 | #ifndef READER_H |
---|
12 | #include "reader.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | |
---|
16 | class Parser : virtual Noncopyable { |
---|
17 | protected: |
---|
18 | EntryState state; |
---|
19 | Seq& seq; |
---|
20 | Reader& reader; |
---|
21 | |
---|
22 | public: |
---|
23 | Parser(Seq& seq_, Reader& reader_) |
---|
24 | : state(ENTRY_NONE), |
---|
25 | seq(seq_), |
---|
26 | reader(reader_) |
---|
27 | {} |
---|
28 | virtual ~Parser() {} |
---|
29 | |
---|
30 | bool parse_entry() __ATTR__USERESULT { |
---|
31 | state = ENTRY_NONE; |
---|
32 | |
---|
33 | for (; reader.line() && state != ENTRY_COMPLETED;) { |
---|
34 | if (!has_content(reader.line())) { ++reader; continue; } // skip empty lines |
---|
35 | |
---|
36 | parse_section(); |
---|
37 | } |
---|
38 | |
---|
39 | if (state == ENTRY_STARTED) throw_incomplete_entry(); |
---|
40 | ++reader; |
---|
41 | |
---|
42 | seq.set_id(get_data().get_id()); |
---|
43 | return state == ENTRY_COMPLETED; |
---|
44 | } |
---|
45 | |
---|
46 | virtual void parse_section() = 0; |
---|
47 | virtual const InputFormat& get_data() const = 0; |
---|
48 | }; |
---|
49 | |
---|
50 | |
---|
51 | #else |
---|
52 | #error parser.h included twice |
---|
53 | #endif // PARSER_H |
---|
Note: See
TracBrowser
for help on using the repository browser.