-
Notifications
You must be signed in to change notification settings - Fork 0
/
DSJoin.cpp
138 lines (113 loc) · 4 KB
/
DSJoin.cpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/****************************************************************************
* Modul: $RCSfile: DSJoin.cpp,v $
*
* $Author: hirche $
* $Date: 1997/08/29 13:33:16 $
* $Revision: 1.1 $
*
* Aufgabe: Dieser Modul ermoeglicht die Abspeicherung bzw. Ruecklieferung
* des Parameters (Sprungaddresse), der in Verbindung mit einem
* JOIN-Befehl angegeben ist
*
* Funktionen: GetConnectorRef(): Gibt einen Zeiger auf einen String zurueck
* SetConnectorRef(): Speichert die Sprungaddresse
****************************************************************************/
#ifdef USE_PRAGMA
#pragma interface
#endif
/****************************************************************************
* Konstanten
****************************************************************************/
/****************************************************************************
* Include-Anweisungen
****************************************************************************/
#include "DSJoin.h"
#include "DSString.h"
#ifdef DEBUG
#include <dmalloc.h>
#endif
/****************************************************************************
* Externe Variablen
****************************************************************************/
/****************************************************************************
* Globale Variablen
****************************************************************************/
/****************************************************************************
* Konstruktoren
****************************************************************************/
DSJoin::DSJoin(DSObject *father,
DSString* connector,
DSString *label_name) :
DSAction (father, DS_JOIN, label_name),
connector_ref(connector)
{
}
DSJoin::DSJoin(DSObject *father,
DSString& connector,
DSString& label_name) :
DSAction(father, DS_JOIN, &label_name),
connector_ref(&connector)
{
}
DSJoin::DSJoin(DSObject *father,
const char* connector,
const char *label_name) :
DSAction(father, DS_JOIN, label_name)
{
connector_ref = new DSString(connector);
assert(connector_ref);
}
/****************************************************************************
* Destruktor
****************************************************************************/
DSJoin::~DSJoin(void)
{
if (connector_ref) delete connector_ref; /* ruft Destruktor der */
} /* Stringklasse auf */
/****************************************************************************
* GetConnectorRef(): Liefert den Zeiger auf die Sprungaddresse zurueck
* Ergebnis: Zeiger auf einen String
* Seiteneffekte: keine
****************************************************************************/
DSString* DSJoin::GetConnectorRef(void) const
{
return connector_ref;
}
/****************************************************************************
* SetConnectorRef(): Speichert den uebergebenen Zeiger
* -> conn_ref: Zeiger auf einen String
* Ergebnis: DS_OK
* Seiteneffekte: keine
****************************************************************************/
DSResult DSJoin::SetConnectorRef(DSString* conn_ref)
{
connector_ref = conn_ref;
return DS_OK;
}
DSObject *DSJoin::Clone(DSObject *father, DSObject *fill_this) const
{
DSJoin *new_join;
if (fill_this == NULL)
{
new_join = (DSJoin *)New(father);
assert(new_join);
}
else
{
assert(fill_this->GetType() == DS_ACTION);
new_join = (DSJoin *)fill_this;
}
// Basisklassen clonen:
DSAction::Clone(father, new_join);
if (GetConnectorRef())
{
new_join->SetConnectorRef((DSString *)GetConnectorRef()->Clone((DSObject *)new_join));
}
return new_join;
}
DSResult DSJoin::Write(DSWriter *writer, DSCardinal what) const
{
assert(writer);
if (connector_ref) connector_ref->Write(writer, what);
return DS_OK;
}