本文整理汇总了C++中UmlPackage::cppNamespace方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlPackage::cppNamespace方法的具体用法?C++ UmlPackage::cppNamespace怎么用?C++ UmlPackage::cppNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlPackage
的用法示例。
在下文中一共展示了UmlPackage::cppNamespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate
void UmlArtifact::generate()
{
if (! managed) {
managed = TRUE;
if (stereotype() == "text") {
generate_text();
return;
}
else if (stereotype() != "source")
return;
package_of_generated_artifact = package();
const WrapperStr hdef = cppHeader();
QLOG_INFO() << "Read header as: " + hdef.operator QString();
const WrapperStr srcdef = cppSource();
if (hdef.isEmpty() && srcdef.isEmpty()) {
if (verbose())
UmlCom::trace(WrapperStr("<hr><font face=helvetica>artifact <i>")
+ name() + "</i> has an empty C++ definition</font><br>");
return;
}
const WrapperStr & name = UmlArtifact::name();
UmlPackage * pack = package();
WrapperStr h_path = pack->header_path(name);
WrapperStr src_path = pack->source_path(name);
WrapperStr nasp_start;
WrapperStr nasp_end;
const char * cnasp = pack->cppNamespace();
WrapperStr nasp = ((cnasp[0] == ':') && (cnasp[1] == ':'))
? cnasp + 2 : cnasp;
if (!nasp.isEmpty()) {
int index = 0;
int index2;
WrapperStr closed = "\n} // namespace ";
while ((index2 = nasp.find(':', index)) != -1) {
WrapperStr na = nasp.mid(index, index2 - index);
nasp_start += WrapperStr("namespace ") + na + " {\n\n";
closed += na;
nasp_end = closed + "\n" + nasp_end;
closed += "::";
nasp.replace(index2, 2, "_");
index = index2 + 1;
}
nasp_start += WrapperStr("namespace ") + nasp.mid(index) + " {\n\n";
closed += nasp.mid(index);
nasp_end = closed + "\n" + nasp_end;
}
else {
WrapperStr s;
if (!hdef.isEmpty())
s = " in <i> " + h_path + "</i>";
if (!srcdef.isEmpty()) {
if (!hdef.isEmpty())
s += " and <i> " + src_path + "</i>";
else
s = " in <i> " + src_path + "</i>";
}
UmlCom::message(name);
if (verbose())
UmlCom::trace(WrapperStr("<hr><font face=helvetica>Generate code for <i> ")
+ name + "</i>" + s + "</font><br>");
else
set_trace_header(WrapperStr("<font face=helvetica>Generate code for <i> ")
+ name + "</i>" + s + "</font><br>");
}
// get bodies if preserve
const Q3PtrVector<UmlClass> & cls = associatedClasses();
if (preserve())
UmlOperation::read_bodies(h_path, src_path);
// compute dependencies
bool all_in_h = (hdef.find("${all_includes}") != -1);
Q3PtrList<CppRefType> dependencies;
unsigned n = cls.count();
unsigned index;
for (index = 0; index != n; index += 1)
cls[index]->compute_dependencies(dependencies, all_in_h);
// generate header file
WrapperStr h_incl;
WrapperStr src_incl;
WrapperStr decl;
//.........这里部分代码省略.........