PageRenderTime 26ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/kdesdk-4.8.97/umbrello/umbrello/basictypes.h

#
C Header | 337 lines | 241 code | 21 blank | 75 comment | 0 complexity | 0d622705f234b039f4678955725383c9 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-2.0, GPL-2.0, CC-BY-SA-3.0
  1. /***************************************************************************
  2. * Copyright (C) 2011 by Andi Fischer <andi.fischer@hispeed.ch> *
  3. * *
  4. * This is free software; you can redistribute it and/or modify *
  5. * it under the terms of the GNU General Public License as published by *
  6. * the Free Software Foundation; either version 2, or (at your option) *
  7. * any later version. *
  8. * *
  9. * This software is distributed in the hope that it will be useful, *
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  12. * GNU General Public License for more details. *
  13. * *
  14. * You should have received a copy of the GNU General Public License *
  15. * along with this package; see the file COPYING. If not, write to *
  16. * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, *
  17. * Boston, MA 02110-1301, USA. *
  18. ***************************************************************************/
  19. #ifndef BASICTYPES_H
  20. #define BASICTYPES_H
  21. #include <QtCore/QString>
  22. #include <string>
  23. /**
  24. * @author Andi Fischer
  25. * ...
  26. */
  27. namespace Uml
  28. {
  29. /**
  30. *
  31. */
  32. class ModelType
  33. {
  34. public:
  35. enum Value {
  36. Logical,
  37. UseCase,
  38. Component,
  39. Deployment,
  40. EntityRelationship,
  41. N_MODELTYPES // must remain last
  42. };
  43. ModelType();
  44. ModelType(Value item);
  45. static QString toString(Value item);
  46. static ModelType fromString(const QString& item);
  47. QString toString() const;
  48. operator Value() const;
  49. private:
  50. Value m_value;
  51. };
  52. /**
  53. *
  54. */
  55. class Visibility
  56. {
  57. public:
  58. enum Value {
  59. Public,
  60. Private,
  61. Protected,
  62. Implementation, // objects marked with this are declared in the implementation file.
  63. FromParent = 3 // alias for Implementation, used by CodeGenerationPolicy
  64. };
  65. Visibility();
  66. Visibility(Value item);
  67. static QString toString(Value item, bool mnemonic = false);
  68. static Visibility fromString(const QString& item);
  69. QString toString(bool mnemonic = false) const;
  70. operator Value() const;
  71. private:
  72. Value m_value;
  73. };
  74. /**
  75. * Supported diagram types.
  76. */
  77. class DiagramType
  78. {
  79. public:
  80. enum Value {
  81. //the values in this enum are saved out to the file
  82. //for file compatibility, only add new values to the end
  83. Undefined = 0,
  84. Class,
  85. UseCase,
  86. Sequence,
  87. Collaboration,
  88. State,
  89. Activity,
  90. Component,
  91. Deployment,
  92. EntityRelationship,
  93. N_DIAGRAMTYPES // must remain last
  94. };
  95. DiagramType();
  96. DiagramType(Value item);
  97. static QString toString(Value item);
  98. static DiagramType fromString(const QString& item);
  99. QString toString() const;
  100. QString toStringI18n() const;
  101. operator Value() const;
  102. private:
  103. Value m_value;
  104. };
  105. /**
  106. * Association types.
  107. */
  108. class AssociationType
  109. {
  110. public:
  111. enum Value {
  112. Generalization = 500,
  113. Aggregation,
  114. Dependency,
  115. Association,
  116. Association_Self,
  117. Coll_Message,
  118. Seq_Message,
  119. Coll_Message_Self,
  120. Seq_Message_Self,
  121. Containment,
  122. Composition,
  123. Realization,
  124. UniAssociation,
  125. Anchor,
  126. State,
  127. Activity,
  128. Exception,
  129. Category2Parent,
  130. Child2Category,
  131. Relationship,
  132. Unknown = - 1
  133. };
  134. AssociationType();
  135. AssociationType(Value item);
  136. static QString toString(Value item);
  137. static AssociationType fromString(const QString& item);
  138. QString toString() const;
  139. QString toStringI18n() const;
  140. operator Value() const;
  141. static bool hasUMLRepresentation(Value item);
  142. private:
  143. Value m_value;
  144. };
  145. /**
  146. * Signature types.
  147. */
  148. class SignatureType
  149. {
  150. public:
  151. enum Value {
  152. NoSig = 600,
  153. ShowSig,
  154. SigNoVis,
  155. NoSigNoVis
  156. };
  157. SignatureType();
  158. SignatureType(Value item);
  159. static QString toString(Value item);
  160. static SignatureType fromString(const QString& item);
  161. QString toString() const;
  162. operator Value() const;
  163. private:
  164. Value m_value;
  165. };
  166. /**
  167. * TextRole types.
  168. */
  169. class TextRole
  170. {
  171. public:
  172. enum Value {
  173. Floating = 700, //text widget on diagrams
  174. MultiA, //Text for Multiple A
  175. MultiB, //Text for Multiple B
  176. Name, //middle text on most associations
  177. Seq_Message, //message on seq diagram between two objects
  178. Seq_Message_Self, //message to self on seq diagram - feature not implemented yet
  179. Coll_Message, //message between two objects on a collab diagram
  180. Coll_Message_Self, //message to object self on collab diagram
  181. State,
  182. RoleAName, //RoleA text on associations
  183. RoleBName, //RoleB text on associations
  184. ChangeA, //Changeability A text on associations
  185. ChangeB //Changeability B text on associations
  186. };
  187. TextRole();
  188. TextRole(Value item);
  189. static QString toString(Value item);
  190. static TextRole fromString(const QString& item);
  191. QString toString() const;
  192. operator Value() const;
  193. private:
  194. Value m_value;
  195. };
  196. /**
  197. * Changeability types.
  198. */
  199. class Changeability
  200. {
  201. public:
  202. enum Value {
  203. Changeable = 900,
  204. Frozen,
  205. AddOnly
  206. };
  207. Changeability();
  208. Changeability(Value item);
  209. static QString toString(Value item);
  210. static Changeability fromString(const QString& item);
  211. QString toString() const;
  212. operator Value() const;
  213. private:
  214. Value m_value;
  215. };
  216. /**
  217. *
  218. */
  219. enum Sequence_Message_Type
  220. {
  221. //This is saved out to the file so only add new entries at the end
  222. sequence_message_synchronous = 1000,
  223. sequence_message_asynchronous,
  224. sequence_message_creation,
  225. sequence_message_lost,
  226. sequence_message_found
  227. };
  228. /**
  229. * Constants used for indexing the roles of associations.
  230. */
  231. enum Role_Type { A, B };
  232. /**
  233. * Direction of operation parameters:
  234. * in = operation uses the parameter as an input value
  235. * out = operation fills the parameter as a return value
  236. * inout = operation both reads and writes the parameter
  237. * The numeric values of this enum are not currently saved to file.
  238. */
  239. enum Parameter_Direction { pd_In, pd_InOut, pd_Out };
  240. /**
  241. * Supported programming languages.
  242. */
  243. class ProgrammingLanguage
  244. {
  245. public:
  246. enum Value {
  247. ActionScript,
  248. Ada,
  249. Cpp,
  250. CSharp,
  251. D,
  252. IDL,
  253. Java,
  254. JavaScript,
  255. MySQL,
  256. Pascal,
  257. Perl,
  258. PHP,
  259. PHP5,
  260. PostgreSQL,
  261. Python,
  262. Ruby,
  263. SQL,
  264. Tcl,
  265. Vala,
  266. XMLSchema,
  267. Reserved
  268. };
  269. ProgrammingLanguage();
  270. ProgrammingLanguage(Value item);
  271. static QString toString(Value item);
  272. static ProgrammingLanguage fromString(const QString& item);
  273. QString toString() const;
  274. operator Value() const;
  275. private:
  276. Value m_value;
  277. };
  278. /**
  279. * Enumeration used for stating where a line is on a widget.
  280. * @note Do not change this ordering, as we use these values in for loop.
  281. */
  282. enum Region {
  283. reg_Error = 0,
  284. reg_West,
  285. reg_North,
  286. reg_East,
  287. reg_South,
  288. reg_NorthWest,
  289. reg_NorthEast,
  290. reg_SouthEast,
  291. reg_SouthWest
  292. };
  293. /**
  294. *
  295. */
  296. enum Corner {
  297. corner_TopLeft = 0x1,
  298. corner_TopRight = 0x2,
  299. corner_BottomRight = 0x4,
  300. corner_BottomLeft = 0x8
  301. };
  302. Q_DECLARE_FLAGS(Corners, Corner)
  303. /**
  304. * The data type used for unique IDs.
  305. */
  306. // class IDType
  307. // {
  308. typedef std::string IDType;
  309. const IDType id_None = "-1"; ///< special value for uninitialized ID
  310. const IDType id_Reserved = "0"; ///< special value for illegal ID
  311. # define STR2ID(id) qPrintable(id)
  312. # define ID2STR(id) QString(id.c_str())
  313. QDebug operator<<(QDebug out, IDType &type);
  314. // }
  315. } // end namespace Uml
  316. #endif