[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sun Feb 4 12:34:18 UTC 2007
SVN commit 630086 by okellogg:
uniqChildName(): Remove seekStereo arg, add prefix arg.
M +26 -19 umlcanvasobject.cpp
M +6 -5 umlcanvasobject.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #630085:630086
@@ -136,25 +136,32 @@
}
QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type,
- bool seekStereo /* = false */ ) {
- QString currentName;
- if (seekStereo) {
- currentName = i18n("new_stereotype");
- } else if (type == Uml::ot_Association) {
- currentName = i18n("new_association");
- } else if (type == Uml::ot_Attribute) {
- currentName = i18n("new_attribute");
- } else if (type == Uml::ot_Template) {
- currentName = i18n("new_template");
- } else if (type == Uml::ot_Operation) {
- currentName = i18n("new_operation");
- } else if (type == Uml::ot_EnumLiteral) {
- currentName = i18n("new_literal");
- } else if (type == Uml::ot_EntityAttribute) {
- currentName = i18n("new_field");
- } else {
- kWarning() << "uniqChildName() called for unknown child type " << type << endl;
- return "ERROR_in_UMLCanvasObject_uniqChildName";
+ const QString &prefix /* = QString() */ ) {
+ QString currentName = prefix;
+ if (currentName.isEmpty()) {
+ switch (type) {
+ case Uml::ot_Association:
+ currentName = i18n("new_association");
+ break;
+ case Uml::ot_Attribute:
+ currentName = i18n("new_attribute");
+ break;
+ case Uml::ot_Template:
+ currentName = i18n("new_template");
+ break;
+ case Uml::ot_Operation:
+ currentName = i18n("new_operation");
+ break;
+ case Uml::ot_EnumLiteral:
+ currentName = i18n("new_literal");
+ break;
+ case Uml::ot_EntityAttribute:
+ currentName = i18n("new_field");
+ break;
+ default:
+ kWarning() << "uniqChildName() called for unknown child type " << type << endl;
+ return "ERROR_in_UMLCanvasObject_uniqChildName";
+ }
}
QString name = currentName;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.h #630085:630086
@@ -172,7 +172,7 @@
/**
* Find an association.
*
- * @param id The id of the object to find.
+ * @param id The id of the object to find.
* @return Pointer to the object found (NULL if not found.)
*/
virtual UMLObject *findChildObjectById(Uml::IDType id, bool considerAncestors = false);
@@ -182,13 +182,14 @@
* or attribute appended with a number if the default name is
* taken e.g. new_association, new_association_1 etc.
*
- * @param type The object type for which to make a name.
- * @param seekStereo Set this true if we should look at the object's
- * stereotype instead of its name.
+ * @param type The object type for which to make a name.
+ * @param prefix Optional prefix to use for the name.
+ * If not given then uniqChildName() will choose the prefix
+ * internally based on the object type.
* @return Unique name string for the Object_Type given.
*/
virtual QString uniqChildName(const Uml::Object_Type type,
- bool seekStereo = false);
+ const QString &prefix = QString());
virtual void removeAllChildObjects();
More information about the umbrello-devel
mailing list