namespace : output |
Output the block to the stream.
Any other method of any other object can call this method. This is called 'public' access.
The data-type returned is "voidtype";
This method is contained in the object "namespace".
The method takes the following arguments:
filedef : Pointer to tgl_structure_parser
Not sure.
obj : Pointer to @schemaobj
Not sure.
This method is overridden from an abstract method with the same signature found in the object @block.
The files "schema/schema_object.hpp", "tgl_structure_parser.hpp" and "boost/tokenizer.hpp" are included.
Parse out namespace declarations and output them. We can output a "start" or "end" declaration, or a using declaration depending on "context".
std::string ns = ""; if (_identifier == "") { ph::tools::schema::schema_object *o = dynamic_cast<ph::tools::schema::schema_object *>(obj); if (o == 0) { filedef->error(obj->name() + " is not a schema_object."); return; } ns = o->get_namespace(); } else ns = _identifier; // split out the namespaces. std::vector<std::string> namespaces; boost::char_separator<char> sep(":"); boost::tokenizer<boost::char_separator<char> > t(ns, sep); for (boost::tokenizer<boost::char_separator<char> >::iterator i=t.begin(); i != t.end(); i++) namespaces.push_back(*i); if (_context == "start") { for (std::vector<std::string>::iterator j=namespaces.begin(); j != namespaces.end(); j++) filedef->write_output("namespace " + *j + " {\\n"); } else if (_context == "end") { for (std::vector<std::string>::iterator j=namespaces.begin(); j != namespaces.end(); j++) filedef->write_output("};\\n"); } else { for (std::vector<std::string>::iterator j=namespaces.begin(); j != namespaces.end(); j++) { if (j != namespaces.begin()) { if (_language == "Java") filedef->write_output("."); else filedef->write_output("::"); } filedef->write_output(*j); } }