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

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //                             SAMPLE CODE
  3. //
  4. // FileName: ACDFMy2.cpp
  5. //
  6. // ClassName: ACompDocFwkMyObject
  7. //
  8. // Description: Compound Document Framework (SimpleServer) 
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #include <ibasstrm.hpp>
  12. #include <iMetaTyp.hpp>
  13. #include <iexcept.hpp>
  14. #include <icconst.h>
  15. #include <assert.h>
  16.  
  17. #include "ACDFMy2.hpp"
  18.  
  19. TypeExtensionMacro(ACompDocFwkMyObject)
  20.  
  21. ACompDocFwkMyObject::ACompDocFwkMyObject() : fMyString()
  22. // Default Constructor
  23. {   IFUNCTRACE_DEVELOP();}
  24.  
  25. ACompDocFwkMyObject::ACompDocFwkMyObject(IString str) : fMyString(str)
  26. // Constructor initilize string
  27. {   IFUNCTRACE_DEVELOP();}
  28.  
  29. ACompDocFwkMyObject::~ACompDocFwkMyObject()
  30. // Default Destructor
  31. {   IFUNCTRACE_DEVELOP();}
  32.  
  33. ACompDocFwkMyObject::ACompDocFwkMyObject( const ACompDocFwkMyObject& other ) :
  34.           fMyString( other.fMyString )
  35. // Copy Constructor
  36. {   IFUNCTRACE_DEVELOP();}
  37.  
  38. IString ACompDocFwkMyObject::getMyString() const
  39. // Implement method for reading member data
  40.  
  41. {   IFUNCTRACE_DEVELOP();
  42.     return fMyString;
  43. }
  44.  
  45. IBoolean ACompDocFwkMyObject::setMyString( const IString& str )
  46. // Implement method for setting member data
  47. {   IFUNCTRACE_DEVELOP();
  48.     fMyString = str;
  49.     return true;
  50. }
  51.  
  52. IBaseStream& ACompDocFwkMyObject::operator>>=(IBaseStream& toWhere) const
  53. // Stream member data out
  54. {   IFUNCTRACE_DEVELOP();
  55.     writeVersion(toWhere,kOriginalVersion);
  56.     fMyString >>= toWhere;
  57.     return toWhere;
  58. }
  59.  
  60.  
  61. IBaseStream& ACompDocFwkMyObject::operator<<=(IBaseStream& fromWhere)
  62. // Stream member data in
  63. {   IFUNCTRACE_DEVELOP();
  64.     switch (readVersion(fromWhere))
  65.     {
  66.         case kOriginalVersion:
  67.             fMyString <<= fromWhere;
  68.             break;
  69.         default:
  70.             ITHROWLIBRARYERROR(IC_STREAM_VERSION_UNSUPPORTED, 
  71.                                IBaseErrorInfo::invalidRequest,
  72.                                IException::recoverable);
  73.     }
  74.     return fromWhere;
  75. }
  76.  
  77.      
  78.