home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / COMPOUND.ZIP / CStgFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-09  |  2.9 KB  |  121 lines

  1. //
  2. //    CStgFile.h
  3. //+
  4. //    header file
  5. //-
  6. //    rev 11/04/98 gls added isOpen()
  7. //    rev 11/03/98 gls
  8. //
  9.  
  10. #if !defined(AFX_CSTGFILE_H__44A6BBE4_7363_11D2_A233_B4D39F7DF00D__INCLUDED_)
  11. #define AFX_CSTGFILE_H__44A6BBE4_7363_11D2_A233_B4D39F7DF00D__INCLUDED_
  12.  
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16.  
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CStgFile window
  20.  
  21. class CStgFile : public CFile
  22. {
  23.  
  24.     IStorage        *m_pStgRoot;        // open storage
  25.     
  26.     IStorage        *m_pStgStreamOpen;    // storage for current open stream
  27.     COleStreamFile    *m_pStreamOpen;        // pointer if stream is open
  28.  
  29.     int    printf( const char *format, ... ) { return(0); }
  30.  
  31.  
  32. // Construction
  33. public:
  34.     CStgFile();
  35.  
  36. // Attributes
  37. public:
  38.  
  39. // Operations
  40. public:
  41.  
  42.     BOOL    OpenStg( LPCSTR pszFileStg );
  43.     BOOL    CreateStg( LPCSTR pszFileStg );
  44.     BOOL    CloseStg( void );
  45.     BOOL    MkStg( LPCSTR pszStg );
  46.  
  47.     BOOL    isOpen( void )
  48.             {
  49.             return( m_pStgRoot != NULL ? TRUE : FALSE );
  50.             }
  51.  
  52.  
  53.  
  54.     BOOL    Enum( IStorage *pStg = NULL, LPCSTR pszStgStart = NULL,
  55.                 BOOL (*pFunc)(void *pContext, LPCSTR pszStgPrefix, STATSTG *pStat ) = NULL,
  56.                 void *pContextCallback = NULL );
  57.  
  58.     BOOL    EnumStreams( CStringArray &rgStreams, LPCSTR pszPattern = NULL );
  59.  
  60.     virtual    BOOL    OnEnumStg( LPCSTR pszStgPrefix, STATSTG *pStat )
  61.             {
  62.             printf( "CStgFile:: OnEnumStg( %s\\%s )\n",
  63.                     pszStgPrefix,  CString( pStat->pwcsName ) );
  64.  
  65.             return( TRUE );
  66.             }
  67.  
  68.     virtual    BOOL    OnEnumStream( LPCSTR pszStgPrefix, STATSTG *pStat )
  69.             {
  70.             printf( "CStgFile:: OnEnumStream( %s\\%s )\n",
  71.                     pszStgPrefix,  CString( pStat->pwcsName ) );
  72.  
  73.             return( TRUE );
  74.             }
  75.  
  76.     IStorage    *getStgRoot()
  77.     {
  78.         return( m_pStgRoot );
  79.     }
  80.  
  81.     
  82. public:
  83.     //
  84.     //    Overrides to switch between external and document stream
  85.     //
  86.     virtual BOOL Open( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL );
  87.     virtual void Close( void );
  88.     virtual void Write( const void* lpBuf, UINT nCount );
  89.     virtual UINT Read( void* lpBuf, UINT nCount );
  90.     virtual void Flush( );
  91.     virtual LONG Seek( LONG lOff, UINT nFrom );
  92.  
  93.  
  94. // Overrides
  95.     // ClassWizard generated virtual function overrides
  96.     //{{AFX_VIRTUAL(CStgFile)
  97.     //}}AFX_VIRTUAL
  98.  
  99. // Implementation
  100. public:
  101.     virtual ~CStgFile();
  102.  
  103.     // Generated message map functions
  104. protected:
  105.     //{{AFX_MSG(CStgFile)
  106.         // NOTE - the ClassWizard will add and remove member functions here.
  107.     //}}AFX_MSG
  108. };
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111.  
  112. //{{AFX_INSERT_LOCATION}}
  113. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  114.  
  115. #endif // !defined(AFX_CSTGFILE_H__44A6BBE4_7363_11D2_A233_B4D39F7DF00D__INCLUDED_)
  116.  
  117.  
  118. // ////////////////////////////////////////////////////////////
  119. // ////////////////////////////////////////////////////////////
  120. // ////////////////////////////////////////////////////////////
  121.