[Uml-devel] KDE/kdesdk/umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Mon Jan 26 16:42:20 UTC 2009
SVN commit 916990 by fischer:
Fixing two compiler warnings and moving the comments from h to cpp.
M +17 -0 codegenerators/textblock.cpp
M +2 -24 codegenerators/textblock.h
M +92 -2 codeimport/import_utils.cpp
M +2 -91 codeimport/import_utils.h
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/textblock.cpp #916989:916990
@@ -36,6 +36,9 @@
setText(text);
}
+/**
+ * Destructor.
+ */
TextBlock::~TextBlock ()
{
}
@@ -317,6 +320,8 @@
*/
void TextBlock::setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement)
{
+ Q_UNUSED(doc);
+
QString endLine = UMLApp::app()->getCommonPolicy()->getNewLineEndingChars();
blockElement.setAttribute("tag",getTag());
@@ -416,3 +421,15 @@
<< ", text=" << obj.getText();
return os;
}
+
+/**
+ * Save the XMI representation of this object
+ * @param doc the xmi document
+ * @param root the starting point to append
+ */
+
+/**
+ * Load params from the appropriate XMI element node.
+ * @param root the starting point in the xmi document to load from
+ */
+
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/textblock.h #916989:916990
@@ -28,30 +28,21 @@
public:
explicit TextBlock ( CodeDocument * parent, const QString & text = "");
-
- /**
- * Destructor.
- */
virtual ~TextBlock ( );
void setText ( const QString & text );
-
+ QString getText() const;
void appendText ( const QString & text );
- QString getText() const;
-
+ void setTag( const QString & value );
QString getTag() const;
- void setTag( const QString & value );
-
CodeDocument * getParentDocument() const;
void setWriteOutText( bool write );
-
bool getWriteOutText() const;
void setIndentationLevel( int level );
-
int getIndentationLevel() const;
QString getIndentationString ( int level = 0) const;
@@ -69,20 +60,9 @@
virtual QString toString() const;
static QString encodeText(const QString & text , const QString & endChars);
-
static QString decodeText(const QString & text, const QString & endChars);
- /**
- * Save the XMI representation of this object
- * @param doc the xmi document
- * @param root the starting point to append
- */
virtual void saveToXMI ( QDomDocument & doc, QDomElement & root ) = 0;
-
- /**
- * Load params from the appropriate XMI element node.
- * @param root the starting point in the xmi document to load from
- */
virtual void loadFromXMI ( QDomElement & root ) = 0;
bool canDelete() const;
@@ -92,7 +72,6 @@
virtual QString getNewEditorLine( int indentAmount = 0 );
virtual int firstEditableLine();
-
virtual int lastEditableLine();
protected:
@@ -102,7 +81,6 @@
virtual void release ();
virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
-
virtual void setAttributesFromNode ( QDomElement & element);
friend QTextStream& operator<<(QTextStream& os, const TextBlock& obj);
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/import_utils.cpp #916989:916990
@@ -67,26 +67,51 @@
*/
QStringList incPathList;
+/**
+ * Control whether an object which is newly created by createUMLObject()
+ * is put at the global scope.
+ *
+ * @param yesno When set to false, the object is created at the scope
+ * given by the parentPkg argument of createUMLObject().
+ */
void putAtGlobalScope(bool yesno)
{
bPutAtGlobalScope = yesno;
}
+/**
+ * Set a related classifier for creation of dependencies on template
+ * parameters in createUMLObject().
+ */
void setRelatedClassifier(UMLClassifier *c)
{
gRelatedClassifier = c;
}
+/**
+ * Control whether the creation methods solicit a new unique ID for the
+ * created object.
+ * By default, unique ID generation is turned on.
+ *
+ * @param yesno False turns UID generation off, true turns it on.
+ */
void assignUniqueIdOnCreation(bool yesno)
{
Object_Factory::assignUniqueIdOnCreation(yesno);
}
+/**
+ * Returns whether the last createUMLObject() actually created
+ * a new object or just returned an existing one.
+ */
bool newUMLObjectWasCreated()
{
return bNewUMLObjectWasCreated;
}
+/**
+ * Strip comment lines of leading whitespace and stars.
+ */
QString formatComment(const QString &comment)
{
if (comment.isEmpty())
@@ -130,6 +155,9 @@
}
*/
+/**
+ * Find or create a document object.
+ */
UMLObject *createUMLObject(Uml::Object_Type type,
const QString& inName,
UMLPackage *parentPkg,
@@ -280,12 +308,25 @@
return o;
}
+/**
+ * Create a UMLOperation.
+ * The reason for this method is to not generate any Qt signals.
+ * Instead, these are generated by insertMethod().
+ * (If we generated a creation signal prematurely, i.e. without
+ * the method parameters being known yet, then that would lead to
+ * a conflict with a pre-existing parameterless method of the same
+ * name.)
+ */
UMLOperation* makeOperation(UMLClassifier *parent, const QString &name)
{
UMLOperation *op = Object_Factory::createOperation(parent, name);
return op;
}
+/**
+ * Create a UMLAttribute and insert it into the document.
+ * Use the specified existing attrType.
+ */
UMLObject* insertAttribute(UMLClassifier *owner,
Uml::Visibility scope,
const QString& name,
@@ -295,9 +336,9 @@
{
Uml::Object_Type ot = owner->getBaseType();
Uml::Programming_Language pl = UMLApp::app()->getActiveLanguage();
- if (! (ot == Uml::ot_Class || ot == Uml::ot_Interface && pl == Uml::pl_Java)) {
+ if (! (ot == Uml::ot_Class || (ot == Uml::ot_Interface && pl == Uml::pl_Java))) {
uDebug() << "insertAttribute: Don not know what to do with "
- << owner->getName() << " (object type " << ot << ")";
+ << owner->getName() << " (object type " << ot << ")";
return NULL;
}
UMLObject *o = owner->findChildObject(name, Uml::ot_Attribute);
@@ -316,6 +357,9 @@
return attr;
}
+/**
+ * Create a UMLAttribute and insert it into the document.
+ */
UMLObject* insertAttribute(UMLClassifier *owner, Uml::Visibility scope,
const QString& name,
const QString& type,
@@ -335,6 +379,24 @@
comment, isStatic);
}
+/**
+ * Insert the UMLOperation into the given classifier.
+ *
+ * @param klass The classifier into which the operation shall be added.
+ * @param op Reference to pointer to the temporary UMLOperation
+ * for insertion. The caller relinquishes ownership of the
+ * object pointed to. If an UMLOperation of same signature
+ * already exists at the classifier then the incoming
+ * UMLOperation is deleted and the pointer is set to the
+ * existing UMLOperation.
+ * @param scope The Uml::Visibility of the method
+ * @param type The return type
+ * @param isStatic boolean switch to decide if method is static
+ * @param isAbstract boolean switch to decide if method is abstract
+ * @param isFriend true boolean switch to decide if methods is a friend function
+ * @param isConstructor boolean switch to decide if methods is a constructor
+ * @param comment The Documentation for this method
+ */
void insertMethod(UMLClassifier *klass, UMLOperation* &op,
Uml::Visibility scope, const QString& type,
bool isStatic, bool isAbstract,
@@ -402,6 +464,11 @@
}
}
+/**
+ * Add an argument to a UMLOperation.
+ * The parentPkg arg is only used for resolving possible scope
+ * prefixes in the `type'.
+ */
UMLAttribute* addMethodParameter(UMLOperation *method,
const QString& type,
const QString& name)
@@ -420,12 +487,19 @@
return attr;
}
+/**
+ * Add an enum literal to an UMLEnum.
+ */
void addEnumLiteral(UMLEnum *enumType, const QString &literal, const QString &comment)
{
UMLObject *el = enumType->addEnumLiteral(literal);
el->setDoc(comment);
}
+/**
+ * Create a generalization from the given child classifier to the given
+ * parent classifier.
+ */
void createGeneralization(UMLClassifier *child, UMLClassifier *parent)
{
// if the child is an interface, so is the parent.
@@ -445,6 +519,10 @@
umldoc->addAssociation(assoc);
}
+/**
+ * Create a generalization from the existing child UMLObject to the given
+ * parent class name.
+ */
void createGeneralization(UMLClassifier *child, const QString &parentName)
{
UMLObject *parentObj = createUMLObject( Uml::ot_Class, parentName );
@@ -452,6 +530,12 @@
createGeneralization(child, parent);
}
+/**
+ * Return the list of paths set by previous calls to addIncludePath()
+ * and the environment variable UMBRELLO_INCPATH.
+ * This list can be used for finding #included (or Ada with'ed or...)
+ * files.
+ */
QStringList includePathList()
{
QStringList includePathList(incPathList);
@@ -462,12 +546,18 @@
return includePathList;
}
+/**
+ * Add a path to the include path list.
+ */
void addIncludePath(const QString& path)
{
if (! incPathList.contains(path))
incPathList.append(path);
}
+/**
+ * Returns true if a type is an actual Datatype
+ */
bool isDatatype(const QString& name, UMLPackage *parentPkg)
{
UMLDoc *umldoc = UMLApp::app()->getDocument();
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/import_utils.h #916989:916990
@@ -30,144 +30,55 @@
namespace Import_Utils {
- /**
- * Find or create a document object.
- */
UMLObject* createUMLObject(Uml::Object_Type type,
const QString& name,
UMLPackage *parentPkg = NULL,
const QString& comment = QString(),
const QString& stereotype = QString());
- /**
- * Control whether an object which is newly created by createUMLObject()
- * is put at the global scope.
- *
- * @param yesno When set to false, the object is created at the scope
- * given by the parentPkg argument of createUMLObject().
- */
+
void putAtGlobalScope(bool yesno);
- /**
- * Set a related classifier for creation of dependencies on template
- * parameters in createUMLObject().
- */
void setRelatedClassifier(UMLClassifier *c);
- /**
- * Control whether the creation methods solicit a new unique ID for the
- * created object.
- * By default, unique ID generation is turned on.
- *
- * @param yesno False turns UID generation off, true turns it on.
- */
void assignUniqueIdOnCreation(bool yesno);
- /**
- * Create a UMLAttribute and insert it into the document.
- */
UMLObject* insertAttribute(UMLClassifier *klass, Uml::Visibility scope,
const QString& name,
const QString& type,
const QString& comment = QString(),
bool isStatic = false);
- /**
- * Create a UMLAttribute and insert it into the document.
- * Use the specified existing attrType.
- */
UMLObject* insertAttribute(UMLClassifier *klass, Uml::Visibility scope,
const QString& name,
UMLClassifier *attrType,
const QString& comment /* ="" */,
bool isStatic /* =false */);
- /**
- * Create a UMLOperation.
- * The reason for this method is to not generate any Qt signals.
- * Instead, these are generated by insertMethod().
- * (If we generated a creation signal prematurely, i.e. without
- * the method parameters being known yet, then that would lead to
- * a conflict with a pre-existing parameterless method of the same
- * name.)
- */
+
UMLOperation* makeOperation(UMLClassifier *parent, const QString &name);
- /**
- * Insert the UMLOperation into the given classifier.
- *
- * @param klass The classifier into which the operation shall be added.
- * @param op Reference to pointer to the temporary UMLOperation
- * for insertion. The caller relinquishes ownership of the
- * object pointed to. If an UMLOperation of same signature
- * already exists at the classifier then the incoming
- * UMLOperation is deleted and the pointer is set to the
- * existing UMLOperation.
- * @param scope The Uml::Visibility of the method
- * @param type The return type
- * @param isStatic boolean switch to decide if method is static
- * @param isAbstract boolean switch to decide if method is abstract
- * @param isFriend true boolean switch to decide if methods is a friend function
- * @param isConstructor boolean switch to decide if methods is a constructor
- * @param comment The Documentation for this method
- */
void insertMethod(UMLClassifier *klass, UMLOperation* &op,
Uml::Visibility scope, const QString& type,
bool isStatic, bool isAbstract,
bool isFriend = false, bool isConstructor = false,
const QString& comment = QString());
- /**
- * Add an argument to a UMLOperation.
- * The parentPkg arg is only used for resolving possible scope
- * prefixes in the `type'.
- */
UMLAttribute* addMethodParameter(UMLOperation *method,
const QString& type,
const QString& name);
- /**
- * Add an enum literal to an UMLEnum.
- */
void addEnumLiteral(UMLEnum *enumType, const QString &literal,
const QString &comment = QString());
- /**
- * Create a generalization from the given child classifier to the given
- * parent classifier.
- */
void createGeneralization(UMLClassifier *child, UMLClassifier *parent);
-
- /**
- * Create a generalization from the existing child UMLObject to the given
- * parent class name.
- */
void createGeneralization(UMLClassifier *child, const QString &parentName);
- /**
- * Strip comment lines of leading whitespace and stars.
- */
QString formatComment(const QString &comment);
- /**
- * Return the list of paths set by previous calls to addIncludePath()
- * and the environment variable UMBRELLO_INCPATH.
- * This list can be used for finding #included (or Ada with'ed or...)
- * files.
- */
QStringList includePathList();
- /**
- * Add a path to the include path list.
- */
void addIncludePath(const QString& path);
- /**
- * Returns whether the last createUMLObject() actually created
- * a new object or just returned an existing one.
- */
bool newUMLObjectWasCreated();
- /**
- * Returns true if a type is an actual Datatype
- */
bool isDatatype(const QString& name, UMLPackage *parentPkg = NULL);
} // end namespace Import_Utils
More information about the umbrello-devel
mailing list