Q3CString UmlClass::decl() { Q3CString result; Q3CString close_template; UmlArtifact * cp = associatedArtifact(); Q3CString nasp = ((UmlPackage *) ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package()) ->cppNamespace(); if (! nasp.isEmpty()) { int index = // bypass :: allowing ::a... ((nasp.at(0) == ':') && (nasp != "::")) ? 2 : 0; int index2 = 0; while ((index2 = nasp.find("::", index)) != -1) { result += "namespace " + nasp.mid(index, index2 - index) + " { "; close_template += " } "; index = index2 + 2; } result += "namespace " + nasp.mid(index) + " { "; close_template += " } "; } Q3CString template1; Q3CString template2; get_template_prefixes(template1, template2); if (!template1.isEmpty()) result += template1.left(template1.length() - 1) + ' '; result += cpp_stereotype() + ' '; return result + name() + ';' + close_template + '\n'; }
void UmlClass::generate_def(QTextStream & f, WrapperStr indent, bool h, WrapperStr templates, WrapperStr cl_names, WrapperStr, WrapperStr) { QLOG_INFO() << "generating definition"; //QsLogging::Logger::instance(). if (! cppDecl().isEmpty()) { WrapperStr template1; WrapperStr template2; WrapperStr templates_tmplop; WrapperStr cl_names_tmplop; get_template_prefixes(template1, template2); templates_tmplop = templates + "template<>\n"; templates += template1; cl_names_tmplop = cl_names + "::" + name()/* true_name */; cl_names = cl_names_tmplop + template2; QVector<UmlItem*> ch = children(); for (int index = 0; index != ch.size(); index += 1) if (ch[index]->kind() != aNcRelation) ((UmlClassItem *) ch[index]) ->generate_def(f, indent, h, templates, cl_names, templates_tmplop, cl_names_tmplop); } }
void ClassData::get_class_spec(QString & templates, QString & names, QString & templates_tmplop, QString & names_tmplop) const { if (((BrowserNode *) browser_node->parent())->get_type() == UmlClass) { ((ClassData *) ((BrowserNode *) browser_node->parent())->get_data()) ->get_class_spec(templates, names, templates_tmplop, names_tmplop); names += "::"; } QString t1; QString t2; get_template_prefixes(t1, t2); templates_tmplop = templates + "template<>\n"; templates += t1; names_tmplop = names + true_name(browser_node->get_name(), cpp_decl); names = names_tmplop + t2; }
void UmlClass::spec(Q3CString & templates, Q3CString & names, Q3CString & templates_tmplop, Q3CString & names_tmplop) { if (parent()->kind() == aClass) { ((UmlClass *) parent()) ->spec(templates, names, templates_tmplop, names_tmplop); names += "::"; } Q3CString t1; Q3CString t2; get_template_prefixes(t1, t2); templates_tmplop = templates + "template<>\n"; templates += t1; // true_name ! names_tmplop = names + name(); names = names_tmplop + t2; }
void UmlClass::spec(WrapperStr & templates, WrapperStr & names, WrapperStr & templates_tmplop, WrapperStr & names_tmplop) { if (parent()->kind() == aClass) { ((UmlClass *) parent()) ->spec(templates, names, templates_tmplop, names_tmplop); names += "::"; } WrapperStr t1; WrapperStr t2; get_template_prefixes(t1, t2); templates_tmplop = templates + "template<>\n"; templates += t1; // true_name ! names_tmplop = names + name(); names = names_tmplop + t2; }
void UmlClass::generate_def(QTextOStream & f, Q3CString indent, bool h, Q3CString templates, Q3CString cl_names, Q3CString, Q3CString) { if (! cppDecl().isEmpty()) { Q3CString template1; Q3CString template2; Q3CString templates_tmplop; Q3CString cl_names_tmplop; get_template_prefixes(template1, template2); templates_tmplop = templates + "template<>\n"; templates += template1; cl_names_tmplop = cl_names + "::" + name()/* true_name */; cl_names = cl_names_tmplop + template2; Q3PtrVector<UmlItem> ch = children(); for (unsigned index = 0; index != ch.size(); index += 1) if (ch[index]->kind() != aNcRelation) ((UmlClassItem *) ch[index]) ->generate_def(f, indent, h, templates, cl_names, templates_tmplop, cl_names_tmplop); } }