export.hh
Go to the documentation of this file.
00001 #ifndef TYPELIB_EXPORT_IDL_HH
00002 #define TYPELIB_EXPORT_IDL_HH
00003 
00004 #include <typelib/exporter.hh>
00005 
00006 /* Exports types or a whole registry in the CORBA Interface Definition Language (IDL).
00007  * This exporter accepts the following options:
00008  * * \c namespace_prefix: a namespace to prepend to the type namespace. Useful
00009  *      to have the normal C types coexist with the CORBA-generated types.
00010  * * \c namespace_suffix: a namespace to add to the types suffixes. Useful
00011  *      to have the normal C types coexist with the CORBA-generated types.
00012  * * \c blob_threshold: if set to a nonzero value, a type which is bigger than
00013  *      the given value will be exported as a sequence<octet>. Useful if
00014  *      performance is important, and if type safety is not an issue (for
00015  *      instance if the software using CORBA implements its own type safety
00016  *      mechanisms)
00017  */
00018 class IDLExport : public Typelib::Exporter
00019 {
00020     std::string m_namespace;
00021     std::string m_ns_prefix;
00022     std::string m_ns_suffix;
00023     std::string m_indent;
00024     int m_blob_threshold;
00025     bool m_opaque_as_any;
00026 
00027     std::set<std::string> m_selected_types;
00028 
00029     struct TypedefSpec
00030     {
00031         std::string name_space;
00032         std::string declaration;
00033     };
00034     typedef std::map<std::string, std::list<std::string> > TypedefMap;
00035     TypedefMap m_typedefs;
00036 
00040     std::map<std::string, Typelib::Type const*> m_exported_typedefs;
00041 
00042 
00043     void closeNamespaces(std::ostream& stream, int levels);
00044     void adaptNamespace(std::ostream& stream, std::string const& ns);
00045     void generateTypedefs(std::ostream& stream);
00046 
00047 protected:
00049     virtual void end  (std::ostream& stream, Typelib::Registry const& registry);
00050 
00051 public:
00052     IDLExport();
00053 
00054     bool marshalOpaquesAsAny() const;
00055 
00056     std::string getNamespacePrefix() const;
00057     std::string getNamespaceSuffix() const;
00058 
00059     std::string getIDLAbsolute(Typelib::Type const& type) const;
00060     std::string getIDLRelative(Typelib::Type const& type, std::string const& relative_to) const;
00061 
00062     virtual void save
00063         ( std::ostream& stream
00064         , utilmm::config_set const& config
00065         , Typelib::Registry const& type);
00066 
00067     virtual bool save
00068         ( std::ostream& stream
00069         , Typelib::RegistryIterator const& type);
00070 
00071     static void checkType(Typelib::Type const& type);
00072 };
00073 
00074 #endif
00075 


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:41