IsStorageFile without downloading whole file
This commit is contained in:
parent
85a28d0099
commit
cd2790c9d1
5 changed files with 29 additions and 11 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: stg.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2000-09-18 16:56:50 $
|
||||
* last change: $Author: mba $ $Date: 2000-10-16 14:05:36 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -132,6 +132,7 @@ public:
|
|||
BOOL bDirect = TRUE );
|
||||
~Storage();
|
||||
static BOOL IsStorageFile( const String & rFileName );
|
||||
static BOOL IsStorageFile( SvStream* );
|
||||
const String& GetName() const;
|
||||
BOOL IsRoot() const { return bIsRoot; }
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: stg.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mm $ $Date: 2000-10-12 16:18:50 $
|
||||
* last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -332,6 +332,12 @@ BOOL Storage::IsStorageFile( const String & rFileName )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL Storage::IsStorageFile( SvStream* pStream )
|
||||
{
|
||||
StgHeader aHdr;
|
||||
return ( pStream && aHdr.Load( *pStream ) && aHdr.Check() );
|
||||
}
|
||||
|
||||
// Open the storage file. If writing is permitted and the file is not
|
||||
// a storage file, initialize it.
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: stgelem.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
|
||||
* last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -133,6 +133,12 @@ void StgHeader::Init()
|
|||
BOOL StgHeader::Load( StgIo& rIo )
|
||||
{
|
||||
SvStream& r = *rIo.GetStrm();
|
||||
Load( r );
|
||||
return rIo.Good();
|
||||
}
|
||||
|
||||
BOOL StgHeader::Load( SvStream& r )
|
||||
{
|
||||
r.Seek( 0L );
|
||||
r.Read( cSignature, 8 );
|
||||
r >> aClsId // 08 Class ID
|
||||
|
@ -151,7 +157,7 @@ BOOL StgHeader::Load( StgIo& rIo )
|
|||
>> nMaster; // 48 # of additional master blocks
|
||||
for( short i = 0; i < 109; i++ )
|
||||
r >> nMasterFAT[ i ];
|
||||
return rIo.Good();
|
||||
return r.GetErrorCode() == ERRCODE_NONE;
|
||||
}
|
||||
|
||||
BOOL StgHeader::Store( StgIo& rIo )
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: stgelem.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
|
||||
* last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -106,6 +106,7 @@ public:
|
|||
StgHeader();
|
||||
void Init(); // initialize the header
|
||||
BOOL Load( StgIo& );
|
||||
BOOL Load( SvStream& );
|
||||
BOOL Store( StgIo& );
|
||||
BOOL Check(); // check the signature and version
|
||||
short GetByteOrder() const { return nByteOrder; }
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: storage.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mm $ $Date: 2000-10-12 16:18:51 $
|
||||
* last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -562,6 +562,10 @@ BOOL SotStorage::IsStorageFile( const String & rFileName )
|
|||
return Storage::IsStorageFile( rFileName );
|
||||
}
|
||||
|
||||
BOOL SotStorage::IsStorageFile( SvStream* pStream )
|
||||
{
|
||||
return Storage::IsStorageFile( pStream );
|
||||
}
|
||||
/*************************************************************************
|
||||
|* SotStorage::GetStorage()
|
||||
|*
|
||||
|
|
Loading…
Reference in a new issue