blob: 45c40de65df2bb449c6b96fe333c2a87bbd906ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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 "tqregexp.h"
namespace Uml {
bool tagEq (const TQString& inTag, const TQString& inPattern) {
TQString tag = inTag;
TQString pattern = inPattern;
tag.remove( TQRegExp("^\\w+:") ); // remove leading "UML:" or other
int patSections = pattern.contains( '.' ) + 1;
TQString tagEnd = tag.section( '.', -patSections );
return (tagEnd.lower() == pattern.lower());
}
TQString 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 TQString& 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) {
}
TQString Visibility::toString(bool mnemonic) const {
return toString(_v, mnemonic);
}
Visibility::operator Visibility::Value() const {
return _v;
}
} // end namespace Uml
|