[dia/dia-next: 42/59] Give Operation & Parameter seperate headers, rename for consistancy
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 42/59] Give Operation & Parameter seperate headers, rename for consistancy
- Date: Wed, 9 Jan 2019 18:37:50 +0000 (UTC)
commit 8b15b132421620cc7836d8d3290bdc92b9d2cbe3
Author: Zander Brown <zbrown gnome org>
Date: Wed Jan 2 00:20:23 2019 +0000
Give Operation & Parameter seperate headers, rename for consistancy
objects/UML/Makefile.am | 4 +-
.../UML/{umloperation.c => dia-uml-operation.c} | 7 ++
objects/UML/dia-uml-operation.h | 69 ++++++++++++++++
.../UML/{umlparameter.c => dia-uml-parameter.c} | 7 +-
objects/UML/dia-uml-parameter.h | 34 ++++++++
.../UML/editor/dia-uml-operation-parameter-row.c | 3 +-
objects/UML/editor/dia-uml-operation-row.c | 3 +-
objects/UML/uml.h | 94 +---------------------
8 files changed, 117 insertions(+), 104 deletions(-)
---
diff --git a/objects/UML/Makefile.am b/objects/UML/Makefile.am
index f8c208b6..1c96fe20 100644
--- a/objects/UML/Makefile.am
+++ b/objects/UML/Makefile.am
@@ -5,6 +5,8 @@ libuml_objects_la_SOURCES = \
uml.h \
uml.c \
dia-uml-class.c \
+ dia-uml-operation.c \
+ dia-uml-parameter.c \
class.c \
class.h \
class_dialog.h \
@@ -43,8 +45,6 @@ libuml_objects_la_SOURCES = \
stereotype.h \
transition.c \
umlattribute.c \
- umloperation.c \
- umlparameter.c \
umlformalparameter.c
libuml_objects_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
diff --git a/objects/UML/umloperation.c b/objects/UML/dia-uml-operation.c
similarity index 99%
rename from objects/UML/umloperation.c
rename to objects/UML/dia-uml-operation.c
index 7dac7f05..579868c5 100644
--- a/objects/UML/umloperation.c
+++ b/objects/UML/dia-uml-operation.c
@@ -53,6 +53,7 @@ for c in theClasses :
#include "uml.h"
#include "properties.h"
+#include "dia-uml-operation.h"
G_DEFINE_TYPE (DiaUmlOperation, dia_uml_operation, G_TYPE_OBJECT)
@@ -645,3 +646,9 @@ dia_uml_operation_remove_parameter (DiaUmlOperation *self,
g_object_unref (parameter);
g_signal_emit (G_OBJECT (self), uml_op_signals[OP_CHANGED], 0);
}
+
+GList *
+dia_uml_operation_get_parameters (DiaUmlOperation *self)
+{
+ return self->parameters;
+}
diff --git a/objects/UML/dia-uml-operation.h b/objects/UML/dia-uml-operation.h
new file mode 100644
index 00000000..5fe448fd
--- /dev/null
+++ b/objects/UML/dia-uml-operation.h
@@ -0,0 +1,69 @@
+#include <glib-object.h>
+#include "uml.h"
+#include "dia-uml-parameter.h"
+
+#ifndef UML_OP_H
+#define UML_OP_H
+
+/* TODO: enums as GEnum for _spec_enum ext */
+
+/** the visibility (allowed acces) of (to) various UML sub elements */
+typedef enum _UMLVisibility {
+ UML_PUBLIC, /**< everyone can use it */
+ UML_PRIVATE, /**< only accessible inside the class itself */
+ UML_PROTECTED, /**< the class and its inheritants ca use this */
+ UML_IMPLEMENTATION /**< ?What's this? Means implementation decision */
+} UMLVisibility;
+
+/** In some languages there are different kinds of class inheritances */
+typedef enum _UMLInheritanceType {
+ UML_ABSTRACT, /**< Pure virtual method: an object of this class cannot be instanciated */
+ UML_POLYMORPHIC, /**< Virtual method : could be reimplemented in derivated classes */
+ UML_LEAF /**< Final method: can't be redefined in subclasses */
+} UMLInheritanceType;
+
+#define DIA_UML_TYPE_OPERATION (dia_uml_operation_get_type ())
+G_DECLARE_FINAL_TYPE (DiaUmlOperation, dia_uml_operation, DIA_UML, OPERATION, GObject)
+
+/** \brief A list of DiaUmlOperation is contained in UMLClass
+ * Some would call them member functions ;)
+ */
+struct _DiaUmlOperation {
+ GObject parent;
+
+ gint internal_id; /**< Arbitrary integer to recognize operations after
+ * the user has shuffled them in the dialog. */
+ gchar *name; /**< the function name */
+ gchar *type; /**< Return type, NULL => No return type */
+ gchar *comment; /**< comment */
+ gchar *stereotype; /**< just some string */
+ UMLVisibility visibility; /**< allowed access */
+ UMLInheritanceType inheritance_type;
+ int query; /**< Do not modify the object, in C++ this is a const function */
+ int class_scope;
+ GList *parameters; /**< List of DiaUmlParameter */
+
+ ConnectionPoint* l_connection; /**< left */
+ ConnectionPoint* r_connection; /**< right */
+
+ gboolean needs_wrapping; /** Whether this operation needs wrapping */
+ gint wrap_indent; /** The amount of indentation in chars */
+ GList *wrappos; /** Absolute wrapping positions */
+ double ascent; /** The ascent amount used for line distance in wrapping */
+};
+
+DiaUmlOperation *dia_uml_operation_new ();
+/** calculated the 'formated' representation */
+gchar *dia_uml_operation_format (DiaUmlOperation *operation);
+/* TODO: Why */
+DiaUmlOperation *dia_uml_operation_copy (DiaUmlOperation *op);
+void dia_uml_operation_ensure_connection_points (DiaUmlOperation *oper,
+ DiaObject *obj);
+void dia_uml_operation_insert_parameter (DiaUmlOperation *self,
+ DiaUmlParameter *parameter,
+ int index);
+void dia_uml_operation_remove_parameter (DiaUmlOperation *self,
+ DiaUmlParameter *parameter);
+GList *dia_uml_operation_get_parameters (DiaUmlOperation *self);
+
+#endif
\ No newline at end of file
diff --git a/objects/UML/umlparameter.c b/objects/UML/dia-uml-parameter.c
similarity index 98%
rename from objects/UML/umlparameter.c
rename to objects/UML/dia-uml-parameter.c
index abc24f18..04113c5e 100644
--- a/objects/UML/umlparameter.c
+++ b/objects/UML/dia-uml-parameter.c
@@ -27,7 +27,7 @@
#include <string.h>
-#include "uml.h"
+#include "dia-uml-parameter.h"
#include "properties.h"
G_DEFINE_TYPE (DiaUmlParameter, dia_uml_parameter, G_TYPE_OBJECT)
@@ -295,8 +295,3 @@ dia_uml_parameter_new ()
return g_object_new (DIA_UML_TYPE_PARAMETER, NULL);
}
-GList *
-dia_uml_operation_get_parameters (DiaUmlOperation *self)
-{
- return self->parameters;
-}
diff --git a/objects/UML/dia-uml-parameter.h b/objects/UML/dia-uml-parameter.h
new file mode 100644
index 00000000..eaca94c8
--- /dev/null
+++ b/objects/UML/dia-uml-parameter.h
@@ -0,0 +1,34 @@
+#include <glib-object.h>
+
+#ifndef UML_PARAM_H
+#define UML_PARAM_H
+
+/** describes the data flow between caller and callee */
+typedef enum _UMLParameterKind {
+ UML_UNDEF_KIND, /**< not defined */
+ UML_IN, /**< by value */
+ UML_OUT, /**< by ref, can be passed in uninitialized */
+ UML_INOUT /**< by ref */
+} UMLParameterKind;
+
+#define DIA_UML_TYPE_PARAMETER (dia_uml_parameter_get_type ())
+G_DECLARE_FINAL_TYPE (DiaUmlParameter, dia_uml_parameter, DIA_UML, PARAMETER, GObject)
+
+/** \brief A list of DiaUmlParameter is contained in DiaUmlOperation
+ * Some would call them functions parameters ;)
+ */
+struct _DiaUmlParameter {
+ GObject parent;
+
+ gchar *name; /**< name*/
+ gchar *type; /**< return value */
+ gchar *value; /**< Initialization, can be NULL => No default value */
+ gchar *comment; /**< comment */
+ UMLParameterKind kind; /**< Not currently used */
+};
+
+DiaUmlParameter *dia_uml_parameter_new ();
+/** calculated the 'formated' representation */
+gchar *dia_uml_parameter_format (DiaUmlParameter *param);
+
+#endif
\ No newline at end of file
diff --git a/objects/UML/editor/dia-uml-operation-parameter-row.c
b/objects/UML/editor/dia-uml-operation-parameter-row.c
index 230eb168..15ed7881 100644
--- a/objects/UML/editor/dia-uml-operation-parameter-row.c
+++ b/objects/UML/editor/dia-uml-operation-parameter-row.c
@@ -1,3 +1,4 @@
+#include "dia-uml-parameter.h"
#include "dia-uml-operation-parameter-row.h"
#include "dia_dirs.h"
@@ -23,7 +24,7 @@ direction_to (GBinding *binding,
GValue *to_value,
gpointer user_data)
{
- gchar *name = g_value_get_string (from_value);
+ const gchar *name = g_value_get_string (from_value);
if (g_strcmp0 (name, "in") == 0) {
g_value_set_int (to_value, UML_IN);
diff --git a/objects/UML/editor/dia-uml-operation-row.c b/objects/UML/editor/dia-uml-operation-row.c
index 6ff0a9c2..b1384405 100644
--- a/objects/UML/editor/dia-uml-operation-row.c
+++ b/objects/UML/editor/dia-uml-operation-row.c
@@ -1,3 +1,4 @@
+#include "dia-uml-operation.h"
#include "dia-uml-operation-row.h"
#include "dia_dirs.h"
@@ -14,8 +15,6 @@ dia_uml_operation_row_finalize (GObject *object)
{
DiaUmlOperationRow *self = DIA_UML_OPERATION_ROW (object);
- G_DEBUG_HERE();
-
g_object_unref (self->operation);
}
diff --git a/objects/UML/uml.h b/objects/UML/uml.h
index 4677ccca..e6417df4 100644
--- a/objects/UML/uml.h
+++ b/objects/UML/uml.h
@@ -26,37 +26,11 @@
#include "intl.h"
#include "connectionpoint.h"
#include "dia_xml.h"
+#include "dia-uml-operation.h"
typedef struct _UMLAttribute UMLAttribute;
typedef struct _UMLFormalParameter UMLFormalParameter;
-/* TODO: enums as GEnum for _spec_enum ext */
-
-/** the visibility (allowed acces) of (to) various UML sub elements */
-typedef enum _UMLVisibility {
- UML_PUBLIC, /**< everyone can use it */
- UML_PRIVATE, /**< only accessible inside the class itself */
- UML_PROTECTED, /**< the class and its inheritants ca use this */
- UML_IMPLEMENTATION /**< ?What's this? Means implementation decision */
-} UMLVisibility;
-
-/** In some languages there are different kinds of class inheritances */
-typedef enum _UMLInheritanceType {
- UML_ABSTRACT, /**< Pure virtual method: an object of this class cannot be instanciated */
- UML_POLYMORPHIC, /**< Virtual method : could be reimplemented in derivated classes */
- UML_LEAF /**< Final method: can't be redefined in subclasses */
-} UMLInheritanceType;
-
-/** describes the data flow between caller and callee */
-typedef enum _UMLParameterKind {
- UML_UNDEF_KIND, /**< not defined */
- UML_IN, /**< by value */
- UML_OUT, /**< by ref, can be passed in uninitialized */
- UML_INOUT /**< by ref */
-} UMLParameterKind;
-
-typedef gchar * UMLStereotype;
-
/** \brief A list of UMLAttribute is contained in UMLClass
* Some would call them member variables ;)
*/
@@ -75,53 +49,6 @@ struct _UMLAttribute {
ConnectionPoint* right_connection; /**< right */
};
-#define DIA_UML_TYPE_OPERATION (dia_uml_operation_get_type ())
-G_DECLARE_FINAL_TYPE (DiaUmlOperation, dia_uml_operation, DIA_UML, OPERATION, GObject)
-
-/** \brief A list of DiaUmlOperation is contained in UMLClass
- * Some would call them member functions ;)
- */
-struct _DiaUmlOperation {
- GObject parent;
-
- gint internal_id; /**< Arbitrary integer to recognize operations after
- * the user has shuffled them in the dialog. */
- gchar *name; /**< the function name */
- gchar *type; /**< Return type, NULL => No return type */
- gchar *comment; /**< comment */
- UMLStereotype stereotype; /**< just some string */
- UMLVisibility visibility; /**< allowed access */
- UMLInheritanceType inheritance_type;
- int query; /**< Do not modify the object, in C++ this is a const function */
- int class_scope;
- GList *parameters; /**< List of DiaUmlParameter */
-
- ConnectionPoint* l_connection; /**< left */
- ConnectionPoint* r_connection; /**< right */
-
- gboolean needs_wrapping; /** Whether this operation needs wrapping */
- gint wrap_indent; /** The amount of indentation in chars */
- GList *wrappos; /** Absolute wrapping positions */
- double ascent; /** The ascent amount used for line distance in wrapping */
-};
-
-
-#define DIA_UML_TYPE_PARAMETER (dia_uml_parameter_get_type ())
-G_DECLARE_FINAL_TYPE (DiaUmlParameter, dia_uml_parameter, DIA_UML, PARAMETER, GObject)
-
-/** \brief A list of DiaUmlParameter is contained in DiaUmlOperation
- * Some would call them functions parameters ;)
- */
-struct _DiaUmlParameter {
- GObject parent;
-
- gchar *name; /**< name*/
- gchar *type; /**< return value */
- gchar *value; /**< Initialization, can be NULL => No default value */
- gchar *comment; /**< comment */
- UMLParameterKind kind; /**< Not currently used */
-};
-
/** \brief A list of UMLFormalParameter is contained in DiaUmlOperation
* Some would call them template parameters ;)
*/
@@ -147,25 +74,6 @@ void uml_attribute_destroy(UMLAttribute *attribute);
void uml_formalparameter_destroy(UMLFormalParameter *param);
UMLAttribute *uml_attribute_new(void);
-DiaUmlOperation *dia_uml_operation_new ();
-/** calculated the 'formated' representation */
-gchar *dia_uml_operation_format (DiaUmlOperation *operation);
-/* TODO: Why */
-DiaUmlOperation *dia_uml_operation_copy (DiaUmlOperation *op);
-void dia_uml_operation_ensure_connection_points (DiaUmlOperation *oper,
- DiaObject *obj);
-void dia_uml_operation_insert_parameter (DiaUmlOperation *self,
- DiaUmlParameter *parameter,
- int index);
-void dia_uml_operation_remove_parameter (DiaUmlOperation *self,
- DiaUmlParameter *parameter);
-GList *dia_uml_operation_get_parameters (DiaUmlOperation *self);
-
-
-DiaUmlParameter *dia_uml_parameter_new ();
-/** calculated the 'formated' representation */
-gchar *dia_uml_parameter_format (DiaUmlParameter *param);
-
UMLFormalParameter *uml_formalparameter_new(void);
void uml_attribute_ensure_connection_points (UMLAttribute *attr, DiaObject* obj);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]