2016-09-07 18:43:49 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace android {
|
2017-10-09 11:21:40 -07:00
|
|
|
namespace stream_proto {
|
2016-09-07 18:43:49 -07:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
struct Error
|
|
|
|
{
|
|
|
|
Error();
|
2018-12-20 13:54:17 -08:00
|
|
|
Error(const Error& that);
|
2016-09-07 18:43:49 -07:00
|
|
|
Error(const string& filename, int lineno, const char* message);
|
|
|
|
|
|
|
|
string filename;
|
|
|
|
int lineno;
|
|
|
|
string message;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Errors
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Errors();
|
|
|
|
~Errors();
|
|
|
|
|
|
|
|
// Add an error
|
|
|
|
void Add(const string& filename, int lineno, const char* format, ...);
|
|
|
|
|
|
|
|
// Print the errors to stderr if there are any.
|
|
|
|
void Print() const;
|
|
|
|
|
|
|
|
bool HasErrors() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The errors that have been added
|
|
|
|
vector<Error> m_errors;
|
|
|
|
void AddImpl(const string& filename, int lineno, const char* format, va_list ap);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Errors ERRORS;
|
|
|
|
extern const string UNKNOWN_FILE;
|
|
|
|
extern const int UNKNOWN_LINE;
|
|
|
|
|
|
|
|
|
2017-10-09 11:21:40 -07:00
|
|
|
} // namespace stream_proto
|
2016-09-07 18:43:49 -07:00
|
|
|
} // namespace android
|