|
public으로 선언된 프라퍼티(unpublished propterty)는 빌더에게 값을 어떻게 읽고 쓰는지를 알려한다고 하네요. 그러한 기능을 하는 메써드로 DefineProperties라는 것이 있는데요.
현재 어떤 클래스에
class TComp : public TComponent
{
...
};
class TSampleComp : public TComponent
{
private:
TComp* FComp3;
public:
__property TComp* Comp3 = {read = FComp3, write = FComp3};
};
void __fastcall TSampleComp::DefineProperties(TFiler* Filer)
{
TComponent::DefineProperties(Filer);
bool WriteValue;
if(Filer->Ancestor)
{
TSampleComp* FilerComp = dynamic_cast<TSampleComp*>(Filer->Ancestor);
if(FilerComp->Comp3==NULL)
WriteValue=(Comp3!=NULL);
else
{
if((Comp3==NULL) || (FilerComp->Comp3->Name != Comp3->Name))
WriteValue = true;
else
WriteValue = false;
}
}
else
WriteValue = (Comp3 !=NULL);
Filer->DefineProperty("Comp3",ReadComp3,WriteComp3,WriteValue);
}
ㅡㅡ;; 넘 복잡하네요. 패턴은 비슷할테니.. 제가 의도하는 바는 아시죠?
1. TFiler는 TSampleComp에서 상속된 클래스인가요?
2. DefineProperties는 누가 호출하나요?
3. DefineProperties하고 Filer안에 DefineProptery는 어떻게 다른가요?
4. 내장형값의 프라퍼티는 간단히 DefineProperty만 호출하던데요. 컴포넌트의 프라퍼티는 왜 이런 복잡한 과정을 거쳐야 하나요? 책에는 "a few times" 읽으면 이해될꺼라고 하는데 "many many times" 읽어도 이해가 안되요. ㅡㅡ;;
감사합니다.
|