home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-19 | 1.5 KB | 51 lines | [TEXT/MPS ] |
- /*
- File: TClassInfoExample.cp
-
- Contains: This module show an example of how to use the TClassInfo class.
-
- Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #include "TInitSLM.h" // the TInitSLM class and SLM include files
-
- /*————————————————————————————————————————————————————————————————————————————————————
- main
-
- Get's an instance of TClassInfo for the TCollection class and then uses the
- TClassInfo to get information about TCollection and all of it's subclasses.
- ————————————————————————————————————————————————————————————————————————————————————*/
-
- main()
- {
- TInitSLM initLibraryManager; // initialize the shared library manager
-
- if( initLibraryManager.Failed() ) // If we failed, let's go home
- return 1;
-
- TClassInfo* theinfo = GetLocalLibraryManager()->GetClassInfo(ClassID(kTCollectionID));
-
- if (theinfo) {
- cout << "Getting class info for class id(" <<
- kTCollectionID << ") and subclasses" << endl;
-
- while ( !theinfo->IterationComplete() ) {
- cout << "\n\nClass size = " << theinfo->GetSize() << endl;
- cout << "Class ID = " << (char*) theinfo->GetClassID() << endl;
- cout << "newobject flag = " <<
- (theinfo->GetNewObjectFlag() ? "true" : "false") << endl;
- cout << "Preload flag ID = " <<
- (theinfo->GetPreloadFlag() ? "true" : "false") << endl;
- cout << "Version = " << (void*)theinfo->GetMinVersion() << "…"
- << (void*)theinfo->GetVersion() << endl;
- theinfo->Next();
- }
- delete theinfo; // free the space
- }
- else
- cout << "Unable to get TClassInfo pointer" << endl;
-
- return 0;
- }
-
-