blob: 5b35504865f8435ec58c16c1b9965e7047928019 [file] [log] [blame]
Joe Onorato6c9547d2016-09-07 18:43:49 -07001#include <stdio.h>
Pablo Gamito6ca20ea2024-02-06 17:04:21 +00002
Joe Onorato6c9547d2016-09-07 18:43:49 -07003#include <iomanip>
4#include <iostream>
Joe Onorato6c9547d2016-09-07 18:43:49 -07005#include <map>
Pablo Gamito6ca20ea2024-02-06 17:04:21 +00006#include <sstream>
7#include <string>
8
9#include "Errors.h"
10#include "java_proto_stream_code_generator.h"
11#include "stream_proto_utils.h"
Joe Onorato6c9547d2016-09-07 18:43:49 -070012
Yi Jin0473f88b2017-10-09 11:21:40 -070013using namespace android::stream_proto;
Joe Onorato6c9547d2016-09-07 18:43:49 -070014using namespace google::protobuf::io;
15using namespace std;
16
Joe Onorato6c9547d2016-09-07 18:43:49 -070017/**
Joe Onoratob38ac0b2016-10-28 13:10:25 -070018 *
Joe Onorato6c9547d2016-09-07 18:43:49 -070019 * Main.
20 */
21int
22main(int argc, char const*const* argv)
23{
24 (void)argc;
25 (void)argv;
26
27 GOOGLE_PROTOBUF_VERIFY_VERSION;
28
Joe Onorato6c9547d2016-09-07 18:43:49 -070029 // Read the request
Pablo Gamito6ca20ea2024-02-06 17:04:21 +000030 CodeGeneratorRequest request;
Joe Onorato6c9547d2016-09-07 18:43:49 -070031 request.ParseFromIstream(&cin);
32
Pablo Gamito6ca20ea2024-02-06 17:04:21 +000033 CodeGeneratorResponse response = generate_java_protostream_code(request);
Joe Onorato6c9547d2016-09-07 18:43:49 -070034
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}