summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/umlnamespace.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /umbrello/umbrello/umlnamespace.cpp
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'umbrello/umbrello/umlnamespace.cpp')
-rw-r--r--umbrello/umbrello/umlnamespace.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/umbrello/umbrello/umlnamespace.cpp b/umbrello/umbrello/umlnamespace.cpp
new file mode 100644
index 00000000..f2d81eeb
--- /dev/null
+++ b/umbrello/umbrello/umlnamespace.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * copyright (C) 2002-2006 *
+ * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
+ ***************************************************************************/
+
+#include "umlnamespace.h"
+#include "qregexp.h"
+
+namespace Uml {
+
+bool tagEq (const QString& inTag, const QString& inPattern) {
+ QString tag = inTag;
+ QString pattern = inPattern;
+ tag.remove( QRegExp("^\\w+:") ); // remove leading "UML:" or other
+ int patSections = pattern.contains( '.' ) + 1;
+ QString tagEnd = tag.section( '.', -patSections );
+ return (tagEnd.lower() == pattern.lower());
+}
+
+QString Visibility::toString(Value value, bool mnemonic) {
+ switch (value) {
+ case Protected:
+ return (mnemonic ? "#" : "protected");
+ break;
+ case Private:
+ return (mnemonic ? "-" : "private");
+ break;
+ case Implementation:
+ return (mnemonic ? "~" : "implementation");
+ break;
+ case Public:
+ default:
+ return (mnemonic ? "+" : "public");
+ break;
+ }
+}
+
+Visibility Visibility::fromString(const QString& vis) {
+ if (vis == "public" || vis == "+")
+ return Visibility(Public);
+ else if (vis == "protected" || vis == "#")
+ return Visibility(Protected);
+ else if (vis == "private" || vis == "-")
+ return Visibility(Private);
+ else if (vis == "~")
+ return Visibility(Implementation);
+ else if (vis == "signals")
+ return Visibility(Protected);
+ else if (vis == "class")
+ return Visibility(Private);
+ else
+ return Visibility(Public);
+}
+
+Visibility::Visibility(): _v(Public) {
+}
+
+Visibility::Visibility(Value v): _v(v) {
+}
+
+QString Visibility::toString(bool mnemonic) const {
+ return toString(_v, mnemonic);
+}
+
+Visibility::operator Visibility::Value() const {
+ return _v;
+}
+
+} // end namespace Uml
+