#include "Errors.h" #include "stream_proto_utils.h" #include "string_utils.h" #include #include #include using namespace android::stream_proto; using namespace google::protobuf::io; using namespace std; const bool GENERATE_MAPPING = true; static string make_filename(const FileDescriptorProto& file_descriptor) { return file_descriptor.name() + ".h"; } static void write_enum(stringstream& text, const EnumDescriptorProto& enu, const string& indent) { const int N = enu.value_size(); text << indent << "// enum " << enu.name() << endl; for (int i=0; i namespaces = split(file_descriptor.package(), '.'); for (vector::iterator it = namespaces.begin(); it != namespaces.end(); it++) { text << "namespace " << *it << " {" << endl; } text << endl; size_t N; N = file_descriptor.enum_type_size(); for (size_t i=0; i::iterator it = namespaces.begin(); it != namespaces.end(); it++) { text << "} // " << *it << endl; } text << endl; text << "#endif // " << header << endl; CodeGeneratorResponse::File* file_response = response->add_file(); file_response->set_name(make_filename(file_descriptor)); file_response->set_content(text.str()); } int main(int argc, char const *argv[]) { (void)argc; (void)argv; GOOGLE_PROTOBUF_VERIFY_VERSION; CodeGeneratorRequest request; CodeGeneratorResponse response; // Read the request request.ParseFromIstream(&cin); // Build the files we need. const int N = request.proto_file_size(); for (int i=0; i