Line data Source code
1 : /***************************************************************************\
2 : * Name : CPP dumper *
3 : * Description : generate C++ src files for de/serialization *
4 : * Author : antonin.kriz@gmail.com *
5 : * ------------------------------------------------------------------------- *
6 : * This is free software; you can redistribute it and/or modify it under the *
7 : * terms of the MIT license. A copy of the license can be found in the file *
8 : * "LICENSE" at the root of this distribution. *
9 : \***************************************************************************/
10 :
11 : #include "dumper.h"
12 : #include "header.h"
13 : #include "pb/dumper.h"
14 : #include "json/dumper.h"
15 :
16 12 : void dump_cpp_header( const proto_file & file, std::ostream & stream )
17 : {
18 : try
19 : {
20 12 : dump_cpp_definitions( file, stream );
21 12 : dump_json_header( file, stream );
22 12 : dump_pb_header( file, stream );
23 : }
24 0 : catch( const std::exception & e )
25 : {
26 0 : throw std::runtime_error( file.path.string( ) + ":" + e.what( ) );
27 0 : }
28 12 : }
29 :
30 12 : void dump_cpp( const proto_file & file, const std::filesystem::path & header_file,
31 : std::ostream & file_stream )
32 : {
33 : try
34 : {
35 12 : dump_json_cpp( file, header_file, file_stream );
36 12 : dump_pb_cpp( file, header_file, file_stream );
37 : }
38 0 : catch( const std::exception & e )
39 : {
40 0 : throw std::runtime_error( file.path.string( ) + ":" + e.what( ) );
41 0 : }
42 12 : }
|