Commit b1268f5c authored by Ralf Habacker's avatar Ralf Habacker
Browse files

added option for using '\' as doxgen tag instead of '@' - this feature is...

added option for using '\' as doxgen tag instead of '@' - this feature is useful when generating code for a project already using '\' as doxygen tag

svn path=/trunk/KDE/kdesdk/umbrello/; revision=1006625
parent 7bca07d7
......@@ -63,6 +63,10 @@ CPPCodeGenerationForm::CPPCodeGenerationForm( QWidget *parent, const char *name
new QListWidgetItem(tr2i18n("Accessors are public"), ui_generalOptionsListWidget);
m_optionAccessorsArePublic->setFlags(flags);
m_optionDocToolTag =
new QListWidgetItem(tr2i18n("Use '\\' as documentation tag instead of '@'"), ui_generalOptionsListWidget);
m_optionDocToolTag->setFlags(flags);
connect(ui_generalOptionsListWidget,
SIGNAL(itemClicked(QListWidgetItem *)), this,
SLOT(generalOptionsListWidgetClicked(QListWidgetItem *)));
......@@ -239,6 +243,15 @@ void CPPCodeGenerationForm::setAccessorsArePublic(bool bFlag)
m_optionAccessorsArePublic->setCheckState(toCheckState(bFlag));
}
/**
* Set the doc display state of option "Doc Tool Tag".
* @param value the value of the tag
*/
void CPPCodeGenerationForm::setDocToolTag(const QString &value)
{
m_optionDocToolTag->setCheckState(toCheckState(value == QLatin1String("\\")));
}
/**
* Get the display state of option "Package Is Namespace".
* @return the state of the flag
......@@ -302,6 +315,11 @@ bool CPPCodeGenerationForm::getAccessorsArePublic()
return m_optionAccessorsArePublic->checkState() == Qt::Checked;
}
QString CPPCodeGenerationForm::getDocToolTag()
{
return m_optionDocToolTag->checkState() == Qt::Checked ? QLatin1String("\\") : QLatin1String("@");
}
/**
* Conversion utility (static) from bool to Qt::CheckState.
* @param value the value to be converted
......
......@@ -34,6 +34,7 @@ public:
void setAccessorsAreInline(bool bFlag = true);
void setAccessorsArePublic(bool bFlag = true);
void setGenerateMakefileDocument(bool bFlag = true);
void setDocToolTag(const QString &value);
bool getPackageIsANamespace();
bool getVirtualDestructors();
......@@ -43,6 +44,7 @@ public:
bool getAccessorsAreInline();
bool getAccessorsArePublic();
bool getGenerateMakefileDocument();
QString getDocToolTag();
public slots:
......@@ -64,6 +66,7 @@ private:
QListWidgetItem *m_optionOperationsAreInline;
QListWidgetItem *m_optionAccessorsAreInline;
QListWidgetItem *m_optionAccessorsArePublic;
QListWidgetItem *m_optionDocToolTag;
static Qt::CheckState toCheckState(bool value);
......
......@@ -204,6 +204,17 @@ void CPPCodeGenerationPolicy::setVectorClassNameInclude(const QString &value)
UMLApp::app()->getCommonPolicy()->emitModifiedCodeContentSig();
}
void CPPCodeGenerationPolicy::setDocToolTag(const QString &value)
{
Settings::getOptionState().codeGenerationState.cppCodeGenerationState.docToolTag = value;
UMLApp::app()->getCommonPolicy()->emitModifiedCodeContentSig();
}
QString CPPCodeGenerationPolicy::getDocToolTag()
{
return Settings::getOptionState().codeGenerationState.cppCodeGenerationState.docToolTag;
}
/**
* Determine if the string include is global.
* @return value of flag
......@@ -319,6 +330,7 @@ void CPPCodeGenerationPolicy::setDefaults ( CPPCodeGenerationPolicy * cppclone,
setVectorClassName(cppclone->getVectorClassName());
setVectorClassNameInclude(cppclone->getVectorClassNameInclude());
setVectorIncludeIsGlobal(cppclone->vectorIncludeIsGlobal());
setDocToolTag(cppclone->getDocToolTag());
}
blockSignals(false); // "as you were citizen"
......@@ -352,6 +364,7 @@ void CPPCodeGenerationPolicy::setDefaults(bool emitUpdateSignal)
setVectorClassName(UmbrelloSettings::vectorClassName());
setVectorClassNameInclude(UmbrelloSettings::vectorClassNameInclude());
setVectorIncludeIsGlobal(UmbrelloSettings::vectorIncludeIsGlobal());
setDocToolTag(UmbrelloSettings::docToolTag());
blockSignals(false); // "as you were citizen"
......
......@@ -65,6 +65,9 @@ public:
void setVectorClassNameInclude(const QString &value);
QString getVectorClassNameInclude();
void setDocToolTag(const QString &value);
QString getDocToolTag();
void setStringIncludeIsGlobal (bool value);
bool stringIncludeIsGlobal ();
......
......@@ -40,6 +40,7 @@ CPPCodeGenerationPolicyPage::CPPCodeGenerationPolicyPage( QWidget *parent, const
form->setOperationsAreInline(policy->getOperationsAreInline());
form->setAccessorsAreInline(policy->getAccessorsAreInline());
form->setAccessorsArePublic(policy->getAccessorsArePublic());
form->setDocToolTag(policy->getDocToolTag());
form->ui_stringClassHCombo->setCurrentItem(policy->getStringClassName(),true);
form->ui_listClassHCombo->setCurrentItem(policy->getVectorClassName(),true);
......@@ -78,6 +79,7 @@ void CPPCodeGenerationPolicyPage::apply()
parent->setAccessorsAreInline(form->getAccessorsAreInline());
parent->setOperationsAreInline(form->getOperationsAreInline());
parent->setAccessorsArePublic(form->getAccessorsArePublic());
parent->setDocToolTag(form->getDocToolTag());
parent->setStringClassName(form->ui_stringClassHCombo->currentText());
parent->setStringClassNameInclude(form->ui_stringIncludeFileHistoryCombo->currentText());
......
......@@ -88,6 +88,7 @@ void CPPHeaderCodeAccessorMethod::updateMethodDeclaration()
CPPCodeClassField * cppfield = dynamic_cast<CPPCodeClassField*>(parentField);
bool isInlineMethod = policy->getAccessorsAreInline( );
QString tag = policy->getDocToolTag( );
QString vectorClassName = policy->getVectorClassName();
QString fieldName = cppfield->getFieldName();
......@@ -107,30 +108,30 @@ void CPPHeaderCodeAccessorMethod::updateMethodDeclaration()
methodName = "add_"+fieldType;
methodReturnType = "void";
methodParams = objectType+" value ";
headerText = "Add a "+fieldName+" object to the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return void";
headerText = "Add a "+fieldName+" object to the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return void";
break;
case CodeAccessorMethod::REMOVE:
methodName = "remove_"+fieldType;
methodParams = objectType+" value ";
methodReturnType = "void";
headerText = "Remove a "+fieldName+" object from the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return void";
headerText = "Remove a "+fieldName+" object from the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return void";
break;
case CodeAccessorMethod::LIST:
methodName = "get_"+fieldType+"_list";
methodReturnType = vectorClassName;
headerText = "Get the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return "+vectorClassName+"with list of objects";
headerText = "Get the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return "+vectorClassName+"with list of objects";
break;
case CodeAccessorMethod::SET:
methodName = "set_"+fieldName;
methodParams = fieldType+" value ";
methodReturnType = "void";
headerText = "Set the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+"@param value the value of "+fieldName;
headerText = "Set the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+tag+"param value the value of "+fieldName;
break;
case CodeAccessorMethod::GET:
default:
methodName = "get_"+fieldName;
methodReturnType = fieldType;
headerText = "Get the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+"@return the value of "+fieldName;
headerText = "Get the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+tag+"return the value of "+fieldName;
break;
}
......
......@@ -61,6 +61,7 @@ void CPPHeaderCodeOperation::updateMethodDeclaration()
CodeGenPolicyExt *pe = UMLApp::app()->getPolicyExt();
CPPCodeGenerationPolicy * policy = dynamic_cast<CPPCodeGenerationPolicy*>(pe);
bool isInlineMethod = policy->getOperationsAreInline( );
QString tag = policy->getDocToolTag( );
QString endLine = getNewLineEndingChars();
......@@ -70,7 +71,7 @@ void CPPHeaderCodeOperation::updateMethodDeclaration()
{
UMLAttributeList parameters = o->getParmList();
foreach (UMLAttribute* currentAtt, parameters ) {
comment += endLine + "@param " + currentAtt->getName() + ' ';
comment += endLine + tag + "param " + currentAtt->getName() + ' ';
comment += currentAtt->getDoc();
}
getComment()->setText(comment);
......
......@@ -87,6 +87,7 @@ void CPPSourceCodeAccessorMethod::updateMethodDeclaration()
UMLClassifier * c = doc->getParentClassifier();
bool isInlineMethod = policy->getAccessorsAreInline( );
QString tag = policy->getDocToolTag( );
QString vectorClassName = policy->getVectorClassName();
QString fieldName = cppfield->getFieldName();
......@@ -107,30 +108,30 @@ void CPPSourceCodeAccessorMethod::updateMethodDeclaration()
methodName = "add_"+fieldType;
methodReturnType = "void";
methodParams = objectType+" value ";
headerText = "Add a "+fieldName+" object to the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return void";
headerText = "Add a "+fieldName+" object to the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return void";
break;
case CodeAccessorMethod::REMOVE:
methodName = "remove_"+fieldType;
methodParams = objectType+" value ";
methodReturnType = "void";
headerText = "Remove a "+fieldName+" object from the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return void";
headerText = "Remove a "+fieldName+" object from the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return void";
break;
case CodeAccessorMethod::LIST:
methodName = "get_"+fieldType+"_list";
methodReturnType = vectorClassName;
headerText = "Get the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+"@return "+vectorClassName+"with list of objects";
headerText = "Get the "+fieldName+"List"+endLine+getParentObject()->getDoc()+endLine+tag+"return "+vectorClassName+"with list of objects";
break;
case CodeAccessorMethod::SET:
methodName = "set_"+fieldName;
methodParams = fieldType+" value ";
methodReturnType = "void";
headerText = "Set the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+"@param value the value of "+fieldName;
headerText = "Set the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+tag+"param value the value of "+fieldName;
break;
case CodeAccessorMethod::GET:
default:
methodName = "get_"+fieldName;
methodReturnType = fieldType;
headerText = "Get the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+"@return the value of "+fieldName;
headerText = "Get the value of "+fieldName+endLine+getParentObject()->getDoc()+endLine+tag+"return the value of "+fieldName;
break;
}
......
......@@ -833,7 +833,7 @@ void CppWriter::writeVectorAttributeAccessorMethods (
QString returnVarName = policyExt()->getVectorClassName() + '<' + className + '>';
writeDocumentation("Get the list of " + fldName + " objects held by " + fieldVarName,
description,
"@return " + returnVarName + " list of " + fldName + " objects held by " + fieldVarName,
policyExt()->getDocToolTag() + "return " + returnVarName + " list of " + fldName + " objects held by " + fieldVarName,
stream);
stream << indent << returnVarName << " ";
if(!isHeaderMethod)
......@@ -869,7 +869,7 @@ void CppWriter::writeSingleAttributeAccessorMethods(
// set method
if (change == Uml::chg_Changeable && !isStatic) {
writeDocumentation("Set the value of " + fieldVarName,description,"@param new_var the new value of " + fieldVarName,stream);
writeDocumentation("Set the value of " + fieldVarName,description,policyExt()->getDocToolTag() + "param new_var the new value of " + fieldVarName,stream);
stream << indent << "void ";
if(!isHeaderMethod)
stream << className_ << "::";
......@@ -889,7 +889,7 @@ void CppWriter::writeSingleAttributeAccessorMethods(
}
// get method
writeDocumentation("Get the value of " + fieldVarName,description,"@return the value of " + fieldVarName,stream);
writeDocumentation("Get the value of " + fieldVarName,description,policyExt()->getDocToolTag() + "return the value of " + fieldVarName,stream);
stream << indent << className << " ";
if (!isHeaderMethod)
stream << className_ << "::";
......@@ -1074,7 +1074,7 @@ void CppWriter::writeOperations(UMLClassifier *c, UMLOperationList &oplist, bool
} else {
methodReturnType = fixTypeName(op->getTypeName());
if(methodReturnType != "void")
doc += "@return " + methodReturnType + '\n';
doc += policyExt()->getDocToolTag() + "return " + methodReturnType + '\n';
}
QString str;
......@@ -1109,7 +1109,7 @@ void CppWriter::writeOperations(UMLClassifier *c, UMLOperationList &oplist, bool
str += " = " + initVal;
if (j < ( uint )( atl.count() - 1 ))
str += ", ";
doc += "@param " + atName + ' ' + at->getDoc() + m_endl;
doc += policyExt()->getDocToolTag() + "param " + atName + ' ' + at->getDoc() + m_endl;
}
doc = doc.remove(doc.size() - 1, 1); // remove last endl of comment
str += " )";
......
......@@ -98,6 +98,7 @@ struct CodeGenerationState{
bool stringIncludeIsGlobal;
QString vectorClassName;
QString vectorClassNameInclude;
QString docToolTag;
bool vectorIncludeIsGlobal;
bool virtualDestructors;
};
......
......@@ -387,6 +387,11 @@
<whatsthis>Enables/Disables virtual destructors</whatsthis>
<default>true</default>
</entry>
<entry name="docToolTag" type="String">
<label>Documentation tags</label>
<whatsthis>The tag used for generating doxygen documentation (\\, @)</whatsthis>
<default>@</default>
</entry>
</group>
<group name="D Code Generation">
<entry name="autoGenerateAttributeAccessorsD" key="autoGenerateAttributeAccessors" type="Bool">
......
......@@ -846,6 +846,7 @@ void UMLApp::saveOptions()
UmbrelloSettings::setVectorClassName(optionState.codeGenerationState.cppCodeGenerationState.vectorClassName);
UmbrelloSettings::setVectorClassNameInclude(optionState.codeGenerationState.cppCodeGenerationState.vectorClassNameInclude);
UmbrelloSettings::setVectorIncludeIsGlobal(optionState.codeGenerationState.cppCodeGenerationState.vectorIncludeIsGlobal);
UmbrelloSettings::setDocToolTag(optionState.codeGenerationState.cppCodeGenerationState.docToolTag);
// write config for Java code generation options
UmbrelloSettings::setAutoGenerateAttributeAccessorsJava(optionState.codeGenerationState.javaCodeGenerationState.autoGenerateAttributeAccessors);
......@@ -1792,6 +1793,7 @@ void UMLApp::readOptionState()
optionState.codeGenerationState.cppCodeGenerationState.vectorClassName = UmbrelloSettings::vectorClassName();
optionState.codeGenerationState.cppCodeGenerationState.vectorClassNameInclude = UmbrelloSettings::vectorClassNameInclude();
optionState.codeGenerationState.cppCodeGenerationState.vectorIncludeIsGlobal = UmbrelloSettings::vectorIncludeIsGlobal();
optionState.codeGenerationState.cppCodeGenerationState.docToolTag = UmbrelloSettings::docToolTag();
// Java code generation options
optionState.codeGenerationState.javaCodeGenerationState.autoGenerateAttributeAccessors = UmbrelloSettings::autoGenerateAttributeAccessorsJava();
......
......@@ -1227,6 +1227,8 @@ void UMLListView::init()
{
if (m_rv == 0) {
m_rv = new UMLListViewItem(this, i18n("Views"), Uml::lvt_View);
m_rv->setID("Views");
for (int i = 0; i < Uml::N_MODELTYPES; ++i) {
Uml::Model_Type mt = (Uml::Model_Type)i;
UMLFolder *sysFolder = m_doc->getRootFolder(mt);
......
......@@ -872,14 +872,16 @@ void UMLListViewItem::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
if (m_pObject == NULL) {
if (! Model_Utils::typeIsDiagram(m_Type) && m_Type != Uml::lvt_View)
uError() << m_Label << ": m_pObject is NULL";
itemElement.setAttribute("label", m_Label);
if (m_Type != Uml::lvt_View)
itemElement.setAttribute("label", m_Label);
} else if (m_pObject->getID() == Uml::id_None) {
if (m_Label.isEmpty()) {
uDebug() << "Skipping empty item";
return;
}
uDebug() << "saving local label " << m_Label << " because umlobject ID is not set";
itemElement.setAttribute("label", m_Label);
if (m_Type != Uml::lvt_View)
itemElement.setAttribute("label", m_Label);
} else if (m_pObject->getBaseType() == Uml::ot_Folder) {
extFolder = static_cast<UMLFolder*>(m_pObject);
if (!extFolder->getFolderFile().isEmpty()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment