home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Apple Shared Library Manager / ASLM Examples / Example Tools / Sources / TClassInfoExample.cp < prev    next >
Encoding:
Text File  |  1996-11-19  |  1.5 KB  |  51 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TClassInfoExample.cp
  3.  
  4.     Contains:    This module show an example of how to use the TClassInfo class.
  5.  
  6.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10. #include "TInitSLM.h"            // the TInitSLM class and SLM include files
  11.  
  12. /*————————————————————————————————————————————————————————————————————————————————————
  13.     main 
  14.     
  15.     Get's an instance of TClassInfo for the TCollection class and then uses the
  16.     TClassInfo to get information about TCollection and all of it's subclasses.
  17. ————————————————————————————————————————————————————————————————————————————————————*/
  18.  
  19. main() 
  20. {
  21.     TInitSLM initLibraryManager;        // initialize the shared library manager
  22.     
  23.     if( initLibraryManager.Failed() )    // If we failed, let's go home
  24.         return 1;
  25.     
  26.     TClassInfo* theinfo = GetLocalLibraryManager()->GetClassInfo(ClassID(kTCollectionID));
  27.  
  28.     if (theinfo) {
  29.         cout << "Getting class info for class id(" <<
  30.                 kTCollectionID << ") and subclasses" << endl;
  31.  
  32.         while ( !theinfo->IterationComplete() ) {
  33.             cout << "\n\nClass size = " << theinfo->GetSize() << endl;
  34.             cout << "Class ID = " << (char*) theinfo->GetClassID() << endl;
  35.             cout << "newobject flag = " << 
  36.                     (theinfo->GetNewObjectFlag() ? "true" : "false") << endl;
  37.             cout << "Preload flag ID = " << 
  38.                     (theinfo->GetPreloadFlag() ? "true" : "false") << endl;
  39.             cout << "Version = " << (void*)theinfo->GetMinVersion() << "…"
  40.                 << (void*)theinfo->GetVersion() << endl;
  41.             theinfo->Next();
  42.         }
  43.         delete theinfo;                    // free the space
  44.     }
  45.     else
  46.         cout << "Unable to get TClassInfo pointer" << endl;
  47.     
  48.     return 0;
  49. }
  50.  
  51.