1 : // Copyright 2015 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_REFINERY_TYPES_TYPE_NAMER_H_
16 : #define SYZYGY_REFINERY_TYPES_TYPE_NAMER_H_
17 :
18 : #include <dia2.h>
19 :
20 : #include "base/macros.h"
21 : #include "base/strings/string16.h"
22 : #include "syzygy/refinery/types/type.h"
23 :
24 m : namespace refinery {
25 :
26 m : bool GetSymBaseTypeName(IDiaSymbol* symbol, base::string16* type_name);
27 :
28 : // Computes type names for types whose name depends on other types.
29 : // @note array names do not depend on the index type.
30 m : class TypeNamer {
31 m : public:
32 m : static bool GetName(ConstTypePtr type, base::string16* type_name);
33 m : static bool GetDecoratedName(ConstTypePtr type, base::string16* type_name);
34 :
35 m : private:
36 m : static bool GetName(ConstTypePtr type,
37 m : bool decorated,
38 m : base::string16* type_name);
39 :
40 m : static bool GetPointerName(ConstPointerTypePtr ptr,
41 m : bool decorated,
42 m : base::string16* type_name);
43 m : static bool GetArrayName(ConstArrayTypePtr array,
44 m : bool decorated,
45 m : base::string16* type_name);
46 m : static bool GetFunctionName(ConstFunctionTypePtr function,
47 m : bool decorated,
48 m : base::string16* type_name);
49 m : };
50 :
51 m : class DiaTypeNamer {
52 m : public:
53 m : static bool GetTypeName(IDiaSymbol* type, base::string16* type_name);
54 :
55 m : private:
56 m : static bool GetPointerName(IDiaSymbol* type, base::string16* type_name);
57 m : static bool GetArrayName(IDiaSymbol* type, base::string16* type_name);
58 m : static bool GetFunctionName(IDiaSymbol* type, base::string16* type_name);
59 m : };
60 :
61 m : } // namespace refinery
62 :
63 : #endif // SYZYGY_REFINERY_TYPES_TYPE_NAMER_H_
|