1 #include <stdio.h>
2 
3 #include <iomanip>
4 #include <iostream>
5 #include <map>
6 #include <sstream>
7 #include <string>
8 
9 #include "Errors.h"
10 #include "java_proto_stream_code_generator.h"
11 #include "stream_proto_utils.h"
12 
13 using namespace android::stream_proto;
14 using namespace google::protobuf::io;
15 using namespace std;
16 
17 /**
18  *
19  * Main.
20  */
21 int
main(int argc,char const * const * argv)22 main(int argc, char const*const* argv)
23 {
24     (void)argc;
25     (void)argv;
26 
27     GOOGLE_PROTOBUF_VERIFY_VERSION;
28 
29     // Read the request
30     CodeGeneratorRequest request;
31     request.ParseFromIstream(&cin);
32 
33     CodeGeneratorResponse response = generate_java_protostream_code(request);
34 
35     // If we had errors, don't write the response. Print the errors and exit.
36     if (ERRORS.HasErrors()) {
37         ERRORS.Print();
38         return 1;
39     }
40 
41     // If we didn't have errors, write the response and exit happily.
42     response.SerializeToOstream(&cout);
43     return 0;
44 }
45