home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
sybase
/
starbuck
/
hpp.z
/
wolestor.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
11KB
|
311 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef _WOLESTOR_HPP_INCLUDED
#define _WOLESTOR_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WARRAY_HPP_INCLUDED
# include "warray.hpp"
#endif
#ifndef _WSTRING_HPP_INCLUDED
# include "wstring.hpp"
#endif
#ifndef _WOLETYPE_HPP_INCLUDED
# include "woletype.hpp"
#endif
#ifndef _WOLEAUTO_HPP_INCLUDED
# include "woleauto.hpp"
#endif
// forward class declarations
class WCMCLASS WOleStream;
class WCMCLASS WOleStorage;
/* Storage instantiation modes */
#define WSTGM_DIRECT 0x00000000L
#define WSTGM_TRANSACTED 0x00010000L
#define WSTGM_SIMPLE 0x08000000L
#define WSTGM_READ 0x00000000L
#define WSTGM_WRITE 0x00000001L
#define WSTGM_READWRITE 0x00000002L
#define WSTGM_SHARE_DENY_NONE 0x00000040L
#define WSTGM_SHARE_DENY_READ 0x00000030L
#define WSTGM_SHARE_DENY_WRITE 0x00000020L
#define WSTGM_SHARE_EXCLUSIVE 0x00000010L
#define WSTGM_PRIORITY 0x00040000L
#define WSTGM_DELETEONRELEASE 0x04000000L
#define WSTGM_NOSCRATCH 0x00100000L
#define WSTGM_CREATE 0x00001000L
#define WSTGM_CONVERT 0x00020000L
#define WSTGM_FAILIFTHERE 0x00000000L
enum WSTGTY {
WSTGTY_STORAGE = 1,
WSTGTY_STREAM = 2,
WSTGTY_LOCKBYTES = 3,
WSTGTY_PROPERTY = 4
};
enum WSTREAM_SEEK {
WSTREAM_SEEK_SET = 0,
WSTREAM_SEEK_CUR = 1,
WSTREAM_SEEK_END = 2
};
enum WLOCKTYPE {
WLOCK_WRITE = 1,
WLOCK_EXCLUSIVE = 2,
WLOCK_ONLYONCE = 4
};
enum WSTGC {
WSTGC_DEFAULT = 0,
WSTGC_OVERWRITE = 1,
WSTGC_ONLYIFCURRENT = 2,
WSTGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4
};
enum WSTGMOVE {
WSTGMOVE_MOVE = 0,
WSTGMOVE_COPY = 1
};
enum WSTATFLAG {
WSTATFLAG_DEFAULT = 0,
WSTATFLAG_NONAME = 1
};
class WCMCLASS WStatStg {
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WStatStg();
WStatStg( const WStatStg & statStg );
~WStatStg();
/**********************************************************
* Operators
*********************************************************/
WStatStg & operator=( const WStatStg & statStg );
/**********************************************************
* Data Members
*********************************************************/
public:
WString name;
WSTGTY type;
WULARGE_INTEGER size;
WFileTime mtime;
WFileTime ctime;
WFileTime atime;
WDWord grfMode;
WDWord grfLocksSupported;
WCLSID clsid;
WDWord grfStateBits;
};
extern template WArrayReference<WStatStg>;
extern template WArray<WStatStg>;
typedef WArray<WStatStg> WStatStgArray;
/*************************************************************************
*
* WOleStream -- OLE Stream
*
*
* Events:
*
*
*************************************************************************/
class WCMCLASS WOleStream : public WObject {
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WOleStream();
WOleStream( WPIStream stream );
WOleStream( const WOleStream & stream );
~WOleStream();
/**************************************************************
* Properties
**************************************************************/
// Valid
WBool GetValid( void ) const;
// Handle
WPIStream GetHandle( void ) const;
// HGlobal
WMemoryHandle GetHGlobal( void ) const;
// Last Result
WHRESULT GetLastResult( void ) const;
/**************************************************************
* Methods
**************************************************************/
void Clear( void );
WBool Read( void *data, WULong length, WULong *numRead );
WBool Write( const void *data, WULong length, WULong *numWritten );
WBool Seek( WLong move, WSTREAM_SEEK origin, WULong *newPosition );
WBool Seek( WLARGE_INTEGER move, WSTREAM_SEEK origin, WULARGE_INTEGER *newPosition );
WBool SetSize( WULong newSize );
WBool SetSize( WULARGE_INTEGER newSize );
WBool CopyTo( WOleStream & stream, WULong length, WULong *numRead, WULong *numWritten );
WBool CopyTo( WOleStream & stream, WULARGE_INTEGER length, WULARGE_INTEGER *numRead, WULARGE_INTEGER *numWritten );
WBool Commit( WDWord commitFlags );
WBool Revert( void );
WBool LockRegion( WULong offset, WULong length, WLOCKTYPE lockType );
WBool LockRegion( WULARGE_INTEGER offset, WULARGE_INTEGER length, WLOCKTYPE lockType );
WBool UnlockRegion( WULong offset, WULong length, WLOCKTYPE lockType );
WBool UnlockRegion( WULARGE_INTEGER offset, WULARGE_INTEGER length, WLOCKTYPE lockType );
WBool Stat( WStatStg & wstatStg, WSTATFLAG statFlag );
WBool Clone( WOleStream & stream );
static WBool CreateStreamOnHGlobal( WMemoryHandle hGlobal, WBool deleteOnRelease, WOleStream & stream );
/**********************************************************
* Operators
*********************************************************/
WOleStream & operator=( const WOleStream & stream );
WOleStream & operator=( WPIStream stream );
operator WPIStream() const;
/**********************************************************
* Data Members
*********************************************************/
protected:
WPIStream _stream;
WHRESULT _lastResult;
};
/*************************************************************************
*
* WOleStorage -- OLE Storage
*
*
* Events:
*
*
*************************************************************************/
class WCMCLASS WOleStorage : public WObject {
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WOleStorage();
WOleStorage( WPIStorage storage );
WOleStorage( const WOleStorage & storage );
~WOleStorage();
/**************************************************************
* Properties
**************************************************************/
// Valid
WBool GetValid( void ) const;
// Handle
WPIStorage GetHandle( void ) const;
// Last Result
WHRESULT GetLastResult( void ) const;
/**************************************************************
* Methods
**************************************************************/
void Clear( void );
WBool CreateStream( const WString & name, WDWord mode, WOleStream & wstream );
WBool OpenStream( const WString & name, WDWord mode, WOleStream & wstream );
WBool CreateStorage( const WString & name, WDWord mode, WDWord stgFmt, WOleStorage & storage );
WBool OpenStorage( const WString & name, WDWord mode, WOleStorage & storage );
// NYI WBool OpenStorage( const WString & name, WOleStorage & stgPriority, WDWord mode, SNB snbExclude, WOleStorage & storage );
WBool CopyTo( WOleStorage & stgDest );
// NYI WBool CopyTo( WDWord numIIDExclude, const WIID *IIDExclude, SNB snbExclude, WOleStorage & stgDest );
WBool MoveElementTo( const WString & name, WOleStorage & stgDest, const WString & newName, WDWord flags );
WBool Commit( WDWord commitFlags );
WBool Revert( void );
WBool EnumElements( WStatStgArray & stgArray );
WBool DestroyElement( const WString & name );
WBool RenameElement( const WString & oldName, const WString & newName );
WBool SetElementTimes( const WString & name, const WFileTime *wctime, const WFileTime *watime, const WFileTime *wmtime );
WBool SetClass( const WCLSID & clsid );
WBool SetStateBits( WDWord stateBits, WDWord mask );
WBool Stat( WStatStg & wstatStg, WSTATFLAG statFlag );
static WBool StgCreateDocfile( const WString & name, WDWord mode, WOleStorage & stgOpen, WHRESULT *result=NULL );
static WBool StgOpenStorage( const WString & name, WDWord mode, WOleStorage & stgOpen, WHRESULT *result=NULL );
// NYI static WBool StgOpenStorage( const WString & name, WOleStorage & stgPriority, WDWord mode, SNB snbExclude, WOleStorage & stgOpen, WHRESULT *result=NULL );
static WBool StgIsStorageFile( const WString & name, WHRESULT *result=NULL );
static WBool StgSetTimes( const WString & name, const WFileTime *wctime, const WFileTime *watime, const WFileTime *wmtime, WHRESULT *result=NULL );
/**********************************************************
* Operators
*********************************************************/
WOleStorage & operator=( const WOleStorage & storage );
WOleStorage & operator=( WPIStorage storage );
operator WPIStorage() const;
/**********************************************************
* Data Members
*********************************************************/
protected:
WPIStorage _storage;
WHRESULT _lastResult;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WOLESTOR_HPP_INCLUDED