summaryrefslogtreecommitdiff
path: root/tools/streaming_proto/java/main.cpp
blob: 5b35504865f8435ec58c16c1b9965e7047928019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>

#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <string>

#include "Errors.h"
#include "java_proto_stream_code_generator.h"
#include "stream_proto_utils.h"

using namespace android::stream_proto;
using namespace google::protobuf::io;
using namespace std;

/**
 *
 * Main.
 */
int
main(int argc, char const*const* argv)
{
    (void)argc;
    (void)argv;

    GOOGLE_PROTOBUF_VERIFY_VERSION;

    // Read the request
    CodeGeneratorRequest request;
    request.ParseFromIstream(&cin);

    CodeGeneratorResponse response = generate_java_protostream_code(request);

    // If we had errors, don't write the response. Print the errors and exit.
    if (ERRORS.HasErrors()) {
        ERRORS.Print();
        return 1;
    }

    // If we didn't have errors, write the response and exit happily.
    response.SerializeToOstream(&cout);
    return 0;
}