home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / acdf6 / acdfmdl6.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  2.8 KB  |  96 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //                                              SAMPLE CODE
  3. //
  4. // FileName: ACDFMdl6.cpp
  5. //
  6. // ClassName: ACompDocFwkModel
  7. //
  8. // Description: Conversion of the Hello World 5 Sample
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #include "ACDFMdl6.hpp"
  12. #include "ACDFVw6.hpp"
  13. #include "acdfst6.hpp"
  14. #include <imsgbox.hpp>
  15.  
  16. #include <fstream.h>
  17. #include <inotifev.hpp>
  18. #include <ibasstrm.hpp>
  19. #include <iStatnry.hpp>
  20. #include <iexcept.hpp>
  21. #include <icconst.h>
  22. #include <assert.h>
  23. #include <iframe.hpp>
  24.  
  25. TypeExtensionMacro(ACompDocFwkModel)
  26.  
  27. ACompDocFwkModel::ACompDocFwkModel()  
  28. // Default Constructor
  29. {       IFUNCTRACE_DEVELOP();}
  30.  
  31. ACompDocFwkModel::~ACompDocFwkModel()
  32. // Default Destructor
  33. {       IFUNCTRACE_DEVELOP();}
  34.  
  35. ACompDocFwkModel::ACompDocFwkModel( const ACompDocFwkModel& other ) :
  36.             IModel( other ) // force assert
  37. // Copy Constructor
  38. {       IFUNCTRACE_DEVELOP(); }
  39.  
  40.  
  41. IBaseStream& ACompDocFwkModel::operator>>=(IBaseStream& toWhere) const
  42. // Stream member data out
  43. {       IFUNCTRACE_DEVELOP();
  44.     writeVersion(toWhere, kOriginalVersion);
  45.     IModel::operator>>=( toWhere );
  46.     return toWhere;
  47. }
  48.  
  49. IBaseStream& ACompDocFwkModel::operator<<=(IBaseStream& fromWhere)
  50. // Stream member data in
  51. {       IFUNCTRACE_DEVELOP();
  52.     switch (readVersion(fromWhere))
  53.     {
  54.         case kOriginalVersion:
  55.             IModel::operator<<=( fromWhere );
  56.             break;
  57.         default:
  58.         ITHROWLIBRARYERROR(IC_STREAM_VERSION_UNSUPPORTED, 
  59.               IBaseErrorInfo::invalidRequest,
  60.               IException::recoverable);
  61.     }
  62.     return fromWhere;
  63. }
  64. // IComponent Stationery class is created using the model, view
  65.  
  66. ACompDocFwkMyStationery CompDocFwkStationery;
  67.  
  68.  
  69. int main( int argc, char* argv[] )
  70. {
  71.     int ireturn;
  72.     try
  73.     {
  74.         // Stationery run will eventually call the IApplication::current().run()
  75.         ireturn =  CompDocFwkStationery.run( argc, argv );
  76.     }
  77.  
  78.     catch (IException& exc)
  79.     {
  80.         ofstream  errorFile("errormsg.log",ios::app);
  81.         const IExceptionLocation *excLocate = exc.locationAtIndex(0);
  82.  
  83.         errorFile << "Exception on exit " << exc.text() << endl;
  84.         errorFile << "File : " << excLocate->fileName() << endl;
  85.         errorFile << "Function : " << excLocate->functionName() << endl;
  86.         errorFile << "Line : " << excLocate->lineNumber() << endl;
  87.  
  88.         cout << "Exception on exit " << exc.text() << endl;
  89.         cout << "File : " << excLocate->fileName() << endl;
  90.         cout << "Function : " << excLocate->functionName() << endl;
  91.         cout << "Line : " << excLocate->lineNumber() << endl;
  92.     }
  93.     return ireturn;
  94. }
  95.     
  96.