[xsd-users] Help me: How to find out what is the type of a class

James Mei jxmei3 at gmail.com
Tue Oct 20 05:03:01 EDT 2009


Hi Boris

After an xml file is parsed and populated into its designated class. I can
create a TreeView out of it starting from the root. Also, I assigned the
class pointer to TreeNode->Data for later manipulation.

                for (n = 0; n < sn.ConnectedAP().at(k).GSE().size(); n++) {
                    TTreeNode *tn=spd->hTree->Items->AddChild(tn_gse,
sn.ConnectedAP().at(k).GSE().at(n).cbName().c_str());
                    tn->Data = &sn.ConnectedAP().at(k).GSE().at(n).cbName();
                    tn=spd->hTree->Items->AddChild(tn_gse,
sn.ConnectedAP().at(k).GSE().at(n).ldInst().c_str());
                    tn->Data = &sn.ConnectedAP().at(k).GSE().at(n).ldInst();
                    TTreeNode *tn_addr=spd->hTree->Items->AddChild(tn_gse,
"Address");
                    for (m = 0; m <
sn.ConnectedAP().at(k).GSE().at(n).Address().get().P().size(); m++) {
                        tn=spd->hTree->Items->AddChild(tn_addr,
sn.ConnectedAP().at(k).GSE().at(n).Address().get().P().at(m).type().c_str());

tn->Data=&sn.ConnectedAP().at(k).GSE().at(n).Address().get().P().at(m)
                    }
                }

Later when user click on the TreeNode, I can get the class pointer and start
the appropriate operation with TreeNode->Data. However, I only have the
pointer, not its class type. I do not know it is a pointer to GSE() or it is
a pointer to Address() .... May I know how do I identify the type of this
class pointer ?


Also, is there a default data member in the generated class for storing
reference data, such as the TreeNode->Data member.

Regards
James


More information about the xsd-users mailing list