1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #ifndef SYZYGY_MSF_MSF_READER_H_
16 : #define SYZYGY_MSF_MSF_READER_H_
17 :
18 : #include "base/files/file_path.h"
19 : #include "base/files/file_util.h"
20 : #include "syzygy/msf/msf_constants.h"
21 : #include "syzygy/msf/msf_data.h"
22 : #include "syzygy/msf/msf_decl.h"
23 : #include "syzygy/msf/msf_file.h"
24 : #include "syzygy/msf/msf_file_stream.h"
25 : #include "syzygy/msf/msf_stream.h"
26 :
27 : namespace msf {
28 : namespace detail {
29 :
30 : // This class is used to read an MSF file from disk, populating an MsfFileImpl
31 : // object with its streams.
32 : template <MsfFileType T>
33 : class MsfReaderImpl {
34 : public:
35 E : MsfReaderImpl() {}
36 :
37 E : virtual ~MsfReaderImpl() {}
38 :
39 : // Reads an MSF, populating the given MsfFileImpl object with the streams.
40 : //
41 : // @note Once use of the above Read function variants has been eliminated,
42 : // MsfReaderImpl will become stateless and simply populate an MsfFileImpl.
43 : //
44 : // @param msf_path the MSF file to read.
45 : // @param msf_file the empty MsfFileImpl object to be filled in.
46 : // @returns true on success, false otherwise.
47 : bool Read(const base::FilePath& msf_path, MsfFileImpl<T>* msf_file);
48 :
49 : private:
50 : DISALLOW_COPY_AND_ASSIGN(MsfReaderImpl);
51 : };
52 :
53 : } // namespace detail
54 :
55 : using MsfReader = detail::MsfReaderImpl<kGenericMsfFileType>;
56 :
57 : } // namespace msf
58 :
59 : #include "syzygy/msf/msf_reader_impl.h"
60 :
61 : #endif // SYZYGY_MSF_MSF_READER_H_
|