TRttiIndexedProperty는 인덱싱 된 속성에 대한 RTTI 데이터를 쓰는 컴파일러, Delphi XE2 컴파일러에서만 수행하는 기능을 사용하므로 이전 Delphi 버전으로 역 이식 될 수 없습니다. 거기에없는 것을 읽을 수는 없습니다.
유일한 가능성은이 데이터를 직접 작성하는 것입니다. 따라서 모든 코드를 실행하고 모든 인덱싱 된 속성에 필요한 유형 정보를 생성하는 파서를 작성해야합니다. 파서가 컴파일러가 아니기 때문에 인덱스 된 속성을 쓰고 읽는 작은 도우미 함수를 작성해야합니다.
TMyClass = class
private
...
public
property MyArray[Index: Integer]: TMyObject read GetMyArray write SetMyArray;
// autogenerated code
class procedure RegisterIndexedPropertyInfos(Registry: TMyRttiIndexedPropertyRegistry); static;
end;
// autogenerated code
class procedure TMyClass.RegisterIndexedPropertyInfos(Registry: TMyRttiIndexedPropertyRegistry): TMyRttiIndexedProperty;
begin
Registry.Register('MyArray', [TMyRttiIndex.Create('Index', TypeInfo(Integer))], TypeInfo(TMyObject), @TMyClass.GetMyArray, @TMyClass.SetMyArray);
end;
// When using RichRTTI you can omit this line and use the the RttiContext to find RegisterIndexedPropertyInfos
RegisterIndexedPropertyClass(TMyClass, @TMyClass.RegisterIndexedPropertyInfos);
무엇이 질문은 클린 룸 구현과해야 할 않습니다 출력은 다음과 같이 될 수 있을까? –
@Rob 이제 대답입니다. –
@Rob Kennedy : 헤더를 수정했습니다. – menjaraz