1 {
2     This file is part of the Free Pascal Class Library SDO Implementation
3     Copyright (c) 2012 by Inoussa OUEDRAOGO
4     Free Pascal development team
5 
6     This unit implements basic SDO data type definitions
7 
8     See the file COPYING.FPC, included in this distribution,
9     for details about the copyright.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 
15  **********************************************************************}
16 {$INCLUDE sdo_global.inc}
17 unit sdo_type;
18 
19 interface
20 uses SysUtils, Classes,
21      sdo_types, sdo;
22 
23 const
24   VALUE_STATUS_LENGTH = 1;
25 
26 type
27 
28   ISDOTypeEx = interface(ISDOType)
29     ['{19C39BF1-397C-4A10-98B2-EB4D23CB027C}']
30     procedure setBaseType(const ABaseType : ISDOType);
31     procedure setAlias(const AAlias : string);
32     procedure setUsedFlag(const AUsed : Boolean);
isUsednull33     function isUsed() : Boolean;
getFieldSizenull34     function getFieldSize() : PtrUInt;
inheritsnull35     function inherits(const AType : ISDOType) : Boolean;
36   end;
37 
38   ISDOObjectType = interface(ISDOTypeEx)
39     ['{19C39BF1-397C-4A10-98B2-EB4D23CB027C}']
40     procedure AddProperty(
41       const AName : string;
42       const AType : ISDOType;
43       const AFlags  : TPropertyFlags
44     );
45     procedure DropProperty(const AProperty : ISDOProperty);
IsOwnerOfnull46     function IsOwnerOf(const AProp : ISDOProperty) : Boolean;
47     procedure Clear();
48   end;
49 
50   ISDOTypeListEx = interface(ISDOTypeList)
51     ['{7C23199E-F9CB-4704-AD51-93C7FB22BB6A}']
52     procedure insert(const AType : ISDOType);
53   end;
54 
55   TSDOTypeAsbtract = class(TInterfacedObject,IInterface,ISDOType,ISDOTypeEx)
56   private
57     FOwner : Pointer; //ISDODataFactory;
58     FName : string;
59     FURI : string;
60     FALiasList : TStringList;
61     FFlags : TTypeFlags;
62     FUsed : Boolean;
63   protected
64     procedure CheckNotUsed(const AOperationName : string);{$IFDEF USE_INLINE}inline;{$ENDIF}
65   protected
getNamenull66     function getName() : string;
getAliasnull67 	  function getAlias(const AIndex : PtrInt) : string;
getAliasCountnull68 	  function getAliasCount() : PtrInt;
getBaseTypenull69 	  function getBaseType() : ISDOType; virtual;
getURInull70 	  function getURI() : string;virtual;
getPropertiesnull71 	  function getProperties() : ISDOPropertyList;virtual;abstract;
getPropertynull72     function getProperty(const APropertyName : string) : ISDOProperty;overload;virtual;abstract;
getPropertynull73     function getProperty(const APropertyIndex : Integer) : ISDOProperty;overload;virtual;abstract;
getPropertyIndexnull74 	  function getPropertyIndex(const APropertyName : string) : Integer; virtual;abstract;
isDataObjectTypenull75 	  function isDataObjectType() : Boolean;virtual;abstract;
isSequencedTypenull76 	  function isSequencedType() : Boolean;
isOpenTypenull77 	  function isOpenType() : Boolean;
isAbstractTypenull78 	  function isAbstractType() : Boolean;
isDataTypenull79     function isDataType() : Boolean;
isChangeSummaryTypenull80     function isChangeSummaryType() : Boolean;virtual;abstract;
getTypeEnumnull81     function getTypeEnum() : TSDOTypeKind; virtual;abstract;
equalsnull82     function equals(const AOther : ISDOType) : Boolean; virtual;
getFlagsnull83     function getFlags() : TTypeFlags;
84     // ISDOTypeEx
85     procedure setBaseType(const ABaseType : ISDOType);virtual;
86     procedure setAlias(const AAlias : string);
87     procedure setUsedFlag(const AUsed : Boolean);virtual;
isUsednull88     function isUsed() : Boolean;
getFieldSizenull89     function getFieldSize() : PtrUInt;virtual;abstract;
inheritsnull90     function inherits(const AType : ISDOType) : Boolean;virtual;
getOwnernull91     function getOwner() : ISDODataFactory;
92   public
93     constructor Create(const AOwner : ISDODataFactory; const AName, AURI : string);
94     destructor Destroy();override;
95   end;
96 
97   TSDOSimpleType = class(TSDOTypeAsbtract)
98   protected
getPropertiesnull99     function getProperties() : ISDOPropertyList;override;
getPropertynull100     function getProperty(const APropertyName : string) : ISDOProperty;overload;override;
getPropertynull101     function getProperty(const APropertyIndex : Integer) : ISDOProperty;overload;override;
getPropertyIndexnull102 	  function getPropertyIndex(const APropertyName : string) : Integer; override;
isDataObjectTypenull103 	  function isDataObjectType() : Boolean;override;
isAbstractTypenull104 	  //function isAbstractType() : Boolean;override;
105     function isChangeSummaryType() : Boolean;override;
getTypeEnumnull106     //function getTypeEnum() : TSDOTypeKind; override;
107   public
108     constructor Create(const AOwner : ISDODataFactory; const AName, AURI : string);
109   end;
110 
111   TSDOChangeSummaryType = class(TSDOTypeAsbtract)
112   protected
getPropertiesnull113 	  function getProperties() : ISDOPropertyList;override;
getPropertynull114     function getProperty(const APropertyName : string) : ISDOProperty;overload;override;
getPropertynull115     function getProperty(const APropertyIndex : Integer) : ISDOProperty;overload;override;
getPropertyIndexnull116 	  function getPropertyIndex(const APropertyName : string) : Integer; override;
isDataObjectTypenull117 	  function isDataObjectType() : Boolean;override;
isChangeSummaryTypenull118     function isChangeSummaryType() : Boolean;override;
getTypeEnumnull119     function getTypeEnum() : TSDOTypeKind; override;
120     // ISDOTypeEx
121     procedure setBaseType(const ABaseType : ISDOType);override;
122     //procedure setAlias(const AAlias : string);
123     //procedure setUsedFlag(const AUsed : Boolean);virtual;
isUsednull124     //function isUsed() : Boolean;
125     function getFieldSize() : PtrUInt;override;
126   public
127     constructor Create(const AOwner : ISDODataFactory);
128   end;
129 
130   TSDOConcreteSimpleType = class(TSDOSimpleType)
131   end;
132 
133   TSDOUserDefinedSimpleType = class(TSDOConcreteSimpleType)
134   private
135     FBaseType : ISDOType;
136   protected
getBaseTypenull137     function getBaseType() : ISDOType; override;
getTypeEnumnull138     function getTypeEnum() : TSDOTypeKind; override;
139     procedure setBaseType(const ABaseType : ISDOType);override;
getFieldSizenull140     function getFieldSize() : PtrUInt;override;
141   public
142     constructor Create(
143       const AOwner : ISDODataFactory;
144       const AName, AURI : string;
145       const AIsAbstract : Boolean
146     );
147   end;
148 
149   TSDONativeSimpleType = class(TSDOConcreteSimpleType)
150   protected
151     procedure setBaseType(const ABaseType : ISDOType);override;
152   end;
153 
154   TSDOBooleanType = class(TSDONativeSimpleType)
155   protected
getTypeEnumnull156 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull157     function getFieldSize() : PtrUInt;override;
158   public
159     constructor Create(const AOwner : ISDODataFactory);
160   end;
161 
162   TSDOByteType = class(TSDONativeSimpleType)
163   protected
getTypeEnumnull164 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull165     function getFieldSize() : PtrUInt;override;
166   public
167     constructor Create(const AOwner : ISDODataFactory);
168   end;
169 
170 {$IFDEF HAS_SDO_BYTES}
171   TSDOBytesType = class(TSDONativeSimpleType)
172   protected
getTypeEnumnull173 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull174     function getFieldSize() : PtrUInt;override;
175   public
176     constructor Create(const AOwner : ISDODataFactory);
177   end;
178 {$ENDIF HAS_SDO_BYTES}
179 
180 {$IFDEF HAS_SDO_CHAR}
181   TSDOCharacterType = class(TSDONativeSimpleType)
182   protected
getTypeEnumnull183 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull184     function getFieldSize() : PtrUInt;override;
185   public
186     constructor Create(const AOwner : ISDODataFactory);
187   end;
188 {$ENDIF HAS_SDO_CHAR}
189 
190   TSDOBaseNumericType = class(TSDONativeSimpleType)
191   end;
192 
193 {$IFDEF HAS_SDO_CURRENCY}
194   TSDOCurrencyType = class(TSDOBaseNumericType)
195   protected
getTypeEnumnull196 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull197     function getFieldSize() : PtrUInt;override;
198   public
199     constructor Create(const AOwner : ISDODataFactory);
200   end;
201 {$ENDIF HAS_SDO_CURRENCY}
202 
203   TSDOBaseStringType = class(TSDONativeSimpleType)
204   end;
205 
206   TSDODateTimeType = class(TSDONativeSimpleType)
207   protected
getTypeEnumnull208 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull209     function getFieldSize() : PtrUInt;override;
210   public
211     constructor Create(const AOwner : ISDODataFactory);
212   end;
213 
214 {$IFDEF HAS_SDO_DOUBLE}
215   TSDODoubleType = class(TSDOBaseNumericType)
216   protected
getTypeEnumnull217 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull218     function getFieldSize() : PtrUInt;override;
219   public
220     constructor Create(const AOwner : ISDODataFactory);
221   end;
222 {$ENDIF HAS_SDO_DOUBLE}
223 
224 {$IFDEF HAS_SDO_FLOAT}
225   TSDOFloatType = class(TSDOBaseNumericType)
226   protected
getTypeEnumnull227 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull228     function getFieldSize() : PtrUInt;override;
229   public
230     constructor Create(const AOwner : ISDODataFactory);
231   end;
232 {$ENDIF HAS_SDO_FLOAT}
233 
234   TSDOBaseOrdinalType = class(TSDONativeSimpleType)
235   end;
236 
237   TSDOIntegerType = class(TSDOBaseOrdinalType)
238   protected
getTypeEnumnull239 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull240     function getFieldSize() : PtrUInt;override;
241   public
242     constructor Create(const AOwner : ISDODataFactory);
243   end;
244 
245 {$IFDEF HAS_SDO_LONG}
246   TSDOLongType = class(TSDOBaseOrdinalType)
247   protected
getTypeEnumnull248 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull249     function getFieldSize() : PtrUInt;override;
250   public
251     constructor Create(const AOwner : ISDODataFactory);
252   end;
253 {$ENDIF HAS_SDO_LONG}
254 
255 {$IFDEF HAS_SDO_SHORT}
256   TSDOShortType = class(TSDOBaseOrdinalType)
257   protected
getTypeEnumnull258 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull259     function getFieldSize() : PtrUInt;override;
260   public
261     constructor Create(const AOwner : ISDODataFactory);
262   end;
263 {$ENDIF HAS_SDO_SHORT}
264 
265   TSDOStringType = class(TSDOBaseStringType)
266   protected
getTypeEnumnull267 	  function getTypeEnum() : TSDOTypeKind; override;
getFieldSizenull268     function getFieldSize() : PtrUInt;override;
269   public
270     constructor Create(const AOwner : ISDODataFactory);
271   end;
272 
273   TSDOBaseObjectType = class(
274     TSDOTypeAsbtract,
275     IInterface,
276     ISDOType,
277     ISDOTypeEx,
278     ISDOObjectType
279   )
280   private
281     FBaseType : ISDOObjectType;
282     FProperties : ISDOPropertyList;
283   protected
getBaseTypenull284 	  function getBaseType() : ISDOType; override;
getPropertiesnull285 	  function getProperties() : ISDOPropertyList; override;
getPropertynull286     function getProperty(const APropertyName : string) : ISDOProperty;overload; override;
getPropertynull287     function getProperty(const APropertyIndex : Integer) : ISDOProperty;overload; override;
getPropertyIndexnull288 	  function getPropertyIndex(const APropertyName : string) : Integer;  override;
isDataObjectTypenull289 	  function isDataObjectType() : Boolean; override;
isChangeSummaryTypenull290     function isChangeSummaryType() : Boolean;override;
getTypeEnumnull291     function getTypeEnum() : TSDOTypeKind;  override;
292     procedure setBaseType(const ABaseType : ISDOType);override;
293     procedure AddProperty(
294       const AName : string;
295       const AType : ISDOType;
296       const AFlags  : TPropertyFlags
297     );
getFieldSizenull298     function getFieldSize() : PtrUInt;override;
299 
300     //ISDOTypeEx
301     procedure setUsedFlag(const AUsed : Boolean);override;
302     procedure DropProperty(const AProperty : ISDOProperty);
IsOwnerOfnull303     function IsOwnerOf(const AProp : ISDOProperty) : Boolean;
inheritsnull304     function inherits(const AType : ISDOType) : Boolean;override;
305     procedure Clear();
306   public
307     constructor Create(
308       const AOwner : ISDODataFactory;
309       const AName, AURI : string;
310       const ASequenced  : Boolean;
311       const AOpened     : Boolean;
312       const AAbstract   : Boolean
313     );
314     destructor Destroy();override;
315   end;
316 
317   TSDOObjectType = class(
318     TSDOBaseObjectType
319   )
320   end;
321 
322   TSDOTypeList = class(
323     TInterfacedObject,
324     IInterface,
325     ISDOTypeList,
326     ISDOTypeListEx
327   )
328   private
329     FList : IInterfaceList;
330   protected
getCountnull331     function getCount() : Integer;
getItemnull332     function getItem(const AIndex : Integer) : ISDOType;
333     procedure insert(const AType : ISDOType);
findnull334     function find(const AUri, AName : string) : ISDOType;
getIndexnull335     function getIndex(const AUri, AName : string) : Integer;
336   public
337     constructor Create();
338     destructor Destroy();override;
339   end;
340 
341   ISDOPropertyEx = interface(ISDOProperty)
342     ['{C0ECCD8C-5727-4E1A-A389-BE15F3F8B350}']
343     procedure setAlias(const AAlias : string);
getBufferOffsetnull344     function getBufferOffset() : PtrUInt;
setBufferOffsetnull345     function setBufferOffset(const AStartingAddress : PtrUInt) : PtrUInt;
346     // do not use this : it is only for houskeeping
347     procedure ClearType();
348   end;
349 
350   ISDOPropertyListEx = interface(ISDOPropertyList)
351     ['{C67F5513-7833-4DE1-870F-DFBEDFFCF5BA}']
352     procedure add(const AProperty : ISDOProperty);
SetBasenull353     function SetBase(const ABaseList : ISDOPropertyList) : ISDOPropertyList;
354     procedure drop(const AProperty : ISDOProperty);
355   end;
356 
357   TSDOPropertyAsbtract = class(
358     TInterfacedObject,
359     IInterface,
360     ISDOProperty,
361     ISDOPropertyEx
362   )
363   private
364     FName : string;
365     FALiasList : TStrings;
366     FType : Pointer; //ISDOType;
367     FContainingType : Pointer;
368     FBufferOffset : PtrUInt;
369     FDefault : TValueBuffer;
370     FDefaultSet : Boolean;
371     FFlags : TPropertyFlags;
372     FWeakReferenceToType : Boolean;
373     FTypeKind : TSDOTypeKind;
374   private
375     procedure InternalSetBufferOffset(const AOffset : PtrUInt);{$IFDEF USE_INLINE}inline;{$ENDIF}
376     procedure FreeDefaultBuffer();
377     procedure CheckIfContainingTypeIsUsed(const AOperation : string);{$IFDEF USE_INLINE}inline;{$ENDIF}
378   protected
getNamenull379  	  function getName() : string;
getAliasnull380     function getAlias(const AIndex : Integer) : string;
getAliasCountnull381     function getAliasCount() : Integer;
getTypenull382     function getType() : ISDOType;
getTypeEnumnull383     function getTypeEnum() : TSDOTypeKind;
isManynull384     function isMany() : Boolean;
isContainmentnull385     function isContainment() : Boolean;
isReferencenull386     function isReference() : Boolean;
getContainingTypenull387     function getContainingType() : ISDOType;
isReadOnlynull388     function isReadOnly() : Boolean;
getOppositenull389     function getOpposite() : ISDOProperty; virtual;
isDefaultednull390 	  function isDefaulted() : Boolean;
getStringDefaultnull391     function getStringDefault() : TSDOString;
392 {$IFDEF HAS_SDO_BYTES}
getBytesDefaultnull393     function getBytesDefault() : TSDOBytes;
394 {$ENDIF HAS_SDO_BYTES}
getBooleanDefaultnull395     function getBooleanDefault() : TSDOBoolean;
getByteDefaultnull396     function getByteDefault() : TSDOByte;
397 {$IFDEF HAS_SDO_CHAR}
getCharacterDefaultnull398     function getCharacterDefault() : TSDOChar;
399 {$ENDIF HAS_SDO_CHAR}
400 {$IFDEF HAS_SDO_CURRENCY}
getCurrencyDefaultnull401     function getCurrencyDefault() : TSDOCurrency;
402 {$ENDIF HAS_SDO_CURRENCY}
getDateDefaultnull403     function getDateDefault() : TSDODate;
404 {$IFDEF HAS_SDO_DOUBLE}
getDoubleDefaultnull405     function getDoubleDefault() : TSDODouble;
406 {$ENDIF HAS_SDO_DOUBLE}
407 {$IFDEF HAS_SDO_FLOAT}
getFloatDefaultnull408     function getFloatDefault() : TSDOFloat;
409 {$ENDIF HAS_SDO_FLOAT}
getIntegerDefaultnull410     function getIntegerDefault() : TSDOInteger;
411 {$IFDEF HAS_SDO_LONG}
getLongDefaultnull412     function getLongDefault() : TSDOLong;
413 {$ENDIF HAS_SDO_LONG}
414 {$IFDEF HAS_SDO_SHORT}
getShortDefaultnull415     function getShortDefault() : TSDOShort;
416 {$ENDIF HAS_SDO_SHORT}
417     procedure setDefault(const AValue : TSDOBoolean);overload;
418     procedure setDefault(const AValue : TSDOByte);overload;
419 {$IFDEF HAS_SDO_BYTES}
420     procedure setDefault(AValue : TSDOBytes);overload;
421 {$ENDIF HAS_SDO_BYTES}
422 {$IFDEF HAS_SDO_CHAR}
423     procedure setDefault(const AValue : TSDOChar);overload;
424 {$ENDIF HAS_SDO_CHAR}
425 {$IFDEF HAS_SDO_CURRENCY }
426     procedure setDefaultCurrency(const AValue : TSDOCurrency);
427 {$ENDIF HAS_SDO_CURRENCY }
428     procedure setDefault(const AValue : TSDODate);overload;
429 {$IFDEF HAS_SDO_DOUBLE}
430     procedure setDefault(const AValue : TSDODouble);overload;
431 {$ENDIF HAS_SDO_DOUBLE}
432 {$IFDEF HAS_SDO_FLOAT}
433     procedure setDefault(const AValue : TSDOFloat);overload;
434 {$ENDIF HAS_SDO_FLOAT}
435     procedure setDefault(const AValue : TSDOInteger);overload;
436 {$IFDEF HAS_SDO_LONG}
437     procedure setDefault(const AValue : TSDOLong);overload;
438 {$ENDIF HAS_SDO_LONG}
439 {$IFDEF HAS_SDO_SHORT}
440     procedure setDefault(const AValue : TSDOShort);overload;
441 {$ENDIF HAS_SDO_SHORT}
442     procedure setDefault(const AValue : TSDOString);overload;
443 
isNullablenull444     function isNullable() : Boolean;
isAttributenull445     function isAttribute() : Boolean;
446 
447     // ISDOPropertyEx
448     procedure setAlias(const AAlias : string);
setBufferOffsetnull449     function setBufferOffset(const AStartingAddress : PtrUInt) : PtrUInt;
getBufferOffsetnull450     function getBufferOffset() : PtrUInt;
451     procedure ClearType();
452   public
453     constructor Create(
454       const AName  : string;
455       const AType  : ISDOType;
456       const AFlags  : TPropertyFlags;
457       const AContainingType : ISDOType
458     );
459     destructor Destroy();override;
460   end;
461 
462   TSDOProperty = class(TSDOPropertyAsbtract,IInterface,ISDOProperty)
463   end;
464 
465   TSDOPropertyList = class(
466     TInterfacedObject,
467     IInterface,
468     ISDOPropertyList,
469     ISDOPropertyListEx
470   )
471   private
472     FList : IInterfaceList;
473     FBaseList : ISDOPropertyList;
474   protected
getCountnull475     function getCount() : Integer;
getItemnull476     function getItem(const AIndex : Integer) : ISDOProperty;
477     procedure add(const AProperty : ISDOProperty);
findnull478     function find(const AName : string) : ISDOProperty;
getIndexnull479     function getIndex(const APropertyName : string) : Integer;
SetBasenull480     function SetBase(const ABaseList : ISDOPropertyList) : ISDOPropertyList;
481     procedure drop(const AProperty : ISDOProperty);
482   public
483     constructor Create(const ABaseList : ISDOPropertyList);
484     destructor Destroy();override;
485   end;
486 
487 implementation
488 uses
489   sdo_imp_utils, sdo_date_utils;
490 
491 
492 { TSDOTypeAsbtract }
493 
494 procedure TSDOTypeAsbtract.CheckNotUsed(const AOperationName : string);
495 begin
496   if FUsed then
497     raise ESDOInvalidStateOperationException.Create(AOperationName);
498 end;
499 
500 constructor TSDOTypeAsbtract.Create(const AOwner : ISDODataFactory; const AName, AURI: string);
501 begin
502   FOwner := Pointer(AOwner);
503   FName := AName;
504   FURI := AURI;
505   FALiasList := TStringList.Create();
506   FALiasList.Duplicates := dupIgnore;
507   //FALiasList.Sorted := True;
508   FALiasList.CaseSensitive := False;
509 end;
510 
511 destructor TSDOTypeAsbtract.Destroy;
512 begin
513   FreeAndNil(FALiasList);
514   inherited;
515 end;
516 
equalsnull517 function TSDOTypeAsbtract.equals(const AOther: ISDOType): Boolean;
518 var
519   i, c : PtrInt;
520 begin
521   Result := False;
522   if AnsiSameText(Self.getURI(),AOther.getURI()) then begin
523     if AnsiSameText(Self.getName(),AOther.getName()) or
524        ( Self.FALiasList.IndexOf(AOther.getName()) > -1 )
525     then begin
526       Result := True;
527     end else begin
528       c := AOther.getAliasCount();
529       if ( c > 0 ) then begin
530         for i := 0 to Pred(c) do begin
531           if AnsiSameText(FName,AOther.getAlias(i)) then begin
532             Result := True;
533             Break;
534           end;
535         end;
536       end;
537     end;
538   end;
539 end;
540 
getAliasnull541 function TSDOTypeAsbtract.getAlias(const AIndex: PtrInt): string;
542 begin
543   if ( AIndex >= 0 ) and ( AIndex < FALiasList.Count ) then
544     Result := FALiasList[AIndex]
545   else
546     raise ESDOIndexOutOfRangeException.Create(AIndex);
547 end;
548 
getAliasCountnull549 function TSDOTypeAsbtract.getAliasCount() : PtrInt;
550 begin
551   Result := FALiasList.Count;
552 end;
553 
TSDOTypeAsbtract.getBaseTypenull554 function TSDOTypeAsbtract.getBaseType() : ISDOType;
555 begin
556   Result := nil;
557 end;
558 
TSDOTypeAsbtract.getFlagsnull559 function TSDOTypeAsbtract.getFlags() : TTypeFlags;
560 begin
561   Result := FFlags;
562 end;
563 
getNamenull564 function TSDOTypeAsbtract.getName() : string;
565 begin
566   Result := FName;
567 end;
568 
TSDOTypeAsbtract.getOwnernull569 function TSDOTypeAsbtract.getOwner() : ISDODataFactory;
570 begin
571   Result := ISDODataFactory(FOwner);
572 end;
573 
TSDOTypeAsbtract.getURInull574 function TSDOTypeAsbtract.getURI() : string;
575 begin
576   Result := FURI;
577 end;
578 
TSDOTypeAsbtract.inheritsnull579 function TSDOTypeAsbtract.inherits(const AType: ISDOType): Boolean;
580 begin
581   Result := False;
582 end;
583 
TSDOTypeAsbtract.isAbstractTypenull584 function TSDOTypeAsbtract.isAbstractType() : Boolean;
585 begin
586   Result := ( tfIsAbstract in FFlags );
587 end;
588 
TSDOTypeAsbtract.isDataTypenull589 function TSDOTypeAsbtract.isDataType() : Boolean;
590 begin
591   Result := ( tfIsDataType in FFlags );
592 end;
593 
TSDOTypeAsbtract.isOpenTypenull594 function TSDOTypeAsbtract.isOpenType() : Boolean;
595 begin
596   Result := ( tfIsOpen in FFlags );
597 end;
598 
isSequencedTypenull599 function TSDOTypeAsbtract.isSequencedType() : Boolean;
600 begin
601   Result := ( tfIsSequenced in FFlags );
602 end;
603 
TSDOTypeAsbtract.isUsednull604 function TSDOTypeAsbtract.isUsed() : Boolean;
605 begin
606   Result := FUsed;
607 end;
608 
609 procedure TSDOTypeAsbtract.setAlias(const AAlias: string);
610 var
611   i : Integer;
612 begin
613   CheckNotUsed('AAlias');
614   for i := 0 to FALiasList.Count - 1 do begin
615     if (FALiasList[i] = AAlias) then
616       Exit;
617   end;
618   FALiasList.Add(AAlias);
619 end;
620 
621 procedure TSDOTypeAsbtract.setBaseType(const ABaseType: ISDOType);
622 begin
623   CheckNotUsed('setBaseType');
624 end;
625 
626 procedure TSDOTypeAsbtract.setUsedFlag(const AUsed: Boolean);
627 begin
628   FUsed := AUsed;
629 end;
630 
631 { TSDOSimpleType }
632 
633 constructor TSDOSimpleType.Create(const AOwner: ISDODataFactory; const AName, AURI: string);
634 begin
635   inherited Create(AOwner, AName, AURI);
636   Include(FFlags, tfIsDataType);
637 end;
638 
639 {$WARNINGS OFF}
TSDOSimpleType.getPropertiesnull640 function TSDOSimpleType.getProperties() : ISDOPropertyList;
641 begin
642   raise ESDOUnsupportedOperationException.Create('getProperties');
643 end;
644 {$WARNINGS ON}
645 
646 {$WARNINGS OFF}
getPropertynull647 function TSDOSimpleType.getProperty(const APropertyName: string): ISDOProperty;
648 begin
649   raise ESDOUnsupportedOperationException.Create('getProperty');
650 end;
651 {$WARNINGS ON}
652 
653 {$WARNINGS OFF}
getPropertynull654 function TSDOSimpleType.getProperty(const APropertyIndex: Integer): ISDOProperty;
655 begin
656   raise ESDOUnsupportedOperationException.Create('getProperty');
657 end;
658 {$WARNINGS ON}
659 
660 {$WARNINGS OFF}
getPropertyIndexnull661 function TSDOSimpleType.getPropertyIndex(const APropertyName: string): Integer;
662 begin
663   raise ESDOUnsupportedOperationException.Create('getPropertyIndex');
664 end;
665 {$WARNINGS ON}
666 
TSDOSimpleType.isChangeSummaryTypenull667 function TSDOSimpleType.isChangeSummaryType() : Boolean;
668 begin
669   Result := False;
670 end;
671 
TSDOSimpleType.isDataObjectTypenull672 function TSDOSimpleType.isDataObjectType() : Boolean;
673 begin
674   Result := False;
675 end;
676 
677 { TSDOBooleanType }
678 
679 constructor TSDOBooleanType.Create(const AOwner : ISDODataFactory);
680 begin
681   inherited Create(AOwner, 'Boolean', sdo_namespace);
682 end;
683 
getFieldSizenull684 function TSDOBooleanType.getFieldSize() : PtrUInt;
685 begin
686   Result := VALUE_STATUS_LENGTH + SizeOf(Byte);
687 end;
688 
getTypeEnumnull689 function TSDOBooleanType.getTypeEnum() : TSDOTypeKind;
690 begin
691   Result := BooleanType;
692 end;
693 
694 { TSDOByteType }
695 
696 constructor TSDOByteType.Create(const AOwner : ISDODataFactory);
697 begin
698   inherited Create(AOwner, 'Byte',sdo_namespace);
699 end;
700 
getFieldSizenull701 function TSDOByteType.getFieldSize() : PtrUInt;
702 begin
703   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOByte);
704 end;
705 
getTypeEnumnull706 function TSDOByteType.getTypeEnum() : TSDOTypeKind;
707 begin
708   Result := ByteType;
709 end;
710 
711 {$IFDEF HAS_SDO_BYTES}
712 { TSDOBytesType }
713 
714 constructor TSDOBytesType.Create(const AOwner : ISDODataFactory);
715 begin
716   inherited Create(AOwner, 'Bytes',sdo_namespace);
717   setAlias('hexBinary');
718 end;
719 
getFieldSizenull720 function TSDOBytesType.getFieldSize() : PtrUInt;
721 begin
722   Result := VALUE_STATUS_LENGTH + SizeOf(PPSDOBytes);
723 end;
724 
getTypeEnumnull725 function TSDOBytesType.getTypeEnum() : TSDOTypeKind;
726 begin
727   Result := BytesType;
728 end;
729 {$ENDIF HAS_SDO_BYTES}
730 
731 {$IFDEF HAS_SDO_CHAR}
732 { TSDOCharacterType }
733 
734 constructor TSDOCharacterType.Create(const AOwner : ISDODataFactory);
735 begin
736   inherited Create(AOwner, 'Character',sdo_namespace);
737   setAlias('Char');
738   setAlias('WideChar');
739   setAlias('AnsiChar');
740 end;
741 
getFieldSizenull742 function TSDOCharacterType.getFieldSize() : PtrUInt;
743 begin
744   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOChar);
745 end;
746 
getTypeEnumnull747 function TSDOCharacterType.getTypeEnum: TSDOTypeKind;
748 begin
749   Result := CharacterType;
750 end;
751 {$ENDIF HAS_SDO_CHAR}
752 
753 {$IFDEF HAS_SDO_CURRENCY}
754 { TSDOCurrencyType }
755 
756 constructor TSDOCurrencyType.Create(const AOwner : ISDODataFactory);
757 begin
758   inherited Create(AOwner, 'Currency',sdo_namespace);
759 end;
760 
getFieldSizenull761 function TSDOCurrencyType.getFieldSize() : PtrUInt;
762 begin
763   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOCurrency);
764 end;
765 
getTypeEnumnull766 function TSDOCurrencyType.getTypeEnum() : TSDOTypeKind;
767 begin
768   Result := CurrencyType;
769 end;
770 {$ENDIF HAS_SDO_CURRENCY}
771 
772 { TSDODateTimeType }
773 
774 constructor TSDODateTimeType.Create(const AOwner : ISDODataFactory);
775 begin
776   inherited Create(AOwner, 'DateTime',sdo_namespace);
777   setAlias('Date');
778 end;
779 
getFieldSizenull780 function TSDODateTimeType.getFieldSize() : PtrUInt;
781 begin
782   Result := VALUE_STATUS_LENGTH + SizeOf(TSDODateTime);
783 end;
784 
getTypeEnumnull785 function TSDODateTimeType.getTypeEnum() : TSDOTypeKind;
786 begin
787   Result := DateTimeType;
788 end;
789 
790 {$IFDEF HAS_SDO_DOUBLE}
791 { TSDODoubleType }
792 
793 constructor TSDODoubleType.Create(const AOwner : ISDODataFactory);
794 begin
795   inherited Create(AOwner, 'Double',sdo_namespace);
796 end;
797 
getFieldSizenull798 function TSDODoubleType.getFieldSize() : PtrUInt;
799 begin
800   Result := VALUE_STATUS_LENGTH + SizeOf(TSDODouble);
801 end;
802 
getTypeEnumnull803 function TSDODoubleType.getTypeEnum() : TSDOTypeKind;
804 begin
805   Result := DoubleType;
806 end;
807 {$ENDIF HAS_SDO_DOUBLE}
808 
809 {$IFDEF HAS_SDO_FLOAT}
810 { TSDOFloatType }
811 
812 constructor TSDOFloatType.Create(const AOwner : ISDODataFactory);
813 begin
814   inherited Create(AOwner, 'Float',sdo_namespace);
815 end;
816 
getFieldSizenull817 function TSDOFloatType.getFieldSize() : PtrUInt;
818 begin
819   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOFloat);
820 end;
821 
getTypeEnumnull822 function TSDOFloatType.getTypeEnum() : TSDOTypeKind;
823 begin
824   Result := FloatType;
825 end;
826 {$ENDIF HAS_SDO_FLOAT}
827 
828 { TSDOIntegerType }
829 
830 constructor TSDOIntegerType.Create(const AOwner : ISDODataFactory);
831 begin
832   inherited Create(AOwner, 'Integer',sdo_namespace);
833   setAlias('Int');
834 end;
835 
getFieldSizenull836 function TSDOIntegerType.getFieldSize() : PtrUInt;
837 begin
838   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOInteger);
839 end;
840 
getTypeEnumnull841 function TSDOIntegerType.getTypeEnum: TSDOTypeKind;
842 begin
843   Result := IntegerType;
844 end;
845 
846 { TSDOStringType }
847 
848 constructor TSDOStringType.Create(const AOwner : ISDODataFactory);
849 begin
850   inherited Create(AOwner, 'String',sdo_namespace);
851   setAlias('Strings');
852 end;
853 
getFieldSizenull854 function TSDOStringType.getFieldSize() : PtrUInt;
855 begin
856   Result := VALUE_STATUS_LENGTH + SizeOf(PPSDOString);
857 end;
858 
getTypeEnumnull859 function TSDOStringType.getTypeEnum() : TSDOTypeKind;
860 begin
861   Result := StringType;
862 end;
863 
864 {$IFDEF HAS_SDO_LONG}
865 { TSDOLongType }
866 
867 constructor TSDOLongType.Create(const AOwner : ISDODataFactory);
868 begin
869   inherited Create(AOwner, 'Long',sdo_namespace);
870 end;
871 
getFieldSizenull872 function TSDOLongType.getFieldSize() : PtrUInt;
873 begin
874   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOLong);
875 end;
876 
getTypeEnumnull877 function TSDOLongType.getTypeEnum() : TSDOTypeKind;
878 begin
879   Result := LongType;
880 end;
881 {$ENDIF HAS_SDO_LONG}
882 
883 {$IFDEF HAS_SDO_SHORT}
884 { TSDOShortType }
885 
886 constructor TSDOShortType.Create(const AOwner : ISDODataFactory);
887 begin
888   inherited Create(AOwner, 'Short',sdo_namespace);
889 end;
890 
getFieldSizenull891 function TSDOShortType.getFieldSize() : PtrUInt;
892 begin
893   Result := VALUE_STATUS_LENGTH + SizeOf(TSDOShort);
894 end;
895 
getTypeEnumnull896 function TSDOShortType.getTypeEnum() : TSDOTypeKind;
897 begin
898   Result := ShortType;
899 end;
900 {$ENDIF HAS_SDO_SHORT}
901 
902 { TSDOBaseObjectType }
903 
904 procedure TSDOBaseObjectType.AddProperty(
905   const AName: string;
906   const AType: ISDOType;
907   const AFlags  : TPropertyFlags
908 );
909 var
910   prpList : ISDOPropertyListEx;
911 begin
912   CheckNotUsed('AddProperty');
913   if ( AType = nil ) then
914     raise ESDOIllegalArgumentException.Create('AType');
915   if ( pfIsContainment in AFlags ) and ( not AType.isDataObjectType() ) then
916     raise ESDOIllegalArgumentException.Create('AIsContainment');
917   prpList := getProperties() as ISDOPropertyListEx;
918   if ( prpList.getIndex(AName) > -1 ) then
919     raise ESDOIllegalArgumentException.Create('AName');
920   if ( pfIsMany in AFlags ) and AType.isChangeSummaryType() then
921     raise ESDOIllegalArgumentException.Create('AIsMany');
922   prpList.add(
923     TSDOProperty.Create(AName,AType,AFlags,Self as ISDOType) as ISDOProperty
924   );
925 end;
926 
927 procedure TSDOBaseObjectType.Clear();
928 
929   procedure NilPropsBase();
930   var
931     exProps : ISDOPropertyListEx;
932   begin
933     exProps := FProperties as ISDOPropertyListEx;
934     exProps.SetBase(nil)
935   end;
936 
937 var
938   i, c, j : PtrInt;
939 begin
940   setUsedFlag(False);
941   if ( FProperties <> nil ) then begin
942     c := FProperties.getCount();
943     if ( FBaseType <> nil ) then
944       j := FBaseType.getProperties().getCount()
945     else
946       j := 0;
947     if ( c > 0 ) then begin
948       for i := Pred(c) downto j do begin
949         DropProperty(FProperties.getItem(i));
950       end;
951     end;
952     if ( FBaseType <> nil ) then
953       NilPropsBase();
954   end;
955   FBaseType := nil;
956 end;
957 
958 constructor TSDOBaseObjectType.Create(
959   const AOwner : ISDODataFactory;
960   const AName, AURI : string;
961   const ASequenced, AOpened, AAbstract: Boolean
962 );
963 begin
964   inherited Create(AOwner, AName,AURI);
965   if ASequenced then
966     Include(FFlags, tfIsSequenced);
967   if AOpened then
968     Include(FFlags, tfIsOpen);
969   if AAbstract then
970     Include(FFlags, tfIsAbstract);
971   FProperties := TSDOPropertyList.Create(nil) as ISDOPropertyList;
972 end;
973 
974 destructor TSDOBaseObjectType.Destroy();
975 begin
976   Clear();
977   FBaseType := nil;
978   FProperties := nil;
979   inherited;
980 end;
981 
982 procedure TSDOBaseObjectType.DropProperty(const AProperty: ISDOProperty);
983 var
984   lsX : ISDOPropertyListEx;
985 begin
986   CheckNotUsed('DropProperty');
987   lsX := FProperties as ISDOPropertyListEx;
988   lsX.drop(AProperty);
989 end;
990 
TSDOBaseObjectType.getBaseTypenull991 function TSDOBaseObjectType.getBaseType() : ISDOType;
992 begin
993   Result := FBaseType;
994 end;
995 
getFieldSizenull996 function TSDOBaseObjectType.getFieldSize() : PtrUInt;
997 begin
998   Result := VALUE_STATUS_LENGTH + SizeOf(PPSDODataObject);
999 end;
1000 
TSDOBaseObjectType.getPropertiesnull1001 function TSDOBaseObjectType.getProperties() : ISDOPropertyList;
1002 begin
1003   Result := FProperties;
1004 end;
1005 
TSDOBaseObjectType.getPropertynull1006 function TSDOBaseObjectType.getProperty(const APropertyName: string): ISDOProperty;
1007 begin
1008   Result := getProperties().find(APropertyName);
1009   if ( Result = nil ) then
1010     raise ESDOPropertyNotFoundException.Create(APropertyName);
1011 end;
1012 
TSDOBaseObjectType.getPropertynull1013 function TSDOBaseObjectType.getProperty(const APropertyIndex: Integer): ISDOProperty;
1014 begin
1015   Result := getProperties().getItem(APropertyIndex);
1016 end;
1017 
getPropertyIndexnull1018 function TSDOBaseObjectType.getPropertyIndex(const APropertyName: string): Integer;
1019 begin
1020   Result := getProperties().getIndex(APropertyName);
1021   if ( Result = -1 ) then
1022     raise ESDOPropertyNotFoundException.Create(APropertyName);
1023 end;
1024 
getTypeEnumnull1025 function TSDOBaseObjectType.getTypeEnum() : TSDOTypeKind;
1026 begin
1027   Result := ObjectType;
1028 end;
1029 
TSDOBaseObjectType.inheritsnull1030 function TSDOBaseObjectType.inherits(const AType: ISDOType): Boolean;
1031 var
1032   locType : ISDOType;
1033 begin
1034   Result := False;
1035   if ( AType <> nil ) and AType.isDataObjectType() then begin
1036     if AnsiSameText(sdo_namespace,AType.getURI()) and
1037        AnsiSameText(SDOTypeDefaultTypeNames[ObjectType],AType.getName())
1038     then begin
1039       Result := True;
1040     end else begin
1041       locType := Self as ISDOType;
1042       while ( locType <> nil ) do begin
1043         if locType.equals(AType) then begin
1044           Result := True;
1045           break;
1046         end;
1047         locType := locType.getBaseType();
1048       end;
1049     end;
1050   end;
1051 end;
1052 
TSDOBaseObjectType.isChangeSummaryTypenull1053 function TSDOBaseObjectType.isChangeSummaryType() : Boolean;
1054 begin
1055   Result := False;
1056 end;
1057 
TSDOBaseObjectType.isDataObjectTypenull1058 function TSDOBaseObjectType.isDataObjectType() : Boolean;
1059 begin
1060   Result := True;
1061 end;
1062 
IsOwnerOfnull1063 function TSDOBaseObjectType.IsOwnerOf(const AProp: ISDOProperty): Boolean;
1064 begin
1065   Result := (AProp <> nil) and
1066             ( ( ( AProp.getContainingType() as ISDOType ) = ( Self as ISDOType ) ) or
1067               ( (FBaseType <> nil) and FBaseType.IsOwnerOf(AProp) )
1068             );
1069 
1070 end;
1071 
1072 procedure TSDOBaseObjectType.setBaseType(const ABaseType: ISDOType);
1073 var
1074   exProps : ISDOPropertyListEx;
1075 begin
1076   inherited setBaseType(ABaseType);
1077   FBaseType := ABaseType as ISDOObjectType;
1078   exProps := FProperties as ISDOPropertyListEx;
1079   if ( ABaseType = nil ) then
1080     exProps.SetBase(nil)
1081   else
1082     exProps.SetBase(ABaseType.getProperties());
1083 end;
1084 
1085 procedure TSDOBaseObjectType.setUsedFlag(const AUsed: Boolean);
1086 var
1087   i : PtrInt;
1088   typ : ISDOTypeEx;
1089 begin
1090   inherited setUsedFlag(AUsed);
1091   if AUsed then begin
1092     if Assigned(FBaseType) then begin
1093       typ := FBaseType as ISDOTypeEx;
1094       if not typ.isUsed() then
1095         typ.setUsedFlag(True);
1096     end;
1097 
1098     for i := 0 to Pred(FProperties.getCount()) do begin
1099       typ := FProperties.getItem(i).getType() as ISDOTypeEx;
1100       if not typ.isUsed() then
1101         typ.setUsedFlag(True);
1102     end;
1103   end;
1104 end;
1105 
1106 { TSDOTypeList }
1107 
1108 constructor TSDOTypeList.Create();
1109 begin
1110   inherited;
1111   FList := TInterfaceList.Create();
1112 end;
1113 
1114 destructor TSDOTypeList.Destroy();
1115 begin
1116   FList := nil;
1117   inherited;
1118 end;
1119 
TSDOTypeList.findnull1120 function TSDOTypeList.find(const AUri, AName: string): ISDOType;
1121 var
1122   i : Integer;
1123 begin
1124   i := getIndex(AUri,AName);
1125   if ( i > -1  ) then
1126     Result := getItem(i)
1127   else
1128     Result := nil;
1129 end;
1130 
TSDOTypeList.getCountnull1131 function TSDOTypeList.getCount() : Integer;
1132 begin
1133   Result := FList.Count;
1134 end;
1135 
TSDOTypeList.getIndexnull1136 function TSDOTypeList.getIndex(const AUri, AName: string): Integer;
1137 var
1138   i, j, c : PtrInt;
1139   typ : ISDOType;
1140 begin
1141   Result := -1;
1142   for i := 0 to Pred(getCount()) do begin
1143     typ := getItem(i);
1144     if AnsiSameText(AUri,typ.getURI()) and
1145        AnsiSameText(AName,typ.getName())
1146     then begin
1147       Result := i;
1148       Break;
1149     end;
1150     c := typ.getAliasCount();
1151     if ( c > 0 ) then begin
1152       for j := 0 to Pred(c) do begin
1153         if AnsiSameText(AUri,typ.getURI()) and
1154            AnsiSameText(AName,typ.getAlias(j))
1155         then begin
1156           Result := i;
1157           Break;
1158         end;
1159       end;
1160     end;
1161   end;
1162 end;
1163 
getItemnull1164 function TSDOTypeList.getItem(const AIndex: Integer) : ISDOType;
1165 begin
1166   if ( AIndex >= 0 ) and ( AIndex < FList.Count ) then begin
1167     Result := FList[AIndex] as ISDOType;
1168   end else begin
1169     raise ESDOIndexOutOfRangeException.Create(AIndex);
1170   end;
1171 end;
1172 
1173 procedure TSDOTypeList.insert(const AType : ISDOType);
1174 begin
1175   if ( AType = nil ) then
1176     raise ESDOIllegalArgumentException.Create('AType');
1177   if ( find(AType.getURI(),AType.getName()) = nil ) then begin
1178     FList.Add(AType);
1179   end;
1180 end;
1181 
1182 
1183 
1184 { TSDONativeSimpleType }
1185 
1186 procedure TSDONativeSimpleType.setBaseType(const ABaseType: ISDOType);
1187 begin
1188   raise ESDOUnsupportedOperationException.Create('SetBaseType');
1189 end;
1190 
1191 { TSDOUserDefinedSimpleType }
1192 
1193 constructor TSDOUserDefinedSimpleType.Create(
1194   const AOwner : ISDODataFactory;
1195   const AName, AURI: string;
1196   const AIsAbstract: Boolean
1197 );
1198 begin
1199   inherited Create(AOwner, AName, AURI);
1200   if AIsAbstract then
1201     Include(FFlags, tfIsAbstract);
1202 end;
1203 
TSDOUserDefinedSimpleType.getBaseTypenull1204 function TSDOUserDefinedSimpleType.getBaseType() : ISDOType;
1205 begin
1206   Result := FBaseType;
1207 end;
1208 
getFieldSizenull1209 function TSDOUserDefinedSimpleType.getFieldSize() : PtrUInt;
1210 var
1211   fb : ISDOType;
1212   fbX : ISDOTypeEx;
1213 begin
1214   fb := getBaseType();
1215   if ( fb = nil ) then
1216     raise ESDOIncompleteTypeException.Create(Self.ClassName());
1217   fbX := fb as ISDOTypeEx;
1218   Result := fbX.getFieldSize();
1219 end;
1220 
getTypeEnumnull1221 function TSDOUserDefinedSimpleType.getTypeEnum() : TSDOTypeKind;
1222 var
1223   fb : ISDOType;
1224 begin
1225   fb := getBaseType();
1226   if ( fb = nil ) then
1227     raise ESDOIncompleteTypeException.Create(Self.ClassName());
1228   Result := fb.getTypeEnum();
1229 end;
1230 
1231 procedure TSDOUserDefinedSimpleType.setBaseType(const ABaseType: ISDOType);
1232 begin
1233   inherited setBaseType(ABaseType);
1234   if ( ABaseType <> nil ) then begin
1235     if not (
1236          ABaseType.isDataType() or
1237          ( ABaseType = ( Self as ISDOType ) )
1238        )
1239     then begin
1240       raise ESDOIllegalArgumentException.Create(ABaseType.getName());
1241     end;
1242   end;
1243   FBaseType := ABaseType;
1244 end;
1245 
1246 { TSDOChangeSummaryType }
1247 
1248 constructor TSDOChangeSummaryType.Create(const AOwner : ISDODataFactory);
1249 begin
1250   inherited Create(AOwner, SDOTypeDefaultTypeNames[ChangeSummaryType],sdo_namespace);
1251   Include(FFlags, tfIsDataType);
1252 end;
1253 
getFieldSizenull1254 function TSDOChangeSummaryType.getFieldSize() : PtrUInt;
1255 begin
1256   Result := VALUE_STATUS_LENGTH + SizeOf(PPSDOChangeSummary);
1257 end;
1258 
1259 {$WARNINGS OFF}
TSDOChangeSummaryType.getPropertiesnull1260 function TSDOChangeSummaryType.getProperties() : ISDOPropertyList;
1261 begin
1262   raise ESDOUnsupportedOperationException.Create('getProperties');
1263 end;
1264 {$WARNINGS ON}
1265 
1266 {$WARNINGS OFF}
getPropertynull1267 function TSDOChangeSummaryType.getProperty(const APropertyName: string): ISDOProperty;
1268 begin
1269   raise ESDOUnsupportedOperationException.Create('getProperty');
1270 end;
1271 {$WARNINGS ON}
1272 
1273 {$WARNINGS OFF}
getPropertynull1274 function TSDOChangeSummaryType.getProperty(const APropertyIndex: Integer): ISDOProperty;
1275 begin
1276   raise ESDOUnsupportedOperationException.Create('getProperty');
1277 end;
1278 {$WARNINGS ON}
1279 
1280 {$WARNINGS OFF}
getPropertyIndexnull1281 function TSDOChangeSummaryType.getPropertyIndex(const APropertyName: string): Integer;
1282 begin
1283   raise ESDOUnsupportedOperationException.Create('getPropertyIndex');
1284 end;
1285 {$WARNINGS ON}
1286 
getTypeEnumnull1287 function TSDOChangeSummaryType.getTypeEnum() : TSDOTypeKind;
1288 begin
1289   Result := ChangeSummaryType;
1290 end;
1291 
TSDOChangeSummaryType.isChangeSummaryTypenull1292 function TSDOChangeSummaryType.isChangeSummaryType() : Boolean;
1293 begin
1294   Result := True;
1295 end;
1296 
TSDOChangeSummaryType.isDataObjectTypenull1297 function TSDOChangeSummaryType.isDataObjectType() : Boolean;
1298 begin
1299   Result := False;
1300 end;
1301 
1302 {$WARNINGS OFF}
1303 procedure TSDOChangeSummaryType.setBaseType(const ABaseType: ISDOType);
1304 begin
1305   raise ESDOUnsupportedOperationException.Create('setBaseType');
1306 end;
1307 {$WARNINGS ON}
1308 
1309 { TSDOPropertyAsbtract }
1310 
1311 procedure TSDOPropertyAsbtract.CheckIfContainingTypeIsUsed(const AOperation : string);
1312 var
1313   tX : ISDOTypeEx;
1314 begin
1315   if ( FContainingType <> nil ) then begin
1316     tX := ISDOType(FContainingType) as ISDOTypeEx;
1317     if tX.isUsed() then
1318       raise ESDOUnsupportedOperationException.Create(AOperation);
1319   end;
1320 end;
1321 
1322 procedure TSDOPropertyAsbtract.ClearType();
1323 begin
1324   FreeDefaultBuffer();
1325   if FWeakReferenceToType then
1326     FType := nil
1327   else
1328     ISDOType(FType) := nil;
1329 end;
1330 
1331 constructor TSDOPropertyAsbtract.Create(
1332   const AName  : string;
1333   const AType  : ISDOType;
1334   const AFlags  : TPropertyFlags;
1335   const AContainingType : ISDOType
1336 );
1337 var
1338   locName : string;
1339 begin
1340   locName := Trim(AName);
1341   if not IsValidName(locName) then
1342     raise ESDOIllegalArgumentException.Create('AName');
1343   if ( AContainingType = nil ) then
1344     raise ESDOIllegalArgumentException.Create('AContainingType');
1345   if ( AType = nil ) then
1346     raise ESDOIllegalArgumentException.Create('AType');
1347   if ( pfIsContainment in AFlags ) and ( not AType.isDataObjectType() ) then
1348     raise ESDOIllegalArgumentException.Create('AContainingType');
1349   FName := AName;
1350   FALiasList := TStringList.Create();
1351   FWeakReferenceToType := AType.equals(AContainingType);
1352   if FWeakReferenceToType then
1353     FType := Pointer(AType)
1354   else
1355     ISDOType(FType) := AType;
1356   FFlags := AFlags;
1357   FContainingType := Pointer(AContainingType);
1358   FTypeKind := AType.getTypeEnum();
1359 end;
1360 
1361 destructor TSDOPropertyAsbtract.Destroy;
1362 begin
1363   FreeDefaultBuffer();
1364   FContainingType := nil;
1365   if FWeakReferenceToType then
1366     FType := nil
1367   else
1368     ISDOType(FType) := nil;
1369   FreeAndNil(FALiasList);
1370   inherited;
1371 end;
1372 
1373 procedure TSDOPropertyAsbtract.FreeDefaultBuffer();
1374 begin
1375   if ( FType <> nil ) then begin
1376     case FTypeKind of
1377 {$IFDEF HAS_SDO_BYTES}
1378       BytesType :
1379         begin
1380           if ( FDefault.BytesValue <> nil ) then begin
1381             Dispose(FDefault.BytesValue);
1382           end;
1383         end;
1384 {$ENDIF HAS_SDO_BYTES}
1385       ObjectType :
1386         begin
1387           if ( FDefault.ObjectValue <> nil ) then begin
1388             Dispose(FDefault.ObjectValue);
1389           end;
1390         end;
1391       StringType :
1392         begin
1393           if ( FDefault.StringValue <> nil ) then begin
1394             Dispose(FDefault.StringValue);
1395           end;
1396         end;
1397     end;
1398     FillChar(FDefault,SizeOf(FDefault),#0);
1399     FDefaultSet := False;
1400   end;
1401 end;
1402 
TSDOPropertyAsbtract.getAliasnull1403 function TSDOPropertyAsbtract.getAlias(const AIndex: Integer): string;
1404 begin
1405   if ( AIndex >= 0 ) and ( AIndex < FALiasList.Count ) then
1406     Result := FALiasList[AIndex]
1407   else
1408     raise ESDOException.CreateFmt('Invalid alias index, Type = %s, Index = %d.',[ClassName,AIndex]);
1409 end;
1410 
getAliasCountnull1411 function TSDOPropertyAsbtract.getAliasCount() : Integer;
1412 begin
1413   Result := FALiasList.Count;
1414 end;
1415 
getBooleanDefaultnull1416 function TSDOPropertyAsbtract.getBooleanDefault(): TSDOBoolean;
1417 begin
1418   if FDefaultSet then begin
1419     case getTypeEnum() of
1420       BooleanType   : Result := FDefault.BooleanValue;
1421       ByteType      : Result := TSDOConvertHelper.ByteToBool(FDefault.ByteValue);
1422 {$IFDEF HAS_SDO_CHAR}
1423       CharacterType : Result := TSDOConvertHelper.CharToBool(FDefault.CharValue);
1424 {$ENDIF HAS_SDO_CHAR}
1425       IntegerType   : Result := TSDOConvertHelper.IntegerToBool(FDefault.IntegerValue);
1426 {$IFDEF HAS_SDO_LONG}
1427       LongType      : Result := TSDOConvertHelper.LongToBool(FDefault.LongValue);
1428 {$ENDIF HAS_SDO_LONG}
1429 {$IFDEF HAS_SDO_SHORT}
1430       ShortType     : Result := TSDOConvertHelper.ShortToBool(FDefault.ShortValue);
1431 {$ENDIF HAS_SDO_SHORT}
1432       StringType    : Result := TSDOConvertHelper.StringToBool(FDefault.StringValue^);
1433       else
1434         Result := False;
1435     end;
1436   end else begin
1437     Result := False;
1438   end;
1439 end;
1440 
getBufferOffsetnull1441 function TSDOPropertyAsbtract.getBufferOffset() : PtrUInt;
1442 begin
1443   Result := FBufferOffset;
1444 end;
1445 
TSDOPropertyAsbtract.getByteDefaultnull1446 function TSDOPropertyAsbtract.getByteDefault(): TSDOByte;
1447 begin
1448   if FDefaultSet then begin
1449     case getTypeEnum() of
1450       BooleanType   : Result := TSDOConvertHelper.BoolToByte(FDefault.BooleanValue);
1451       ByteType      : Result := FDefault.ByteValue;
1452 {$IFDEF HAS_SDO_CHAR}
1453       CharacterType : Result := TSDOConvertHelper.CharToByte(FDefault.CharValue);
1454 {$ENDIF HAS_SDO_CHAR}
1455       IntegerType   : Result := FDefault.IntegerValue;
1456 {$IFDEF HAS_SDO_LONG}
1457       LongType      : Result := FDefault.LongValue;
1458 {$ENDIF HAS_SDO_LONG}
1459 {$IFDEF HAS_SDO_SHORT}
1460       ShortType     : Result := FDefault.ShortValue;
1461 {$ENDIF HAS_SDO_SHORT}
1462       StringType    : Result := TSDOConvertHelper.StringToByte(FDefault.StringValue^);
1463       else
1464         Result := 0;
1465     end;
1466   end else begin
1467     Result := 0;
1468   end;
1469 end;
1470 
1471 {$IFDEF HAS_SDO_BYTES}
TSDOPropertyAsbtract.getBytesDefaultnull1472 function TSDOPropertyAsbtract.getBytesDefault() : TSDOBytes;
1473 begin
1474   if FDefaultSet then begin
1475     case getTypeEnum() of
1476       BytesType       : Result := FDefault.BytesValue^;
1477       StringType      : Result := TSDOConvertHelper.StringToBytes(FDefault.StringValue^);
1478     end;
1479   end;
1480 end;
1481 {$ENDIF HAS_SDO_BYTES}
1482 
1483 {$IFDEF HAS_SDO_CHAR}
getCharacterDefaultnull1484 function TSDOPropertyAsbtract.getCharacterDefault() : TSDOChar;
1485 begin
1486   if FDefaultSet then begin
1487     case getTypeEnum() of
1488       BooleanType   : Result := TSDOConvertHelper.BoolToChar(FDefault.BooleanValue);
1489       ByteType      : Result := TSDOConvertHelper.ByteToChar(FDefault.ByteValue);
1490       CharacterType : Result := FDefault.CharValue;
1491       IntegerType   : Result := TSDOConvertHelper.IntegerToChar(FDefault.IntegerValue);
1492 {$IFDEF HAS_SDO_LONG}
1493       LongType      : Result := TSDOConvertHelper.LongToChar(FDefault.LongValue);
1494 {$ENDIF HAS_SDO_LONG}
1495 {$IFDEF HAS_SDO_SHORT}
1496       ShortType     : Result := TSDOConvertHelper.ShortToChar(FDefault.ShortValue);
1497 {$ENDIF HAS_SDO_SHORT}
1498       StringType    : Result := TSDOConvertHelper.StringToChar(FDefault.StringValue^);
1499       else
1500         Result := #0;
1501     end;
1502   end else begin
1503     Result := #0;
1504   end;
1505 end;
1506 {$ENDIF HAS_SDO_CHAR}
1507 
1508 {$IFDEF HAS_SDO_CURRENCY }
getCurrencyDefaultnull1509 function TSDOPropertyAsbtract.getCurrencyDefault() : TSDOCurrency;
1510 begin
1511   if FDefaultSet then begin
1512     case getTypeEnum() of
1513       ByteType      : Result := FDefault.ByteValue;
1514       CurrencyType  : Result := FDefault.CurrencyValue;
1515 {$IFDEF HAS_SDO_DOUBLE}
1516       DoubleType    : Result := FDefault.DoubleValue;
1517 {$ENDIF HAS_SDO_DOUBLE}
1518 {$IFDEF HAS_SDO_FLOAT }
1519       FloatType     : Result := FDefault.FloatValue;
1520 {$ENDIF HAS_SDO_FLOAT }
1521       IntegerType   : Result := FDefault.IntegerValue;
1522 {$IFDEF HAS_SDO_LONG}
1523       LongType      : Result := FDefault.LongValue;
1524 {$ENDIF HAS_SDO_LONG}
1525 {$IFDEF HAS_SDO_SHORT}
1526       ShortType     : Result := FDefault.ShortValue;
1527 {$ENDIF HAS_SDO_SHORT}
1528       StringType    : Result := TSDOConvertHelper.StringToFloat(FDefault.StringValue^);
1529       else
1530         Result := 0;
1531     end;
1532   end else begin
1533     Result := 0;
1534   end;
1535 end;
1536 {$ENDIF HAS_SDO_CURRENCY }
1537 
TSDOPropertyAsbtract.getContainingTypenull1538 function TSDOPropertyAsbtract.getContainingType() : ISDOType;
1539 begin
1540   Result := ISDOType(FContainingType);
1541 end;
1542 
TSDOPropertyAsbtract.getDateDefaultnull1543 function TSDOPropertyAsbtract.getDateDefault() : TSDODate;
1544 begin
1545   if FDefaultSet and ( getTypeEnum() = DateTimeType ) then
1546     Result := FDefault.DateValue
1547   else
1548     Result := ZERO_DATE;
1549 end;
1550 
1551 {$IFDEF HAS_SDO_DOUBLE}
getDoubleDefaultnull1552 function TSDOPropertyAsbtract.getDoubleDefault() : TSDODouble;
1553 begin
1554   if FDefaultSet then begin
1555     case getTypeEnum() of
1556       ByteType      : Result := FDefault.ByteValue;
1557 {$IFDEF HAS_SDO_CURRENCY }
1558       CurrencyType  : Result := FDefault.CurrencyValue;
1559 {$ENDIF HAS_SDO_CURRENCY }
1560       DoubleType    : Result := FDefault.DoubleValue;
1561 {$IFDEF HAS_SDO_FLOAT}
1562       FloatType     : Result := FDefault.FloatValue;
1563 {$ENDIF HAS_SDO_FLOAT}
1564       IntegerType   : Result := FDefault.IntegerValue;
1565 {$IFDEF HAS_SDO_LONG}
1566       LongType      : Result := FDefault.LongValue;
1567 {$ENDIF HAS_SDO_LONG}
1568 {$IFDEF HAS_SDO_SHORT}
1569       ShortType     : Result := FDefault.ShortValue;
1570 {$ENDIF HAS_SDO_SHORT}
1571       StringType    : Result := TSDOConvertHelper.StringToFloat(FDefault.StringValue^);
1572       else
1573         Result := 0;
1574     end;
1575   end else begin
1576     Result := 0;
1577   end;
1578 end;
1579 {$ENDIF HAS_SDO_DOUBLE}
1580 
1581 {$IFDEF HAS_SDO_FLOAT}
getFloatDefaultnull1582 function TSDOPropertyAsbtract.getFloatDefault() : TSDOFloat;
1583 begin
1584   if FDefaultSet then begin
1585     case getTypeEnum() of
1586       ByteType      : Result := FDefault.ByteValue;
1587 {$IFDEF HAS_SDO_CURRENCY }
1588       CurrencyType  : Result := FDefault.CurrencyValue;
1589 {$ENDIF HAS_SDO_CURRENCY }
1590 {$IFDEF HAS_SDO_DOUBLE}
1591       DoubleType    : Result := FDefault.DoubleValue;
1592 {$ENDIF HAS_SDO_DOUBLE}
1593       FloatType     : Result := FDefault.FloatValue;
1594       IntegerType   : Result := FDefault.IntegerValue;
1595 {$IFDEF HAS_SDO_LONG}
1596       LongType      : Result := FDefault.LongValue;
1597 {$ENDIF HAS_SDO_LONG}
1598 {$IFDEF HAS_SDO_SHORT}
1599       ShortType     : Result := FDefault.ShortValue;
1600 {$ENDIF HAS_SDO_SHORT}
1601       StringType    : Result := TSDOConvertHelper.StringToFloat(FDefault.StringValue^);
1602       else
1603         Result := 0;
1604     end;
1605   end else begin
1606     Result := 0;
1607   end;
1608 end;
1609 {$ENDIF HAS_SDO_FLOAT}
1610 
TSDOPropertyAsbtract.getIntegerDefaultnull1611 function TSDOPropertyAsbtract.getIntegerDefault() : TSDOInteger;
1612 begin
1613   if FDefaultSet then begin
1614     case getTypeEnum() of
1615       BooleanType   : Result := TSDOConvertHelper.BoolToInteger(FDefault.BooleanValue);
1616       ByteType      : Result := FDefault.ByteValue;
1617 {$IFDEF HAS_SDO_CHAR}
1618       CharacterType : Result := TSDOConvertHelper.CharToInteger(FDefault.CharValue);
1619 {$ENDIF HAS_SDO_CHAR}
1620       IntegerType   : Result := FDefault.IntegerValue;
1621 {$IFDEF HAS_SDO_LONG}
1622       LongType      : Result := FDefault.LongValue;
1623 {$ENDIF HAS_SDO_LONG}
1624 {$IFDEF HAS_SDO_SHORT}
1625       ShortType     : Result := FDefault.ShortValue;
1626 {$ENDIF HAS_SDO_SHORT}
1627       StringType    : Result := TSDOConvertHelper.StringToInteger(FDefault.StringValue^);
1628       else
1629         Result := 0;
1630     end;
1631   end else begin
1632     Result := 0;
1633   end;
1634 end;
1635 
TSDOPropertyAsbtract.getLongDefaultnull1636 function TSDOPropertyAsbtract.getLongDefault() : TSDOLong;
1637 begin
1638   if FDefaultSet then begin
1639     case getTypeEnum() of
1640       BooleanType   : Result := TSDOConvertHelper.BoolToLong(FDefault.BooleanValue);
1641       ByteType      : Result := FDefault.ByteValue;
1642 {$IFDEF HAS_SDO_CHAR}
1643       CharacterType : Result := TSDOConvertHelper.CharToLong(FDefault.CharValue);
1644 {$ENDIF HAS_SDO_CHAR}
1645       IntegerType   : Result := FDefault.IntegerValue;
1646 {$IFDEF HAS_SDO_LONG}
1647       LongType      : Result := FDefault.LongValue;
1648 {$ENDIF HAS_SDO_LONG}
1649 {$IFDEF HAS_SDO_SHORT}
1650       ShortType     : Result := FDefault.ShortValue;
1651 {$ENDIF HAS_SDO_SHORT}
1652       StringType    : Result := TSDOConvertHelper.StringToLong(FDefault.StringValue^);
1653       else
1654         Result := 0;
1655     end;
1656   end else begin
1657     Result := 0;
1658   end;
1659 end;
1660 
getNamenull1661 function TSDOPropertyAsbtract.getName() : string;
1662 begin
1663   Result := FName;
1664 end;
1665 
TSDOPropertyAsbtract.getOppositenull1666 function TSDOPropertyAsbtract.getOpposite() : ISDOProperty;
1667 begin
1668   Result := nil;
1669 end;
1670 
getShortDefaultnull1671 function TSDOPropertyAsbtract.getShortDefault() : TSDOShort;
1672 begin
1673   if FDefaultSet then begin
1674     case getTypeEnum() of
1675       BooleanType   : Result := TSDOConvertHelper.BoolToShort(FDefault.BooleanValue);
1676       ByteType      : Result := FDefault.ByteValue;
1677 {$IFDEF HAS_SDO_CHAR}
1678       CharacterType : Result := TSDOConvertHelper.CharToShort(FDefault.CharValue);
1679 {$ENDIF HAS_SDO_CHAR}
1680       IntegerType   : Result := FDefault.IntegerValue;
1681 {$IFDEF HAS_SDO_LONG}
1682       LongType      : Result := FDefault.LongValue;
1683 {$ENDIF HAS_SDO_LONG}
1684 {$IFDEF HAS_SDO_SHORT}
1685       ShortType     : Result := FDefault.ShortValue;
1686 {$ENDIF HAS_SDO_SHORT}
1687       StringType    : Result := TSDOConvertHelper.StringToShort(FDefault.StringValue^);
1688       else
1689         Result := 0;
1690     end;
1691   end else begin
1692     Result := 0;
1693   end;
1694 end;
1695 
getStringDefaultnull1696 function TSDOPropertyAsbtract.getStringDefault() : TSDOString;
1697 begin
1698   if FDefaultSet then begin
1699     case getTypeEnum() of
1700       BooleanType     : Result := TSDOConvertHelper.BoolToString(FDefault.BooleanValue);
1701       ByteType        : Result := TSDOConvertHelper.ByteToString(FDefault.ByteValue);
1702 {$IFDEF HAS_SDO_BYTES}
1703       BytesType       : Result := TSDOConvertHelper.BytesToString(FDefault.BytesValue^);
1704 {$ENDIF HAS_SDO_BYTES}
1705 {$IFDEF HAS_SDO_CHAR}
1706       CharacterType   : Result := FDefault.CharValue;
1707 {$ENDIF HAS_SDO_CHAR}
1708 {$IFDEF HAS_SDO_DOUBLE}
1709       DoubleType      : Result := TSDOConvertHelper.FloatToString(FDefault.DoubleValue);
1710 {$ENDIF HAS_SDO_DOUBLE}
1711 {$IFDEF HAS_SDO_FLOAT}
1712       FloatType       : Result := TSDOConvertHelper.FloatToString(FDefault.FloatValue);
1713 {$ENDIF HAS_SDO_FLOAT}
1714       IntegerType     : Result := TSDOConvertHelper.IntegerToString(FDefault.IntegerValue);
1715 {$IFDEF HAS_SDO_LONG}
1716       LongType        : Result := TSDOConvertHelper.LongToString(FDefault.LongValue);
1717 {$ENDIF HAS_SDO_LONG}
1718 {$IFDEF HAS_SDO_SHORT}
1719       ShortType       : Result := TSDOConvertHelper.ShortToString(FDefault.ShortValue);
1720 {$ENDIF HAS_SDO_SHORT}
1721       StringType      : Result := FDefault.StringValue^;
1722     end;
1723   end;
1724 end;
1725 
TSDOPropertyAsbtract.getTypenull1726 function TSDOPropertyAsbtract.getType() : ISDOType;
1727 begin
1728   Result := ISDOType(FType);
1729 end;
1730 
getTypeEnumnull1731 function TSDOPropertyAsbtract.getTypeEnum() : TSDOTypeKind;
1732 begin
1733   Result := getType().getTypeEnum();
1734 end;
1735 
1736 procedure TSDOPropertyAsbtract.InternalSetBufferOffset(const AOffset: PtrUInt);
1737 begin
1738   FBufferOffset := AOffset;
1739 end;
1740 
isContainmentnull1741 function TSDOPropertyAsbtract.isContainment() : Boolean;
1742 begin
1743   Result := ( pfIsContainment in FFlags );
1744 end;
1745 
isDefaultednull1746 function TSDOPropertyAsbtract.isDefaulted() : Boolean;
1747 begin
1748   Result := FDefaultSet;
1749 end;
1750 
TSDOPropertyAsbtract.isManynull1751 function TSDOPropertyAsbtract.isMany() : Boolean;
1752 begin
1753   Result := ( pfIsMany in FFlags );;
1754 end;
1755 
isNullablenull1756 function TSDOPropertyAsbtract.isNullable() : Boolean;
1757 begin
1758   Result := not ( pfIsNotNullable in FFlags );
1759 end;
1760 
isReadOnlynull1761 function TSDOPropertyAsbtract.isReadOnly() : Boolean;
1762 begin
1763   Result := ( pfIsReadOnly in FFlags );
1764 end;
1765 
TSDOPropertyAsbtract.isReferencenull1766 function TSDOPropertyAsbtract.isReference() : Boolean;
1767 begin
1768   Result := ( not isContainment() ) and ( getType().isDataObjectType() );
1769 end;
1770 
1771 procedure TSDOPropertyAsbtract.setAlias(const AAlias: string);
1772 begin
1773   if ( FALiasList.IndexOf(AAlias) = -1 ) then
1774     FALiasList.Add(AAlias);
1775 end;
1776 
setBufferOffsetnull1777 function TSDOPropertyAsbtract.setBufferOffset(const AStartingAddress: PtrUInt): PtrUInt;
1778 var
1779   typ : ISDOTypeEx;
1780   bufferLen : PtrInt;
1781 begin
1782   Result := AStartingAddress;
1783   InternalSetBufferOffset(Result);
1784   if isMany() then begin
1785     bufferLen := SizeOf(Pointer);
1786   end else begin
1787     typ := getType() as ISDOTypeEx;
1788     bufferLen := typ.getFieldSize();
1789   end;
1790   Inc(Result,bufferLen);
1791 end;
1792 
1793 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOBoolean);
1794 begin
1795   if getType().isDataObjectType or getType().isChangeSummaryType() then
1796     raise ESDOUnsupportedOperationException.Create('setDefault');
1797   CheckIfContainingTypeIsUsed('setDefault');
1798   if not ( getTypeEnum() in [
1799              BooleanType,ByteType
1800              {$IFDEF HAS_SDO_CHAR},CharacterType{$ENDIF}
1801              {$IFDEF HAS_SDO_LONG},LongType{$ENDIF}
1802              {$IFDEF HAS_SDO_SHORT},ShortType{$ENDIF}
1803              ,IntegerType,StringType
1804           ]
1805          )
1806   then begin
1807     raise ESDOUnsupportedOperationException.Create('setDefault');
1808   end;
1809   FreeDefaultBuffer();
1810   FDefaultSet := True;
1811   case getTypeEnum() of
1812     BooleanType    : FDefault.BooleanValue := AValue;
1813     ByteType       : FDefault.ByteValue := TSDOConvertHelper.BoolToByte(AValue);
1814 {$IFDEF HAS_SDO_CHAR}
1815     CharacterType  : FDefault.CharValue := TSDOConvertHelper.BoolToChar(AValue);
1816 {$ENDIF HAS_SDO_CHAR}
1817 {$IFDEF HAS_SDO_LONG}
1818     LongType       : FDefault.LongValue := TSDOConvertHelper.BoolToLong(AValue);
1819 {$ENDIF HAS_SDO_LONG}
1820     IntegerType    : FDefault.IntegerValue := TSDOConvertHelper.BoolToInteger(AValue);
1821 {$IFDEF HAS_SDO_SHORT}
1822     ShortType      : FDefault.ShortValue := TSDOConvertHelper.BoolToShort(AValue);
1823 {$ENDIF HAS_SDO_SHORT}
1824     StringType   :
1825       begin
1826         New(FDefault.StringValue);
1827         FDefault.StringValue^ := TSDOConvertHelper.BoolToString(AValue);
1828       end;
1829   end;
1830 end;
1831 
1832 {$IFDEF HAS_SDO_CURRENCY }
1833 procedure TSDOPropertyAsbtract.setDefaultCurrency(const AValue: TSDOCurrency);
1834 begin
1835   if getType().isDataObjectType or getType().isChangeSummaryType() then
1836     raise ESDOUnsupportedOperationException.Create('setDefault');
1837   CheckIfContainingTypeIsUsed('setDefault');
1838   if not ( getTypeEnum() in [DoubleType,FloatType,CurrencyType,StringType] ) then
1839     raise ESDOUnsupportedOperationException.Create('setDefault');
1840 
1841   FreeDefaultBuffer();
1842   FDefaultSet := True;
1843   case getTypeEnum() of
1844     CurrencyType  : FDefault.CurrencyValue := AValue;
1845 {$IFDEF HAS_SDO_DOUBLE }
1846     DoubleType    : FDefault.DoubleValue := AValue;
1847 {$ENDIF HAS_SDO_DOUBLE }
1848 {$IFDEF HAS_SDO_FLOAT }
1849     FloatType     : FDefault.FloatValue := AValue;
1850 {$ENDIF HAS_SDO_FLOAT }
1851     StringType   :
1852       begin
1853         New(FDefault.StringValue);
1854         FDefault.StringValue^ := TSDOConvertHelper.FloatToString(AValue);
1855       end;
1856   end;
1857 end;
1858 {$ENDIF HAS_SDO_CURRENCY }
1859 
1860 {$IFDEF HAS_SDO_DOUBLE }
1861 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDODouble);
1862 begin
1863   if getType().isDataObjectType or getType().isChangeSummaryType() then
1864     raise ESDOUnsupportedOperationException.Create('setDefault');
1865   CheckIfContainingTypeIsUsed('setDefault');
1866   if not ( getTypeEnum() in [DoubleType,FloatType,CurrencyType,StringType] ) then
1867     raise ESDOUnsupportedOperationException.Create('setDefault');
1868 
1869   FreeDefaultBuffer();
1870   FDefaultSet := True;
1871   case getTypeEnum() of
1872 {$IFDEF HAS_SDO_CURRENCY }
1873     CurrencyType  : FDefault.CurrencyValue := AValue;
1874 {$ENDIF HAS_SDO_CURRENCY }
1875     DoubleType    : FDefault.DoubleValue := AValue;
1876 {$IFDEF HAS_SDO_FLOAT }
1877     FloatType     : FDefault.FloatValue := AValue;
1878 {$ENDIF HAS_SDO_FLOAT }
1879     StringType   :
1880       begin
1881         New(FDefault.StringValue);
1882         FDefault.StringValue^ := TSDOConvertHelper.FloatToString(AValue);
1883       end;
1884   end;
1885 end;
1886 {$ENDIF HAS_SDO_DOUBLE }
1887 
1888 {$IFDEF HAS_SDO_FLOAT}
1889 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOFloat);
1890 begin
1891   if getType().isDataObjectType or getType().isChangeSummaryType() then
1892     raise ESDOUnsupportedOperationException.Create('setDefault');
1893   CheckIfContainingTypeIsUsed('setDefault');
1894   if not ( getTypeEnum() in [DoubleType,FloatType,CurrencyType,StringType] ) then
1895     raise ESDOUnsupportedOperationException.Create('setDefault');
1896 
1897   FreeDefaultBuffer();
1898   FDefaultSet := True;
1899   case getTypeEnum() of
1900 {$IFDEF HAS_SDO_CURRENCY }
1901     CurrencyType  : FDefault.CurrencyValue := AValue;
1902 {$ENDIF HAS_SDO_CURRENCY }
1903 {$IFDEF HAS_SDO_FLOAT}
1904     DoubleType    : FDefault.DoubleValue := AValue;
1905 {$ENDIF HAS_SDO_FLOAT}
1906     FloatType     : FDefault.FloatValue := AValue;
1907     StringType   :
1908       begin
1909         New(FDefault.StringValue);
1910         FDefault.StringValue^ := TSDOConvertHelper.FloatToString(AValue);
1911       end;
1912   end;
1913 end;
1914 {$ENDIF HAS_SDO_FLOAT}
1915 
1916 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOInteger);
1917 begin
1918   if getType().isDataObjectType or getType().isChangeSummaryType() then
1919     raise ESDOUnsupportedOperationException.Create('setDefault');
1920   CheckIfContainingTypeIsUsed('setDefault');
1921   if not ( getTypeEnum() in [BooleanType,ByteType,IntegerType,StringType] ) then
1922     raise ESDOUnsupportedOperationException.Create('setDefault');
1923 
1924   FreeDefaultBuffer();
1925   FDefaultSet := True;
1926   case getTypeEnum() of
1927     BooleanType  : FDefault.BooleanValue := ( AValue <> 0 );
1928     ByteType     : FDefault.ByteValue := AValue;
1929     IntegerType  : FDefault.IntegerValue := AValue;
1930     StringType   :
1931       begin
1932         New(FDefault.StringValue);
1933         FDefault.StringValue^ := IntToStr(AValue);
1934       end;
1935   end;
1936 end;
1937 
1938 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOString);
1939 begin
1940   if getType().isDataObjectType or getType().isChangeSummaryType() then
1941     raise ESDOUnsupportedOperationException.Create('setDefault');
1942   CheckIfContainingTypeIsUsed('setDefault');
1943   FreeDefaultBuffer();
1944   FDefaultSet := True;
1945   case getTypeEnum() of
1946     BooleanType    : FDefault.BooleanValue := TSDOConvertHelper.StringToBool(AValue);
1947     ByteType       : FDefault.ByteValue := TSDOConvertHelper.StringToByte(AValue);
1948 {$IFDEF HAS_SDO_CHAR}
1949     CharacterType  : FDefault.CharValue := TSDOConvertHelper.StringToChar(AValue);
1950 {$ENDIF HAS_SDO_CHAR}
1951 {$IFDEF HAS_SDO_LONG}
1952     LongType       : FDefault.LongValue := TSDOConvertHelper.StringToLong(AValue);
1953 {$ENDIF HAS_SDO_LONG}
1954     DateTimeType   : FDefault.DateValue := TSDOConvertHelper.StringToDate(AValue);
1955     IntegerType    : FDefault.IntegerValue := TSDOConvertHelper.StringToInteger(AValue);
1956 {$IFDEF HAS_SDO_SHORT}
1957     ShortType      : FDefault.ShortValue := TSDOConvertHelper.StringToShort(AValue);
1958 {$ENDIF HAS_SDO_SHORT}
1959     StringType     :
1960       begin
1961         New(FDefault.StringValue);
1962         FDefault.StringValue^ := AValue;
1963       end;
1964   end;
1965 end;
1966 
1967 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOByte);
1968 begin
1969   if getType().isDataObjectType or getType().isChangeSummaryType() then
1970     raise ESDOUnsupportedOperationException.Create('setDefault');
1971   CheckIfContainingTypeIsUsed('setDefault');
1972   if not ( getTypeEnum() in [
1973              BooleanType,ByteType
1974              {$IFDEF HAS_SDO_CHAR},CharacterType{$ENDIF}
1975              {$IFDEF HAS_SDO_LONG},LongType{$ENDIF}
1976              {$IFDEF HAS_SDO_SHORT},ShortType{$ENDIF}
1977              ,IntegerType,StringType
1978           ]
1979          )
1980   then begin
1981     raise ESDOUnsupportedOperationException.Create('setDefault');
1982   end;
1983 
1984   FreeDefaultBuffer();
1985   FDefaultSet := True;
1986   case getTypeEnum() of
1987     BooleanType    : FDefault.BooleanValue := TSDOConvertHelper.ByteToBool(AValue);
1988     ByteType       : FDefault.ByteValue := AValue;
1989 {$IFDEF HAS_SDO_CHAR}
1990     CharacterType  : FDefault.CharValue := TSDOConvertHelper.ByteToChar(AValue);
1991 {$ENDIF HAS_SDO_CHAR}
1992 {$IFDEF HAS_SDO_LONG}
1993     LongType       : FDefault.LongValue := AValue;
1994 {$ENDIF HAS_SDO_LONG}
1995     IntegerType    : FDefault.IntegerValue := AValue;
1996 {$IFDEF HAS_SDO_SHORT}
1997     ShortType      : FDefault.ShortValue := AValue;
1998 {$ENDIF HAS_SDO_SHORT}
1999     StringType     :
2000       begin
2001         New(FDefault.StringValue);
2002         FDefault.StringValue^ := TSDOConvertHelper.ByteToString(AValue);
2003       end;
2004   end;
2005 end;
2006 
2007 {$IFDEF HAS_SDO_BYTES}
2008 procedure TSDOPropertyAsbtract.setDefault(AValue: TSDOBytes);
2009 begin
2010   if getType().isDataObjectType or getType().isChangeSummaryType() then
2011     raise ESDOUnsupportedOperationException.Create('setDefault');
2012   CheckIfContainingTypeIsUsed('setDefault');
2013   if not ( getTypeEnum() in [BytesType,StringType] ) then begin
2014     raise ESDOUnsupportedOperationException.Create('setDefault');
2015   end;
2016 
2017   FreeDefaultBuffer();
2018   FDefaultSet := True;
2019   case getTypeEnum() of
2020     BytesType     :
2021       begin
2022         New(FDefault.BytesValue);
2023         FDefault.BytesValue^ := Copy(AValue);
2024       end;
2025     StringType     :
2026       begin
2027         New(FDefault.StringValue);
2028         FDefault.StringValue^ := TSDOConvertHelper.BytesToString(AValue);
2029       end;
2030   end;
2031 end;
2032 {$ENDIF HAS_SDO_BYTES}
2033 
2034 {$IFDEF HAS_SDO_CHAR}
2035 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOChar);
2036 begin
2037   if getType().isDataObjectType or getType().isChangeSummaryType() then
2038     raise ESDOUnsupportedOperationException.Create('setDefault');
2039   CheckIfContainingTypeIsUsed('setDefault');
2040   if not ( getTypeEnum() in [
2041              BooleanType,ByteType
2042              {$IFDEF HAS_SDO_CHAR},CharacterType{$ENDIF}
2043              {$IFDEF HAS_SDO_LONG},LongType{$ENDIF}
2044              {$IFDEF HAS_SDO_SHORT},ShortType{$ENDIF}
2045              ,IntegerType,StringType
2046           ]
2047          )
2048   then begin
2049     raise ESDOUnsupportedOperationException.Create('setDefault');
2050   end;
2051 
2052   FreeDefaultBuffer();
2053   FDefaultSet := True;
2054   case getTypeEnum() of
2055     BooleanType    : FDefault.BooleanValue := TSDOConvertHelper.CharToBool(AValue);
2056     ByteType       : FDefault.ByteValue := TSDOConvertHelper.CharToByte(AValue);
2057 {$IFDEF HAS_SDO_CHAR}
2058     CharacterType  : FDefault.CharValue := AValue;
2059 {$ENDIF HAS_SDO_CHAR}
2060 {$IFDEF HAS_SDO_LONG}
2061     LongType       : FDefault.LongValue := TSDOConvertHelper.CharToLong(AValue);
2062 {$ENDIF HAS_SDO_LONG}
2063     IntegerType    : FDefault.IntegerValue := TSDOConvertHelper.CharToInteger(AValue);
2064 {$IFDEF HAS_SDO_SHORT}
2065     ShortType      : FDefault.ShortValue := TSDOConvertHelper.CharToShort(AValue);
2066 {$ENDIF HAS_SDO_SHORT}
2067     StringType     :
2068       begin
2069         New(FDefault.StringValue);
2070         FDefault.StringValue^ := AValue;
2071       end;
2072   end;
2073 end;
2074 {$ENDIF HAS_SDO_CHAR}
2075 
2076 {$IFDEF HAS_SDO_LONG}
2077 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOLong);
2078 begin
2079   if getType().isDataObjectType or getType().isChangeSummaryType() then
2080     raise ESDOUnsupportedOperationException.Create('setDefault');
2081   CheckIfContainingTypeIsUsed('setDefault');
2082   if not ( getTypeEnum() in [
2083              BooleanType,ByteType
2084              {$IFDEF HAS_SDO_CHAR},CharacterType{$ENDIF}
2085              {$IFDEF HAS_SDO_LONG},LongType{$ENDIF}
2086              {$IFDEF HAS_SDO_SHORT},ShortType{$ENDIF}
2087              ,IntegerType,StringType
2088           ]
2089          )
2090   then begin
2091     raise ESDOUnsupportedOperationException.Create('setDefault');
2092   end;
2093 
2094   FreeDefaultBuffer();
2095   FDefaultSet := True;
2096   case getTypeEnum() of
2097     BooleanType    : FDefault.BooleanValue := TSDOConvertHelper.LongToBool(AValue);
2098     ByteType       : FDefault.ByteValue := AValue;
2099 {$IFDEF HAS_SDO_CHAR}
2100     CharacterType  : FDefault.CharValue := TSDOConvertHelper.LongToChar(AValue);
2101 {$ENDIF HAS_SDO_CHAR}
2102 {$IFDEF HAS_SDO_LONG}
2103     LongType       : FDefault.LongValue := AValue;
2104 {$ENDIF HAS_SDO_LONG}
2105     IntegerType    : FDefault.IntegerValue := AValue;
2106 {$IFDEF HAS_SDO_SHORT}
2107     ShortType      : FDefault.ShortValue := AValue;
2108 {$ENDIF HAS_SDO_SHORT}
2109     StringType     :
2110       begin
2111         New(FDefault.StringValue);
2112         FDefault.StringValue^ := TSDOConvertHelper.LongToString(AValue);
2113       end;
2114   end;
2115 end;
2116 {$ENDIF HAS_SDO_LONG}
2117 
2118 {$IFDEF HAS_SDO_SHORT}
2119 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDOShort);
2120 begin
2121   if getType().isDataObjectType or getType().isChangeSummaryType() then
2122     raise ESDOUnsupportedOperationException.Create('setDefault');
2123   CheckIfContainingTypeIsUsed('setDefault');
2124   if not ( getTypeEnum() in [
2125              BooleanType,ByteType
2126              {$IFDEF HAS_SDO_CHAR},CharacterType{$ENDIF}
2127              {$IFDEF HAS_SDO_LONG},LongType{$ENDIF}
2128              {$IFDEF HAS_SDO_SHORT},ShortType{$ENDIF}
2129              ,IntegerType,StringType
2130           ]
2131          )
2132   then begin
2133     raise ESDOUnsupportedOperationException.Create('setDefault');
2134   end;
2135 
2136   FreeDefaultBuffer();
2137   FDefaultSet := True;
2138   case getTypeEnum() of
2139     BooleanType    : FDefault.BooleanValue := TSDOConvertHelper.ShortToBool(AValue);
2140     ByteType       : FDefault.ByteValue := AValue;
2141 {$IFDEF HAS_SDO_CHAR}
2142     CharacterType  : FDefault.CharValue := TSDOConvertHelper.ShortToChar(AValue);
2143 {$ENDIF HAS_SDO_CHAR}
2144 {$IFDEF HAS_SDO_LONG}
2145     LongType       : FDefault.LongValue := AValue;
2146 {$ENDIF HAS_SDO_LONG}
2147     IntegerType    : FDefault.IntegerValue := AValue;
2148 {$IFDEF HAS_SDO_SHORT}
2149     ShortType      : FDefault.ShortValue := AValue;
2150 {$ENDIF HAS_SDO_SHORT}
2151     StringType     :
2152       begin
2153         New(FDefault.StringValue);
2154         FDefault.StringValue^ := TSDOConvertHelper.ShortToString(AValue);
2155       end;
2156   end;
2157 end;
2158 {$ENDIF HAS_SDO_SHORT}
2159 
2160 procedure TSDOPropertyAsbtract.setDefault(const AValue: TSDODate);
2161 begin
2162   if getType().isDataObjectType or getType().isChangeSummaryType() then
2163     raise ESDOUnsupportedOperationException.Create('setDefault');
2164   CheckIfContainingTypeIsUsed('setDefault');
2165   if not ( getTypeEnum() in [DateTimeType,StringType] ) then
2166     raise ESDOUnsupportedOperationException.Create('setDefault');
2167   FreeDefaultBuffer();
2168   FDefaultSet := True;
2169   case getTypeEnum() of
2170     DateTimeType : FDefault.DateValue := AValue;
2171     StringType   :
2172       begin
2173         New(FDefault.StringValue);
2174         FDefault.StringValue^ := TSDOConvertHelper.DateToString(AValue);
2175       end;
2176   end;
2177 end;
2178 
TSDOPropertyAsbtract.isAttributenull2179 function TSDOPropertyAsbtract.isAttribute() : Boolean;
2180 begin
2181   Result := (pfIsAttribute in FFlags);
2182 end;
2183 
2184 { TSDOPropertyList }
2185 
2186 constructor TSDOPropertyList.Create(const ABaseList : ISDOPropertyList);
2187 begin
2188   FList := TInterfaceList.Create();
2189   FBaseList := ABaseList;
2190 end;
2191 
2192 destructor TSDOPropertyList.Destroy();
2193 begin
2194   FBaseList := nil;
2195   FList := nil;
2196   inherited;
2197 end;
2198 
2199 procedure TSDOPropertyList.drop(const AProperty: ISDOProperty);
2200 var
2201   locProp : ISDOProperty;
2202   //locPropX : ISDOPropertyEx;
2203 begin
2204   if ( AProperty = nil ) then
2205     raise ESDOIllegalArgumentException.Create('AProperty');
2206   locProp := AProperty as ISDOProperty;
2207   if ( FList.Remove(AProperty) < 0 ) then
2208     raise ESDOPropertyNotFoundException.Create(AProperty.getName());
2209   //locPropX := locProp as ISDOPropertyEx;
2210   //locPropX.ClearType();
2211 end;
2212 
findnull2213 function TSDOPropertyList.find(const AName: string): ISDOProperty;
2214 var
2215   i : Integer;
2216 begin
2217   i := getIndex(AName);
2218   if ( i >= 0 ) then
2219     Result := GetItem(i)
2220   else
2221     Result := nil;
2222 end;
2223 
TSDOPropertyList.getCountnull2224 function TSDOPropertyList.getCount() : Integer;
2225 begin
2226   Result := FList.Count;
2227   if ( FBaseList <> nil ) then
2228     Inc(Result,FBaseList.getCount());
2229 end;
2230 
getIndexnull2231 function TSDOPropertyList.getIndex(const APropertyName: string): Integer;
2232 var
2233   i : Integer;
2234   prp : ISDOProperty;
2235 begin
2236   if ( FBaseList <> nil ) then
2237     Result := FBaseList.getIndex(APropertyName)
2238   else
2239     Result := -1;
2240   if ( Result = -1 ) then begin
2241     for i := 0 to Pred(FList.Count) do begin
2242       prp := FList[i] as ISDOProperty;
2243       if AnsiSameText(APropertyName,prp.getName()) then begin
2244         Result := i;
2245         if ( FBaseList <> nil ) then
2246           Inc(Result,FBaseList.getCount());
2247         Break;
2248       end;
2249     end;
2250   end;
2251 end;
2252 
getItemnull2253 function TSDOPropertyList.getItem(const AIndex: Integer): ISDOProperty;
2254 begin
2255   if ( AIndex >= 0 ) and ( AIndex < getCount() ) then begin
2256     if ( FBaseList <> nil ) then begin
2257       if ( AIndex < FBaseList.getCount() ) then
2258         Result := FBaseList.getItem(AIndex)
2259       else
2260         Result := FList[AIndex - FBaseList.getCount()] as ISDOProperty;
2261     end else begin
2262       Result := FList[AIndex] as ISDOProperty;
2263     end;
2264   end else begin
2265     raise ESDOIndexOutOfRangeException.Create(AIndex);
2266   end;
2267 end;
2268 
2269 procedure TSDOPropertyList.add(const AProperty: ISDOProperty);
2270 var
2271   locProp : ISDOProperty;
2272 begin
2273   if ( AProperty = nil ) then
2274     raise ESDOIllegalArgumentException.Create('AProperty');
2275   if ( find(AProperty.getName()) = nil ) then begin
2276     locProp := AProperty as ISDOProperty;
2277     FList.Add(locProp);
2278   end;
2279 end;
2280 
SetBasenull2281 function TSDOPropertyList.SetBase(const ABaseList: ISDOPropertyList): ISDOPropertyList;
2282 begin
2283   Result := FBaseList;
2284   FBaseList := ABaseList;
2285 end;
2286 
2287 end.
2288