0027067: Avoid use of virtual methods for implementation of destructors in legacy...
[occt.git] / src / Storage / Storage_BaseDriver.cxx
CommitLineData
b311480e 1// Copyright (c) 1998-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
42cf5bc1 15
16#include <Storage_BaseDriver.hxx>
17#include <Storage_StreamExtCharParityError.hxx>
18#include <Storage_StreamFormatError.hxx>
19#include <Storage_StreamTypeMismatchError.hxx>
20#include <Storage_StreamWriteError.hxx>
21#include <TCollection_AsciiString.hxx>
22#include <TCollection_ExtendedString.hxx>
7fd59977 23
24Storage_BaseDriver::Storage_BaseDriver() : myOpenMode(Storage_VSNone)
25{
26}
e6f550da 27
28Storage_BaseDriver::~Storage_BaseDriver()
7fd59977 29{}
30
4ff92abe 31TCollection_AsciiString Storage_BaseDriver::ReadMagicNumber (Standard_IStream& theIStream)
32{
33 // magic number has the same length which is 7: BINFILE, CMPFILE and FSDFILE
34 Standard_Size aMagicNumberLen = 7;
35
36 TCollection_AsciiString aReadMagicNumber;
37
38 char aChar;
39 Standard_Size aReadCharNb = 0;
40
41 while (theIStream.good() && (aReadCharNb < aMagicNumberLen))
42 {
43 theIStream.get(aChar);
44 aReadCharNb += (Standard_Size)theIStream.gcount();
45 aReadMagicNumber += aChar;
46 }
47
48 return aReadMagicNumber;
49}