
Mon, 09/20/2010 - 03:18
Forums:
Say I have a few subclass of TDocStd_Document, then use TDocStd_Application::NewDocument() to add instances of those subclasses. (I've subclassed TDocStd_Application as well):
Handle_FooDoc fooDoc;
myApp->NewDocument("foo", fooDoc);
Handle_BarDoc barDoc;
myApp->NewDocument("bar", barDoc);
I then iterate over the docs:
for (int i=1; iNbDocuments(); ++i) {
Handle_TDocStd_Document doc;
myApp->GetDocument(1, doc);
// how do I determine the type of doc?
// doc->IsKind(STANDARD_TYPE(FooDoc)) never succeeds
}
Ive attached a short compilable example.
Attachments:
Mon, 09/20/2010 - 09:13
Ok, so I was way the hell off the mark there.
Mon, 09/20/2010 - 16:44
Hi,
I suppose that you expect to get storage format ("foo" | "bar").
For this you may use doc->StorageFormat() method.
Regards
sergey
Mon, 09/20/2010 - 23:02
Hi sergey,
Well, foo and bar were just names I threw in for the post. The attached source of that post uses "XmlOcaf".
What I ended up doing was overriding NewDocument() to accept Handle_FooDoc&, and Handle_BarDoc& to create instances of those instead of an instance of TDocStd_Document.
IsKind(STANDARD_TYPE(FooDoc)) now works with the reference GetDocument() gives me. So now I can discern between the different types of docs I have stored in the app instance.
I guess there are a few different way to go about this. I'm just experimenting right now.