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 partial PdbMutatorInterface implementation that provides an
16 : // implementation for the 'name' member function.
17 :
18 : #ifndef SYZYGY_PDB_MUTATORS_NAMED_MUTATOR_H_
19 : #define SYZYGY_PDB_MUTATORS_NAMED_MUTATOR_H_
20 :
21 : #include "syzygy/pdb/pdb_mutator.h"
22 :
23 : namespace pdb {
24 : namespace mutators {
25 :
26 : // Implements the 'name' member function of PdbMutatorInterface.
27 : // The user must define the static variable:
28 : //
29 : // const char DerivedType::kMutatorName[];
30 : //
31 : // @tparam DerivedType the type of the derived class.
32 : template<class DerivedType>
33 : class NamedPdbMutatorImpl : public PdbMutatorInterface {
34 : public:
35 : // Gets the name of this mutator.
36 : // @returns the name of this mutator.
37 E : virtual const char* name() const override {
38 E : return DerivedType::kMutatorName;
39 E : }
40 : };
41 :
42 : } // namespace mutators
43 : } // namespace pdb
44 :
45 : #endif // SYZYGY_PDB_MUTATORS_NAMED_MUTATOR_H_
|