PageRenderTime 77ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 1ms

/packages/fcl-sdo/src/base/sdo_dataobject.pas

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