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 : // Declares a simple API for mutating PDB files.
16 :
17 : #ifndef SYZYGY_PDB_PDB_MUTATOR_H_
18 : #define SYZYGY_PDB_PDB_MUTATOR_H_
19 :
20 : #include "syzygy/pdb/pdb_file.h"
21 :
22 : namespace pdb {
23 :
24 : // A PdbMutatorInterface is a pure virtual base class defining the mutator API.
25 : class PdbMutatorInterface {
26 : public:
27 E : virtual ~PdbMutatorInterface() { }
28 :
29 : // Gets the name of this mutator.
30 : // @returns the name of this mutator.
31 : virtual const char* name() const = 0;
32 :
33 : // Applies this mutator to the provided PDB. It is up to the mutator to
34 : // ensure that all headers are maintained properly, etc.
35 : // @param pdb_file The PDB file to be modified.
36 : virtual bool MutatePdb(PdbFile* pdb_file) = 0;
37 : };
38 :
39 : // Applies a vector of PDB mutators to the given file. Logs an error on failure.
40 : // @param pdb_mutators The PDB mutators to be applied.
41 : // @param pdb_file The PDB file to be modified.
42 : // @returns true on success, false otherwise.
43 : bool ApplyPdbMutators(const std::vector<PdbMutatorInterface*>& pdb_mutators,
44 : PdbFile* pdb_file);
45 :
46 : } // namespace pdb
47 :
48 : #endif // SYZYGY_PDB_PDB_MUTATOR_H_
|