From: <jcm...@us...> - 2006-03-23 00:44:55
|
Revision: 656 Author: jcmoraisjr Date: 2006-03-22 16:44:47 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=656&view=rev Log Message: ----------- Implemented 'RaiseException: Boolean' parameter to the InstantFindAttribute function. Modified Paths: -------------- trunk/Source/Core/InstantPersistence.pas trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPersistence.pas =================================================================== --- trunk/Source/Core/InstantPersistence.pas 2006-03-23 00:42:05 UTC (rev 655) +++ trunk/Source/Core/InstantPersistence.pas 2006-03-23 00:44:47 UTC (rev 656) @@ -2652,7 +2652,7 @@ function InstantDefaultConnector: TInstantConnector; procedure InstantDisableNotifiers; procedure InstantEnableNotifiers; -function InstantFindAttribute(const Path: string; AObject: TInstantObject): TInstantAttribute; +function InstantFindAttribute(const Path: string; AObject: TInstantObject; RaiseExceptions: Boolean = True): TInstantAttribute; function InstantFindClass(const ClassName: string): TInstantObjectClass; function InstantFindClassMetadata(const ClassName: string): TInstantClassMetadata; function InstantGetClass(const ClassName: string): TInstantObjectClass; @@ -2956,8 +2956,8 @@ ObjectNotifiers.Enable; end; -function InstantFindAttribute(const Path: string; - AObject: TInstantObject): TInstantAttribute; +function InstantFindAttribute(const Path: string; AObject: TInstantObject; + RaiseExceptions: Boolean = True): TInstantAttribute; var I: Integer; AttribName: string; @@ -2969,7 +2969,12 @@ AttribName := InstantPartStr(Path, I, InstantDot); while (AttribName <> '') and Assigned(AObject) do begin - Result := AObject.AttributeByName(AttribName); + if RaiseExceptions then + Result := AObject.AttributeByName(AttribName) + else + Result := AObject.FindAttribute(AttribName); + if not Assigned(Result) then + Exit; Inc(I); AttribName := InstantPartStr(Path, I, InstantDot); if (AttribName <> '') and (Result is TInstantElement) then Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-23 00:42:05 UTC (rev 655) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-23 00:44:47 UTC (rev 656) @@ -1689,11 +1689,8 @@ if Assigned(FSubject) and Assigned(AField) and (FindFieldIndex(AField) = -1) then begin VAttr := nil; - try - if FSubject is TInstantObject then - VAttr := InstantFindAttribute(AField.FieldName, TInstantObject(FSubject)); - except - end; + if FSubject is TInstantObject then + VAttr := InstantFindAttribute(AField.FieldName, TInstantObject(FSubject), False); if Assigned(VAttr) then VarClear(VProperty) else |