1 {
2 This file is part of the Free Pascal Class Library SDO Implementation
3 Copyright (c) 2012 by Inoussa OUEDRAOGO
4 Free Pascal development team
5
6 This unit implements the basic SDO objects
7
8 See the file COPYING.FPC, included in this distribution,
9 for details about the copyright.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 **********************************************************************}
16 {$INCLUDE sdo_global.inc}
17 unit sdo_dataobject;
18
19 interface
20 uses
21 SysUtils, Classes, Contnrs,
22 sdo_types, sdo, sdo_type, sdo_changesummary, sdo_xpath_helper, sdo_linked_list,
23 sdo_field_imp;
24
25 type
26
27 IDataObjectObserver = interface
28 ['{EF23F339-EF10-4312-B202-43AA5C743841}']
29 procedure NotifyDeletion(
30 const ADataObject : ISDODataObject;
31 const AProperty : ISDOProperty
32 );
33 end;
34
35 ISDODataObjectEx = interface(ISDODataObject)
36 ['{2EA33304-D190-425F-A952-685619896AB2}']
37 //Return TRUE if this instance is an instance or a derived class
IsInstanceOfnull38 function IsInstanceOf(const AType : ISDOType) : Boolean;
39
IsAncestorOfnull40 function IsAncestorOf(const AObject : ISDODataObject) : Boolean;
41 procedure setContainer(
42 const AContainer : ISDODataObject;
43 const AContainerProperty : ISDOProperty
44 );
45 procedure AddReference(
46 const AReferencer : ISDODataObject;
47 const AReferenceProperty : ISDOProperty
48 );
49 procedure RemoveReference(
50 const AReferencer : ISDODataObject;
51 const AReferenceProperty : ISDOProperty
52 );
53 procedure NotifyContainedObjectsForDeletion(const ACallFromParent : Boolean);// logical deletion
54
55 // for open Type support
56 procedure addProperty(
57 const APropName : string;
58 const APropType : ISDOType;
59 const AFlags : TPropertyFlags
60 );
61 end;
62
63 TObserverInfo = class
64 private
65 FDataObject : Pointer;
66 FRefProperty : Pointer;
67 public
68 constructor Create(const ADataObject : ISDODataObject; const ARefProperty : ISDOProperty);
GetDataObjectnull69 function GetDataObject() : ISDODataObject;{$IFDEF USE_INLINE}inline;{$ENDIF}
GetRefPropertynull70 function GetRefProperty() : ISDOProperty;{$IFDEF USE_INLINE}inline;{$ENDIF}
71 end;
72
73 TDataObjectObserverList = class
74 private
75 FList : TObjectList;
76 public
77 constructor Create();
78 destructor Destroy();override;
79 procedure Add(const ADataObject : ISDODataObject; const ARefProperty : ISDOProperty);{$IFDEF USE_INLINE}inline;{$ENDIF}
IndexOfnull80 function IndexOf(const ADataObject : ISDODataObject; const ARefProperty : ISDOProperty) : PtrInt;
Findnull81 function Find(const ADataObject : ISDODataObject; const ARefProperty : ISDOProperty) : TObserverInfo;{$IFDEF USE_INLINE}inline;{$ENDIF}
GetCountnull82 function GetCount() : PtrInt;{$IFDEF USE_INLINE}inline;{$ENDIF}
GetItemnull83 function GetItem(const AIndex : PtrInt) : TObserverInfo;{$IFDEF USE_INLINE}inline;{$ENDIF}
Extractnull84 function Extract(const AIndex : PtrInt) : TObserverInfo;{$IFDEF USE_INLINE}inline;{$ENDIF}
85 procedure Delete(const AIndex : PtrInt);{$IFDEF USE_INLINE}inline;{$ENDIF}
86 end;
87
88 TSDOBaseDataObjectClass = class of TSDOBaseDataObject;
89 TSDOBaseDataObject = class(
90 TInterfacedObject,
91 IInterface,
92 ISDODataObject,
93 ISDODataObjectEx,
94 IDataObjectObserver
95 )
96 private
97 FDestroying : Boolean;
98 FType : ISDOObjectType;
99 FContainer : Pointer;
100 FContainerProperty : Pointer;
101 FBuffer : TSDOFieldBuffer;
102 FBufferLength : PtrUInt;
103 FChangeSummary : Pointer;//ISDOChangeSummaryEx;
104 FReferenceLinkList : TDataObjectObserverList;
105 private
106 FXPathExpression : TXPathExpression;
107 FXPathProcessor : TXPathProcessor;
108 protected
_Releasenull109 function _Release: LongInt; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
110 procedure PrepareDataBuffer();
111 procedure FreeBuffer();
parsePropertyPathnull112 function parsePropertyPath(const APath : string) : TXPathExecContext;
IsOwnerOfnull113 function IsOwnerOf(const AProp : ISDOProperty) : Boolean;virtual;//{$IFDEF USE_INLINE}inline;{$ENDIF}
CreateListnull114 function CreateList(const AProperty : ISDOProperty) : ISDODataObjectList;{$IFDEF USE_INLINE}inline;{$ENDIF}
115 procedure InitializeDefaultValues();
116 protected
117 procedure RecordChange(const AProperty : ISDOProperty);{$IFDEF USE_INLINE}inline;{$ENDIF}
118 procedure NotifyReferencersForDeletion();
119 protected
120 // ISDODataObjectEx
IsInstanceOfnull121 function IsInstanceOf(const AType : ISDOType) : Boolean;
IsAncestorOfnull122 function IsAncestorOf(const AObject : ISDODataObject) : Boolean;
123 procedure setContainer(
124 const AContainer : ISDODataObject;
125 const AContainerProperty : ISDOProperty
126 );
127
128 //ISDODataObject
getPropertyIndexnull129 function getPropertyIndex(const AProperty : ISDOProperty) : PtrInt;
getInstancePropertiesnull130 function getInstanceProperties() : ISDOPropertyList;virtual;
131
getPropertynull132 function getProperty(const AIndex : PtrUInt) : ISDOProperty;overload;
getPropertynull133 function getProperty(const AProp : string) : ISDOProperty;overload;
134
getContainernull135 function getContainer() : ISDODataObject;
getContainmentPropertynull136 function getContainmentProperty() : ISDOProperty;
getTypenull137 function getType() : ISDOType;
getTypeEnumnull138 function getTypeEnum() : TSDOTypeKind;
139
getListnull140 function getList(const APath : string) : ISDODataObjectList; overload;
getListnull141 function getList(const APropertyIndex : PtrUInt) : ISDODataObjectList; overload;
getListnull142 function getList(const AProperty : ISDOProperty) : ISDODataObjectList; overload;
143
getDataObjectnull144 function getDataObject(const APath : string) : ISDODataObject; overload;
getDataObjectnull145 function getDataObject(const APropertyIndex : PtrUInt) : ISDODataObject; overload;
getDataObjectnull146 function getDataObject(const AProperty : ISDOProperty) : ISDODataObject; overload;
147
148 procedure setDataObject(const APath : string; AValue : ISDODataObject); overload; virtual;
149 procedure setDataObject(const APropertyIndex : PtrUInt; AValue : ISDODataObject); overload;
150 procedure setDataObject(const AProperty : ISDOProperty; AValue : ISDODataObject); overload;
151
getBooleannull152 function getBoolean(const APath : string) : TSDOBoolean; overload;
getBooleannull153 function getBoolean(const APropertyIndex : PtrUInt) : TSDOBoolean; overload;
getBooleannull154 function getBoolean(const AProperty : ISDOProperty) : TSDOBoolean; overload;
155
156 procedure setBoolean(const APath : string; const AValue : TSDOBoolean); overload; virtual;
157 procedure setBoolean(const APropertyIndex : PtrUInt; const AValue : TSDOBoolean); overload;
158 procedure setBoolean(const AProperty : ISDOProperty; const AValue : TSDOBoolean); overload;
159
getBytenull160 function getByte(const APath : string) : TSDOByte;overload;
getBytenull161 function getByte(const APropertyIndex : PtrUInt) : TSDOByte;overload;
getBytenull162 function getByte(const AProperty : ISDOProperty) : TSDOByte;overload;
163
164 procedure setByte(const APath : string; const AValue : TSDOByte);overload; virtual;
165 procedure setByte(const APropertyIndex : PtrUInt; const AValue : TSDOByte);overload;
166 procedure setByte(const AProperty : ISDOProperty; const AValue : TSDOByte);overload;
167
168 {$IFDEF HAS_SDO_CHAR}
getCharacternull169 function getCharacter(const APath : string) : TSDOChar;overload;
getCharacternull170 function getCharacter(const APropertyIndex : PtrUInt) : TSDOChar;overload;
getCharacternull171 function getCharacter(const AProperty : ISDOProperty) : TSDOChar;overload;
172
173 procedure setCharacter(const APath : string; const AValue : TSDOChar);overload; virtual;
174 procedure setCharacter(const APropertyIndex : PtrUInt; const AValue : TSDOChar);overload;
175 procedure setCharacter(const AProperty : ISDOProperty; const AValue : TSDOChar);overload;
176 {$ENDIF HAS_SDO_CHAR}
177
178 {$IFDEF HAS_SDO_BYTES}
getBytesnull179 function getBytes(const APath : string) : TSDOBytes;overload;
getBytesnull180 function getBytes(const APropertyIndex : PtrUInt) : TSDOBytes;overload;
getBytesnull181 function getBytes(const AProperty : ISDOProperty) : TSDOBytes;overload;
182
183 procedure setBytes(const APath : string; AValue : TSDOBytes);overload; virtual;
184 procedure setBytes(const APropertyIndex : PtrUInt; AValue : TSDOBytes);overload;
185 procedure setBytes(const AProperty : ISDOProperty; AValue : TSDOBytes);overload;
186 {$ENDIF HAS_SDO_BYTES}
187
188 {$IFDEF HAS_SDO_CURRENCY}
getCurrencynull189 function getCurrency(const APath : string) : TSDOCurrency;overload;
getCurrencynull190 function getCurrency(const APropertyIndex : PtrUInt) : TSDOCurrency;overload;
getCurrencynull191 function getCurrency(const AProperty : ISDOProperty) : TSDOCurrency;overload;
192
193 procedure setCurrency(const APath : string; const AValue : TSDOCurrency);overload; virtual;
194 procedure setCurrency(const APropertyIndex : PtrUInt; const AValue : TSDOCurrency);overload;
195 procedure setCurrency(const AProperty : ISDOProperty; const AValue : TSDOCurrency);overload;
196 {$ENDIF HAS_SDO_CURRENCY}
197
getStringnull198 function getString(const APath : string) : TSDOString;overload;
getStringnull199 function getString(const APropertyIndex : PtrUInt) : TSDOString;overload;
getStringnull200 function getString(const AProperty : ISDOProperty) : TSDOString;overload;
201
202 procedure setString(const APath : string; const AValue : TSDOString);overload;virtual;
203 procedure setString(const APropertyIndex : PtrUInt; const AValue : TSDOString);overload;
204 procedure setString(const AProperty : ISDOProperty; const AValue : TSDOString);overload;
205
getDatenull206 function getDate(const APath : string) : TSDODate;overload;
getDatenull207 function getDate(const APropertyIndex : PtrUInt) : TSDODate;overload;
getDatenull208 function getDate(const AProperty : ISDOProperty) : TSDODate;overload;
209
210 procedure setDate(const APath : string; const AValue : TSDODate);overload;virtual;
211 procedure setDate(const APropertyIndex : PtrUInt; const AValue : TSDODate);overload;
212 procedure setDate(const AProperty : ISDOProperty; const AValue : TSDODate);overload;
213
214 {$IFDEF HAS_SDO_DOUBLE}
getDoublenull215 function getDouble(const APath : string) : TSDODouble;overload;
getDoublenull216 function getDouble(const APropertyIndex : PtrUInt) : TSDODouble;overload;
getDoublenull217 function getDouble(const AProperty : ISDOProperty) : TSDODouble;overload;
218
219 procedure setDouble(const APath : string; const AValue : TSDODouble);overload; virtual;
220 procedure setDouble(const APropertyIndex : PtrUInt; const AValue : TSDODouble);overload;
221 procedure setDouble(const AProperty : ISDOProperty; const AValue : TSDODouble);overload;
222 {$ENDIF HAS_SDO_DOUBLE}
223
224 {$IFDEF HAS_SDO_FLOAT}
getFloatnull225 function getFloat(const APath : string) : TSDOFloat;overload;
getFloatnull226 function getFloat(const APropertyIndex : PtrUInt) : TSDOFloat;overload;
getFloatnull227 function getFloat(const AProperty : ISDOProperty) : TSDOFloat;overload;
228
229 procedure setFloat(const APath : string; const AValue : TSDOFloat);overload; virtual;
230 procedure setFloat(const APropertyIndex : PtrUInt; const AValue : TSDOFloat);overload;
231 procedure setFloat(const AProperty : ISDOProperty; const AValue : TSDOFloat);overload;
232 {$ENDIF HAS_SDO_FLOAT}
233
getIntegernull234 function getInteger(const APath : string) : TSDOInteger;overload;
getIntegernull235 function getInteger(const APropertyIndex : PtrUInt) : TSDOInteger;overload;
getIntegernull236 function getInteger(const AProperty : ISDOProperty) : TSDOInteger;overload;
237
238 procedure setInteger(const APath : string; const AValue : TSDOInteger);overload;virtual;
239 procedure setInteger(const APropertyIndex : PtrUInt; const AValue : TSDOInteger);overload;
240 procedure setInteger(const AProperty : ISDOProperty; const AValue : TSDOInteger);overload;
241
242 {$IFDEF HAS_SDO_LONG}
getLongnull243 function getLong(const APath : string) : TSDOLong;overload;
getLongnull244 function getLong(const APropertyIndex : PtrUInt) : TSDOLong;overload;
getLongnull245 function getLong(const AProperty : ISDOProperty) : TSDOLong;overload;
246
247 procedure setLong(const APath : string; const AValue : TSDOLong);overload; virtual;
248 procedure setLong(const APropertyIndex : PtrUInt; const AValue : TSDOLong);overload;
249 procedure setLong(const AProperty : ISDOProperty; const AValue : TSDOLong);overload;
250 {$ENDIF HAS_SDO_LONG}
251
252 {$IFDEF HAS_SDO_SHORT}
getShortnull253 function getShort(const APath : string) : TSDOShort;overload;
getShortnull254 function getShort(const APropertyIndex : PtrUInt) : TSDOShort;overload;
getShortnull255 function getShort(const AProperty : ISDOProperty) : TSDOShort;overload;
256
257 procedure setShort(const APath : string; const AValue : TSDOShort);overload; virtual;
258 procedure setShort(const APropertyIndex : PtrUInt; const AValue : TSDOShort);overload;
259 procedure setShort(const AProperty : ISDOProperty; const AValue : TSDOShort);overload;
260 {$ENDIF HAS_SDO_SHORT}
261
getVariantnull262 function getVariant(const APath : string) : TSDOVariant;overload;
getVariantnull263 function getVariant(const APropertyIndex : PtrUInt) : TSDOVariant;overload;
getVariantnull264 function getVariant(const AProperty : ISDOProperty) : TSDOVariant;overload;
265
266 procedure setVariant(const APath : string; const AValue : TSDOVariant);overload;
267 procedure setVariant(const APropertyIndex : PtrUInt; const AValue : TSDOVariant);overload;
268 procedure setVariant(const AProperty : ISDOProperty; const AValue : TSDOVariant);overload;
269
270 procedure setNull(const APath : string);overload;
271 procedure setNull(const APropertyIndex : PtrUInt);overload;
272 procedure setNull(const AProperty : ISDOProperty);overload;
273
isNullnull274 function isNull(const APath : string) : Boolean;overload;
isNullnull275 function isNull(const APropertyIndex : PtrUInt) : Boolean;overload;
isNullnull276 function isNull(const AProperty : ISDOProperty) : Boolean;overload;
277
isSetnull278 function isSet(const APath : string) : Boolean;overload;
isSetnull279 function isSet(const APropertyIndex : PtrUInt) : Boolean;overload;
isSetnull280 function isSet(const AProperty : ISDOProperty) : Boolean;overload;
281
282 procedure unset(const APath : string);overload;
283 procedure unset(const APropertyIndex : PtrUInt);overload;
284 procedure unset(const AProperty : ISDOProperty);overload;
285
createDataObjectnull286 function createDataObject(const APath : string) : ISDODataObject; overload;
createDataObjectnull287 function createDataObject(const APropertyIndex : PtrUInt) : ISDODataObject; overload;
createDataObjectnull288 function createDataObject(const AProperty : ISDOProperty) : ISDODataObject; overload;
289
getChangeSummarynull290 function getChangeSummary() : ISDOChangeSummary;overload;
291 {function getChangeSummary(const APath : string) : ISDOChangeSummary;overload;
292 function getChangeSummary(const APropIndex : PtrUInt) : ISDOChangeSummary;overload;
293 function getChangeSummary(const AProp : ISDOProperty ) : ISDOChangeSummary;overload;
294 }
295 procedure clear();
296
297 // IDataObjectObserver implementation
298 procedure NotifyDeletion(
299 const ADataObject : ISDODataObject;
300 const AProperty : ISDOProperty
301 );
302 procedure AddReference(
303 const AReferencer : ISDODataObject;
304 const AReferenceProperty : ISDOProperty
305 );
306 procedure RemoveReference(
307 const AReferencer : ISDODataObject;
308 const AReferenceProperty : ISDOProperty
309 );
310 procedure NotifyContainedObjectsForDeletion(const ACallFromParent : Boolean);// logical deletion
311 // for open Type support
312 procedure addProperty(
313 const APropName : string;
314 const APropType : ISDOType;
315 const AFlags : TPropertyFlags
316 );
317 public
318 constructor Create(
319 const AType : ISDOTypeEx;
320 const AContainer : ISDODataObject;
321 const AContainerProperty : ISDOProperty
322 );virtual;
323 destructor Destroy();override;
324 end;
325
326 TSDODataObject = class(TSDOBaseDataObject, IInterface, ISDODataObject)
327 end;
328
329 TSDOOpenedDataObject = class(
330 TSDOBaseDataObject,
331 IInterface,
332 ISDODataObject,
333 ISDODataObjectEx
334 )
335 private
336 FInstanceProperties : ISDOPropertyListEx;
337 protected
IsOwnerOfnull338 function IsOwnerOf(const AProp : ISDOProperty) : Boolean; override;
getInstancePropertiesnull339 function getInstanceProperties() : ISDOPropertyList;override;
340 procedure setBoolean(const APath : string; const AValue : TSDOBoolean); overload; override;
341 procedure setByte(const APath : string; const AValue : TSDOByte); overload; override;
342 {$IFDEF HAS_SDO_BYTES}
343 procedure setBytes(const APath : string; AValue : TSDOBytes); overload; override;
344 {$ENDIF HAS_SDO_BYTES}
345 {$IFDEF HAS_SDO_CHAR}
346 procedure setCharacter(const APath : string; const AValue : TSDOChar); overload; override;
347 {$ENDIF HAS_SDO_CHAR}
348 {$IFDEF HAS_SDO_CURRENCY}
349 procedure setCurrency(const APath : string; const AValue : Currency); overload; override;
350 {$ENDIF HAS_SDO_CURRENCY}
351 procedure setDate(const APath : string; const AValue : TSDODate);overload;override;
352 {$IFDEF HAS_SDO_DOUBLE}
353 procedure setDouble(const APath : string; const AValue : TSDODouble); overload; override;
354 {$ENDIF HAS_SDO_DOUBLE}
355 {$IFDEF HAS_SDO_FLOAT}
356 procedure setFloat(const APath : string; const AValue : TSDOFloat); overload; override;
357 {$ENDIF HAS_SDO_FLOAT}
358 procedure setInteger(const APath : string; const AValue : TSDOInteger);overload;override;
359 {$IFDEF HAS_SDO_LONG}
360 procedure setLong(const APath : string; const AValue : TSDOLong); overload; override;
361 {$ENDIF HAS_SDO_LONG}
362 {$IFDEF HAS_SDO_SHORT}
363 procedure setShort(const APath : string; const AValue : TSDOShort); overload; override;
364 {$ENDIF HAS_SDO_SHORT}
365 procedure setString(const APath : string; const AValue : TSDOString);overload;override;
366 procedure setDataObject(const APath : string; AValue : ISDODataObject); overload; override;
367
368 // for open Type support
369 procedure addProperty(
370 const APropName : string;
371 const APropType : ISDOType;
372 const AFlags : TPropertyFlags
373 );
374 public
375 constructor Create(
376 const AType : ISDOTypeEx;
377 const AContainer : ISDODataObject;
378 const AContainerProperty : ISDOProperty
379 );override;
380 end;
381
382 TSDODataObjectList = class(TInterfacedObject,IInterface,ISDODataObjectList)
383 private
384 FItemType : ISDOType;
385 FData : TDoubleLinkedList;
386 FCursor : ILinkedListCursor;
387 FField : ISDOField;
388 private
389 procedure Clear();
390 procedure InternalDelete(const AData : PLinkedNode);{$IFDEF USE_INLINE}inline;{$ENDIF}
InternalAppendnull391 function InternalAppend() : PLinkedNode;{$IFDEF USE_INLINE}inline;{$ENDIF}
392 procedure CheckCursorPosition();{$IFDEF USE_INLINE}inline;{$ENDIF}
393 procedure MoveTo(const AIndex : PtrInt);{$IFDEF USE_INLINE}inline;{$ENDIF}
394 protected
getItemTypenull395 function getItemType() : ISDOType;{$IFDEF USE_INLINE}inline;{$ENDIF}
sizenull396 function size() : PtrInt;
getCursornull397 function getCursor() : ILinkedListCursor;
398
399 {These operations use the cursor location}
getBooleannull400 function getBoolean() : TSDOBoolean;overload;
getBytenull401 function getByte() : TSDOByte;overload;
402 {$IFDEF HAS_SDO_BYTES}
getBytesnull403 function getBytes() : TSDOBytes;overload;
404 {$ENDIF HAS_SDO_BYTES}
405 {$IFDEF HAS_SDO_CHAR}
getCharacternull406 function getCharacter() : TSDOChar;overload;
407 {$ENDIF HAS_SDO_CHAR}
408 {$IFDEF HAS_SDO_CURRENCY}
getCurrencynull409 function getCurrency() : TSDOCurrency;overload;
410 {$ENDIF HAS_SDO_CURRENCY}
getDatenull411 function getDate() : TSDODate;overload;
412 {$IFDEF HAS_SDO_DOUBLE}
getDoublenull413 function getDouble() : TSDODouble;overload;
414 {$ENDIF HAS_SDO_DOUBLE}
415 {$IFDEF HAS_SDO_FLOAT}
getFloatnull416 function getFloat() : TSDOFloat;overload;
417 {$ENDIF HAS_SDO_FLOAT}
getIntegernull418 function getInteger() : TSDOInteger;overload;
419 {$IFDEF HAS_SDO_LONG}
getLongnull420 function getLong() : TSDOLong;overload;
421 {$ENDIF HAS_SDO_LONG}
422 {$IFDEF HAS_SDO_SHORT}
getShortnull423 function getShort() : TSDOShort;overload;
424 {$ENDIF HAS_SDO_SHORT}
getStringnull425 function getString() : TSDOString;overload;
getDataObjectnull426 function getDataObject() : ISDODataObject;overload;
getVariantnull427 function getVariant() : TSDOVariant;overload;
428
429
430 procedure setBoolean(const AValue : TSDOBoolean);overload;
431 procedure setByte(const AValue : TSDOByte);overload;
432 {$IFDEF HAS_SDO_BYTES}
433 procedure setBytes(AValue : TSDOBytes);overload;
434 {$ENDIF HAS_SDO_BYTES}
435 {$IFDEF HAS_SDO_CHAR}
436 procedure setCharacter(const AValue : TSDOChar);overload;
437 {$ENDIF HAS_SDO_CHAR}
438 {$IFDEF HAS_SDO_CURRENCY}
439 procedure setCurrency(const AValue : TSDOCurrency);overload;
440 {$ENDIF HAS_SDO_CURRENCY}
441 procedure setDate(const AValue : TSDODate);overload;
442 {$IFDEF HAS_SDO_DOUBLE}
443 procedure setDouble(const AValue : TSDODouble);overload;
444 {$ENDIF HAS_SDO_DOUBLE}
445 {$IFDEF HAS_SDO_FLOAT}
446 procedure setFloat(const AValue : TSDOFloat);overload;
447 {$ENDIF HAS_SDO_FLOAT}
448 procedure setInteger(const AValue : TSDOInteger);overload;
449 {$IFDEF HAS_SDO_LONG}
450 procedure setLong(const AValue : TSDOLong);overload;
451 {$ENDIF HAS_SDO_LONG}
452 {$IFDEF HAS_SDO_SHORT}
453 procedure setShort(const AValue : TSDOShort);overload;
454 {$ENDIF HAS_SDO_SHORT}
455 procedure setString(const AValue : TSDOString);overload;
456 procedure setDataObject(AValue : ISDODataObject);overload;
457 procedure setVariant(const AValue : TSDOVariant);overload;
458
459
getBooleannull460 function getBoolean(const AIndex : PtrInt) : TSDOBoolean;overload;
getBytenull461 function getByte(const AIndex : PtrInt) : TSDOByte;overload;
462 {$IFDEF HAS_SDO_BYTES}
getBytesnull463 function getBytes(const AIndex : PtrInt) : TSDOBytes;overload;
464 {$ENDIF HAS_SDO_BYTES}
465 {$IFDEF HAS_SDO_CHAR}
getCharacternull466 function getCharacter(const AIndex : PtrInt) : TSDOChar;overload;
467 {$ENDIF HAS_SDO_CHAR}
468 {$IFDEF HAS_SDO_CURRENCY}
getCurrencynull469 function getCurrency(const AIndex : PtrInt) : TSDOCurrency;overload;
470 {$ENDIF HAS_SDO_CURRENCY}
getDatenull471 function getDate(const AIndex : PtrInt) : TSDODate;overload;
472 {$IFDEF HAS_SDO_DOUBLE}
getDoublenull473 function getDouble(const AIndex : PtrInt) : TSDODouble;overload;
474 {$ENDIF HAS_SDO_DOUBLE}
475 {$IFDEF HAS_SDO_FLOAT}
getFloatnull476 function getFloat(const AIndex : PtrInt) : TSDOFloat;overload;
477 {$ENDIF HAS_SDO_FLOAT}
getIntegernull478 function getInteger(const AIndex : PtrInt) : TSDOInteger;overload;
479 {$IFDEF HAS_SDO_LONG}
getLongnull480 function getLong(const AIndex : PtrInt) : TSDOLong;overload;
481 {$ENDIF HAS_SDO_LONG}
482 {$IFDEF HAS_SDO_SHORT}
getShortnull483 function getShort(const AIndex : PtrInt) : TSDOShort;overload;
484 {$ENDIF HAS_SDO_SHORT}
getStringnull485 function getString(const AIndex : PtrInt) : TSDOString;overload;
getDataObjectnull486 function getDataObject(const AIndex : PtrInt) : ISDODataObject;overload;
getVariantnull487 function getVariant(const AIndex : PtrInt) : TSDOVariant;overload;
488
489
490 procedure setBoolean(const AIndex : PtrInt; const AValue : TSDOBoolean);overload;
491 procedure setByte(const AIndex : PtrInt; const AValue : TSDOByte);overload;
492 {$IFDEF HAS_SDO_BYTES}
493 procedure setBytes(const AIndex : PtrInt; AValue : TSDOBytes);overload;
494 {$ENDIF HAS_SDO_BYTES}
495 {$IFDEF HAS_SDO_CHAR}
496 procedure setCharacter(const AIndex : PtrInt; const AValue : TSDOChar);overload;
497 {$ENDIF HAS_SDO_CHAR}
498 {$IFDEF HAS_SDO_CURRENCY}
499 procedure setCurrency(const AIndex : PtrInt; const AValue : TSDOCurrency);overload;
500 {$ENDIF HAS_SDO_CURRENCY}
501 procedure setDate(const AIndex : PtrInt; const AValue : TSDODate);overload;
502 {$IFDEF HAS_SDO_DOUBLE}
503 procedure setDouble(const AIndex : PtrInt; const AValue : TSDODouble);overload;
504 {$ENDIF HAS_SDO_DOUBLE}
505 {$IFDEF HAS_SDO_FLOAT}
506 procedure setFloat(const AIndex : PtrInt; const AValue : TSDOFloat);overload;
507 {$ENDIF HAS_SDO_FLOAT}
508 procedure setInteger(const AIndex : PtrInt; const AValue : TSDOInteger);overload;
509 {$IFDEF HAS_SDO_LONG}
510 procedure setLong(const AIndex : PtrInt; const AValue : TSDOLong);overload;
511 {$ENDIF HAS_SDO_LONG}
512 {$IFDEF HAS_SDO_SHORT}
513 procedure setShort(const AIndex : PtrInt; const AValue : TSDOShort);overload;
514 {$ENDIF HAS_SDO_SHORT}
515 procedure setString(const AIndex : PtrInt; const AValue : TSDOString);overload;
516 procedure setVariant(const AIndex : PtrInt; const AValue : TSDOVariant);overload;
517 procedure setDataObject(const AIndex : PtrInt; AValue : ISDODataObject);overload;
518
519
520 procedure insert(const AIndex : PtrInt; const AValue : TSDOBoolean);overload;
521 procedure insert(const AIndex : PtrInt; const AValue : TSDOByte);overload;
522 {$IFDEF HAS_SDO_BYTES}
523 procedure insertBytes(const AIndex : PtrInt; AValue : TSDOBytes);overload;
524 {$ENDIF HAS_SDO_BYTES}
525 {$IFDEF HAS_SDO_CHAR}
526 procedure insert(const AIndex : PtrInt; const AValue : TSDOChar);overload;
527 {$ENDIF HAS_SDO_CHAR}
528 {$IFDEF HAS_SDO_CURRENCY}
529 procedure insertCurrency(const AIndex : PtrInt; const AValue : TSDOCurrency);
530 {$ENDIF HAS_SDO_CURRENCY}
531 procedure insert(const AIndex : PtrInt; const AValue : TSDODate);overload;
532 {$IFDEF HAS_SDO_DOUBLE}
533 procedure insert(const AIndex : PtrInt; const AValue : TSDODouble);overload;
534 {$ENDIF HAS_SDO_DOUBLE}
535 {$IFDEF HAS_SDO_FLOAT}
536 procedure insert(const AIndex : PtrInt; const AValue : TSDOFloat);overload;
537 {$ENDIF HAS_SDO_FLOAT}
538 procedure insert(const AIndex : PtrInt; const AValue : TSDOInteger);overload;
539 {$IFDEF HAS_SDO_LONG}
540 procedure insert(const AIndex : PtrInt; const AValue : TSDOLong);overload;
541 {$ENDIF HAS_SDO_LONG}
542 {$IFDEF HAS_SDO_SHORT}
543 procedure insert(const AIndex : PtrInt; const AValue : TSDOShort);overload;
544 {$ENDIF HAS_SDO_SHORT}
545 procedure insert(const AIndex : PtrInt; const AValue : TSDOString);overload;
546 procedure insert(const AIndex : PtrInt; AValue : ISDODataObject);overload;
547
548
549 procedure append(const AValue : TSDOBoolean);overload;
550 procedure append(const AValue : TSDOByte);overload;
551 {$IFDEF HAS_SDO_BYTES}
552 procedure appendBytes(AValue : TSDOBytes);overload;
553 {$ENDIF HAS_SDO_BYTES}
554 {$IFDEF HAS_SDO_CHAR}
555 procedure append(const AValue : TSDOChar);overload;
556 {$ENDIF HAS_SDO_CHAR}
557 {$IFDEF HAS_SDO_CURRENCY}
558 procedure appendCurrency(const AValue : TSDOCurrency);
559 {$ENDIF HAS_SDO_CURRENCY}
560 procedure append(const AValue : TSDODate);overload;
561 {$IFDEF HAS_SDO_DOUBLE}
562 procedure append(const AValue : TSDODouble);overload;
563 {$ENDIF HAS_SDO_DOUBLE}
564 {$IFDEF HAS_SDO_FLOAT}
565 procedure append(const AValue : TSDOFloat);overload;
566 {$ENDIF HAS_SDO_FLOAT}
567 procedure append(const AValue : TSDOInteger);overload;
568 {$IFDEF HAS_SDO_LONG}
569 procedure append(const AValue : TSDOLong);overload;
570 {$ENDIF HAS_SDO_LONG}
571 {$IFDEF HAS_SDO_SHORT}
572 procedure append(const AValue : TSDOShort);overload;
573 {$ENDIF HAS_SDO_SHORT}
574 procedure append(const AValue : TSDOString);overload;
575 procedure append(AValue : ISDODataObject);overload;
576
577
578 procedure delete(const AIndex : PtrInt);overload;
579 procedure delete();overload;
580 public
581 constructor Create(const AItemType : ISDOType);
582 destructor Destroy();override;
583 end;
584
585 TSDOOwnedDataObjectList = class(TSDODataObjectList,IInterface,ISDODataObjectList)
586 private
587 FOwner : Pointer; // do not add a reference count!
588 FOwnerProperty : ISDOProperty;
589 protected
590 procedure RecordChange(const AChange : TManyValuePropAction);overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
getOwnernull591 function getOwner() : ISDODataObject;{$IFDEF USE_INLINE}inline;{$ENDIF}
592 procedure InternalSetDataObject(const AValue : ISDODataObject; const ADoRecordChange : Boolean);
593 protected
594 procedure setBoolean(const AValue : TSDOBoolean);overload;
595 procedure setByte(const AValue : TSDOByte);overload;
596 {$IFDEF HAS_SDO_BYTES}
597 procedure setBytes(AValue : TSDOBytes);overload;
598 {$ENDIF HAS_SDO_BYTES}
599 {$IFDEF HAS_SDO_CHAR}
600 procedure setCharacter(const AValue : TSDOChar);overload;
601 {$ENDIF HAS_SDO_CHAR}
602 {$IFDEF HAS_SDO_CURRENCY}
603 procedure setCurrency(const AValue : TSDOCurrency);overload;
604 {$ENDIF HAS_SDO_CURRENCY}
605 procedure setDate(const AValue : TSDODate);overload;
606 {$IFDEF HAS_SDO_DOUBLE}
607 procedure setDouble(const AValue : TSDODouble);overload;
608 {$ENDIF HAS_SDO_DOUBLE}
609 {$IFDEF HAS_SDO_FLOAT}
610 procedure setFloat(const AValue : TSDOFloat);overload;
611 {$ENDIF HAS_SDO_FLOAT}
612 procedure setInteger(const AValue : TSDOInteger);overload;
613 {$IFDEF HAS_SDO_LONG}
614 procedure setLong(const AValue : TSDOLong);overload;
615 {$ENDIF HAS_SDO_LONG}
616 {$IFDEF HAS_SDO_SHORT}
617 procedure setShort(const AValue : TSDOShort);overload;
618 {$ENDIF HAS_SDO_SHORT}
619 procedure setString(const AValue : TSDOString);overload;
620 procedure setDataObject(AValue : ISDODataObject);overload;
621 procedure setVariant(const AValue : TSDOVariant);overload;
622
623 procedure setBoolean(const AIndex : PtrInt; const AValue : TSDOBoolean);overload;
624 procedure setByte(const AIndex : PtrInt; const AValue : TSDOByte);overload;
625 {$IFDEF HAS_SDO_BYTES}
626 procedure setBytes(const AIndex : PtrInt; AValue : TSDOBytes);overload;
627 {$ENDIF HAS_SDO_BYTES}
628 {$IFDEF HAS_SDO_CHAR}
629 procedure setCharacter(const AIndex : PtrInt; const AValue : TSDOChar);overload;
630 {$ENDIF HAS_SDO_CHAR}
631 {$IFDEF HAS_SDO_CURRENCY}
632 procedure setCurrency(const AIndex : PtrInt; const AValue : TSDOCurrency);overload;
633 {$ENDIF HAS_SDO_CURRENCY}
634 procedure setDate(const AIndex : PtrInt; const AValue : TSDODate);overload;
635 {$IFDEF HAS_SDO_DOUBLE}
636 procedure setDouble(const AIndex : PtrInt; const AValue : TSDODouble);overload;
637 {$ENDIF HAS_SDO_DOUBLE}
638 {$IFDEF HAS_SDO_FLOAT}
639 procedure setFloat(const AIndex : PtrInt; const AValue : TSDOFloat);overload;
640 {$ENDIF HAS_SDO_FLOAT}
641 procedure setInteger(const AIndex : PtrInt; const AValue : TSDOInteger);overload;
642 {$IFDEF HAS_SDO_LONG}
643 procedure setLong(const AIndex : PtrInt; const AValue : TSDOLong);overload;
644 {$ENDIF HAS_SDO_LONG}
645 {$IFDEF HAS_SDO_SHORT}
646 procedure setShort(const AIndex : PtrInt; const AValue : TSDOShort);overload;
647 {$ENDIF HAS_SDO_SHORT}
648 procedure setString(const AIndex : PtrInt; const AValue : TSDOString);overload;
649 procedure setDataObject(const AIndex : PtrInt; AValue : ISDODataObject);overload;
650 procedure setVariant(const AIndex : PtrInt; const AValue : TSDOVariant);overload;
651
652 procedure insert(const AIndex : PtrInt; const AValue : TSDOBoolean);overload;
653 procedure insert(const AIndex : PtrInt; const AValue : TSDOByte);overload;
654 {$IFDEF HAS_SDO_BYTES}
655 procedure insertBytes(const AIndex : PtrInt; AValue : TSDOBytes);overload;
656 {$ENDIF HAS_SDO_BYTES}
657 {$IFDEF HAS_SDO_CHAR}
658 procedure insert(const AIndex : PtrInt; const AValue : TSDOChar);overload;
659 {$ENDIF HAS_SDO_CHAR}
660 {$IFDEF HAS_SDO_CURRENCY}
661 procedure insertCurrency(const AIndex : PtrInt; const AValue : TSDOCurrency);
662 {$ENDIF HAS_SDO_CURRENCY}
663 procedure insert(const AIndex : PtrInt; const AValue : TSDODate);overload;
664 {$IFDEF HAS_SDO_DOUBLE}
665 procedure insert(const AIndex : PtrInt; const AValue : TSDODouble);overload;
666 {$ENDIF HAS_SDO_DOUBLE}
667 {$IFDEF HAS_SDO_FLOAT}
668 procedure insert(const AIndex : PtrInt; const AValue : TSDOFloat);overload;
669 {$ENDIF HAS_SDO_FLOAT}
670 procedure insert(const AIndex : PtrInt; const AValue : TSDOInteger);overload;
671 {$IFDEF HAS_SDO_LONG}
672 procedure insert(const AIndex : PtrInt; const AValue : TSDOLong);overload;
673 {$ENDIF HAS_SDO_LONG}
674 {$IFDEF HAS_SDO_SHORT}
675 procedure insert(const AIndex : PtrInt; const AValue : TSDOShort);overload;
676 {$ENDIF HAS_SDO_SHORT}
677 procedure insert(const AIndex : PtrInt; const AValue : TSDOString);overload;
678 procedure insert(const AIndex : PtrInt; AValue : ISDODataObject);overload;
679
680 procedure append(const AValue : TSDOBoolean);overload;
681 procedure append(const AValue : TSDOByte);overload;
682 {$IFDEF HAS_SDO_BYTES}
683 procedure appendBytes(AValue : TSDOBytes);overload;
684 {$ENDIF HAS_SDO_BYTES}
685 {$IFDEF HAS_SDO_CHAR}
686 procedure append(const AValue : TSDOChar);overload;
687 {$ENDIF HAS_SDO_CHAR}
688 {$IFDEF HAS_SDO_CURRENCY}
689 procedure appendCurrency(const AValue : TSDOCurrency);
690 {$ENDIF HAS_SDO_CURRENCY}
691 procedure append(const AValue : TSDODate);overload;
692 {$IFDEF HAS_SDO_DOUBLE}
693 procedure append(const AValue : TSDODouble);overload;
694 {$ENDIF HAS_SDO_DOUBLE}
695 {$IFDEF HAS_SDO_FLOAT}
696 procedure append(const AValue : TSDOFloat);overload;
697 {$ENDIF HAS_SDO_FLOAT}
698 procedure append(const AValue : TSDOInteger);overload;
699 {$IFDEF HAS_SDO_LONG}
700 procedure append(const AValue : TSDOLong);overload;
701 {$ENDIF HAS_SDO_LONG}
702 {$IFDEF HAS_SDO_SHORT}
703 procedure append(const AValue : TSDOShort);overload;
704 {$ENDIF HAS_SDO_SHORT}
705 procedure append(AValue : ISDODataObject);overload;
706 procedure append(const AValue : TSDOString);overload;
707
708 procedure delete(const AIndex : PtrInt);overload;
709 procedure delete();overload;
710 public
711 constructor Create(
712 const AOwner : ISDODataObject;
713 const AProperty : ISDOProperty
714 );
715 end;
716
717 implementation
718
719 uses
720 sdo_imp_utils, sdo_utils;
721
722 { TSDOBaseDataObject }
723
724 procedure TSDOBaseDataObject.clear;
725 begin
726
727 end;
728
729 constructor TSDOBaseDataObject.Create(
730 const AType: ISDOTypeEx;
731 const AContainer : ISDODataObject;
732 const AContainerProperty : ISDOProperty
733 );
734 begin
735 if ( AType = nil ) then
736 raise ESDOIllegalArgumentException.Create('AType');
737 if ( AContainer <> nil ) and ( AContainerProperty = nil ) then
738 raise ESDOIllegalArgumentException.Create('AContainerProperty');
739 FType := AType as ISDOObjectType;
740 FContainer := Pointer(AContainer);
741 FContainerProperty := Pointer(AContainerProperty);
742 FXPathExpression := TXPathExpression.Create();
743 FXPathProcessor := TXPathProcessor.Create();
744 PrepareDataBuffer();
745 InitializeDefaultValues();
746 FType.setUsedFlag(True);
747 end;
748
TSDOBaseDataObject.createDataObjectnull749 function TSDOBaseDataObject.createDataObject(const APath: string): ISDODataObject;
750 var
751 locCtx : TXPathExecContext;
752 begin
753 locCtx := parsePropertyPath(APath);
754 if ( locCtx.PropertyOwner = nil ) then
755 raise ESDOInvalidPathException.Create(APath);
756 Result := locCtx.PropertyOwner.createDataObject(locCtx.CurrentProperty);
757 end;
758
TSDOBaseDataObject.createDataObjectnull759 function TSDOBaseDataObject.createDataObject(const AProperty: ISDOProperty) : ISDODataObject;
760 var
761 prp : ISDOPropertyEx;
762 begin
763 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
764 raise ESDOIllegalArgumentException.Create('AProperty');
765 prp := AProperty as ISDOPropertyEx;
766 Result := TSDOBaseDataObjectClass(Self.ClassType).Create(
767 prp.getType() as ISDOTypeEx,
768 nil, //Self as ISDODataObject,
769 prp
770 ) as ISDODataObject;
771 if not AProperty.isMany() then
772 setDataObject(prp,Result);
773 end;
774
TSDOBaseDataObject.createDataObjectnull775 function TSDOBaseDataObject.createDataObject(const APropertyIndex: PtrUInt): ISDODataObject;
776 begin
777 Result := createDataObject(getProperty(APropertyIndex));
778 end;
779
780 destructor TSDOBaseDataObject.Destroy();
781 begin
782 FDestroying := True;
783 FreeBuffer();
784 FType := nil;
785 FContainer := nil;
786 FContainerProperty := nil;
787 FChangeSummary := nil;
788 FreeAndNil(FReferenceLinkList);
789 FreeAndNil(FXPathExpression);
790 FreeAndNil(FXPathProcessor);
791 inherited;
792 end;
793
getBooleannull794 function TSDOBaseDataObject.getBoolean(const APath: string): TSDOBoolean;
795 var
796 locCtx : TXPathExecContext;
797 begin
798 locCtx := parsePropertyPath(APath);
799 if ( locCtx.PropertyOwner = nil ) then
800 raise ESDOInvalidPathException.Create(APath);
801 if ( locCtx.ContentKind = xckList ) then
802 Result := locCtx.ListItem.getBoolean()
803 else
804 Result := locCtx.PropertyOwner.getBoolean(locCtx.CurrentProperty);
805 end;
806
getBooleannull807 function TSDOBaseDataObject.getBoolean(const APropertyIndex: PtrUInt): TSDOBoolean;
808 begin
809 Result := getBoolean(getProperty(APropertyIndex));
810 end;
811
getBooleannull812 function TSDOBaseDataObject.getBoolean(const AProperty: ISDOProperty): TSDOBoolean;
813 var
814 prp : ISDOPropertyEx;
815 begin
816 if ( AProperty = nil ) or
817 ( not Self.IsOwnerOf(AProperty) ) or
818 ( AProperty.isMany() )
819 then begin
820 raise ESDOIllegalArgumentException.Create('AProperty');
821 end;
822 prp := AProperty as ISDOPropertyEx;
823 Result := getField(prp.getTypeEnum()).getBoolean(FBuffer,prp.getBufferOffset());
824 end;
825
TSDOBaseDataObject.getBytenull826 function TSDOBaseDataObject.getByte(const APath: string): TSDOByte;
827 var
828 locCtx : TXPathExecContext;
829 begin
830 locCtx := parsePropertyPath(APath);
831 if ( locCtx.PropertyOwner = nil ) then
832 raise ESDOInvalidPathException.Create(APath);
833 if ( locCtx.ContentKind = xckList ) then
834 Result := locCtx.ListItem.getByte()
835 else
836 Result := locCtx.PropertyOwner.getByte(locCtx.CurrentProperty);
837 end;
838
TSDOBaseDataObject.getBytenull839 function TSDOBaseDataObject.getByte(const APropertyIndex: PtrUInt): TSDOByte;
840 begin
841 Result := getByte(getProperty(APropertyIndex));
842 end;
843
TSDOBaseDataObject.getBytenull844 function TSDOBaseDataObject.getByte(const AProperty: ISDOProperty): TSDOByte;
845 var
846 prp : ISDOPropertyEx;
847 begin
848 if ( AProperty = nil ) or
849 ( not Self.IsOwnerOf(AProperty) ) or
850 ( AProperty.isMany() )
851 then begin
852 raise ESDOIllegalArgumentException.Create('AProperty');
853 end;
854 prp := AProperty as ISDOPropertyEx;
855 Result := getField(prp.getTypeEnum()).getByte(FBuffer,prp.getBufferOffset());
856 end;
857
858 {$IFDEF HAS_SDO_BYTES}
TSDOBaseDataObject.getBytesnull859 function TSDOBaseDataObject.getBytes(const AProperty: ISDOProperty): TSDOBytes;
860 var
861 prp : ISDOPropertyEx;
862 begin
863 if ( AProperty = nil ) or
864 ( not Self.IsOwnerOf(AProperty) ) or
865 ( AProperty.isMany() )
866 then begin
867 raise ESDOIllegalArgumentException.Create('AProperty');
868 end;
869 prp := AProperty as ISDOPropertyEx;
870 Result := getField(prp.getTypeEnum()).getBytes(FBuffer,prp.getBufferOffset());
871 end;
872
TSDOBaseDataObject.getBytesnull873 function TSDOBaseDataObject.getBytes(const APath: string): TSDOBytes;
874 var
875 locCtx : TXPathExecContext;
876 begin
877 locCtx := parsePropertyPath(APath);
878 if ( locCtx.PropertyOwner = nil ) then
879 raise ESDOInvalidPathException.Create(APath);
880 if ( locCtx.ContentKind = xckList ) then
881 Result := locCtx.ListItem.getBytes()
882 else
883 Result := locCtx.PropertyOwner.getBytes(locCtx.CurrentProperty);
884 end;
885
TSDOBaseDataObject.getBytesnull886 function TSDOBaseDataObject.getBytes(const APropertyIndex: PtrUInt): TSDOBytes;
887 begin
888 Result := getBytes(getProperty(APropertyIndex));
889 end;
890 {$ENDIF HAS_SDO_BYTES}
891
TSDOBaseDataObject.getCharacternull892 function TSDOBaseDataObject.getCharacter(const AProperty: ISDOProperty): TSDOChar;
893 var
894 prp : ISDOPropertyEx;
895 begin
896 if ( AProperty = nil ) or
897 ( not Self.IsOwnerOf(AProperty) ) or
898 ( AProperty.isMany() )
899 then begin
900 raise ESDOIllegalArgumentException.Create('AProperty');
901 end;
902 prp := AProperty as ISDOPropertyEx;
903 Result := getField(prp.getTypeEnum()).getCharacter(FBuffer,prp.getBufferOffset());
904 end;
905
TSDOBaseDataObject.getCharacternull906 function TSDOBaseDataObject.getCharacter(const APropertyIndex: PtrUInt): TSDOChar;
907 begin
908 Result := getCharacter(getProperty(APropertyIndex));
909 end;
910
TSDOBaseDataObject.getCharacternull911 function TSDOBaseDataObject.getCharacter(const APath: string): TSDOChar;
912 var
913 locCtx : TXPathExecContext;
914 begin
915 locCtx := parsePropertyPath(APath);
916 if ( locCtx.PropertyOwner = nil ) then
917 raise ESDOInvalidPathException.Create(APath);
918 if ( locCtx.ContentKind = xckList ) then
919 Result := locCtx.ListItem.getCharacter()
920 else
921 Result := locCtx.PropertyOwner.getCharacter(locCtx.CurrentProperty);
922 end;
923
getContainernull924 function TSDOBaseDataObject.getContainer() : ISDODataObject;
925 begin
926 Result := ISDODataObject(FContainer);
927 end;
928
getContainmentPropertynull929 function TSDOBaseDataObject.getContainmentProperty() : ISDOProperty;
930 begin
931 if not Assigned(FContainerProperty) then
932 raise ESDOPropertyNotFoundException.Create('ContainmentProperty');
933 Result := ISDOProperty(FContainerProperty);
934 end;
935
936 {$IFDEF HAS_SDO_CURRENCY }
getCurrencynull937 function TSDOBaseDataObject.getCurrency(const AProperty: ISDOProperty): TSDOCurrency;
938 var
939 prp : ISDOPropertyEx;
940 begin
941 if ( AProperty = nil ) or
942 ( not Self.IsOwnerOf(AProperty) ) or
943 ( AProperty.isMany() )
944 then begin
945 raise ESDOIllegalArgumentException.Create('AProperty');
946 end;
947 prp := AProperty as ISDOPropertyEx;
948 Result := getField(prp.getTypeEnum()).getCurrency(FBuffer,prp.getBufferOffset());
949 end;
950
getCurrencynull951 function TSDOBaseDataObject.getCurrency(const APropertyIndex: PtrUInt): TSDOCurrency;
952 begin
953 Result := getCurrency(getProperty(APropertyIndex));
954 end;
955
getCurrencynull956 function TSDOBaseDataObject.getCurrency(const APath: string): TSDOCurrency;
957 var
958 locCtx : TXPathExecContext;
959 begin
960 locCtx := parsePropertyPath(APath);
961 if ( locCtx.PropertyOwner = nil ) then
962 raise ESDOInvalidPathException.Create(APath);
963 if ( locCtx.ContentKind = xckList ) then
964 Result := locCtx.ListItem.getCurrency()
965 else
966 Result := locCtx.PropertyOwner.getCurrency(locCtx.CurrentProperty);
967 end;
968 {$ENDIF HAS_SDO_CURRENCY }
969
getDataObjectnull970 function TSDOBaseDataObject.getDataObject(const APath: string): ISDODataObject;
971 var
972 locCtx : TXPathExecContext;
973 begin
974 locCtx := parsePropertyPath(APath);
975 if ( locCtx.PropertyOwner = nil ) then
976 raise ESDOInvalidPathException.Create(APath);
977 Result := locCtx.ObjectItem;
978 {if ( locCtx.ContentKind = xckList ) then
979 Result := locCtx.ListItem.getDataObject()
980 else
981 Result := locCtx.PropertyOwner.getDataObject(locCtx.CurrentProperty);}
982 end;
983
getDataObjectnull984 function TSDOBaseDataObject.getDataObject(const APropertyIndex: PtrUInt): ISDODataObject;
985 begin
986 Result := getDataObject(getProperty(APropertyIndex));
987 end;
988
getDataObjectnull989 function TSDOBaseDataObject.getDataObject(const AProperty: ISDOProperty): ISDODataObject;
990 var
991 prp : ISDOPropertyEx;
992 begin
993 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
994 raise ESDOIllegalArgumentException.Create('AProperty');
995 if AProperty.isMany() then begin
996 Result := getList(AProperty).getDataObject();
997 end else begin
998 prp := AProperty as ISDOPropertyEx;
999 Result := getField(prp.getTypeEnum()).getDataObject(FBuffer,prp.getBufferOffset());
1000 end;
1001 end;
1002
getDatenull1003 function TSDOBaseDataObject.getDate(const APropertyIndex: PtrUInt): TSDODate;
1004 begin
1005 Result := getDate(getProperty(APropertyIndex));
1006 end;
1007
getDatenull1008 function TSDOBaseDataObject.getDate(const APath: string): TSDODate;
1009 var
1010 locCtx : TXPathExecContext;
1011 begin
1012 locCtx := parsePropertyPath(APath);
1013 if ( locCtx.PropertyOwner = nil ) then
1014 raise ESDOInvalidPathException.Create(APath);
1015 if ( locCtx.ContentKind = xckList ) then
1016 Result := locCtx.ListItem.getDate()
1017 else
1018 Result := locCtx.PropertyOwner.getDate(locCtx.CurrentProperty);
1019 end;
1020
getDatenull1021 function TSDOBaseDataObject.getDate(const AProperty: ISDOProperty): TSDODate;
1022 var
1023 prp : ISDOPropertyEx;
1024 begin
1025 if ( AProperty = nil ) or
1026 ( not Self.IsOwnerOf(AProperty) ) or
1027 ( AProperty.isMany() )
1028 then begin
1029 raise ESDOIllegalArgumentException.Create('AProperty');
1030 end;
1031 prp := AProperty as ISDOPropertyEx;
1032 Result := getField(prp.getTypeEnum()).getDate(FBuffer,prp.getBufferOffset());
1033 end;
1034
1035 {$IFDEF HAS_SDO_DOUBLE }
TSDOBaseDataObject.getDoublenull1036 function TSDOBaseDataObject.getDouble(const AProperty: ISDOProperty): TSDODouble;
1037 var
1038 prp : ISDOPropertyEx;
1039 begin
1040 if ( AProperty = nil ) or
1041 ( not Self.IsOwnerOf(AProperty) ) or
1042 ( AProperty.isMany() )
1043 then begin
1044 raise ESDOIllegalArgumentException.Create('AProperty');
1045 end;
1046 prp := AProperty as ISDOPropertyEx;
1047 Result := getField(prp.getTypeEnum()).getDouble(FBuffer,prp.getBufferOffset());
1048 end;
1049
TSDOBaseDataObject.getDoublenull1050 function TSDOBaseDataObject.getDouble(const APropertyIndex: PtrUInt): TSDODouble;
1051 begin
1052 Result := getDouble(getProperty(APropertyIndex));
1053 end;
1054
TSDOBaseDataObject.getDoublenull1055 function TSDOBaseDataObject.getDouble(const APath: string): TSDODouble;
1056 var
1057 locCtx : TXPathExecContext;
1058 begin
1059 locCtx := parsePropertyPath(APath);
1060 if ( locCtx.PropertyOwner = nil ) then
1061 raise ESDOInvalidPathException.Create(APath);
1062 if ( locCtx.ContentKind = xckList ) then
1063 Result := locCtx.ListItem.getDouble()
1064 else
1065 Result := locCtx.PropertyOwner.getDouble(locCtx.CurrentProperty);
1066 end;
1067 {$ENDIF HAS_SDO_DOUBLE }
1068
1069 {$IFDEF HAS_SDO_FLOAT }
TSDOBaseDataObject.getFloatnull1070 function TSDOBaseDataObject.getFloat(const AProperty: ISDOProperty): TSDOFloat;
1071 var
1072 prp : ISDOPropertyEx;
1073 begin
1074 if ( AProperty = nil ) or
1075 ( not Self.IsOwnerOf(AProperty) ) or
1076 ( AProperty.isMany() )
1077 then begin
1078 raise ESDOIllegalArgumentException.Create('AProperty');
1079 end;
1080 prp := AProperty as ISDOPropertyEx;
1081 Result := getField(prp.getTypeEnum()).getFloat(FBuffer,prp.getBufferOffset());
1082 end;
1083
TSDOBaseDataObject.getFloatnull1084 function TSDOBaseDataObject.getFloat(const APropertyIndex: PtrUInt): TSDOFloat;
1085 begin
1086 Result := getFloat(getProperty(APropertyIndex));
1087 end;
1088
TSDOBaseDataObject.getFloatnull1089 function TSDOBaseDataObject.getFloat(const APath: string): TSDOFloat;
1090 var
1091 locCtx : TXPathExecContext;
1092 begin
1093 locCtx := parsePropertyPath(APath);
1094 if ( locCtx.PropertyOwner = nil ) then
1095 raise ESDOInvalidPathException.Create(APath);
1096 if ( locCtx.ContentKind = xckList ) then
1097 Result := locCtx.ListItem.getFloat()
1098 else
1099 Result := locCtx.PropertyOwner.getFloat(locCtx.CurrentProperty);
1100 end;
1101 {$ENDIF HAS_SDO_FLOAT }
1102
getInstancePropertiesnull1103 function TSDOBaseDataObject.getInstanceProperties() : ISDOPropertyList;
1104 begin
1105 Result := FType.getProperties();
1106 end;
1107
TSDOBaseDataObject.getIntegernull1108 function TSDOBaseDataObject.getInteger(const AProperty: ISDOProperty): TSDOInteger;
1109 var
1110 prp : ISDOPropertyEx;
1111 begin
1112 if ( AProperty = nil ) or
1113 ( not Self.IsOwnerOf(AProperty) ) or
1114 ( AProperty.isMany() )
1115 then begin
1116 raise ESDOIllegalArgumentException.Create('AProperty');
1117 end;
1118 prp := AProperty as ISDOPropertyEx;
1119 Result := getField(prp.getTypeEnum()).getInteger(FBuffer,prp.getBufferOffset());
1120 end;
1121
TSDOBaseDataObject.getIntegernull1122 function TSDOBaseDataObject.getInteger(const APropertyIndex: PtrUInt): TSDOInteger;
1123 begin
1124 Result := getInteger(getProperty(APropertyIndex));
1125 end;
1126
TSDOBaseDataObject.getIntegernull1127 function TSDOBaseDataObject.getInteger(const APath: string): TSDOInteger;
1128 var
1129 locCtx : TXPathExecContext;
1130 begin
1131 locCtx := parsePropertyPath(APath);
1132 if ( locCtx.PropertyOwner = nil ) then
1133 raise ESDOInvalidPathException.Create(APath);
1134 if ( locCtx.ContentKind = xckList ) then
1135 Result := locCtx.ListItem.getInteger()
1136 else
1137 Result := locCtx.PropertyOwner.getInteger(locCtx.CurrentProperty);
1138 end;
1139
getLongnull1140 function TSDOBaseDataObject.getLong(const AProperty: ISDOProperty): TSDOLong;
1141 var
1142 prp : ISDOPropertyEx;
1143 begin
1144 if ( AProperty = nil ) or
1145 ( not Self.IsOwnerOf(AProperty) ) or
1146 ( AProperty.isMany() )
1147 then begin
1148 raise ESDOIllegalArgumentException.Create('AProperty');
1149 end;
1150 prp := AProperty as ISDOPropertyEx;
1151 Result := getField(prp.getTypeEnum()).getLong(FBuffer,prp.getBufferOffset());
1152 end;
1153
getLongnull1154 function TSDOBaseDataObject.getLong(const APropertyIndex: PtrUInt): TSDOLong;
1155 begin
1156 Result := getLong(getProperty(APropertyIndex));
1157 end;
1158
getLongnull1159 function TSDOBaseDataObject.getLong(const APath: string): TSDOLong;
1160 var
1161 locCtx : TXPathExecContext;
1162 begin
1163 locCtx := parsePropertyPath(APath);
1164 if ( locCtx.PropertyOwner = nil ) then
1165 raise ESDOInvalidPathException.Create(APath);
1166 if ( locCtx.ContentKind = xckList ) then
1167 Result := locCtx.ListItem.getLong()
1168 else
1169 Result := locCtx.PropertyOwner.getLong(locCtx.CurrentProperty);
1170 end;
1171
getPropertynull1172 function TSDOBaseDataObject.getProperty(const AIndex: PtrUInt): ISDOProperty;
1173 begin
1174 Result := getInstanceProperties().getItem(AIndex);//FType.getProperty(AIndex);
1175 end;
1176
getPropertynull1177 function TSDOBaseDataObject.getProperty(const AProp: string): ISDOProperty;
1178 begin
1179 Result := getInstanceProperties().find(AProp);
1180 if ( Result = nil ) then
1181 raise ESDOPropertyNotFoundException.Create(AProp);
1182 end;
1183
getPropertyIndexnull1184 function TSDOBaseDataObject.getPropertyIndex(const AProperty: ISDOProperty): PtrInt;
1185 begin
1186 Result := FType.getPropertyIndex(AProperty.getName());
1187 end;
1188
getShortnull1189 function TSDOBaseDataObject.getShort(const APropertyIndex: PtrUInt): TSDOShort;
1190 begin
1191 Result := getShort(getProperty(APropertyIndex));
1192 end;
1193
getShortnull1194 function TSDOBaseDataObject.getShort(const APath: string): TSDOShort;
1195 var
1196 locCtx : TXPathExecContext;
1197 begin
1198 locCtx := parsePropertyPath(APath);
1199 if ( locCtx.PropertyOwner = nil ) then
1200 raise ESDOInvalidPathException.Create(APath);
1201 if ( locCtx.ContentKind = xckList ) then
1202 Result := locCtx.ListItem.getShort()
1203 else
1204 Result := locCtx.PropertyOwner.getShort(locCtx.CurrentProperty);
1205 end;
1206
getShortnull1207 function TSDOBaseDataObject.getShort(const AProperty: ISDOProperty): TSDOShort;
1208 var
1209 prp : ISDOPropertyEx;
1210 begin
1211 if ( AProperty = nil ) or
1212 ( not Self.IsOwnerOf(AProperty) ) or
1213 ( AProperty.isMany() )
1214 then begin
1215 raise ESDOIllegalArgumentException.Create('AProperty');
1216 end;
1217 prp := AProperty as ISDOPropertyEx;
1218 Result := getField(prp.getTypeEnum()).getShort(FBuffer,prp.getBufferOffset());
1219 end;
1220
TSDOBaseDataObject.getStringnull1221 function TSDOBaseDataObject.getString(const AProperty: ISDOProperty): TSDOString;
1222 var
1223 prp : ISDOPropertyEx;
1224 begin
1225 if ( AProperty = nil ) or
1226 ( not Self.IsOwnerOf(AProperty) ) or
1227 ( AProperty.isMany() )
1228 then begin
1229 raise ESDOIllegalArgumentException.Create('AProperty');
1230 end;
1231 prp := AProperty as ISDOPropertyEx;
1232 Result := getField(prp.getTypeEnum()).getString(FBuffer,prp.getBufferOffset());
1233 end;
1234
TSDOBaseDataObject.getStringnull1235 function TSDOBaseDataObject.getString(const APropertyIndex: PtrUInt): TSDOString;
1236 begin
1237 Result := getString(getProperty(APropertyIndex));
1238 end;
1239
TSDOBaseDataObject.getStringnull1240 function TSDOBaseDataObject.getString(const APath: string): TSDOString;
1241 var
1242 locCtx : TXPathExecContext;
1243 begin
1244 locCtx := parsePropertyPath(APath);
1245 if ( locCtx.PropertyOwner = nil ) then
1246 raise ESDOInvalidPathException.Create(APath);
1247 if ( locCtx.ContentKind = xckList ) then
1248 Result := locCtx.ListItem.getString()
1249 else
1250 Result := locCtx.PropertyOwner.getString(locCtx.CurrentProperty);
1251 end;
1252
getTypenull1253 function TSDOBaseDataObject.getType() : ISDOType;
1254 begin
1255 Result := FType as ISDOType;
1256 end;
1257
TSDOBaseDataObject.getTypeEnumnull1258 function TSDOBaseDataObject.getTypeEnum() : TSDOTypeKind;
1259 begin
1260 Result := FType.getTypeEnum();
1261 end;
1262
TSDOBaseDataObject.isNullnull1263 function TSDOBaseDataObject.isNull(const APath: string): Boolean;
1264 var
1265 locCtx : TXPathExecContext;
1266 begin
1267 locCtx := parsePropertyPath(APath);
1268 if ( locCtx.PropertyOwner = nil ) then
1269 raise ESDOInvalidPathException.Create(APath);
1270 case locCtx.ContentKind of
1271 xckNull : Result := True;
1272 xckObject : Result := False;
1273 xckList :
1274 begin
1275 Result := locCtx.CurrentProperty.getType().isDataObjectType and ( locCtx.ListItem.getDataObject() = nil );
1276 end;
1277 xckValue : Result := locCtx.ObjectItem.isNull(locCtx.CurrentProperty);
1278 else
1279 Result := False;
1280 end;
1281 end;
1282
TSDOBaseDataObject.isNullnull1283 function TSDOBaseDataObject.isNull(const AProperty: ISDOProperty): Boolean;
1284 var
1285 prp : ISDOPropertyEx;
1286 begin
1287 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
1288 raise ESDOIllegalArgumentException.Create('AProperty');
1289 if AProperty.isMany() then begin
1290 Result := ( getList(AProperty).size > 0 );
1291 end else begin
1292 prp := AProperty as ISDOPropertyEx;
1293 Result := getField(prp.getTypeEnum()).isNull(FBuffer,prp.getBufferOffset());
1294 end;
1295 end;
1296
TSDOBaseDataObject.isNullnull1297 function TSDOBaseDataObject.isNull(const APropertyIndex: PtrUInt): Boolean;
1298 begin
1299 Result := isNull(getProperty(APropertyIndex));
1300 end;
1301
isSetnull1302 function TSDOBaseDataObject.isSet(const APropertyIndex: PtrUInt): Boolean;
1303 begin
1304 Result := isSet(getProperty(APropertyIndex));
1305 end;
1306
isSetnull1307 function TSDOBaseDataObject.isSet(const APath: string): Boolean;
1308 var
1309 locCtx : TXPathExecContext;
1310 begin
1311 locCtx := parsePropertyPath(APath);
1312 if ( locCtx.PropertyOwner = nil ) then
1313 raise ESDOInvalidPathException.Create(APath);
1314 case locCtx.ContentKind of
1315 xckNull : Result := not locCtx.PropertyOwner.getType().isDataObjectType();
1316 xckObject : Result := locCtx.PropertyOwner.isSet(locCtx.CurrentProperty);
1317 xckList : Result := ( locCtx.ListItem.size() > 0 );
1318 xckValue : Result := locCtx.ObjectItem.isSet(locCtx.CurrentProperty);
1319 else
1320 Result := False;
1321 end;
1322 end;
1323
isSetnull1324 function TSDOBaseDataObject.isSet(const AProperty: ISDOProperty): Boolean;
1325 var
1326 prp : ISDOPropertyEx;
1327 begin
1328 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
1329 raise ESDOIllegalArgumentException.Create('AProperty');
1330 if AProperty.isMany() then begin
1331 Result := ( getList(AProperty).size > 0 );
1332 end else begin
1333 prp := AProperty as ISDOPropertyEx;
1334 Result := getField(prp.getTypeEnum()).isSet(FBuffer,prp.getBufferOffset());
1335 end;
1336 end;
1337
1338 procedure TSDOBaseDataObject.setBoolean(const APropertyIndex: PtrUInt;const AValue: TSDOBoolean);
1339 begin
1340 setBoolean(getProperty(APropertyIndex),AValue);
1341 end;
1342
1343 procedure TSDOBaseDataObject.PrepareDataBuffer();
1344 var
1345 prpCount : PtrInt;
1346 prpList : ISDOPropertyList;
1347 csPrp : ISDOPropertyEx;
1348
1349 procedure InitializeListsBuffer();
1350 var
1351 k : PtrInt;
1352 locPrp : ISDOPropertyEx;
1353 locBuffer : PPSDODataObjectList;
1354 begin
1355 for k := 0 to Pred(prpCount) do begin
1356 locPrp := prpList.getItem(k) as ISDOPropertyEx;
1357 if locPrp.isMany() then begin
1358 locBuffer := PPSDODataObjectList( PtrUInt(FBuffer) + locPrp.getBufferOffset() );
1359 GetMem(locBuffer^,SizeOf(Pointer));
1360 FillChar(locBuffer^^,SizeOf(ISDODataObjectList),#0);
1361 locBuffer^^ := CreateList(locPrp);
1362 end;
1363 end;
1364 end;
1365
1366 procedure InitChangeSummary();
1367 var
1368 locStore : ISDOChangedDataObjectList;
1369 locCS : ISDOChangeSummary;
1370 locCSX : ISDOChangeSummaryEx;
1371 begin
1372 locStore := TSDOChangedDataObjectList.Create() as ISDOChangedDataObjectList;
1373 locCSX := TSDOChangeSummary.Create(locStore) as ISDOChangeSummaryEx;//ISDOChangeSummaryEx
1374 FChangeSummary := Pointer(locCSX);
1375 locCS := locCSX as ISDOChangeSummary;
1376 getField(ChangeSummaryType).setChangeSummary(FBuffer,csPrp.getBufferOffset(),locCS);
1377 end;
1378
1379 var
1380 i, loc_fieldAddress : PtrUInt;
1381 prp : ISDOPropertyEx;
1382 prpType : ISDOTypeEx;
1383 prpStorageLength : PtrUInt;
1384 multiPrpCount : PtrInt;
1385 begin
1386 csPrp := nil;
1387 prpList := getType().getProperties();
1388 prpCount := prpList.getCount();
1389 FBufferLength := 0;
1390 loc_fieldAddress := 0;
1391 multiPrpCount := 0;
1392 if ( prpCount > 0 ) then begin
1393 { TODO -oInoussa :
1394 The property BufferOffset computation should be moved to the type
1395 definition and done _only once_ }
1396 for i := 0 to Pred(prpCount) do begin
1397 prp := prpList.getItem(i) as ISDOPropertyEx;
1398 if prp.isMany() then begin
1399 prpStorageLength := SizeOf(Pointer);
1400 Inc(multiPrpCount);
1401 end else begin
1402 prpType := prp.getType() as ISDOTypeEx;
1403 prpStorageLength := prpType.getFieldSize();
1404 if ( csPrp = nil ) and prpType.isChangeSummaryType() then
1405 csPrp := prp;
1406 end;
1407 Inc(FBufferLength,prpStorageLength);
1408 loc_fieldAddress := prp.setBufferOffset(loc_fieldAddress);
1409 end;
1410 GetMem(FBuffer,FBufferLength);
1411 FillChar(FBuffer^,FBufferLength,#0);
1412 if ( multiPrpCount > 0 ) then
1413 InitializeListsBuffer();
1414 if ( csPrp <> nil ) then
1415 InitChangeSummary();
1416 end;
1417 end;
1418
1419 procedure TSDOBaseDataObject.setBoolean(
1420 const AProperty: ISDOProperty;
1421 const AValue: TSDOBoolean
1422 );
1423 var
1424 prp : ISDOPropertyEx;
1425 begin
1426 if ( AProperty = nil ) or
1427 ( not Self.IsOwnerOf(AProperty) ) or
1428 ( AProperty.isMany() )
1429 then begin
1430 raise ESDOIllegalArgumentException.Create('AProperty');
1431 end;
1432 prp := AProperty as ISDOPropertyEx;
1433 RecordChange(AProperty);
1434 getField(prp.getTypeEnum()).setBoolean(FBuffer,prp.getBufferOffset(),AValue);
1435 end;
1436
1437 procedure TSDOBaseDataObject.setBoolean(const APath: string; const AValue: TSDOBoolean);
1438 var
1439 locCtx : TXPathExecContext;
1440 begin
1441 locCtx := parsePropertyPath(APath);
1442 if ( locCtx.PropertyOwner = nil ) then
1443 raise ESDOInvalidPathException.Create(APath);
1444 if ( locCtx.ContentKind = xckList ) then
1445 locCtx.ListItem.setBoolean(AValue)
1446 else
1447 locCtx.PropertyOwner.setBoolean(locCtx.CurrentProperty,AValue);
1448 end;
1449
1450 procedure TSDOBaseDataObject.setByte(
1451 const APath: string;
1452 const AValue: TSDOByte
1453 );
1454 var
1455 locCtx : TXPathExecContext;
1456 begin
1457 locCtx := parsePropertyPath(APath);
1458 if ( locCtx.PropertyOwner = nil ) then
1459 raise ESDOInvalidPathException.Create(APath);
1460 if ( locCtx.ContentKind = xckList ) then
1461 locCtx.ListItem.setByte(AValue)
1462 else
1463 locCtx.PropertyOwner.setByte(locCtx.CurrentProperty,AValue);
1464 end;
1465
1466 procedure TSDOBaseDataObject.setByte(
1467 const AProperty: ISDOProperty;
1468 const AValue: TSDOByte
1469 );
1470 var
1471 prp : ISDOPropertyEx;
1472 begin
1473 if ( AProperty = nil ) or
1474 ( not Self.IsOwnerOf(AProperty) ) or
1475 ( AProperty.isMany() )
1476 then begin
1477 raise ESDOIllegalArgumentException.Create('AProperty');
1478 end;
1479 prp := AProperty as ISDOPropertyEx;
1480 RecordChange(AProperty);
1481 getField(prp.getTypeEnum()).setByte(FBuffer,prp.getBufferOffset(),AValue);
1482 end;
1483
1484 procedure TSDOBaseDataObject.setByte(
1485 const APropertyIndex: PtrUInt;
1486 const AValue: TSDOByte
1487 );
1488 begin
1489 setByte(getProperty(APropertyIndex),AValue);
1490 end;
1491
1492 {$IFDEF HAS_SDO_BYTES}
1493 procedure TSDOBaseDataObject.setBytes(const AProperty: ISDOProperty; AValue: TSDOBytes);
1494 var
1495 prp : ISDOPropertyEx;
1496 begin
1497 if ( AProperty = nil ) or
1498 ( not Self.IsOwnerOf(AProperty) ) or
1499 ( AProperty.isMany() )
1500 then begin
1501 raise ESDOIllegalArgumentException.Create('AProperty');
1502 end;
1503 prp := AProperty as ISDOPropertyEx;
1504 RecordChange(AProperty);
1505 getField(prp.getTypeEnum()).setBytes(FBuffer,prp.getBufferOffset(),AValue);
1506 end;
1507
1508 procedure TSDOBaseDataObject.setBytes(const APropertyIndex: PtrUInt; AValue : TSDOBytes);
1509 begin
1510 setBytes(getProperty(APropertyIndex),AValue);
1511 end;
1512
1513 procedure TSDOBaseDataObject.setBytes(const APath: string; AValue : TSDOBytes);
1514 var
1515 locCtx : TXPathExecContext;
1516 begin
1517 locCtx := parsePropertyPath(APath);
1518 if ( locCtx.PropertyOwner = nil ) then
1519 raise ESDOInvalidPathException.Create(APath);
1520 if ( locCtx.ContentKind = xckList ) then
1521 locCtx.ListItem.setBytes(AValue)
1522 else
1523 locCtx.PropertyOwner.setBytes(locCtx.CurrentProperty,AValue);
1524 end;
1525 {$ENDIF HAS_SDO_BYTES}
1526
1527 procedure TSDOBaseDataObject.setCharacter(const AProperty: ISDOProperty; const AValue: TSDOChar);
1528 var
1529 prp : ISDOPropertyEx;
1530 begin
1531 if ( AProperty = nil ) or
1532 ( not Self.IsOwnerOf(AProperty) ) or
1533 ( AProperty.isMany() )
1534 then begin
1535 raise ESDOIllegalArgumentException.Create('AProperty');
1536 end;
1537 prp := AProperty as ISDOPropertyEx;
1538 RecordChange(AProperty);
1539 getField(prp.getTypeEnum()).setCharacter(FBuffer,prp.getBufferOffset(),AValue);
1540 end;
1541
1542 procedure TSDOBaseDataObject.setCharacter(const APropertyIndex: PtrUInt; const AValue: TSDOChar);
1543 begin
1544 setCharacter(getProperty(APropertyIndex),AValue);
1545 end;
1546
1547 procedure TSDOBaseDataObject.setCharacter(const APath: string; const AValue: TSDOChar);
1548 var
1549 locCtx : TXPathExecContext;
1550 begin
1551 locCtx := parsePropertyPath(APath);
1552 if ( locCtx.PropertyOwner = nil ) then
1553 raise ESDOInvalidPathException.Create(APath);
1554 if ( locCtx.ContentKind = xckList ) then
1555 locCtx.ListItem.setCharacter(AValue)
1556 else
1557 locCtx.PropertyOwner.setCharacter(locCtx.CurrentProperty,AValue);
1558 end;
1559
1560 {$IFDEF HAS_SDO_CURRENCY}
1561 procedure TSDOBaseDataObject.setCurrency(const AProperty: ISDOProperty; const AValue: TSDOCurrency);
1562 var
1563 prp : ISDOPropertyEx;
1564 begin
1565 if ( AProperty = nil ) or
1566 ( not Self.IsOwnerOf(AProperty) ) or
1567 ( AProperty.isMany() )
1568 then begin
1569 raise ESDOIllegalArgumentException.Create('AProperty');
1570 end;
1571 prp := AProperty as ISDOPropertyEx;
1572 RecordChange(AProperty);
1573 getField(prp.getTypeEnum()).setCurrency(FBuffer,prp.getBufferOffset(),AValue);
1574 end;
1575
1576 procedure TSDOBaseDataObject.setCurrency(const APropertyIndex: PtrUInt; const AValue: TSDOCurrency);
1577 begin
1578 setCurrency(getProperty(APropertyIndex),AValue);
1579 end;
1580
1581 procedure TSDOBaseDataObject.setCurrency(const APath: string; const AValue: TSDOCurrency);
1582 var
1583 locCtx : TXPathExecContext;
1584 begin
1585 locCtx := parsePropertyPath(APath);
1586 if ( locCtx.PropertyOwner = nil ) then
1587 raise ESDOInvalidPathException.Create(APath);
1588 if ( locCtx.ContentKind = xckList ) then
1589 locCtx.ListItem.setCurrency(AValue)
1590 else
1591 locCtx.PropertyOwner.setCurrency(locCtx.CurrentProperty,AValue);
1592 end;
1593 {$ENDIF HAS_SDO_CURRENCY}
1594
1595 procedure TSDOBaseDataObject.setDataObject(
1596 const APath: string;
1597 AValue: ISDODataObject
1598 );
1599 var
1600 locCtx : TXPathExecContext;
1601 begin
1602 locCtx := parsePropertyPath(APath);
1603 if ( locCtx.PropertyOwner = nil ) then
1604 raise ESDOInvalidPathException.Create(APath);
1605 if ( locCtx.ContentKind = xckList ) then
1606 locCtx.ListItem.setDataObject(AValue)
1607 else
1608 locCtx.PropertyOwner.setDataObject(locCtx.CurrentProperty,AValue);
1609 end;
1610
1611 procedure TSDOBaseDataObject.setDataObject(
1612 const APropertyIndex: PtrUInt;
1613 AValue: ISDODataObject
1614 );
1615 begin
1616 setDataObject(getProperty(APropertyIndex),AValue);
1617 end;
1618
1619 procedure TSDOBaseDataObject.setDataObject(
1620 const AProperty: ISDOProperty;
1621 AValue: ISDODataObject
1622 );
1623 var
1624 prp : ISDOPropertyEx;
1625 fld : ISDOField;
1626 oldObj, newObj : ISDODataObjectEx;
1627 off : PtrInt;
1628 selfIntf, oldContainer : ISDODataObject;
1629 begin
1630 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
1631 raise ESDOIllegalArgumentException.Create('AProperty');
1632
1633 if AProperty.isMany() then begin
1634 getList(AProperty).setDataObject(AValue);
1635 end else begin
1636 prp := AProperty as ISDOPropertyEx;
1637 selfIntf := Self as ISDODataObject;
1638 if ( AValue <> nil ) then begin
1639 newObj := AValue as ISDODataObjectEx;
1640 if not newObj.IsInstanceOf(prp.getType()) then
1641 raise ESDOIllegalArgumentException.Create('AProperty');
1642 if prp.isContainment() then begin
1643 if newObj.IsAncestorOf(selfIntf) then
1644 raise ESDOCycleContainmentException.Create('AValue');
1645 end;
1646 end;
1647
1648 fld := getField(prp.getTypeEnum());
1649 off := prp.getBufferOffset();
1650
1651 oldObj := fld.getDataObject(FBuffer,off) as ISDODataObjectEx;
1652 if Assigned(oldObj) then begin
1653 if prp.isContainment() then
1654 oldObj.setContainer(nil,nil);
1655 if prp.isReference() then
1656 oldObj.RemoveReference(selfIntf,AProperty);
1657 end;
1658
1659 RecordChange(AProperty);
1660 if ( AValue <> nil ) then begin
1661 if prp.isContainment() then begin
1662 oldContainer := newObj.getContainer();
1663 if Assigned(oldContainer) then
1664 oldContainer.setDataObject(newObj.getContainmentProperty(),nil);
1665 end;
1666 fld.setDataObject(FBuffer,off,AValue);
1667 if prp.isContainment() then
1668 newObj.setContainer(selfIntf,AProperty);
1669 if prp.isReference() then
1670 newObj.AddReference(selfIntf,AProperty);
1671 end else begin;
1672 fld.setDataObject(FBuffer,off,nil);
1673 end;
1674 end;
1675 end;
1676
1677 procedure TSDOBaseDataObject.setDate(const AProperty: ISDOProperty; const AValue: TSDODate);
1678 var
1679 prp : ISDOPropertyEx;
1680 begin
1681 if ( AProperty = nil ) or
1682 ( not Self.IsOwnerOf(AProperty) ) or
1683 ( AProperty.isMany() )
1684 then begin
1685 raise ESDOIllegalArgumentException.Create('AProperty');
1686 end;
1687 prp := AProperty as ISDOPropertyEx;
1688 RecordChange(AProperty);
1689 getField(prp.getTypeEnum()).setDate(FBuffer,prp.getBufferOffset(),AValue);
1690 end;
1691
1692 procedure TSDOBaseDataObject.setDate(const APropertyIndex: PtrUInt; const AValue: TSDODate);
1693 begin
1694 setDate(getProperty(APropertyIndex),AValue);
1695 end;
1696
1697 procedure TSDOBaseDataObject.setDate(const APath: string; const AValue: TSDODate);
1698 var
1699 locCtx : TXPathExecContext;
1700 begin
1701 locCtx := parsePropertyPath(APath);
1702 if ( locCtx.PropertyOwner = nil ) then
1703 raise ESDOInvalidPathException.Create(APath);
1704 if ( locCtx.ContentKind = xckList ) then
1705 locCtx.ListItem.setDate(AValue)
1706 else
1707 locCtx.PropertyOwner.setDate(locCtx.CurrentProperty,AValue);
1708 end;
1709
1710 {$IFDEF HAS_SDO_DOUBLE}
1711 procedure TSDOBaseDataObject.setDouble(const AProperty: ISDOProperty; const AValue: TSDODouble);
1712 var
1713 prp : ISDOPropertyEx;
1714 begin
1715 if ( AProperty = nil ) or
1716 ( not Self.IsOwnerOf(AProperty) ) or
1717 ( AProperty.isMany() )
1718 then begin
1719 raise ESDOIllegalArgumentException.Create('AProperty');
1720 end;
1721 prp := AProperty as ISDOPropertyEx;
1722 RecordChange(AProperty);
1723 getField(prp.getTypeEnum()).setDouble(FBuffer,prp.getBufferOffset(),AValue);
1724 end;
1725
1726 procedure TSDOBaseDataObject.setDouble(const APropertyIndex: PtrUInt; const AValue: TSDODouble);
1727 begin
1728 setDouble(getProperty(APropertyIndex),AValue);
1729 end;
1730
1731 procedure TSDOBaseDataObject.setDouble(const APath: string; const AValue: TSDODouble);
1732 var
1733 locCtx : TXPathExecContext;
1734 begin
1735 locCtx := parsePropertyPath(APath);
1736 if ( locCtx.PropertyOwner = nil ) then
1737 raise ESDOInvalidPathException.Create(APath);
1738 if ( locCtx.ContentKind = xckList ) then
1739 locCtx.ListItem.setDouble(AValue)
1740 else
1741 locCtx.PropertyOwner.setDouble(locCtx.CurrentProperty,AValue);
1742 end;
1743 {$ENDIF HAS_SDO_DOUBLE}
1744
1745 {$IFDEF HAS_SDO_FLOAT}
1746 procedure TSDOBaseDataObject.setFloat(const AProperty: ISDOProperty; const AValue: TSDOFloat);
1747 var
1748 prp : ISDOPropertyEx;
1749 begin
1750 if ( AProperty = nil ) or
1751 ( not Self.IsOwnerOf(AProperty) ) or
1752 ( AProperty.isMany() )
1753 then begin
1754 raise ESDOIllegalArgumentException.Create('AProperty');
1755 end;
1756 prp := AProperty as ISDOPropertyEx;
1757 RecordChange(AProperty);
1758 getField(prp.getTypeEnum()).setFloat(FBuffer,prp.getBufferOffset(),AValue);
1759 end;
1760
1761 procedure TSDOBaseDataObject.setFloat(const APropertyIndex: PtrUInt; const AValue: TSDOFloat);
1762 begin
1763 setFloat(getProperty(APropertyIndex),AValue);
1764 end;
1765
1766 procedure TSDOBaseDataObject.setFloat(const APath: string; const AValue: TSDOFloat);
1767 var
1768 locCtx : TXPathExecContext;
1769 begin
1770 locCtx := parsePropertyPath(APath);
1771 if ( locCtx.PropertyOwner = nil ) then
1772 raise ESDOInvalidPathException.Create(APath);
1773 if ( locCtx.ContentKind = xckList ) then
1774 locCtx.ListItem.setFloat(AValue)
1775 else
1776 locCtx.PropertyOwner.setFloat(locCtx.CurrentProperty,AValue);
1777 end;
1778 {$ENDIF HAS_SDO_FLOAT}
1779
1780 procedure TSDOBaseDataObject.setInteger(
1781 const APath: string;
1782 const AValue: TSDOInteger
1783 );
1784 var
1785 locCtx : TXPathExecContext;
1786 begin
1787 locCtx := parsePropertyPath(APath);
1788 if ( locCtx.PropertyOwner = nil ) then
1789 raise ESDOInvalidPathException.Create(APath);
1790 if ( locCtx.ContentKind = xckList ) then
1791 locCtx.ListItem.setInteger(AValue)
1792 else
1793 locCtx.PropertyOwner.setInteger(locCtx.CurrentProperty,AValue);
1794 end;
1795
1796 procedure TSDOBaseDataObject.setInteger(
1797 const APropertyIndex: PtrUInt;
1798 const AValue: TSDOInteger
1799 );
1800 begin
1801 setInteger(getProperty(APropertyIndex),AValue);
1802 end;
1803
1804 procedure TSDOBaseDataObject.setInteger(
1805 const AProperty: ISDOProperty;
1806 const AValue: TSDOInteger
1807 );
1808 var
1809 prp : ISDOPropertyEx;
1810 begin
1811 if ( AProperty = nil ) or
1812 ( not Self.IsOwnerOf(AProperty) ) or
1813 ( AProperty.isMany() )
1814 then begin
1815 raise ESDOIllegalArgumentException.Create('AProperty');
1816 end;
1817 prp := AProperty as ISDOPropertyEx;
1818 RecordChange(AProperty);
1819 getField(prp.getTypeEnum()).setInteger(FBuffer,prp.getBufferOffset(),AValue);
1820 end;
1821
1822 procedure TSDOBaseDataObject.setLong(const APath: string; const AValue: TSDOLong);
1823 var
1824 locCtx : TXPathExecContext;
1825 begin
1826 locCtx := parsePropertyPath(APath);
1827 if ( locCtx.PropertyOwner = nil ) then
1828 raise ESDOInvalidPathException.Create(APath);
1829 if ( locCtx.ContentKind = xckList ) then
1830 locCtx.ListItem.setLong(AValue)
1831 else
1832 locCtx.PropertyOwner.setLong(locCtx.CurrentProperty,AValue);
1833 end;
1834
1835 procedure TSDOBaseDataObject.setLong(const APropertyIndex: PtrUInt; const AValue: TSDOLong);
1836 begin
1837 setLong(getProperty(APropertyIndex),AValue);
1838 end;
1839
1840 procedure TSDOBaseDataObject.setLong(const AProperty: ISDOProperty; const AValue: TSDOLong);
1841 var
1842 prp : ISDOPropertyEx;
1843 begin
1844 if ( AProperty = nil ) or
1845 ( not Self.IsOwnerOf(AProperty) ) or
1846 ( AProperty.isMany() )
1847 then begin
1848 raise ESDOIllegalArgumentException.Create('AProperty');
1849 end;
1850 prp := AProperty as ISDOPropertyEx;
1851 RecordChange(AProperty);
1852 getField(prp.getTypeEnum()).setLong(FBuffer,prp.getBufferOffset(),AValue);
1853 end;
1854
1855 procedure TSDOBaseDataObject.setNull(const AProperty: ISDOProperty);
1856 var
1857 prp : ISDOPropertyEx;
1858 oldObj : ISDODataObjectEx;
1859 selfIntf : ISDODataObject;
1860 fld : ISDOField;
1861 off : PtrInt;
1862 begin
1863 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
1864 raise ESDOIllegalArgumentException.Create('AProperty');
1865 RecordChange(AProperty);
1866
1867 if AProperty.isMany() then begin
1868 ClearList(getList(AProperty));
1869 end else begin
1870 prp := AProperty as ISDOPropertyEx;
1871 fld := getField(prp.getTypeEnum());
1872 off := prp.getBufferOffset();
1873 if prp.getType().isDataObjectType() then begin
1874 oldObj := fld.getDataObject(FBuffer,off) as ISDODataObjectEx;
1875 if Assigned(oldObj) then begin
1876 if prp.isContainment() then
1877 oldObj.setContainer(nil,nil);
1878 if prp.isReference() then begin
1879 selfIntf := Self as ISDODataObject;
1880 oldObj.RemoveReference(selfIntf,AProperty);
1881 end;
1882 end;
1883 end;
1884 fld.setNull(FBuffer,off);
1885 end;
1886 end;
1887
1888 procedure TSDOBaseDataObject.setNull(const APropertyIndex: PtrUInt);
1889 begin
1890 setNull(getProperty(APropertyIndex));
1891 end;
1892
1893 procedure TSDOBaseDataObject.setNull(const APath: string);
1894 var
1895 locCtx : TXPathExecContext;
1896 begin
1897 locCtx := parsePropertyPath(APath);
1898 if ( locCtx.PropertyOwner = nil ) then
1899 raise ESDOInvalidPathException.Create(APath);
1900 locCtx.PropertyOwner.setNull(locCtx.CurrentProperty);
1901 end;
1902
1903 procedure TSDOBaseDataObject.setShort(const APath: string; const AValue: TSDOShort);
1904 var
1905 locCtx : TXPathExecContext;
1906 begin
1907 locCtx := parsePropertyPath(APath);
1908 if ( locCtx.PropertyOwner = nil ) then
1909 raise ESDOInvalidPathException.Create(APath);
1910 if ( locCtx.ContentKind = xckList ) then
1911 locCtx.ListItem.setShort(AValue)
1912 else
1913 locCtx.PropertyOwner.setShort(locCtx.CurrentProperty,AValue);
1914 end;
1915
1916 procedure TSDOBaseDataObject.setShort(const APropertyIndex: PtrUInt; const AValue: TSDOShort);
1917 begin
1918 setShort(getProperty(APropertyIndex),AValue);
1919 end;
1920
1921 procedure TSDOBaseDataObject.setShort(const AProperty: ISDOProperty; const AValue: TSDOShort);
1922 var
1923 prp : ISDOPropertyEx;
1924 begin
1925 if ( AProperty = nil ) or
1926 ( not Self.IsOwnerOf(AProperty) ) or
1927 ( AProperty.isMany() )
1928 then begin
1929 raise ESDOIllegalArgumentException.Create('AProperty');
1930 end;
1931 prp := AProperty as ISDOPropertyEx;
1932 RecordChange(AProperty);
1933 getField(prp.getTypeEnum()).setShort(FBuffer,prp.getBufferOffset(),AValue);
1934 end;
1935
1936 procedure TSDOBaseDataObject.setString(const APath: string; const AValue: TSDOString);
1937 var
1938 locCtx : TXPathExecContext;
1939 begin
1940 locCtx := parsePropertyPath(APath);
1941 if ( locCtx.PropertyOwner = nil ) then
1942 raise ESDOInvalidPathException.Create(APath);
1943 if ( locCtx.ContentKind = xckList ) then
1944 locCtx.ListItem.setString(AValue)
1945 else
1946 locCtx.PropertyOwner.setString(locCtx.CurrentProperty,AValue);
1947 end;
1948
1949 procedure TSDOBaseDataObject.setString(
1950 const APropertyIndex: PtrUInt;
1951 const AValue: TSDOString
1952 );
1953 begin
1954 setString(getProperty(APropertyIndex),AValue);
1955 end;
1956
1957 procedure TSDOBaseDataObject.setString(
1958 const AProperty: ISDOProperty;
1959 const AValue: TSDOString
1960 );
1961 var
1962 prp : ISDOPropertyEx;
1963 begin
1964 if ( AProperty = nil ) or
1965 ( not Self.IsOwnerOf(AProperty) ) or
1966 ( AProperty.isMany() )
1967 then begin
1968 raise ESDOIllegalArgumentException.Create('AProperty');
1969 end;
1970 prp := AProperty as ISDOPropertyEx;
1971 RecordChange(AProperty);
1972 getField(prp.getTypeEnum()).setString(FBuffer,prp.getBufferOffset(),AValue);
1973 end;
1974
1975 procedure TSDOBaseDataObject.unset(const APath: string);
1976 var
1977 locCtx : TXPathExecContext;
1978 begin
1979 locCtx := parsePropertyPath(APath);
1980 if ( locCtx.PropertyOwner = nil ) then
1981 raise ESDOInvalidPathException.Create(APath);
1982 locCtx.PropertyOwner.unset(locCtx.CurrentProperty);
1983 end;
1984
1985 procedure TSDOBaseDataObject.unset(const APropertyIndex: PtrUInt);
1986 begin
1987 unset(getProperty(APropertyIndex));
1988 end;
1989
1990 procedure TSDOBaseDataObject.unset(const AProperty: ISDOProperty);
1991 var
1992 prp : ISDOPropertyEx;
1993 fld : ISDOField;
1994 typeKind : TSDOTypeKind;
1995 off : PtrInt;
1996 oldObj : ISDODataObjectEx;
1997 selfIntf : ISDODataObject;
1998 begin
1999 if ( AProperty = nil ) or ( not Self.IsOwnerOf(AProperty) ) then
2000 raise ESDOIllegalArgumentException.Create('AProperty');
2001 if AProperty.getType().isChangeSummaryType() then
2002 raise ESDOIllegalArgumentException.Create('AProperty');
2003 RecordChange(AProperty);
2004 if AProperty.isMany() then begin
2005 ClearList(getList(AProperty));
2006 end else begin
2007 prp := AProperty as ISDOPropertyEx;
2008 typeKind := prp.getTypeEnum();
2009 fld := getField(typeKind);
2010 off := prp.getBufferOffset();
2011 case typeKind of
2012 BooleanType : fld.setBoolean(FBuffer,off,prp.getBooleanDefault());
2013 ByteType : fld.setByte(FBuffer,off,prp.getByteDefault());
2014 {$IFDEF HAS_SDO_BYTES}
2015 BytesType : fld.setBytes(FBuffer,off,prp.getBytesDefault());
2016 {$ENDIF HAS_SDO_BYTES}
2017 {$IFDEF HAS_SDO_CHAR}
2018 CharacterType : fld.setCharacter(FBuffer,off,prp.getCharacterDefault());
2019 {$ENDIF HAS_SDO_CHAR}
2020 {$IFDEF HAS_SDO_CURRENCY}
2021 CurrencyType : fld.setCurrency(FBuffer,off,prp.getCurrencyDefault());
2022 {$ENDIF HAS_SDO_CURRENCY}
2023 DateTimeType : fld.setDate(FBuffer,off,prp.getDateDefault());
2024 {$IFDEF HAS_SDO_DOUBLE}
2025 DoubleType : fld.setDouble(FBuffer,off,prp.getDoubleDefault());
2026 {$ENDIF HAS_SDO_DOUBLE}
2027 {$IFDEF HAS_SDO_FLOAT}
2028 FloatType : fld.setFloat(FBuffer,off,prp.getFloatDefault());
2029 {$ENDIF HAS_SDO_FLOAT}
2030 IntegerType : fld.setInteger(FBuffer,off,prp.getIntegerDefault());
2031 {$IFDEF HAS_SDO_LONG}
2032 LongType : fld.setLong(FBuffer,off,prp.getLongDefault());
2033 {$ENDIF HAS_SDO_LONG}
2034 {$IFDEF HAS_SDO_SHORT}
2035 ShortType : fld.setShort(FBuffer,off,prp.getShortDefault());
2036 {$ENDIF HAS_SDO_SHORT}
2037 StringType : fld.setString(FBuffer,off,prp.getStringDefault());
2038 ObjectType :
2039 begin
2040 if prp.getType().isDataObjectType() then begin
2041 oldObj := fld.getDataObject(FBuffer,off) as ISDODataObjectEx;
2042 if Assigned(oldObj) then begin
2043 if prp.isContainment() then
2044 oldObj.setContainer(nil,nil);
2045 if prp.isReference() then begin
2046 selfIntf := Self as ISDODataObject;
2047 oldObj.RemoveReference(selfIntf,AProperty);
2048 end;
2049 end;
2050 end;
2051 fld.setDataObject(FBuffer,off,nil);
2052 end;
2053 else
2054 raise ESDOUnsupportedOperationException.Create('NOT-IMPLEMENTED-YET');
2055 end;
2056 fld.unset(FBuffer,off);
2057 end;
2058 end;
2059
2060 procedure TSDOBaseDataObject.FreeBuffer();
2061 var
2062 prpCount , i: PtrInt;
2063 prpList : ISDOPropertyList;
2064 prp : ISDOProperty;
2065 prpX : ISDOPropertyEx;
2066 lstObjRef : PPSDODataObjectList;
2067 obj, selfIntf : ISDODataObject;
2068 objX : ISDODataObjectEx;
2069 crs : ILinkedListCursor;
2070 lstObj : ISDODataObjectList;
2071 begin
2072 if ( FBuffer <> nil ) then begin
2073 prpList := getInstanceProperties();
2074 prpCount := prpList.getCount();
2075 if ( prpCount > 0 ) then begin
2076 selfIntf := Self as ISDODataObject;
2077 for i := 0 to Pred(prpCount) do begin
2078 prp := prpList.getItem(i);
2079 prpX := prp as ISDOPropertyEx;
2080 if prpX.isMany() then begin
2081 lstObjRef := PPSDODataObjectList( PtrUInt(FBuffer) + prpX.getBufferOffset() );
2082 if prpX.getType().isDataObjectType() and prpX.isReference() then begin
2083 lstObj := lstObjRef^^;
2084 crs := lstObj.getCursor();
2085 crs.Reset();
2086 while crs.MoveNext() do begin
2087 obj := lstObj.getDataObject();
2088 if ( obj <> nil ) then begin
2089 objX := obj as ISDODataObjectEx;
2090 objX.RemoveReference(selfIntf,prp);
2091 objX := nil;
2092 obj := nil;
2093 end;
2094 end;
2095 end;
2096 lstObj := nil;
2097 lstObjRef^^ := nil;
2098 FreeMem(lstObjRef^,SizeOf(Pointer));
2099 end else begin
2100 if prpX.getType().isDataObjectType() and prpX.isReference() then begin
2101 obj := getField(prpX.getTypeEnum()).getDataObject(FBuffer,prpX.getBufferOffset());
2102 if ( obj <> nil ) then begin
2103 objX := obj as ISDODataObjectEx;
2104 objX.RemoveReference(selfIntf,prp);
2105 objX := nil;
2106 obj := nil;
2107 end;
2108 end;
2109 getField(prpX.getTypeEnum()).setNull(FBuffer,prpX.getBufferOffset());
2110 end;
2111 end;
2112 selfIntf := nil;
2113 FreeMem(FBuffer,FBufferLength);
2114 end;
2115 FBuffer := nil;
2116 FBufferLength := 0;
2117 end;
2118 end;
2119
TSDOBaseDataObject.parsePropertyPathnull2120 function TSDOBaseDataObject.parsePropertyPath(const APath: string): TXPathExecContext;
2121 var
2122 locSelf : ISDODataObject;
2123 begin
2124 FXPathExpression.SetRoot(ParseXPath(APath));
2125 locSelf := Self as ISDODataObject;
2126 FXPathProcessor.Context.SetObject(locSelf,nil);
2127 FXPathProcessor.Execute(FXPathExpression);
2128 if ( FXPathProcessor.Context.CurrentProperty = nil ) then
2129 raise ESDOInvalidPathException.Create(APath);
2130 Result := FXPathProcessor.Context;
2131 end;
2132
2133 procedure TSDOBaseDataObject.setContainer(
2134 const AContainer: ISDODataObject;
2135 const AContainerProperty: ISDOProperty
2136 );
2137 var
2138 locCS : ISDOChangeSummary;
2139 locCSx : ISDOChangeSummaryEx;
2140 locIsCreating : Boolean;
2141 begin
2142 if Assigned(AContainerProperty) then begin
2143 if not Assigned(AContainer) then
2144 raise ESDOIllegalArgumentException.Create('AContainer');
2145 if not sdo_utils.InheritsFrom(AContainer.getType(), AContainerProperty.getContainingType()) then //if ( AContainerProperty.getContainingType() <> AContainer.getType() ) then
2146 raise ESDOIllegalArgumentException.Create('AContainerProperty');
2147 end;
2148 if Self.IsAncestorOf(AContainer) then
2149 raise ESDOCycleContainmentException.Create('AContainer');
2150 if ( AContainer = nil ) and ( FContainer <> nil ) then begin
2151 //deleting the current object
2152 {NotifyReferencersForDeletion();
2153 NotifyContainedObjectsForDeletion(False); }
2154 if not getContainmentProperty().isMany() then begin
2155 locCS := getChangeSummary();
2156 if ( locCS <> nil ) and locCS.isLogging() then begin
2157 locCSx := locCS as ISDOChangeSummaryEx;
2158 locCSx.getRecorder().recordDeletion(Self as ISDODataObject);
2159 end;
2160 end;
2161 NotifyReferencersForDeletion();
2162 NotifyContainedObjectsForDeletion(False);
2163 FChangeSummary := nil;
2164 end;
2165 locIsCreating := ( FContainer = nil ) and ( AContainer <> nil );
2166 FContainer := Pointer(AContainer);
2167 FContainerProperty := Pointer(AContainerProperty);
2168 if locIsCreating then begin
2169 //creating the current object
2170 if not AContainerProperty.isMany() then begin
2171 locCS := AContainer.getChangeSummary();
2172 if ( locCS <> nil ) and locCS.isLogging() then begin
2173 locCSx := locCS as ISDOChangeSummaryEx;
2174 locCSx.getRecorder().recordCreation(Self as ISDODataObject);
2175 end;
2176 end;
2177 end;
2178 end;
2179
IsAncestorOfnull2180 function TSDOBaseDataObject.IsAncestorOf(const AObject: ISDODataObject): Boolean;
2181 var
2182 locSelf, locObj : ISDODataObject;
2183 begin
2184 locObj := AObject as ISDODataObject;
2185 locSelf := Self as ISDODataObject;
2186 while Assigned(locObj) and ( locObj <> locSelf ) do begin
2187 locObj := locObj.getContainer();
2188 end;
2189 Result := Assigned(AObject) and Assigned(locObj);
2190 end;
2191
IsInstanceOfnull2192 function TSDOBaseDataObject.IsInstanceOf(const AType: ISDOType) : Boolean;
2193 var
2194 locType : ISDOTypeEx;
2195 begin
2196 locType := getType() as ISDOTypeEx;
2197 Result := locType.inherits(AType);
2198 end;
2199
TSDOBaseDataObject.IsOwnerOfnull2200 function TSDOBaseDataObject.IsOwnerOf(const AProp: ISDOProperty): Boolean;
2201 begin
2202 Result := Assigned(AProp) and
2203 ( ( ( AProp.getContainingType() as ISDOType ) = ( FType as ISDOType ) ) or
2204 FType.IsOwnerOf(AProp)
2205 );
2206 end;
2207
CreateListnull2208 function TSDOBaseDataObject.CreateList(const AProperty : ISDOProperty) : ISDODataObjectList;
2209 begin
2210 //Result := TSDODataObjectList.Create(AItemType) as ISDODataObjectList;
2211 Result := TSDOOwnedDataObjectList.Create(Self as ISDODataObject, AProperty) as ISDODataObjectList;
2212 end;
2213
TSDOBaseDataObject.getListnull2214 function TSDOBaseDataObject.getList(const APath: string): ISDODataObjectList;
2215 var
2216 locCtx : TXPathExecContext;
2217 begin
2218 locCtx := parsePropertyPath(APath);
2219 if ( locCtx.PropertyOwner = nil ) then
2220 raise ESDOInvalidPathException.Create(APath);
2221 if ( locCtx.ContentKind <> xckList ) then
2222 raise ESDOIllegalArgumentException.Create('APath');
2223 Result := locCtx.ListItem;
2224 end;
2225
TSDOBaseDataObject.getListnull2226 function TSDOBaseDataObject.getList(const APropertyIndex: PtrUInt): ISDODataObjectList;
2227 begin
2228 Result := getList(getProperty(APropertyIndex));
2229 end;
2230
TSDOBaseDataObject.getListnull2231 function TSDOBaseDataObject.getList(const AProperty: ISDOProperty): ISDODataObjectList;
2232 var
2233 prp : ISDOPropertyEx;
2234 begin
2235 if ( AProperty = nil ) or
2236 ( not Self.IsOwnerOf(AProperty) ) or
2237 ( not AProperty.isMany() )
2238 then begin
2239 raise ESDOUnsupportedOperationException.Create('getList');
2240 end;
2241 prp := AProperty as ISDOPropertyEx;
2242 Result := PPSDODataObjectList( PtrUInt(FBuffer) + prp.getBufferOffset() )^^;
2243 end;
2244
TSDOBaseDataObject.getChangeSummarynull2245 function TSDOBaseDataObject.getChangeSummary() : ISDOChangeSummary;
2246 var
2247 locCS : ISDOChangeSummary;
2248 locCSX : ISDOChangeSummaryEx;
2249 begin
2250 if ( FChangeSummary = nil ) then begin
2251 if ( FContainer <> nil ) then begin
2252 locCS := getContainer().getChangeSummary();
2253 if ( locCS <> nil ) then begin
2254 locCSX := locCS as ISDOChangeSummaryEx;
2255 FChangeSummary := Pointer(locCSX);
2256 end;
2257 end;
2258 end;
2259 Result := ISDOChangeSummaryEx(FChangeSummary) as ISDOChangeSummary;
2260 end;
2261
2262 procedure TSDOBaseDataObject.RecordChange(const AProperty : ISDOProperty);
2263 var
2264 locCS : ISDOChangeSummaryEx;
2265 begin
2266 if ( FChangeSummary = nil ) then
2267 getChangeSummary();
2268 locCS := ISDOChangeSummaryEx(FChangeSummary);
2269 if Assigned(locCS) and locCS.isLogging() then begin
2270 locCS.getRecorder().recordChange(Self as ISDODataObject,AProperty);
2271 end;
2272 end;
2273
2274 procedure TSDOBaseDataObject.NotifyDeletion(
2275 const ADataObject: ISDODataObject;
2276 const AProperty: ISDOProperty
2277 );
2278 var
2279 cs : ISDOChangeSummary;
2280 begin
2281 cs := getChangeSummary();
2282 if ( ( cs = nil ) or ( not cs.isDeleted(Self as ISDODataObject) ) ) and
2283 ( getDataObject(AProperty) = ADataObject )
2284 then
2285 setDataObject(AProperty,nil);
2286 end;
2287
2288 procedure TSDOBaseDataObject.AddReference(
2289 const AReferencer: ISDODataObject;
2290 const AReferenceProperty: ISDOProperty
2291 );
2292 begin
2293 if ( AReferencer = nil ) then
2294 raise ESDOIllegalArgumentException.Create('AReferencer');
2295 if ( AReferenceProperty = nil ) then
2296 raise ESDOIllegalArgumentException.Create('AReferenceProperty');
2297 if ( FReferenceLinkList = nil ) then
2298 FReferenceLinkList := TDataObjectObserverList.Create();
2299 FReferenceLinkList.Add(AReferencer,AReferenceProperty);
2300 end;
2301
2302 procedure TSDOBaseDataObject.NotifyReferencersForDeletion();
2303 var
2304 i, c : PtrInt;
2305 itm : TObserverInfo;
2306 oX : IDataObjectObserver;
2307 locSelf : ISDODataObject;
2308 begin
2309 if ( FReferenceLinkList <> nil ) then begin
2310 c := FReferenceLinkList.GetCount();
2311 if ( c > 0 ) then begin
2312 locSelf := Self as ISDODataObject;
2313 itm := nil;
2314 try
2315 for i := Pred(c) downto 0 do begin
2316 itm := FReferenceLinkList.Extract(i);
2317 oX := itm.GetDataObject() as IDataObjectObserver;
2318 oX.NotifyDeletion(locSelf,itm.GetRefProperty());
2319 FreeAndNil(itm);
2320 end;
2321 finally
2322 FreeAndNil(itm);
2323 end;
2324 end;
2325 end;
2326 end;
2327
2328 procedure TSDOBaseDataObject.RemoveReference(
2329 const AReferencer: ISDODataObject;
2330 const AReferenceProperty: ISDOProperty
2331 );
2332 var
2333 i : PtrInt;
2334 begin
2335 if ( FReferenceLinkList <> nil ) then begin
2336 i := FReferenceLinkList.IndexOf(AReferencer,AReferenceProperty);
2337 if ( i > -1 ) then
2338 FReferenceLinkList.Delete(i);
2339 end;
2340 end;
2341
2342 procedure TSDOBaseDataObject.NotifyContainedObjectsForDeletion(const ACallFromParent : Boolean);
2343 var
2344 i, c : PtrInt;
2345 ls : ISDOPropertyList;
2346 prp : ISDOProperty;
2347 po : ISDODataObject;
2348 poX : ISDODataObjectEx;
2349 ols : ISDODataObjectList;
2350 ocrs : ILinkedListCursor;
2351 oldPos : TLinkedListBookmark;
2352 begin
2353 if ACallFromParent then
2354 NotifyReferencersForDeletion();
2355 ls := getInstanceProperties();
2356 c := ls.getCount();
2357 if ( c > 0 ) then begin
2358 for i := 0 to Pred(c) do begin
2359 prp := ls.getItem(i);
2360 if prp.isContainment() and ( prp.getType().isDataObjectType ) then begin
2361 if prp.isMany() then begin
2362 ols := getList(prp);
2363 if ( ols.size() > 0 ) then begin
2364 ocrs := ols.getCursor();
2365 oldPos := ocrs.GetBookmark();
2366 try
2367 ocrs.Reset();
2368 while ocrs.MoveNext() do begin
2369 po := getDataObject(prp);
2370 if ( po <> nil ) then begin
2371 poX := po as ISDODataObjectEx;
2372 poX.NotifyContainedObjectsForDeletion(True);
2373 end;
2374 end;
2375 finally
2376 ocrs.GotoBookmark(oldPos);
2377 end;
2378 end;
2379 end else begin
2380 po := getDataObject(prp);
2381 if ( po <> nil ) then begin
2382 poX := po as ISDODataObjectEx;
2383 poX.NotifyContainedObjectsForDeletion(True);
2384 end;
2385 end;
2386 end;
2387 end;
2388 end;
2389 end;
2390
2391 procedure TSDOBaseDataObject.InitializeDefaultValues();
2392 var
2393 i, c : PtrInt;
2394 pls : ISDOPropertyList;
2395 p : ISDOPropertyEx;
2396 f : ISDOField;
2397 begin
2398 pls := FType.getProperties();
2399 c := pls.getCount();
2400 if ( c > 0 ) then begin
2401 for i := 0 to Pred(c) do begin
2402 p := pls.getItem(i) as ISDOPropertyEx;
2403 if p.isDefaulted() then begin
2404 case p.getTypeEnum() of
2405 BooleanType :
2406 begin
2407 f := getField(BooleanType);
2408 f.setBoolean(FBuffer,p.getBufferOffset(),p.getBooleanDefault());
2409 f.unset(FBuffer,p.getBufferOffset());
2410 end;
2411 ByteType :
2412 begin
2413 f := getField(ByteType);
2414 f.setByte(FBuffer,p.getBufferOffset(),p.getByteDefault());
2415 f.unset(FBuffer,p.getBufferOffset());
2416 end;
2417 {$IFDEF HAS_SDO_BYTES}
2418 BytesType :
2419 begin
2420 f := getField(BytesType);
2421 f.setBytes(FBuffer,p.getBufferOffset(),p.getBytesDefault());
2422 f.unset(FBuffer,p.getBufferOffset());
2423 end;
2424 {$ENDIF HAS_SDO_BYTES}
2425 {$IFDEF HAS_SDO_CHAR}
2426 CharacterType :
2427 begin
2428 f := getField(CharacterType);
2429 f.setCharacter(FBuffer,p.getBufferOffset(),p.getCharacterDefault());
2430 f.unset(FBuffer,p.getBufferOffset());
2431 end;
2432 {$ENDIF HAS_SDO_CHAR}
2433 DateTimeType :
2434 begin
2435 f := getField(DateTimeType);
2436 f.setDate(FBuffer,p.getBufferOffset(),p.getDateDefault());
2437 f.unset(FBuffer,p.getBufferOffset());
2438 end;
2439 {$IFDEF HAS_SDO_CURRENCY}
2440 CurrencyType :
2441 begin
2442 f := getField(CurrencyType);
2443 f.setCurrency(FBuffer,p.getBufferOffset(),p.getCurrencyDefault());
2444 f.unset(FBuffer,p.getBufferOffset());
2445 end;
2446 {$ENDIF HAS_SDO_CURRENCY}
2447 {$IFDEF HAS_SDO_DOUBLE}
2448 DoubleType :
2449 begin
2450 f := getField(DoubleType);
2451 f.setDouble(FBuffer,p.getBufferOffset(),p.getDoubleDefault());
2452 f.unset(FBuffer,p.getBufferOffset());
2453 end;
2454 {$ENDIF HAS_SDO_DOUBLE}
2455 {$IFDEF HAS_SDO_FLOAT}
2456 FloatType :
2457 begin
2458 f := getField(FloatType);
2459 f.setFloat(FBuffer,p.getBufferOffset(),p.getFloatDefault());
2460 f.unset(FBuffer,p.getBufferOffset());
2461 end;
2462 {$ENDIF HAS_SDO_FLOAT}
2463 IntegerType :
2464 begin
2465 f := getField(IntegerType);
2466 f.setInteger(FBuffer,p.getBufferOffset(),p.getIntegerDefault());
2467 f.unset(FBuffer,p.getBufferOffset());
2468 end;
2469 {$IFDEF HAS_SDO_LONG}
2470 LongType :
2471 begin
2472 f := getField(LongType);
2473 f.setLong(FBuffer,p.getBufferOffset(),p.getLongDefault());
2474 f.unset(FBuffer,p.getBufferOffset());
2475 end;
2476 {$ENDIF HAS_SDO_LONG}
2477 {$IFDEF HAS_SDO_SHORT}
2478 ShortType :
2479 begin
2480 f := getField(ShortType);
2481 f.setShort(FBuffer,p.getBufferOffset(),p.getShortDefault());
2482 f.unset(FBuffer,p.getBufferOffset());
2483 end;
2484 {$ENDIF HAS_SDO_SHORT}
2485 StringType :
2486 begin
2487 f := getField(StringType);
2488 f.setString(FBuffer,p.getBufferOffset(),p.getStringDefault());
2489 f.unset(FBuffer,p.getBufferOffset());
2490 end;
2491 else
2492 raise ESDONotImplementedException.CreateFmt('NOT IMPLEMENTED for this type : "%s"',[SDOTypeDefaultTypeNames[p.getTypeEnum()]]);
2493 end;
2494 end;
2495 end;
2496 end;
2497 end;
2498
2499 procedure TSDOBaseDataObject.addProperty(
2500 const APropName : string;
2501 const APropType : ISDOType;
2502 const AFlags : TPropertyFlags
2503 );
2504 begin
2505 raise ESDOUnsupportedOperationException.Create('addProperty');
2506 end;
2507
_Releasenull2508 function TSDOBaseDataObject._Release(): LongInt; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
2509 begin
2510 if not FDestroying then
2511 Result := inherited _Release()
2512 else
2513 Result := 0;
2514 end;
2515
getVariantnull2516 function TSDOBaseDataObject.getVariant(const AProperty: ISDOProperty): TSDOVariant;
2517 var
2518 prp : ISDOPropertyEx;
2519 begin
2520 if ( AProperty = nil ) or
2521 ( not Self.IsOwnerOf(AProperty) ) or
2522 ( AProperty.isMany() )
2523 then begin
2524 raise ESDOIllegalArgumentException.Create('AProperty');
2525 end;
2526 prp := AProperty as ISDOPropertyEx;
2527 Result := getField(prp.getTypeEnum()).getVariant(FBuffer,prp.getBufferOffset());
2528 end;
2529
getVariantnull2530 function TSDOBaseDataObject.getVariant(const APropertyIndex: PtrUInt): TSDOVariant;
2531 begin
2532 Result := getVariant(getProperty(APropertyIndex));
2533 end;
2534
getVariantnull2535 function TSDOBaseDataObject.getVariant(const APath: string): TSDOVariant;
2536 var
2537 locCtx : TXPathExecContext;
2538 begin
2539 locCtx := parsePropertyPath(APath);
2540 if ( locCtx.PropertyOwner = nil ) then
2541 raise ESDOInvalidPathException.Create(APath);
2542 if ( locCtx.ContentKind = xckList ) then
2543 Result := locCtx.ListItem.getVariant()
2544 else
2545 Result := locCtx.PropertyOwner.getVariant(locCtx.CurrentProperty);
2546 end;
2547
2548 procedure TSDOBaseDataObject.setVariant(const AProperty: ISDOProperty; const AValue: TSDOVariant);
2549 var
2550 prp : ISDOPropertyEx;
2551 begin
2552 if ( AProperty = nil ) or
2553 ( not Self.IsOwnerOf(AProperty) ) or
2554 ( AProperty.isMany() )
2555 then begin
2556 raise ESDOIllegalArgumentException.Create('AProperty');
2557 end;
2558 prp := AProperty as ISDOPropertyEx;
2559 RecordChange(AProperty);
2560 getField(prp.getTypeEnum()).setVariant(FBuffer,prp.getBufferOffset(),AValue);
2561 end;
2562
2563 procedure TSDOBaseDataObject.setVariant(const APropertyIndex: PtrUInt; const AValue: TSDOVariant);
2564 begin
2565 setVariant(getProperty(APropertyIndex),AValue);
2566 end;
2567
2568 procedure TSDOBaseDataObject.setVariant(const APath: string; const AValue: TSDOVariant);
2569 var
2570 locCtx : TXPathExecContext;
2571 begin
2572 locCtx := parsePropertyPath(APath);
2573 if ( locCtx.PropertyOwner = nil ) then
2574 raise ESDOInvalidPathException.Create(APath);
2575 if ( locCtx.ContentKind = xckList ) then
2576 locCtx.ListItem.setVariant(AValue)
2577 else
2578 locCtx.PropertyOwner.setVariant(locCtx.CurrentProperty,AValue);
2579 end;
2580
2581 { TObserverInfo }
2582
2583 constructor TObserverInfo.Create(
2584 const ADataObject: ISDODataObject;
2585 const ARefProperty: ISDOProperty
2586 );
2587 begin
2588 FDataObject := Pointer(ADataObject);
2589 FRefProperty := Pointer(ARefProperty);
2590 end;
2591
GetDataObjectnull2592 function TObserverInfo.GetDataObject(): ISDODataObject;
2593 begin
2594 Result := ISDODataObject(FDataObject);
2595 end;
2596
TObserverInfo.GetRefPropertynull2597 function TObserverInfo.GetRefProperty() : ISDOProperty;
2598 begin
2599 Result := ISDOProperty(FRefProperty);
2600 end;
2601
2602 { TDataObjectObserverList }
2603
2604 procedure TDataObjectObserverList.Add(
2605 const ADataObject : ISDODataObject;
2606 const ARefProperty : ISDOProperty
2607 );
2608 begin
2609 if ( Find(ADataObject,ARefProperty) = nil ) then
2610 FList.Add(TObserverInfo.Create(ADataObject,ARefProperty));
2611 end;
2612
2613 constructor TDataObjectObserverList.Create();
2614 begin
2615 FList := TObjectList.Create(True);
2616 end;
2617
2618 procedure TDataObjectObserverList.Delete(const AIndex: PtrInt);
2619 begin
2620 FList.Delete(AIndex);
2621 end;
2622
2623 destructor TDataObjectObserverList.Destroy();
2624 begin
2625 FreeAndNil(FList);
2626 inherited;
2627 end;
2628
TDataObjectObserverList.Extractnull2629 function TDataObjectObserverList.Extract(const AIndex: PtrInt): TObserverInfo;
2630 begin
2631 Result := TObserverInfo(FList.Extract(GetItem(AIndex)));
2632 end;
2633
TDataObjectObserverList.Findnull2634 function TDataObjectObserverList.Find(
2635 const ADataObject : ISDODataObject;
2636 const ARefProperty : ISDOProperty
2637 ) : TObserverInfo;
2638 var
2639 i : PtrInt;
2640 begin
2641 i := IndexOf(ADataObject,ARefProperty);
2642 if ( i > -1 ) then
2643 Result := GetItem(i)
2644 else
2645 Result := nil;
2646 end;
2647
GetCountnull2648 function TDataObjectObserverList.GetCount() : PtrInt;
2649 begin
2650 Result := FList.Count;
2651 end;
2652
GetItemnull2653 function TDataObjectObserverList.GetItem(const AIndex: PtrInt): TObserverInfo;
2654 begin
2655 if ( AIndex < 0 ) or ( AIndex >= GetCount() ) then
2656 raise ESDOIndexOutOfRangeException.Create(AIndex);
2657 Result := TObserverInfo(FList[AIndex]);
2658 end;
2659
IndexOfnull2660 function TDataObjectObserverList.IndexOf(
2661 const ADataObject: ISDODataObject;
2662 const ARefProperty: ISDOProperty
2663 ) : PtrInt;
2664 var
2665 i, c : PtrInt;
2666 locInfo : TObserverInfo;
2667 locObj : ISDODataObject;
2668 locP : ISDOProperty;
2669 begin
2670 Result := -1;
2671 c := FList.Count;
2672 for i := 0 to Pred(c) do begin
2673 locInfo := TObserverInfo(FList[i]);
2674 locObj := locInfo.GetDataObject();
2675 locP := locInfo.GetRefProperty();
2676 if ( locObj = ADataObject ) and ( locP = ARefProperty ) then begin
2677 Result := i;
2678 Break;
2679 end;
2680 end;
2681 end;
2682
2683 { TSDOOpenedDataObject }
2684
2685 procedure TSDOOpenedDataObject.addProperty(
2686 const APropName: string;
2687 const APropType: ISDOType;
2688 const AFlags: TPropertyFlags
2689 );
2690 var
2691 p : ISDOPropertyEx;
2692 pt : ISDOTypeEx;
2693 fs, oldLength : PtrUInt;
2694 locBuffer : PPSDODataObjectList;
2695 begin
2696 if ( FInstanceProperties.find(APropName) <> nil ) then
2697 raise ESDODuplicatedItemException.Create(APropName);
2698 p := TSDOProperty.Create(
2699 APropName,
2700 APropType,
2701 AFlags,
2702 getType()
2703 ) as ISDOPropertyEx;
2704 oldLength := FBufferLength;
2705 p.setBufferOffset(oldLength);
2706 pt := p.getType() as ISDOTypeEx;
2707 if p.isMany() then
2708 fs := SizeOf(Pointer)
2709 else
2710 fs := pt.getFieldSize();
2711 ReallocMem(FBuffer, ( oldLength + fs ));
2712 FBufferLength := oldLength + fs;
2713 FillChar(
2714 Pointer(PtrUInt(FBuffer) + oldLength)^,
2715 fs,
2716 #0
2717 );
2718 if p.isMany() then begin
2719 locBuffer := PPSDODataObjectList( PtrUInt(FBuffer) + p.getBufferOffset() );
2720 GetMem(locBuffer^,SizeOf(Pointer));
2721 FillChar(locBuffer^^,SizeOf(ISDODataObjectList),#0);
2722 locBuffer^^ := CreateList(p);
2723 end;
2724 FInstanceProperties.add((p as ISDOProperty));
2725 end;
2726
2727 constructor TSDOOpenedDataObject.Create(
2728 const AType: ISDOTypeEx;
2729 const AContainer: ISDODataObject;
2730 const AContainerProperty: ISDOProperty
2731 );
2732 begin
2733 if not AType.isOpenType() then
2734 raise ESDOIllegalArgumentException.Create('AType');
2735 inherited;
2736 FInstanceProperties := TSDOPropertyList.Create(AType.getProperties());
2737 end;
2738
TSDOOpenedDataObject.getInstancePropertiesnull2739 function TSDOOpenedDataObject.getInstanceProperties() : ISDOPropertyList;
2740 begin
2741 Result := FInstanceProperties as ISDOPropertyList;
2742 end;
2743
IsOwnerOfnull2744 function TSDOOpenedDataObject.IsOwnerOf(const AProp: ISDOProperty): Boolean;
2745 var
2746 i, c : PtrInt;
2747 locProp : ISDOProperty;
2748 begin
2749 Result := False;
2750 if ( AProp <> nil ) then begin
2751 c := FInstanceProperties.getCount();
2752 if ( c > 0 ) then begin
2753 locProp := AProp as ISDOProperty;
2754 for i := 0 to ( c - 1 ) do begin
2755 if ( locProp = FInstanceProperties.getItem(i) ) then begin
2756 Result := True;
2757 Break;
2758 end;
2759 end;
2760 end;
2761 end;
2762 end;
2763
2764 procedure TSDOOpenedDataObject.setBoolean(const APath: string; const AValue: TSDOBoolean);
2765 begin
2766 try
2767 inherited;
2768 except
2769 on e : ESDOPropertyNotFoundException do begin
2770 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2771 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[BooleanType]),[pfIsAttribute]);
2772 inherited;
2773 end else begin
2774 raise;
2775 end;
2776 end;
2777 end;
2778 end;
2779
2780 procedure TSDOOpenedDataObject.setByte(const APath: string; const AValue: TSDOByte);
2781 begin
2782 try
2783 inherited;
2784 except
2785 on e : ESDOPropertyNotFoundException do begin
2786 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2787 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[ByteType]),[pfIsAttribute]);
2788 inherited;
2789 end else begin
2790 raise;
2791 end;
2792 end;
2793 end;
2794 end;
2795
2796 {$IFDEF HAS_SDO_BYTES}
2797 procedure TSDOOpenedDataObject.setBytes(const APath: string; AValue : TSDOBytes);
2798 begin
2799 try
2800 inherited;
2801 except
2802 on e : ESDOPropertyNotFoundException do begin
2803 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2804 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[BytesType]),[pfIsAttribute]);
2805 inherited;
2806 end else begin
2807 raise;
2808 end;
2809 end;
2810 end;
2811 end;
2812 {$ENDIF HAS_SDO_BYTES}
2813
2814 {$IFDEF HAS_SDO_CHAR}
2815 procedure TSDOOpenedDataObject.setCharacter(const APath: string; const AValue: TSDOChar);
2816 begin
2817 try
2818 inherited;
2819 except
2820 on e : ESDOPropertyNotFoundException do begin
2821 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2822 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[CharacterType]),[pfIsAttribute]);
2823 inherited;
2824 end else begin
2825 raise;
2826 end;
2827 end;
2828 end;
2829 end;
2830 {$ENDIF HAS_SDO_CHAR}
2831
2832 {$IFDEF HAS_SDO_CURRENCY}
2833 procedure TSDOOpenedDataObject.setCurrency(const APath: string; const AValue: Currency);
2834 begin
2835 try
2836 inherited;
2837 except
2838 on e : ESDOPropertyNotFoundException do begin
2839 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2840 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[CurrencyType]),[pfIsAttribute]);
2841 inherited;
2842 end else begin
2843 raise;
2844 end;
2845 end;
2846 end;
2847 end;
2848 {$ENDIF HAS_SDO_CURRENCY}
2849
2850 procedure TSDOOpenedDataObject.setDataObject(const APath: string; AValue: ISDODataObject);
2851 var
2852 pf : TPropertyFlags;
2853 begin
2854 try
2855 inherited;
2856 except
2857 on e : ESDOPropertyNotFoundException do begin
2858 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2859 if ( AValue = nil ) then
2860 raise;
2861 pf := [];
2862 if ( AValue.getContainer() = nil ) then
2863 Include(pf,pfIsContainment);
2864 addProperty(Trim(APath),AValue.getType(),pf);
2865 inherited;
2866 end else begin
2867 raise;
2868 end;
2869 end;
2870 end;
2871 end;
2872
2873 procedure TSDOOpenedDataObject.setDate(const APath: string; const AValue: TSDODate);
2874 begin
2875 try
2876 inherited;
2877 except
2878 on e : ESDOPropertyNotFoundException do begin
2879 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2880 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[DateType]),[pfIsAttribute]);
2881 inherited;
2882 end else begin
2883 raise;
2884 end;
2885 end;
2886 end;
2887 end;
2888
2889 {$IFDEF HAS_SDO_DOUBLE}
2890 procedure TSDOOpenedDataObject.setDouble(const APath: string; const AValue: Double);
2891 begin
2892 try
2893 inherited;
2894 except
2895 on e : ESDOPropertyNotFoundException do begin
2896 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2897 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[DoubleType]),[pfIsAttribute]);
2898 inherited;
2899 end else begin
2900 raise;
2901 end;
2902 end;
2903 end;
2904 end;
2905 {$ENDIF HAS_SDO_DOUBLE}
2906
2907 {$IFDEF HAS_SDO_FLOAT}
2908 procedure TSDOOpenedDataObject.setFloat(const APath: string; const AValue: TSDOFloat);
2909 begin
2910 try
2911 inherited;
2912 except
2913 on e : ESDOPropertyNotFoundException do begin
2914 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2915 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[FloatType]),[pfIsAttribute]);
2916 inherited;
2917 end else begin
2918 raise;
2919 end;
2920 end;
2921 end;
2922 end;
2923 {$ENDIF HAS_SDO_FLOAT}
2924
2925 procedure TSDOOpenedDataObject.setInteger(const APath: string; const AValue: TSDOInteger);
2926 begin
2927 try
2928 inherited;
2929 except
2930 on e : ESDOPropertyNotFoundException do begin
2931 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2932 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[IntegerType]),[pfIsAttribute]);
2933 inherited;
2934 end else begin
2935 raise;
2936 end;
2937 end;
2938 end;
2939 end;
2940
2941 {$IFDEF HAS_SDO_LONG}
2942 procedure TSDOOpenedDataObject.setLong(const APath: string; const AValue: TSDOLong);
2943 begin
2944 try
2945 inherited;
2946 except
2947 on e : ESDOPropertyNotFoundException do begin
2948 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2949 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[LongType]),[pfIsAttribute]);
2950 inherited;
2951 end else begin
2952 raise;
2953 end;
2954 end;
2955 end;
2956 end;
2957 {$ENDIF HAS_SDO_LONG}
2958
2959 {$IFDEF HAS_SDO_SHORT}
2960 procedure TSDOOpenedDataObject.setShort(const APath: string; const AValue: TSDOShort);
2961 begin
2962 try
2963 inherited;
2964 except
2965 on e : ESDOPropertyNotFoundException do begin
2966 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2967 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[ShortType]),[pfIsAttribute]);
2968 inherited;
2969 end else begin
2970 raise;
2971 end;
2972 end;
2973 end;
2974 end;
2975 {$ENDIF HAS_SDO_SHORT}
2976
2977 procedure TSDOOpenedDataObject.setString(const APath: string; const AValue: TSDOString);
2978 begin
2979 try
2980 inherited;
2981 except
2982 on e : ESDOPropertyNotFoundException do begin
2983 if ( Pos('/', APath) = 0 ) and ( not IsStrEmpty(APath) ) then begin
2984 addProperty(Trim(APath),FType.getOwner().getType(sdo_namespace,SDOTypeDefaultTypeNames[StringType]),[pfIsAttribute]);
2985 inherited;
2986 end else begin
2987 raise;
2988 end;
2989 end;
2990 end;
2991 end;
2992
2993 const
2994 data_offset = 0; { TSDODataObjectList }
2995
2996 procedure TSDODataObjectList.append(const AValue: TSDOBoolean);
2997 begin
2998 FField.setBoolean(GetData(InternalAppend()),0,AValue);
2999 end;
3000
3001 procedure TSDODataObjectList.append(const AValue: TSDOInteger);
3002 begin
3003 FField.setInteger(GetData(InternalAppend()),0,AValue);
3004 end;
3005
3006 procedure TSDODataObjectList.append(const AValue: TSDOString);
3007 begin
3008 FField.setString(GetData(InternalAppend()),0,AValue);
3009 end;
3010
3011 procedure TSDODataObjectList.Clear();
3012 var
3013 i : PtrInt;
3014 begin
3015 if Assigned(FData) then begin
3016 for i := 0 to Pred(FData.GetLength()) do begin
3017 InternalDelete(FData.GetFirst());
3018 end;
3019 end;
3020 end;
3021
3022 constructor TSDODataObjectList.Create(const AItemType: ISDOType);
3023 var
3024 typEx : ISDOTypeEx;
3025 begin
3026 if ( AItemType = nil ) or ( not Supports(AItemType,ISDOTypeEx,typEx) ) then
3027 raise ESDOIllegalArgumentException.Create('AItemType');
3028 FItemType := AItemType;
3029 FField := getField(FItemType.getTypeEnum());
3030 FData := TDoubleLinkedList.Create(typEx.getFieldSize());
3031 FCursor := CreateIterator(FData);
3032 end;
3033
3034 destructor TSDODataObjectList.Destroy();
3035 begin
3036 Clear();
3037 FCursor := nil;
3038 FItemType := nil;
3039 FreeAndNil(FData);
3040 inherited;
3041 end;
3042
TSDODataObjectList.getBooleannull3043 function TSDODataObjectList.getBoolean(const AIndex: PtrInt): TSDOBoolean;
3044 begin
3045 MoveTo(AIndex);
3046 Result := getBoolean();
3047 end;
3048
TSDODataObjectList.getIntegernull3049 function TSDODataObjectList.getInteger(const AIndex: PtrInt): TSDOInteger;
3050 begin
3051 MoveTo(AIndex);
3052 Result := getInteger();
3053 end;
3054
getStringnull3055 function TSDODataObjectList.getString(const AIndex: PtrInt): TSDOString;
3056 begin
3057 MoveTo(AIndex);
3058 Result := getString();
3059 end;
3060
3061 procedure TSDODataObjectList.delete(const AIndex: PtrInt);
3062 begin
3063 MoveTo(AIndex);
3064 delete();
3065 end;
3066
3067 procedure TSDODataObjectList.setBoolean(const AIndex: PtrInt; const AValue: TSDOBoolean);
3068 begin
3069 MoveTo(AIndex);
3070 setBoolean(AValue);
3071 end;
3072
3073 procedure TSDODataObjectList.setInteger(const AIndex: PtrInt; const AValue: TSDOInteger);
3074 begin
3075 MoveTo(AIndex);
3076 setInteger(AValue);
3077 end;
3078
3079 procedure TSDODataObjectList.setString(const AIndex: PtrInt; const AValue: TSDOString);
3080 begin
3081 MoveTo(AIndex);
3082 setString(AValue);
3083 end;
3084
TSDODataObjectList.sizenull3085 function TSDODataObjectList.size() : PtrInt;
3086 begin
3087 Result := FData.GetLength();
3088 end;
3089
3090 procedure TSDODataObjectList.InternalDelete(const AData: PLinkedNode);
3091 begin
3092 FField.setNull(GetData(AData),0);
3093 FData.Delete(AData);
3094 end;
3095
getCursornull3096 function TSDODataObjectList.getCursor() : ILinkedListCursor;
3097 begin
3098 Result := FCursor;
3099 end;
3100
TSDODataObjectList.getBooleannull3101 function TSDODataObjectList.getBoolean() : TSDOBoolean;
3102 begin
3103 CheckCursorPosition();
3104 Result := FField.getBoolean(GetData(FCursor.GetCurrent()),0);
3105 end;
3106
TSDODataObjectList.getIntegernull3107 function TSDODataObjectList.getInteger() : TSDOInteger;
3108 begin
3109 CheckCursorPosition();
3110 Result := FField.getInteger(GetData(FCursor.GetCurrent()),0);
3111 end;
3112
getStringnull3113 function TSDODataObjectList.getString() : TSDOString;
3114 begin
3115 CheckCursorPosition();
3116 Result := FField.getString(GetData(FCursor.GetCurrent()),0);
3117 end;
3118
TSDODataObjectList.InternalAppendnull3119 function TSDODataObjectList.InternalAppend() : PLinkedNode;
3120 begin
3121 Result := FData.Append();
3122 FCursor.MoveLast();
3123 end;
3124
3125 procedure TSDODataObjectList.CheckCursorPosition();
3126 begin
3127 if not FCursor.IsPosValid() then
3128 raise ESDOIllegalArgumentException.Create('Cursor');
3129 end;
3130
3131 procedure TSDODataObjectList.setBoolean(const AValue: TSDOBoolean);
3132 begin
3133 CheckCursorPosition();
3134 FField.setBoolean(GetData(FCursor.GetCurrent()),0,AValue);
3135 end;
3136
3137 procedure TSDODataObjectList.setInteger(const AValue: TSDOInteger);
3138 begin
3139 CheckCursorPosition();
3140 FField.setInteger(GetData(FCursor.GetCurrent()),0,AValue);
3141 end;
3142
3143 procedure TSDODataObjectList.setString(const AValue: TSDOString);
3144 begin
3145 CheckCursorPosition();
3146 FField.setString(GetData(FCursor.GetCurrent()),0,AValue);
3147 end;
3148
3149 procedure TSDODataObjectList.delete();
3150 var
3151 p : PLinkedNode;
3152 begin
3153 CheckCursorPosition();
3154 p := FCursor.GetCurrent();
3155 if FCursor.Bof() then
3156 FCursor.MoveNext()
3157 else if FCursor.Eof() then
3158 FCursor.MovePrevious();
3159 InternalDelete(p);
3160 end;
3161
3162 {procedure TSDODataObjectList.MoveTo(const AIndex: PtrInt);
3163 var
3164 c , j : PtrInt;
3165 begin
3166 c := FData.GetLength();
3167 if ( AIndex < 0 ) or ( AIndex >= c ) then
3168 raise ESDOIndexOutOfRangeException.Create(AIndex);
3169 j := AIndex;
3170 if ( j <= ( Pred(c) div 2 ) ) then begin
3171 if FCursor.MoveFirst() then begin
3172 while ( j > 0 ) and FCursor.MoveNext() do begin
3173 Dec(j);
3174 end;
3175 end;
3176 end else begin
3177 if FCursor.MoveLast() then begin
3178 j := Pred(c) - j;
3179 while ( j > 0 ) and FCursor.MovePrevious() do begin
3180 Dec(j);
3181 end;
3182 end;
3183 end;
3184 if ( j > 0 ) then
3185 raise ESDOIndexOutOfRangeException.Create(j);
3186 end; }
3187 procedure TSDODataObjectList.MoveTo(const AIndex: PtrInt);
3188 begin
3189 if not FCursor.MoveTo(AIndex) then
3190 raise ESDOIndexOutOfRangeException.Create(AIndex);
3191 end;
3192
3193 procedure TSDODataObjectList.append(AValue: ISDODataObject);
3194 var
3195 newObj : ISDODataObjectEx;
3196 begin
3197 if ( AValue <> nil ) then begin
3198 newObj := AValue as ISDODataObjectEx;
3199 if not newObj.IsInstanceOf(FItemType) then
3200 raise ESDOIllegalArgumentException.Create('AProperty');
3201 end;
3202 FField.setDataObject(GetData(InternalAppend()),0,AValue);
3203 end;
3204
TSDODataObjectList.getDataObjectnull3205 function TSDODataObjectList.getDataObject(const AIndex: PtrInt): ISDODataObject;
3206 begin
3207 MoveTo(AIndex);
3208 Result := getDataObject();
3209 end;
3210
TSDODataObjectList.getDataObjectnull3211 function TSDODataObjectList.getDataObject() : ISDODataObject;
3212 begin
3213 CheckCursorPosition();
3214 Result := FField.getDataObject(GetData(FCursor.GetCurrent()),0);
3215 end;
3216
3217 procedure TSDODataObjectList.setDataObject(AValue: ISDODataObject);
3218 begin
3219 CheckCursorPosition();
3220 FField.setDataObject(GetData(FCursor.GetCurrent()),0,AValue);
3221 end;
3222
3223 procedure TSDODataObjectList.setDataObject(const AIndex: PtrInt; AValue: ISDODataObject);
3224 begin
3225 MoveTo(AIndex);
3226 setDataObject(AValue);
3227 end;
3228
3229 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOInteger);
3230 begin
3231 if ( AIndex = 0 ) then begin
3232 FField.setInteger(GetData(FData.InsertFirst()),0,AValue);
3233 end else begin
3234 if ( AIndex = FData.GetLength() ) then begin
3235 append(AValue);
3236 end else begin
3237 MoveTo(AIndex);
3238 FField.setInteger(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3239 end;
3240 end;
3241 MoveTo(AIndex);
3242 end;
3243
3244 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOBoolean);
3245 begin
3246 if ( AIndex = 0 ) then begin
3247 FField.setBoolean(GetData(FData.InsertFirst()),0,AValue);
3248 end else begin
3249 if ( AIndex = FData.GetLength() ) then begin
3250 append(AValue);
3251 end else begin
3252 MoveTo(AIndex);
3253 FField.setBoolean(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3254 end;
3255 end;
3256 MoveTo(AIndex);
3257 end;
3258
3259 procedure TSDODataObjectList.insert(const AIndex: PtrInt; AValue: ISDODataObject);
3260 begin
3261 if ( AIndex = 0 ) then begin
3262 FField.setDataObject(GetData(FData.InsertFirst()),0,AValue);
3263 end else begin
3264 if ( AIndex = FData.GetLength() ) then begin
3265 append(AValue);
3266 end else begin
3267 MoveTo(AIndex);
3268 FField.setDataObject(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3269 end;
3270 end;
3271 MoveTo(AIndex);
3272 end;
3273
3274 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOString);
3275 begin
3276 if ( AIndex = 0 ) then begin
3277 FField.setString(GetData(FData.InsertFirst()),0,AValue);
3278 end else begin
3279 if ( AIndex = FData.GetLength() ) then begin
3280 append(AValue);
3281 end else begin
3282 MoveTo(AIndex);
3283 FField.setString(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3284 end;
3285 end;
3286 MoveTo(AIndex);
3287 end;
3288
TSDODataObjectList.getItemTypenull3289 function TSDODataObjectList.getItemType() : ISDOType;
3290 begin
3291 Result := FItemType;
3292 end;
3293
3294 procedure TSDODataObjectList.append(const AValue: TSDOByte);
3295 begin
3296 FField.setByte(GetData(InternalAppend()),0,AValue);
3297 end;
3298
getBytenull3299 function TSDODataObjectList.getByte() : TSDOByte;
3300 begin
3301 CheckCursorPosition();
3302 Result := FField.getByte(GetData(FCursor.GetCurrent()),0);
3303 end;
3304
3305 {$IFDEF HAS_SDO_BYTES}
TSDODataObjectList.getBytesnull3306 function TSDODataObjectList.getBytes() : TSDOBytes;
3307 begin
3308 CheckCursorPosition();
3309 Result := FField.getBytes(GetData(FCursor.GetCurrent()),0);
3310 end;
3311
TSDODataObjectList.getBytesnull3312 function TSDODataObjectList.getBytes(const AIndex: PtrInt): TSDOBytes;
3313 begin
3314 MoveTo(AIndex);
3315 Result := getBytes();
3316 end;
3317
3318 procedure TSDODataObjectList.setBytes(AValue: TSDOBytes);
3319 begin
3320 CheckCursorPosition();
3321 FField.setBytes(GetData(FCursor.GetCurrent()),0,AValue);
3322 end;
3323
3324 procedure TSDODataObjectList.setBytes(const AIndex: PtrInt; AValue: TSDOBytes);
3325 begin
3326 MoveTo(AIndex);
3327 setBytes(AValue);
3328 end;
3329
3330 procedure TSDODataObjectList.insertBytes(const AIndex: PtrInt; AValue: TSDOBytes);
3331 begin
3332 if ( AIndex = 0 ) then begin
3333 FField.setBytes(GetData(FData.InsertFirst()),0,AValue);
3334 end else begin
3335 if ( AIndex = FData.GetLength() ) then begin
3336 appendBytes(AValue);
3337 end else begin
3338 MoveTo(AIndex);
3339 FField.setBytes(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3340 end;
3341 end;
3342 MoveTo(AIndex);
3343 end;
3344
3345 procedure TSDODataObjectList.appendBytes(AValue: TSDOBytes);
3346 begin
3347 FField.setBytes(GetData(InternalAppend()),0,AValue);
3348 end;
3349 {$ENDIF HAS_SDO_BYTES}
3350
3351 procedure TSDODataObjectList.setByte(const AValue: TSDOByte);
3352 begin
3353 CheckCursorPosition();
3354 FField.setByte(GetData(FCursor.GetCurrent()),0,AValue);
3355 end;
3356
getBytenull3357 function TSDODataObjectList.getByte(const AIndex: PtrInt): TSDOByte;
3358 begin
3359 MoveTo(AIndex);
3360 Result := getByte();
3361 end;
3362
3363 procedure TSDODataObjectList.setByte(const AIndex: PtrInt; const AValue: TSDOByte);
3364 begin
3365 MoveTo(AIndex);
3366 setByte(AValue);
3367 end;
3368
3369 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOByte);
3370 begin
3371 if ( AIndex = 0 ) then begin
3372 FField.setByte(GetData(FData.InsertFirst()),0,AValue);
3373 end else begin
3374 if ( AIndex = FData.GetLength() ) then begin
3375 append(AValue);
3376 end else begin
3377 MoveTo(AIndex);
3378 FField.setByte(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3379 end;
3380 end;
3381 MoveTo(AIndex);
3382 end;
3383
3384 {$IFDEF HAS_SDO_CHAR}
3385 procedure TSDODataObjectList.append(const AValue: TSDOChar);
3386 begin
3387 FField.setCharacter(GetData(InternalAppend()),0,AValue);
3388 end;
3389
TSDODataObjectList.getCharacternull3390 function TSDODataObjectList.getCharacter() : TSDOChar;
3391 begin
3392 CheckCursorPosition();
3393 Result := FField.getCharacter(GetData(FCursor.GetCurrent()),0);
3394 end;
3395
3396 procedure TSDODataObjectList.setCharacter(const AValue: TSDOChar);
3397 begin
3398 CheckCursorPosition();
3399 FField.setCharacter(GetData(FCursor.GetCurrent()),0,AValue);
3400 end;
3401
TSDODataObjectList.getCharacternull3402 function TSDODataObjectList.getCharacter(const AIndex: PtrInt): TSDOChar;
3403 begin
3404 MoveTo(AIndex);
3405 Result := getCharacter();
3406 end;
3407
3408 procedure TSDODataObjectList.setCharacter(const AIndex: PtrInt; const AValue: TSDOChar);
3409 begin
3410 MoveTo(AIndex);
3411 setCharacter(AValue);
3412 end;
3413
3414 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOChar);
3415 begin
3416 if ( AIndex = 0 ) then begin
3417 FField.setCharacter(GetData(FData.InsertFirst()),0,AValue);
3418 end else begin
3419 if ( AIndex = FData.GetLength() ) then begin
3420 append(AValue);
3421 end else begin
3422 MoveTo(AIndex);
3423 FField.setCharacter(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3424 end;
3425 end;
3426 MoveTo(AIndex);
3427 end;
3428 {$ENDIF HAS_SDO_CHAR}
3429
3430 {$IFDEF HAS_SDO_CURRENCY}
3431 procedure TSDODataObjectList.appendCurrency(const AValue: TSDOCurrency);
3432 begin
3433 FField.setCurrency(GetData(InternalAppend()),0,AValue);
3434 end;
3435
getCurrencynull3436 function TSDODataObjectList.getCurrency() : TSDOCurrency;
3437 begin
3438 CheckCursorPosition();
3439 Result := FField.getCurrency(GetData(FCursor.GetCurrent()),0);
3440 end;
3441
3442 procedure TSDODataObjectList.setCurrency(const AValue: TSDOCurrency);
3443 begin
3444 CheckCursorPosition();
3445 FField.setCurrency(GetData(FCursor.GetCurrent()),0,AValue);
3446 end;
3447
getCurrencynull3448 function TSDODataObjectList.getCurrency(const AIndex: PtrInt): TSDOCurrency;
3449 begin
3450 MoveTo(AIndex);
3451 Result := getCurrency();
3452 end;
3453
3454 procedure TSDODataObjectList.setCurrency(const AIndex: PtrInt; const AValue: TSDOCurrency);
3455 begin
3456 MoveTo(AIndex);
3457 setCurrency(AValue);
3458 end;
3459
3460 procedure TSDODataObjectList.insertCurrency(const AIndex: PtrInt; const AValue: TSDOCurrency);
3461 begin
3462 if ( AIndex = 0 ) then begin
3463 FField.setCurrency(GetData(FData.InsertFirst()),0,AValue);
3464 end else begin
3465 if ( AIndex = FData.GetLength() ) then begin
3466 appendCurrency(AValue);
3467 end else begin
3468 MoveTo(AIndex);
3469 FField.setCurrency(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3470 end;
3471 end;
3472 MoveTo(AIndex);
3473 end;
3474 {$ENDIF HAS_SDO_CURRENCY}
3475
3476 {$IFDEF HAS_SDO_DOUBLE}
3477 procedure TSDODataObjectList.append(const AValue: TSDODouble);
3478 begin
3479 FField.setDouble(GetData(InternalAppend()),0,AValue);
3480 end;
3481
getDoublenull3482 function TSDODataObjectList.getDouble() : TSDODouble;
3483 begin
3484 CheckCursorPosition();
3485 Result := FField.getDouble(GetData(FCursor.GetCurrent()),0);
3486 end;
3487
3488 procedure TSDODataObjectList.setDouble(const AValue: TSDODouble);
3489 begin
3490 CheckCursorPosition();
3491 FField.setDouble(GetData(FCursor.GetCurrent()),0,AValue);
3492 end;
3493
getDoublenull3494 function TSDODataObjectList.getDouble(const AIndex: PtrInt): TSDODouble;
3495 begin
3496 MoveTo(AIndex);
3497 Result := getDouble();
3498 end;
3499
3500 procedure TSDODataObjectList.setDouble(const AIndex: PtrInt; const AValue: TSDODouble);
3501 begin
3502 MoveTo(AIndex);
3503 setDouble(AValue);
3504 end;
3505
3506 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDODouble);
3507 begin
3508 if ( AIndex = 0 ) then begin
3509 FField.setDouble(GetData(FData.InsertFirst()),0,AValue);
3510 end else begin
3511 if ( AIndex = FData.GetLength() ) then begin
3512 append(AValue);
3513 end else begin
3514 MoveTo(AIndex);
3515 FField.setDouble(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3516 end;
3517 end;
3518 MoveTo(AIndex);
3519 end;
3520 {$ENDIF HAS_SDO_DOUBLE}
3521
3522 {$IFDEF HAS_SDO_FLOAT }
3523 procedure TSDODataObjectList.append(const AValue: TSDOFloat);
3524 begin
3525 FField.setFloat(GetData(InternalAppend()),0,AValue);
3526 end;
3527
TSDODataObjectList.getFloatnull3528 function TSDODataObjectList.getFloat() : TSDOFloat;
3529 begin
3530 CheckCursorPosition();
3531 Result := FField.getFloat(GetData(FCursor.GetCurrent()),0);
3532 end;
3533
3534 procedure TSDODataObjectList.setFloat(const AValue: TSDOFloat);
3535 begin
3536 CheckCursorPosition();
3537 FField.setFloat(GetData(FCursor.GetCurrent()),0,AValue);
3538 end;
3539
TSDODataObjectList.getFloatnull3540 function TSDODataObjectList.getFloat(const AIndex: PtrInt): TSDOFloat;
3541 begin
3542 MoveTo(AIndex);
3543 Result := getFloat();
3544 end;
3545
3546 procedure TSDODataObjectList.setFloat(const AIndex: PtrInt; const AValue: TSDOFloat);
3547 begin
3548 MoveTo(AIndex);
3549 setFloat(AValue);
3550 end;
3551
3552 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOFloat);
3553 begin
3554 if ( AIndex = 0 ) then begin
3555 FField.setFloat(GetData(FData.InsertFirst()),0,AValue);
3556 end else begin
3557 if ( AIndex = FData.GetLength() ) then begin
3558 append(AValue);
3559 end else begin
3560 MoveTo(AIndex);
3561 FField.setFloat(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3562 end;
3563 end;
3564 MoveTo(AIndex);
3565 end;
3566 {$ENDIF HAS_SDO_FLOAT }
3567
3568 procedure TSDODataObjectList.append(const AValue: TSDODate);
3569 begin
3570 FField.setDate(GetData(InternalAppend()),0,AValue);
3571 end;
3572
TSDODataObjectList.getDatenull3573 function TSDODataObjectList.getDate() : TSDODate;
3574 begin
3575 CheckCursorPosition();
3576 Result := FField.getDate(GetData(FCursor.GetCurrent()),0);
3577 end;
3578
TSDODataObjectList.getDatenull3579 function TSDODataObjectList.getDate(const AIndex: PtrInt): TSDODate;
3580 begin
3581 MoveTo(AIndex);
3582 Result := getDate();
3583 end;
3584
3585 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDODate);
3586 begin
3587 if ( AIndex = 0 ) then begin
3588 FField.setDate(GetData(FData.InsertFirst()),0,AValue);
3589 end else begin
3590 if ( AIndex = FData.GetLength() ) then begin
3591 append(AValue);
3592 end else begin
3593 MoveTo(AIndex);
3594 FField.setDate(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3595 end;
3596 end;
3597 MoveTo(AIndex);
3598 end;
3599
3600 procedure TSDODataObjectList.setDate(const AIndex: PtrInt; const AValue: TSDODate);
3601 begin
3602 MoveTo(AIndex);
3603 setDate(AValue);
3604 end;
3605
3606 procedure TSDODataObjectList.setDate(const AValue: TSDODate);
3607 begin
3608 CheckCursorPosition();
3609 FField.setDate(GetData(FCursor.GetCurrent()),0,AValue);
3610 end;
3611
3612 {$IFDEF HAS_SDO_LONG}
3613 procedure TSDODataObjectList.append(const AValue: TSDOLong);
3614 begin
3615 FField.setLong(GetData(InternalAppend()),0,AValue);
3616 end;
3617
getLongnull3618 function TSDODataObjectList.getLong() : TSDOLong;
3619 begin
3620 CheckCursorPosition();
3621 Result := FField.getLong(GetData(FCursor.GetCurrent()),0);
3622 end;
3623
3624 procedure TSDODataObjectList.setLong(const AValue: TSDOLong);
3625 begin
3626 CheckCursorPosition();
3627 FField.setLong(GetData(FCursor.GetCurrent()),0,AValue);
3628 end;
3629
getLongnull3630 function TSDODataObjectList.getLong(const AIndex: PtrInt): TSDOLong;
3631 begin
3632 MoveTo(AIndex);
3633 Result := getLong();
3634 end;
3635
3636 procedure TSDODataObjectList.setLong(const AIndex: PtrInt; const AValue: TSDOLong);
3637 begin
3638 MoveTo(AIndex);
3639 setLong(AValue);
3640 end;
3641
3642 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOLong);
3643 begin
3644 if ( AIndex = 0 ) then begin
3645 FField.setLong(GetData(FData.InsertFirst()),0,AValue);
3646 end else begin
3647 if ( AIndex = FData.GetLength() ) then begin
3648 append(AValue);
3649 end else begin
3650 MoveTo(AIndex);
3651 FField.setLong(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3652 end;
3653 end;
3654 MoveTo(AIndex);
3655 end;
3656 {$ENDIF HAS_SDO_LONG}
3657
3658 {$IFDEF HAS_SDO_SHORT}
3659 procedure TSDODataObjectList.append(const AValue: TSDOShort);
3660 begin
3661 FField.setShort(GetData(InternalAppend()),0,AValue);
3662 end;
3663
getShortnull3664 function TSDODataObjectList.getShort() : TSDOShort;
3665 begin
3666 CheckCursorPosition();
3667 Result := FField.getShort(GetData(FCursor.GetCurrent()),0);
3668 end;
3669
3670 procedure TSDODataObjectList.setShort(const AValue: TSDOShort);
3671 begin
3672 CheckCursorPosition();
3673 FField.setShort(GetData(FCursor.GetCurrent()),0,AValue);
3674 end;
3675
getShortnull3676 function TSDODataObjectList.getShort(const AIndex: PtrInt): TSDOShort;
3677 begin
3678 MoveTo(AIndex);
3679 Result := getShort();
3680 end;
3681
3682 procedure TSDODataObjectList.setShort(const AIndex: PtrInt; const AValue: TSDOShort);
3683 begin
3684 MoveTo(AIndex);
3685 setShort(AValue);
3686 end;
3687
3688 procedure TSDODataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOShort);
3689 begin
3690 if ( AIndex = 0 ) then begin
3691 FField.setShort(GetData(FData.InsertFirst()),0,AValue);
3692 end else begin
3693 if ( AIndex = FData.GetLength() ) then begin
3694 append(AValue);
3695 end else begin
3696 MoveTo(AIndex);
3697 FField.setShort(GetData(FData.InsertBefore(FCursor.GetCurrent())),0,AValue);
3698 end;
3699 end;
3700 MoveTo(AIndex);
3701 end;
3702 {$ENDIF HAS_SDO_SHORT}
3703
getVariantnull3704 function TSDODataObjectList.getVariant: TSDOVariant;
3705 begin
3706 CheckCursorPosition();
3707 Result := FField.getVariant(GetData(FCursor.GetCurrent()),0);
3708 end;
3709
3710 procedure TSDODataObjectList.setVariant(const AValue: TSDOVariant);
3711 begin
3712 CheckCursorPosition();
3713 FField.setVariant(GetData(FCursor.GetCurrent()),0,AValue);
3714 end;
3715
getVariantnull3716 function TSDODataObjectList.getVariant(const AIndex: PtrInt): TSDOVariant;
3717 begin
3718 MoveTo(AIndex);
3719 Result := getVariant();
3720 end;
3721
3722 procedure TSDODataObjectList.setVariant(const AIndex: PtrInt; const AValue: TSDOVariant);
3723 begin
3724 MoveTo(AIndex);
3725 setVariant(AValue);
3726 end;
3727
3728 { TSDOOwnedDataObjectList }
3729
3730 procedure TSDOOwnedDataObjectList.append(AValue: ISDODataObject);
3731 var
3732 newObj : ISDODataObjectEx;
3733 prp : ISDOProperty;
3734 ownerIntf : ISDODataObject;
3735 begin
3736 ownerIntf := getOwner();
3737 prp := FOwnerProperty;
3738 if ( AValue <> nil ) then begin
3739 newObj := AValue as ISDODataObjectEx;
3740 if not newObj.IsInstanceOf(getItemType()) then
3741 raise ESDOIllegalArgumentException.Create('AProperty');
3742 if prp.isContainment() then begin
3743 if newObj.IsAncestorOf(ownerIntf) then
3744 raise ESDOCycleContainmentException.Create('AValue');
3745 end;
3746 end;
3747
3748 inherited append(NIL_OBJECT);
3749 InternalSetDataObject(AValue,False);
3750 RecordChange(mvpaAppend);
3751 end;
3752
3753 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOInteger);
3754 begin
3755 inherited append(AValue);
3756 RecordChange(mvpaAppend);
3757 end;
3758
3759 constructor TSDOOwnedDataObjectList.Create(
3760 const AOwner : ISDODataObject;
3761 const AProperty: ISDOProperty
3762 );
3763 begin
3764 if ( AProperty = nil ) then
3765 raise ESDOIllegalArgumentException.Create('AProperty');
3766 if ( AOwner = nil ) then
3767 raise ESDOIllegalArgumentException.Create('AOwner');
3768 inherited Create(AProperty.getType());
3769 FOwnerProperty := AProperty;
3770 FOwner := Pointer(AOwner);
3771 end;
3772
3773 procedure TSDOOwnedDataObjectList.delete(const AIndex: PtrInt);
3774 begin
3775 MoveTo(AIndex);
3776 delete();
3777 end;
3778
3779 procedure TSDOOwnedDataObjectList.delete();
3780 begin
3781 RecordChange(mvpaDelete);
3782 if getItemType().isDataObjectType() then
3783 InternalSetDataObject(nil, False);
3784 inherited delete();
3785 end;
3786
getOwnernull3787 function TSDOOwnedDataObjectList.getOwner() : ISDODataObject;
3788 begin
3789 Result := ISDODataObject(FOwner);
3790 end;
3791
3792 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOInteger);
3793 begin
3794 inherited insert(AIndex, AValue);
3795 RecordChange(mvpaInsert);
3796 end;
3797
3798 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; AValue: ISDODataObject);
3799 begin
3800 inherited insert(AIndex, NIL_OBJECT);
3801 InternalSetDataObject(AValue, False);
3802 RecordChange(mvpaInsert);
3803 end;
3804
3805 procedure TSDOOwnedDataObjectList.InternalSetDataObject(
3806 const AValue: ISDODataObject;
3807 const ADoRecordChange: Boolean
3808 );
3809 var
3810 prp : ISDOProperty;
3811 fld : ISDOField;
3812 oldObj, newObj : ISDODataObjectEx;
3813 ownerIntf, oldContainer : ISDODataObject;
3814 locBuffer : Pointer;
3815 locCS : ISDOChangeSummaryEx;
3816 begin
3817 CheckCursorPosition();
3818 locBuffer := GetData(FCursor.GetCurrent());
3819
3820 ownerIntf := getOwner();
3821 prp := FOwnerProperty;
3822 if ( AValue <> nil ) then begin
3823 newObj := AValue as ISDODataObjectEx;
3824 if not newObj.IsInstanceOf(getItemType()) then
3825 raise ESDOIllegalArgumentException.Create('AProperty');
3826 if prp.isContainment() then begin
3827 if newObj.IsAncestorOf(ownerIntf) then
3828 raise ESDOCycleContainmentException.Create('AValue');
3829 end;
3830 end;
3831
3832 fld := FField;
3833
3834 oldObj := fld.getDataObject(locBuffer,data_offset) as ISDODataObjectEx;
3835 if Assigned(oldObj) then begin
3836 if prp.isContainment() then begin
3837 if ADoRecordChange then begin
3838 locCS := ownerIntf.getChangeSummary() as ISDOChangeSummaryEx;
3839 if ( locCS <> nil ) and locCS.isLogging() then begin
3840 locCS.getRecorder().recordDeletion(oldObj as ISDODataObject,getCursor().GetPosition());
3841 end;
3842 end;
3843 oldObj.setContainer(nil,nil);
3844 end;
3845 if prp.isReference() then
3846 oldObj.RemoveReference(ownerIntf,prp);
3847 end;
3848
3849 if ADoRecordChange then
3850 RecordChange(mvpaChange);
3851 if ( AValue <> nil ) then begin
3852 if prp.isContainment() then begin
3853 oldContainer := newObj.getContainer();
3854 if Assigned(oldContainer) then
3855 oldContainer.setDataObject(newObj.getContainmentProperty(),nil);
3856 end;
3857 fld.setDataObject(locBuffer,data_offset,AValue);
3858 if prp.isContainment() then begin
3859 newObj.setContainer(ownerIntf,prp);
3860 if ADoRecordChange then begin
3861 if ( locCS = nil ) then
3862 locCS := ownerIntf.getChangeSummary() as ISDOChangeSummaryEx;
3863 if ( locCS <> nil ) and locCS.isLogging() then begin
3864 locCS.getRecorder().recordCreation(newObj as ISDODataObject,getCursor().GetPosition());
3865 end;
3866 end;
3867 end;
3868 if prp.isReference() then
3869 newObj.AddReference(ownerIntf,prp);
3870 end else begin;
3871 fld.setDataObject(locBuffer,data_offset,nil);
3872 end;
3873 end;
3874
3875 procedure TSDOOwnedDataObjectList.RecordChange(const AChange : TManyValuePropAction);
3876 var
3877 locCS : ISDOChangeSummaryEx;
3878 begin
3879 locCS := getOwner().getChangeSummary() as ISDOChangeSummaryEx;
3880 if ( locCS <> nil ) and locCS.isLogging() then begin
3881 locCS.getRecorder().recordChange(getOwner(),FOwnerProperty,getCursor().GetPosition(),AChange);
3882 end;
3883 end;
3884
3885 procedure TSDOOwnedDataObjectList.setDataObject(AValue: ISDODataObject);
3886 begin
3887 InternalSetDataObject(AValue,True);
3888 end;
3889
3890 procedure TSDOOwnedDataObjectList.setInteger(const AValue: TSDOInteger);
3891 begin
3892 RecordChange(mvpaChange);
3893 inherited setInteger(AValue);
3894 end;
3895
3896 procedure TSDOOwnedDataObjectList.setDataObject(const AIndex: PtrInt; AValue: ISDODataObject);
3897 begin
3898 MoveTo(AIndex);
3899 setDataObject(AValue);
3900 end;
3901
3902 procedure TSDOOwnedDataObjectList.setInteger(const AIndex: PtrInt; const AValue: TSDOInteger);
3903 begin
3904 MoveTo(AIndex);
3905 setInteger(AValue);
3906 end;
3907
3908 procedure TSDOOwnedDataObjectList.setBoolean(const AValue: TSDOBoolean);
3909 begin
3910 RecordChange(mvpaChange);
3911 inherited setBoolean(AValue);
3912 end;
3913
3914 procedure TSDOOwnedDataObjectList.setString(const AValue: TSDOString);
3915 begin
3916 RecordChange(mvpaChange);
3917 inherited setString(AValue);
3918 end;
3919
3920 procedure TSDOOwnedDataObjectList.setBoolean(const AIndex: PtrInt; const AValue: TSDOBoolean);
3921 begin
3922 MoveTo(AIndex);
3923 setBoolean(AValue);
3924 end;
3925
3926 procedure TSDOOwnedDataObjectList.setString(const AIndex: PtrInt; const AValue: TSDOString);
3927 begin
3928 MoveTo(AIndex);
3929 setString(AValue);
3930 end;
3931
3932 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOBoolean);
3933 begin
3934 inherited insert(AIndex, AValue);
3935 RecordChange(mvpaInsert);
3936 end;
3937
3938 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOString);
3939 begin
3940 inherited insert(AIndex, AValue);
3941 RecordChange(mvpaInsert);
3942 end;
3943
3944 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOBoolean);
3945 begin
3946 inherited append(AValue);
3947 RecordChange(mvpaAppend);
3948 end;
3949
3950 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOString);
3951 begin
3952 inherited append(AValue);
3953 RecordChange(mvpaAppend);
3954 end;
3955
3956 procedure TSDOOwnedDataObjectList.setByte(const AValue: TSDOByte);
3957 begin
3958 RecordChange(mvpaChange);
3959 inherited setByte(AValue);
3960 end;
3961
3962 procedure TSDOOwnedDataObjectList.setByte(const AIndex: PtrInt; const AValue: TSDOByte);
3963 begin
3964 MoveTo(AIndex);
3965 setByte(AValue);
3966 end;
3967
3968 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOByte);
3969 begin
3970 inherited insert(AIndex, AValue);
3971 RecordChange(mvpaInsert);
3972 end;
3973
3974 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOByte);
3975 begin
3976 inherited append(AValue);
3977 RecordChange(mvpaAppend);
3978 end;
3979
3980 {$IFDEF HAS_SDO_BYTES}
3981 procedure TSDOOwnedDataObjectList.setBytes(AValue: TSDOBytes);
3982 begin
3983 RecordChange(mvpaChange);
3984 inherited setBytes(AValue);
3985 end;
3986
3987 procedure TSDOOwnedDataObjectList.setBytes(const AIndex: PtrInt; AValue: TSDOBytes);
3988 begin
3989 MoveTo(AIndex);
3990 setBytes(AValue);
3991 end;
3992
3993 procedure TSDOOwnedDataObjectList.insertBytes(const AIndex: PtrInt; AValue : TSDOBytes);
3994 begin
3995 inherited insertBytes(AIndex, AValue);
3996 RecordChange(mvpaInsert);
3997 end;
3998
3999 procedure TSDOOwnedDataObjectList.appendBytes(AValue : TSDOBytes);
4000 begin
4001 inherited appendBytes(AValue);
4002 RecordChange(mvpaAppend);
4003 end;
4004 {$ENDIF HAS_SDO_BYTES}
4005
4006 procedure TSDOOwnedDataObjectList.setDate(const AValue: TSDODate);
4007 begin
4008 RecordChange(mvpaChange);
4009 inherited setDate(AValue);
4010 end;
4011
4012 procedure TSDOOwnedDataObjectList.setDate(const AIndex: PtrInt; const AValue: TSDODate);
4013 begin
4014 MoveTo(AIndex);
4015 setDate(AValue);
4016 end;
4017
4018 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDODate);
4019 begin
4020 inherited insert(AIndex, AValue);
4021 RecordChange(mvpaInsert);
4022 end;
4023
4024 procedure TSDOOwnedDataObjectList.append(const AValue: TSDODate);
4025 begin
4026 inherited append(AValue);
4027 RecordChange(mvpaAppend);
4028 end;
4029
4030 {$IFDEF HAS_SDO_CHAR}
4031 procedure TSDOOwnedDataObjectList.setCharacter(const AValue: TSDOChar);
4032 begin
4033 RecordChange(mvpaChange);
4034 inherited setCharacter(AValue);
4035 end;
4036
4037 procedure TSDOOwnedDataObjectList.setCharacter(const AIndex: PtrInt; const AValue: TSDOChar);
4038 begin
4039 MoveTo(AIndex);
4040 setCharacter(AValue);
4041 end;
4042
4043 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOChar);
4044 begin
4045 inherited insert(AIndex, AValue);
4046 RecordChange(mvpaInsert);
4047 end;
4048
4049 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOChar);
4050 begin
4051 inherited append(AValue);
4052 RecordChange(mvpaAppend);
4053 end;
4054 {$ENDIF HAS_SDO_CHAR}
4055
4056 {$IFDEF HAS_SDO_CURRENCY}
4057 procedure TSDOOwnedDataObjectList.setCurrency(const AValue: TSDOCurrency);
4058 begin
4059 RecordChange(mvpaChange);
4060 inherited setCurrency(AValue);
4061 end;
4062
4063 procedure TSDOOwnedDataObjectList.setCurrency(const AIndex: PtrInt; const AValue: TSDOCurrency);
4064 begin
4065 MoveTo(AIndex);
4066 setCurrency(AValue);
4067 end;
4068
4069 procedure TSDOOwnedDataObjectList.insertCurrency(const AIndex: PtrInt; const AValue: TSDOCurrency);
4070 begin
4071 inherited insertCurrency(AIndex, AValue);
4072 RecordChange(mvpaInsert);
4073 end;
4074
4075 procedure TSDOOwnedDataObjectList.appendCurrency(const AValue: TSDOCurrency);
4076 begin
4077 inherited appendCurrency(AValue);
4078 RecordChange(mvpaAppend);
4079 end;
4080 {$ENDIF HAS_SDO_CURRENCY}
4081
4082 {$IFDEF HAS_SDO_DOUBLE}
4083 procedure TSDOOwnedDataObjectList.setDouble(const AValue: TSDODouble);
4084 begin
4085 RecordChange(mvpaChange);
4086 inherited setDouble(AValue);
4087 end;
4088
4089 procedure TSDOOwnedDataObjectList.setDouble(const AIndex: PtrInt; const AValue: TSDODouble);
4090 begin
4091 MoveTo(AIndex);
4092 setDouble(AValue);
4093 end;
4094
4095 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDODouble);
4096 begin
4097 inherited insert(AIndex, AValue);
4098 RecordChange(mvpaInsert);
4099 end;
4100
4101 procedure TSDOOwnedDataObjectList.append(const AValue: TSDODouble);
4102 begin
4103 inherited append(AValue);
4104 RecordChange(mvpaAppend);
4105 end;
4106 {$ENDIF HAS_SDO_DOUBLE}
4107
4108 {$IFDEF HAS_SDO_FLOAT}
4109 procedure TSDOOwnedDataObjectList.setFloat(const AValue: TSDOFloat);
4110 begin
4111 RecordChange(mvpaChange);
4112 inherited setFloat(AValue);
4113 end;
4114
4115 procedure TSDOOwnedDataObjectList.setFloat(const AIndex: PtrInt; const AValue: TSDOFloat);
4116 begin
4117 MoveTo(AIndex);
4118 setFloat(AValue);
4119 end;
4120
4121 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOFloat);
4122 begin
4123 inherited insert(AIndex, AValue);
4124 RecordChange(mvpaInsert);
4125 end;
4126
4127 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOFloat);
4128 begin
4129 inherited append(AValue);
4130 RecordChange(mvpaAppend);
4131 end;
4132 {$ENDIF HAS_SDO_FLOAT}
4133
4134 {$IFDEF HAS_SDO_LONG}
4135 procedure TSDOOwnedDataObjectList.setLong(const AValue: TSDOLong);
4136 begin
4137 RecordChange(mvpaChange);
4138 inherited setLong(AValue);
4139 end;
4140
4141 procedure TSDOOwnedDataObjectList.setLong(const AIndex: PtrInt; const AValue: TSDOLong);
4142 begin
4143 MoveTo(AIndex);
4144 setLong(AValue);
4145 end;
4146
4147 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOLong);
4148 begin
4149 inherited insert(AIndex, AValue);
4150 RecordChange(mvpaInsert);
4151 end;
4152
4153 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOLong);
4154 begin
4155 inherited append(AValue);
4156 RecordChange(mvpaAppend);
4157 end;
4158 {$ENDIF HAS_SDO_LONG}
4159
4160 {$IFDEF HAS_SDO_SHORT}
4161 procedure TSDOOwnedDataObjectList.setShort(const AValue: TSDOShort);
4162 begin
4163 RecordChange(mvpaChange);
4164 inherited setShort(AValue);
4165 end;
4166
4167 procedure TSDOOwnedDataObjectList.setShort(const AIndex: PtrInt; const AValue: TSDOShort);
4168 begin
4169 MoveTo(AIndex);
4170 setShort(AValue);
4171 end;
4172
4173 procedure TSDOOwnedDataObjectList.insert(const AIndex: PtrInt; const AValue: TSDOShort);
4174 begin
4175 inherited insert(AIndex, AValue);
4176 RecordChange(mvpaInsert);
4177 end;
4178
4179 procedure TSDOOwnedDataObjectList.append(const AValue: TSDOShort);
4180 begin
4181 inherited append(AValue);
4182 RecordChange(mvpaAppend);
4183 end;
4184 {$ENDIF HAS_SDO_SHORT}
4185
4186
4187 procedure TSDOOwnedDataObjectList.setVariant(const AValue: TSDOVariant);
4188 begin
4189 RecordChange(mvpaChange);
4190 inherited setVariant(AValue);
4191 end;
4192
4193 procedure TSDOOwnedDataObjectList.setVariant(const AIndex: PtrInt; const AValue: TSDOVariant);
4194 begin
4195 MoveTo(AIndex);
4196 setVariant(AValue);
4197 end;
4198
4199 end.
4200