Commit 4f9c87d8 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

- Replace QString("") by QString()

- At calls to QDomElement::attribute() remove "" when given as optional arg
parent d8b5bc4b
......@@ -218,7 +218,7 @@ bool UMLAssociation::load(QDomElement & element)
m_AssocType == Uml::AssociationType::Dependency ||
m_AssocType == Uml::AssociationType::Child2Category ||
m_AssocType == Uml::AssociationType::Category2Parent) {
QString general = element.attribute("general", "");
QString general = element.attribute("general");
if (!general.isEmpty()) {
UMLClassifier *owningClassifier = dynamic_cast<UMLClassifier*>(m_pUMLPackage);
if (owningClassifier == NULL){
......@@ -270,15 +270,15 @@ bool UMLAssociation::load(QDomElement & element)
// Permitted tag names:
// roleA: "child" "subtype" "client"
// roleB: "parent" "supertype" "supplier"
QString idStr = tempElement.attribute("xmi.id", "");
QString idStr = tempElement.attribute("xmi.id");
if (idStr.isEmpty())
idStr = tempElement.attribute("xmi.idref", "");
idStr = tempElement.attribute("xmi.idref");
if (idStr.isEmpty()) {
QDomNode inner = node.firstChild();
QDomElement tmpElem = inner.toElement();
idStr = tmpElem.attribute("xmi.id", "");
idStr = tmpElem.attribute("xmi.id");
if (idStr.isEmpty())
idStr = tmpElem.attribute("xmi.idref", "");
idStr = tmpElem.attribute("xmi.idref");
}
if (idStr.isEmpty()) {
uError() << "type " << m_AssocType
......@@ -451,14 +451,14 @@ bool UMLAssociation::load(QDomElement & element)
else
return false;
setMultiplicity(element.attribute("multia", ""), RoleType::A);
setMultiplicity(element.attribute("multib", ""), RoleType::B);
setMultiplicity(element.attribute("multia"), RoleType::A);
setMultiplicity(element.attribute("multib"), RoleType::B);
setRoleName(element.attribute("namea", ""), RoleType::A);
setRoleName(element.attribute("nameb", ""), RoleType::B);
setRoleName(element.attribute("namea"), RoleType::A);
setRoleName(element.attribute("nameb"), RoleType::B);
setRoleDoc(element.attribute("doca", ""), RoleType::A);
setRoleDoc(element.attribute("docb", ""), RoleType::B);
setRoleDoc(element.attribute("doca"), RoleType::A);
setRoleDoc(element.attribute("docb"), RoleType::B);
// Visibility defaults to Public if it cant set it here..
QString visibilityA = element.attribute("visibilitya", "0");
......
......@@ -275,7 +275,7 @@ void UMLAttribute::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
*/
bool UMLAttribute::load(QDomElement & element)
{
m_SecondaryId = element.attribute("type", "");
m_SecondaryId = element.attribute("type");
// We use the m_SecondaryId as a temporary store for the xmi.id
// of the attribute type model object.
// It is resolved later on, when all classes have been loaded.
......@@ -298,15 +298,15 @@ bool UMLAttribute::load(QDomElement & element)
}
m_SecondaryId = Model_Utils::getXmiId(tempElement);
if (m_SecondaryId.isEmpty())
m_SecondaryId = tempElement.attribute("xmi.idref", "");
m_SecondaryId = tempElement.attribute("xmi.idref");
if (m_SecondaryId.isEmpty()) {
QString href = tempElement.attribute("href", "");
QString href = tempElement.attribute("href");
if (href.isEmpty()) {
QDomNode inner = node.firstChild();
QDomElement tmpElem = inner.toElement();
m_SecondaryId = Model_Utils::getXmiId(tmpElem);
if (m_SecondaryId.isEmpty())
m_SecondaryId = tmpElem.attribute("xmi.idref", "");
m_SecondaryId = tmpElem.attribute("xmi.idref");
} else {
int hashpos = href.lastIndexOf(QChar('#'));
if (hashpos < 0) {
......@@ -329,10 +329,10 @@ bool UMLAttribute::load(QDomElement & element)
uDebug() << name() << ": cannot find type.";
}
}
m_InitialValue = element.attribute("initialValue", "");
m_InitialValue = element.attribute("initialValue");
if (m_InitialValue.isEmpty()) {
// for backward compatibility
m_InitialValue = element.attribute("value", "");
m_InitialValue = element.attribute("value");
}
return true;
}
......
......@@ -1514,7 +1514,7 @@ UMLClassifierListItem* UMLClassifier::makeChildObject(const QString& xmiTag)
bool UMLClassifier::load(QDomElement& element)
{
UMLClassifierListItem *child = NULL;
m_SecondaryId = element.attribute("elementReference", "");
m_SecondaryId = element.attribute("elementReference");
if (!m_SecondaryId.isEmpty()) {
// @todo We do not currently support composition.
m_isRef = true;
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Alexander Blum <blum@kewbee.de> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -754,7 +754,7 @@ void ASWriter::writeOperations(QString classname, UMLOperationList *opList, QTex
for (UMLAttributeListIt atlIt(atl); atlIt.hasNext(); ++j) {
UMLAttribute* at = atlIt.next();
as << cleanName(at->name())
<< (!(at->getInitialValue().isEmpty()) ? (QString(" = ")+at->getInitialValue()) : QString(""))
<< (!(at->getInitialValue().isEmpty()) ? (QString(" = ")+at->getInitialValue()) : QString())
<< ((j < i-1)?", ":"");
}
as << ")" << m_endl << "{" << m_endl;
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -272,7 +272,7 @@ void CodeClassField::setAttributesFromNode (QDomElement & root)
initFields();
setWriteOutMethods(root.attribute("writeOutMethods","true") == "true" ? true : false);
m_listClassName = root.attribute("listClassName","");
m_listClassName = root.attribute("listClassName");
m_classFieldType = (ClassFieldType) root.attribute("field_type","0").toInt();
// load accessor methods now
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -386,9 +386,9 @@ void CodeDocument::setAttributesOnNode (QDomDocument & doc, QDomElement & docEle
void CodeDocument::setAttributesFromNode (QDomElement & root)
{
// now set local attributes
setFileName(root.attribute("fileName",""));
setFileExtension(root.attribute("fileExt",""));
QString pkgStr = root.attribute("package","");
setFileName(root.attribute("fileName"));
setFileExtension(root.attribute("fileExt"));
QString pkgStr = root.attribute("package");
if (!pkgStr.isEmpty() && pkgStr != "-1") {
UMLDoc *umldoc = UMLApp::app()->document();
if (pkgStr.contains(QRegExp("\\D"))) {
......@@ -403,7 +403,7 @@ void CodeDocument::setAttributesFromNode (QDomElement & root)
}
}
setWriteOutCode(root.attribute("writeOutCode","true") == "true" ? true : false);
setID(root.attribute("id",""));
setID(root.attribute("id"));
// load comment now
// by looking for our particular child element
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -71,7 +71,7 @@ public:
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock ();
virtual CodeBlockWithComments * newCodeBlockWithComments ();
virtual QString getUniqueTag(const QString& prefix = QString(""));
virtual QString getUniqueTag(const QString& prefix = QString());
QString cleanName (const QString &name);
......
......@@ -236,7 +236,7 @@ void CodeGenerator::loadCodeForOperation(const QString& idStr, const QDomElement
UMLObject *obj = m_document->findObjectById(id);
if (obj) {
uDebug() << "found UMLObject for id:" << idStr;
QString value = codeDocElement.attribute("value", "");
QString value = codeDocElement.attribute("value");
UMLObject::ObjectType t = obj->baseType();
if (t == UMLObject::ot_Operation) {
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -472,7 +472,7 @@ void CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode (QDomElement & roo
} else if (name == "codeaccessormethod" ||
name == "ccfdeclarationcodeblock") {
QString acctag = element.attribute("tag","");
QString acctag = element.attribute("tag");
// search for our method in the
TextBlock * tb = findCodeClassFieldTextBlockByTag(acctag);
if (!tb || !addTextBlock(tb)) {
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -113,8 +113,8 @@ void CodeMethodBlock::setAttributesFromNode(QDomElement & elem)
if (contentType() != AutoGenerated)
{
QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
setStartMethodText(decodeText(elem.attribute("startMethodText",""), endLine));
setEndMethodText(decodeText(elem.attribute("endMethodText",""), endLine));
setStartMethodText(decodeText(elem.attribute("startMethodText"), endLine));
setEndMethodText(decodeText(elem.attribute("endMethodText"), endLine));
}
}
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -237,7 +237,7 @@ void CodeParameter::setAttributesFromNode(QDomElement & root)
<< Uml::ID::toString(id) << " not found, corrupt save file?";
// other attribs now
setInitialValue(root.attribute("initialValue",""));
setInitialValue(root.attribute("initialValue"));
// load comment now
// by looking for our particular child element
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -113,7 +113,7 @@ void CPPHeaderCodeDocument::loadChildTextBlocksFromNode (QDomElement & root)
if(name == "codeaccessormethod" ||
name == "ccfdeclarationcodeblock"
) {
QString acctag = element.attribute("tag","");
QString acctag = element.attribute("tag");
// search for our method in the
TextBlock * tb = findCodeClassFieldTextBlockByTag(acctag);
if(!tb || !addTextBlock(tb))
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -80,7 +80,7 @@ void CPPHeaderCodeOperation::updateMethodDeclaration()
// no return type for constructors
QString methodReturnType = o->getTypeName();
QString methodName = o->name();
QString paramStr = QString("");
QString paramStr = QString();
// assemble parameters
UMLAttributeList list = getParentOperation()->getParmList();
......
......@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2007-2013 *
* copyright (C) 2007-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -542,7 +542,7 @@ void CSharpWriter::writeOperations(UMLOperationList opList,
// no initial values in C#
//<< (!(at->getInitialValue().isEmpty()) ?
// (QString(" = ")+at->getInitialValue()) :
// QString(""))
// QString())
cs << ((j < i-1)?", ":"");
}
cs << ")";
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2007 Jari-Matti Mäkelä <jmjm@iki.fi> *
* copyright (C) 2008-2013 *
* copyright (C) 2008-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -162,7 +162,7 @@ void DClassifierCodeDocument::loadChildTextBlocksFromNode(QDomElement & root)
if(name == "codeaccessormethod" ||
name == "ccfdeclarationcodeblock"
) {
QString acctag = element.attribute("tag","");
QString acctag = element.attribute("tag");
// search for our method in the
TextBlock * tb = findCodeClassFieldTextBlockByTag(acctag);
if(!tb || !addTextBlock(tb))
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2007 Jari-Matti Mäkelä <jmjm@iki.fi> *
* copyright (C) 2008-2013 *
* copyright (C) 2008-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -80,7 +80,7 @@ QString DCodeClassField::getInitialValue()
if(fieldIsSingleValue()) {
// FIX : IF the multiplicity is "1" then we should init a new object here, if its 0 or 1,
// then we can just return 'empty' string (minor problem).
return QString("");
return QString();
} else {
return " new "+DCodeGenerator::getListFieldClassName()+"()";
}
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2007 Jari-Matti Mäkelä <jmjm@iki.fi> *
* copyright (C) 2008-2013 *
* copyright (C) 2008-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -77,7 +77,7 @@ void DCodeOperation::updateMethodDeclaration()
startText += '(';
// assemble parameters
QString paramStr = QString("");
QString paramStr = QString();
UMLAttributeList list = getParentOperation()->getParmList();
int paramNum = list.count();
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2007 Jari-Matti Mäkelä <jmjm@iki.fi> *
* copyright (C) 2008-2013 *
* copyright (C) 2008-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -912,7 +912,7 @@ void DWriter::writeOperations(UMLOperationList &oplist, QTextStream &d)
str += typeName + ' ' + atName +
(!(at->getInitialValue().isEmpty()) ?
(QString(" = ")+at->getInitialValue()) :
QString(""))
QString())
+ ((j < i-1)?", ":"");
doc += "@param " + atName+' '+at->doc() + m_endl;
}
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -283,8 +283,8 @@ void HierarchicalCodeBlock::setAttributesFromNode (QDomElement & root)
if (contentType() != CodeBlock::AutoGenerated)
{
QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
setStartText(decodeText(root.attribute("startText",""), endLine));
setEndText(decodeText(root.attribute("endText",""), endLine));
setStartText(decodeText(root.attribute("startText"), endLine));
setEndText(decodeText(root.attribute("endText"), endLine));
}
// do this *after* all other attributes saved
......
......@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2013 *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
......@@ -87,7 +87,7 @@ void JavaANTCodeDocument::loadChildTextBlocksFromNode (QDomElement & root)
if(name == "codeaccessormethod" ||
name == "ccfdeclarationcodeblock"
) {
QString acctag = element.attribute("tag","");
QString acctag = element.attribute("tag");
// search for our method in the
TextBlock * tb = findCodeClassFieldTextBlockByTag(acctag);
if(!tb || !addTextBlock(tb))
......@@ -204,7 +204,7 @@ void JavaANTCodeDocument::setAttributesFromNode (QDomElement & root)
CodeDocument::setAttributesFromNode(root);
// now set local attributes
// setPackage(root.attribute("package",""));
// setPackage(root.attribute("package"));
}
/**
......
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