Joe Onorato 6c9547d8e1 Add android.util.proto package as an @TestApi.
The classes there add a way for the platform to write out
protocol buffers that doesn't require lots of small objects,
generate code, and extra copying.

Includes the plugin for protoc to generate the constants.

Test: proto cts tests

Change-Id: I6385c198cecda9ac6fa533151609e3ace341af01
2016-10-12 16:37:18 -07:00

49 lines
891 B
C++

#include <stdio.h>
#include <string>
#include <vector>
namespace android {
namespace javastream_proto {
using namespace std;
struct Error
{
Error();
explicit Error(const Error& that);
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;
} // namespace javastream_proto
} // namespace android