本文整理汇总了C++中UmlOperation::cppDecl方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlOperation::cppDecl方法的具体用法?C++ UmlOperation::cppDecl怎么用?C++ UmlOperation::cppDecl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlOperation
的用法示例。
在下文中一共展示了UmlOperation::cppDecl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QCString
UmlOperation * UmlOperation::cpp2Python(UmlClass * python, UmlClass * cpp,
const char * cppname,
const char * pythonname)
{
if (pythonname == 0)
pythonname = cppname;
UmlOperation * from = cpp->get_operation(cppname);
if (from == 0) {
QCString err = QCString("cannot find operation '") +
cppname + QCString("' in class '") + cpp->name()
+ QCString("'<br>\n");
UmlCom::trace(err);
throw 0;
}
UmlOperation * to = UmlBaseOperation::create(python, pythonname);
if (to == 0) {
QCString err = QCString("cannot create operation '") +
pythonname + QCString("' in class '") + python->name()
+ QCString("'<br>\n");
UmlCom::trace(err);
throw 0;
}
UmlCom::trace("add operation " + python->name() + "::" + pythonname + "<br>\n");
to->set_Description(::cpp2Python(from->description()));
to->set_ReturnType(from->returnType());
to->set_isClassMember(from->isClassMember());
to->set_Visibility(from->visibility());
to->set_CppVisibility(from->cppVisibility());
const QValueList<UmlParameter> params = from->params();
unsigned index;
for (index = 0; index != params.count(); index += 1)
to->addParameter(index, params[index]);
const QValueList<UmlTypeSpec> exceptions = from->exceptions();
for (index = 0; index != exceptions.count(); index += 1)
to->addException(index, exceptions[index]);
to->set_isCppVirtual(from->isCppVirtual());
to->set_isCppConst(from->isCppConst());
to->set_isCppInline(from->isCppInline());
to->set_CppDecl(::cpp2Python(from->cppDecl()));
to->set_CppDef(::cpp2Python(from->cppDef()));
to->set_CppBody(::cpp2Python(from->cppBody()));
to->set_isJavaFinal(from->isJavaFinal());
to->set_JavaDef(from->javaDef());
to->set_JavaBody(::cpp2Python(from->javaBody()));
return to;
}
示例2: addAssign
void UmlClass::addAssign(bool cte)
{
TRACE_FUNCTION;
UmlOperation * op = UmlOperation::create(this, "operator=");
if (op == 0)
UmlCom::trace("can't add assignment contructor");
else {
// add 'source' parameter
UmlParameter param;
param.name = "source";
param.dir = (cte) ? InputDirection : InputOutputDirection;
param.type.type = this;
op->addParameter(0, param);
// set return type, add the parameter profile
UmlTypeSpec t;
t.type = this;
op->set_ReturnType(t);
QByteArray p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
QByteArray s;
int index;
s = op->cppDecl();
if (s.isEmpty())
s = CppSettings::operationDecl();
if ((index = s.indexOf("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray
if ((index = s.indexOf("${type}")) != -1)
s.insert(index + 7, " &");
op->set_CppDecl(s);
s = op->cppDef();
if (s.isEmpty())
s = CppSettings::operationDef();
if ((index = s.indexOf("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray
if ((index = s.indexOf("${type}")) != -1)
s.insert(index + 7, " &");
op->set_CppDef(s);
}
}
示例3: addCopy
void UmlClass::addCopy(bool cte)
{
TRACE_FUNCTION;
UmlOperation * op = UmlOperation::create(this, name());
if (op == 0)
UmlCom::trace("can't add copy contructor");
else {
// to see that it is a copy constructor
op->set_Stereotype("copy");
// add 'source' parameter
UmlParameter param;
param.name = "source";
param.dir = (cte) ? InputDirection : InputOutputDirection;
param.type.type = this;
op->addParameter(0, param);
// add the parameter profile, and
// remove the useless "${type} " mainly to remove the space
QByteArray p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
QByteArray s;
int index;
s = op->cppDecl();
if (s.isEmpty())
s = CppSettings::operationDecl();
if ((index = s.indexOf("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray
if ((index = s.indexOf("${type} ")) != -1)
s.remove(index, 8);
op->set_CppDecl(s);
s = op->cppDef();
if (s.isEmpty())
s = CppSettings::operationDef();
if ((index = s.indexOf("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray
if ((index = s.indexOf("${type} ")) != -1)
s.remove(index, 8);
op->set_CppDef(s);
}
}
示例4: addContructor
void UmlClass::addContructor(bool expl)
{
TRACE_FUNCTION;
QLOG_INFO() << "1.1.1";
UmlOperation * op = UmlOperation::create(this, name());
QLOG_INFO() << "1.1.2";
if (op == 0)
UmlCom::trace("can't add contructor");
else {
QLOG_INFO() << "1.1.3";
QByteArray s;
int index;
// remove the useless "${type} " mainly to remove the space
s = op->cppDecl();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.4";
if (s.isEmpty())
s = CppSettings::operationDecl();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.5";
if ((index = s.indexOf("${type} ")) != -1)
s.remove(index, 8);
QLOG_INFO() << s;
QLOG_INFO() << "1.1.6";
if (expl && ((index = s.indexOf("${name}")) != -1))
s.insert(index, "explicit ");
QLOG_INFO() << s;
QLOG_INFO() << "1.1.7";
op->set_CppDecl(s);
QLOG_INFO() << s;
QLOG_INFO() << "1.1.8";
s = op->cppDef();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.81";
if (s.isEmpty())
s = CppSettings::operationDef();
QLOG_INFO() << "1.1.9";
if ((index = s.indexOf("${type} ")) != -1)
s.remove(index, 8);
QLOG_INFO() << "1.1.10";
op->set_CppDef(s);
}
}
示例5: addDestructor
void UmlClass::addDestructor(bool virt)
{
TRACE_FUNCTION;
UmlOperation * op = UmlOperation::create(this, "~" + name());
if (op == 0)
UmlCom::trace("can't add destructor");
else {
if (virt)
op->set_isCppVirtual(TRUE);
QByteArray s;
int index;
// remove the useless "${type} " mainly to remove the space
s = op->cppDecl();
if (s.isEmpty())
s = CppSettings::operationDecl();
if ((index = s.indexOf("${type} ")) != -1) {
s.remove(index, 8);
op->set_CppDecl(s);
}
s = op->cppDef();
if (s.isEmpty())
s = CppSettings::operationDef();
if ((index = s.indexOf("${type} ")) != -1) {
s.remove(index, 8);
op->set_CppDef(s);
}
}
}