• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 
3 #include <string>
4 #include <vector>
5 
6 namespace android {
7 namespace javastream_proto {
8 
9 using namespace std;
10 
11 struct Error
12 {
13     Error();
14     explicit Error(const Error& that);
15     Error(const string& filename, int lineno, const char* message);
16 
17     string filename;
18     int lineno;
19     string message;
20 };
21 
22 class Errors
23 {
24 public:
25     Errors();
26     ~Errors();
27 
28     // Add an error
29     void Add(const string& filename, int lineno, const char* format, ...);
30 
31     // Print the errors to stderr if there are any.
32     void Print() const;
33 
34     bool HasErrors() const;
35 
36 private:
37     // The errors that have been added
38     vector<Error> m_errors;
39     void AddImpl(const string& filename, int lineno, const char* format, va_list ap);
40 };
41 
42 extern Errors ERRORS;
43 extern const string UNKNOWN_FILE;
44 extern const int UNKNOWN_LINE;
45 
46 
47 } // namespace javastream_proto
48 } // namespace android
49