1 // Copyright (c) 2006- Facebook
2 // Distributed under the Thrift Software License
4 // See accompanying file LICENSE or visit the Thrift site at:
5 // http://developers.facebook.com/thrift/
7 #ifndef T_XSD_GENERATOR_H
8 #define T_XSD_GENERATOR_H
13 #include "t_generator.h"
16 * XSD generator, creates an XSD for the base types etc.
18 * @author Mark Slee <mcslee@facebook.com>
20 class t_xsd_generator
: public t_generator
{
22 t_xsd_generator(t_program
* program
) :
23 t_generator(program
) {
24 out_dir_base_
= "gen-xsd";
27 virtual ~t_xsd_generator() {}
30 * Init and close methods
33 void init_generator();
34 void close_generator();
37 * Program-level generation functions
40 void generate_typedef(t_typedef
* ttypedef
);
41 void generate_enum(t_enum
* tenum
) {}
43 void generate_service(t_service
* tservice
);
44 void generate_struct(t_struct
* tstruct
);
48 void generate_element(std::ostream
& out
, std::string name
, t_type
* ttype
, t_struct
* attrs
=NULL
, bool optional
=false, bool nillable
=false, bool list_element
=false);
50 std::string
ns(std::string in
, std::string ns
) {
54 std::string
xsd(std::string in
) {
58 std::string
type_name(t_type
* ttype
);
59 std::string
base_type_name(t_base_type::t_base tbase
);
68 * Output string stream
70 std::ostringstream s_xsd_types_
;