coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
line_despatch.h
Go to the documentation of this file.
1 #ifndef LINE_DESPATCH_H
2 #define LINE_DESPATCH_H
3 #pragma once
4 /***************************************************************************
5  * Copyright (C) 2004, 2006 Symbian Software Ltd. *
6  * All rights reserved. *
7  * Copyright (C) 2002, 2003 Tony Finch <dot@dotat.at>. *
8  * All rights reserved. *
9  * Copyright (C) 1985, 1993 The Regents of the University of California. *
10  * All rights reserved. *
11  * Copyright (C) 2007-2013 Mike Kinghan, imk@burroingroingjoing.com *
12  * All rights reserved. *
13  * *
14  * Contributed by Mike Kinghan, imk@burroingroingjoing.com, *
15  * derived from the code of Tony Finch *
16  * *
17  * Redistribution and use in source and binary forms, with or without *
18  * modification, are permitted provided that the following conditions *
19  * are met: *
20  * *
21  * Redistributions of source code must retain the above copyright *
22  * notice, this list of conditions and the following disclaimer. *
23  * *
24  * Redistributions in binary form must reproduce the above copyright *
25  * notice, this list of conditions and the following disclaimer in the *
26  * documentation and/or other materials provided with the distribution. *
27  * *
28  * Neither the name of Symbian Software Ltd. nor the names of its *
29  * contributors may be used to endorse or promote products derived from *
30  * this software without specific prior written permission. *
31  * *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
35  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
36  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
37  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
38  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
39  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
40  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
41  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
42  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
43  * DAMAGE. *
44  * *
45  **************************************************************************/
46 
47 #include "line_type.h"
48 #include "parsed_line.h"
49 #include <string>
50 #include <memory>
51 
62 struct line_despatch {
63 
65  static void top();
66 
68  static parsed_line & cur_line() {
69  return *_cur_line_;
70  }
71 
73  static void drop() {
74  _cur_line_->drop();
75  }
76 
78  static void print() {
79  _cur_line_->output();
80  }
81 
85  static line_type next();
86 
98  static void substitute(std::string const & replacement);
99 
101  static unsigned & lines_suppressed() {
102  return _lines_suppressed_;
103  }
104 
106  static unsigned & lines_changed() {
107  return _lines_changed_;
108  }
109 
111  static std::string pretty();
112 
113 private:
114 
116  static unsigned _lines_suppressed_;
118  static unsigned _lines_changed_;
120  static std::unique_ptr<parsed_line> _cur_line_;
121 
122 };
123 
124 #endif // EOF
static parsed_line & cur_line()
Get a reference to the current output line.
Definition: line_despatch.h:68
static void print()
Print the current output line.
Definition: line_despatch.h:78
static void substitute(std::string const &replacement)
Substitute a diagnostic insert for the line in the line-buffer and print it to output.
static line_type next()
Process the current input line and return its line type.
static unsigned & lines_changed()
Get a reference to the count of changed lines.
static unsigned & lines_suppressed()
Get a reference to the count of suppressed lines.
static std::unique_ptr< parsed_line > _cur_line_
The current output line.
static void top()
Reinitialize the class static state.
static void drop()
Drop the current output line.
Definition: line_despatch.h:73
line_type
Enumeration of types of input lines.
Definition: line_type.h:52
static unsigned _lines_changed_
Number of input lines changed.
static std::string pretty()
Get a pretty printable version of the current input line.
Manages printing, discarding and replacement of lines.
Definition: line_despatch.h:62
static unsigned _lines_suppressed_
Number of input lines suppressed.