Recent

Author Topic: C++ porting: Is this really a template "CDocTemplate"  (Read 781 times)

jamie

  • Hero Member
  • *****
  • Posts: 6587
C++ porting: Is this really a template "CDocTemplate"
« on: September 08, 2024, 04:56:16 pm »
I need to create to a limited degree a CDocTemplate equivalent to To C++.

MS states it as being a template, is this really a Template ? if I can write a generic for it.

I just want to cut to the shortest path possible.

https://learn.microsoft.com/en-us/cpp/mfc/reference/cdoctemplate-class?view=msvc-170
The only true wisdom is knowing you know nothing

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11780
  • FPC developer.
Re: C++ porting: Is this really a template "CDocTemplate"
« Reply #1 on: September 08, 2024, 05:16:27 pm »
I'm no C++ interoperability expert, but an abstract base class, without standard constructor/destructors might be an  C++ rendering of an interface?


jamie

  • Hero Member
  • *****
  • Posts: 6587
Re: C++ porting: Is this really a template "CDocTemplate"
« Reply #2 on: September 08, 2024, 05:33:12 pm »
There is a "CCmdTarget" as a inherited class attached to that also, but that class is mainly used in my case to post messages to the window that is logged within that current instance.

 I don't know if using an interface here warrants that type of code, there is a constructor for that the CDOCTemplate, but as with most C++ classes, destructors are called, maybe not in this case however.


 
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6587
Re: C++ porting: Is this really a template "CDocTemplate"
« Reply #3 on: September 08, 2024, 06:18:30 pm »
Ok, I am going to give the compiler a run for its money!  :o

Looks like I first need to implement the CMultiDocTemplate then the CDOcTemplate and so on.

We will see how the Generics fares!
The only true wisdom is knowing you know nothing

iLya2IK

  • New Member
  • *
  • Posts: 45
Re: C++ porting: Is this really a template "CDocTemplate"
« Reply #4 on: September 11, 2024, 12:45:48 pm »
From the description of the CDocTemplate class, I see that this is a classic abstract class (it is not a template in the understanding of c++). In Pascal, it can be implemented either by interfaces (if you do not want to free up the allocated memory yourself) or by directly translating the description of the CDocTemplate class into Pascal syntax (pascal has all the necessary specifiers for this).

 

TinyPortal © 2005-2018