Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to identify constructor parameters

Community Beginner ,
Jun 16, 2020 Jun 16, 2020

Hi all,

I am developing InDesign plugin via C++ SDK. So I want to know the idea of constructor parameters of objects.

 

Sample 01:

If someone wants to create IActiveContext, Then I saw they used ISubject.

InterfacePtr<IActiveContext> context(iSubj, UseDefaultIID());

 So I want to know why they use ISubject for construct IActiveContext here?

 

Sample 02:

InterfacePtr<IStrokeAttributeSuite> strokeAttributeSuite(selectionManager, UseDefaultIID());

How to identify IStrokeAttributeSuite needs to be passed ISelectionManager for construct IStrokeAttributeSuite.

These two are only samples. but I have to implement alot of object types. So Is there any hierarchy of objects? or any document to refer about this?

TOPICS
SDK
499
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 16, 2020 Jun 16, 2020

Read about boss classes, boss classes can be thought of as a collection of classes. So whenever you want to get an instance of an interface, you just need to get hold of some interface that lies in the same boss class as this wanted interface and then you can create an instance of your required interface using the syntax you used. Without getting into too much details lets discuss your example broadly

InterfacePtr<IActiveContext> context(iSubj, UseDefaultIID());

Now in this you need IActiveConte

...
Translate
Community Expert ,
Jun 16, 2020 Jun 16, 2020

Read about boss classes, boss classes can be thought of as a collection of classes. So whenever you want to get an instance of an interface, you just need to get hold of some interface that lies in the same boss class as this wanted interface and then you can create an instance of your required interface using the syntax you used. Without getting into too much details lets discuss your example broadly

InterfacePtr<IActiveContext> context(iSubj, UseDefaultIID());

Now in this you need IActiveContext, so check which boss class aggregates this interface. Then see what other interfaces are present in this boss class, you can use any one of these interface instead of iSubj, provided you have an instance of that interface. Now mostly the code is written in classes that makes these patterns almost same, for ex if you are writing a controller implementation then you are inside a kDoc boss and have access to its interface so you can navigate the whole kdoc boss hierarchy using that

Read the programming guide shipped with the sdk present in the docs folder. That is only documentation present

 

-Manan.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 16, 2020 Jun 16, 2020
LATEST

Thanks Manan. Now sorted that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines