added test using own class as argument
authorJens Thiele <jens.thiele@intra2net.com>
Tue, 21 Nov 2006 16:05:25 +0000 (16:05 +0000)
committerJens Thiele <jens.thiele@intra2net.com>
Tue, 21 Nov 2006 16:05:25 +0000 (16:05 +0000)
codegen/main.cpp

index f8a2e23..f0c6ad4 100644 (file)
@@ -152,8 +152,14 @@ type_info get_type(const xmlpp::Element* root, const std::string &id)
 
      assert(element->get_attribute("name"));
      type_info ret;
-     if (element->get_attribute("context"))
-         ret.name=get_namespace(root, element->get_attribute("context")->get_value())+"::";
+     if (element->get_attribute("context")) {
+         ret.name=get_namespace(root, element->get_attribute("context")->get_value());
+         if (ret.name!="::")
+              ret.name+="::";
+         else
+              // do not explicitely add ::
+              ret.name="";
+     }
      ret.name+=element->get_attribute("name")->get_value();
      return ret;
 }
@@ -301,7 +307,7 @@ void output_common_hpp(std::ostream &o, const std::list<t2n_procedure> &procs) {
            << "private:\n"
            << "        friend class boost::serialization::access;\n"
            << "        template<class Archive>\n"
-           << "        void serialize(Archive & ar, const unsigned int version)\n"
+           << "        void serialize(Archive & ar, const unsigned int /* version */)\n"
            << "        {ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::command);}\n"
            << "};\n";
      }
@@ -313,7 +319,7 @@ void output_common_hpp(std::ostream &o, const std::list<t2n_procedure> &procs) {
            << "        " << it->ret_type << " res;\n"
            << "        friend class boost::serialization::access;\n"
            << "        template<class Archive>\n"
-           << "        void serialize(Archive & ar, const unsigned int version)\n"
+           << "        void serialize(Archive & ar, const unsigned int /* version */)\n"
            << "        {\n"
            << "                ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::result);\n"
            << "                ar & BOOST_SERIALIZATION_NVP(res);\n"
@@ -333,7 +339,7 @@ void output_common_hpp(std::ostream &o, const std::list<t2n_procedure> &procs) {
          }
          o << "        friend class boost::serialization::access;\n"
            << "        template<class Archive>\n"
-           << "        void serialize(Archive & ar, const unsigned int version)\n"
+           << "        void serialize(Archive & ar, const unsigned int /* version */)\n"
            << "        {\n"
            << "                ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(cmd_group_" << it->group << ");\n";
          for (t2n_procedure::Args::const_iterator ait=it->args.begin();ait!=it->args.end();++ait) {
@@ -553,9 +559,9 @@ main(int argc, char* argv[])
      output_common_cpp(common_cpp, procedures, common_hpp_fname);
 
      header_file client_hpp(client_hpp_fname.c_str());
+     client_hpp << "#include \"codegen-stubhead.hxx\"\n";
      // we can't paste the includes before codegen-stubhead.hxx was included
-     // but we also do not want to include codegen-stubhead.hxx in this file
-     //     paste_includes(client_hpp, includes);
+     paste_includes(client_hpp, includes);
      output_client_hpp(client_hpp, procedures);
 
      cpp_file client_cpp(client_cpp_fname.c_str());