forked from cmu-sei/pharos-demangle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemangle_json.hpp
69 lines (59 loc) · 2.19 KB
/
demangle_json.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Pharos Demangler
//
// Copyright 2017-2020 Carnegie Mellon University. All Rights Reserved.
//
// NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING
// INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON
// UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR
// IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF
// FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS
// OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
// MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT,
// TRADEMARK, OR COPYRIGHT INFRINGEMENT.
//
// Released under a BSD-style license, please see license.txt or contact
// [email protected] for full terms.
//
// [DISTRIBUTION STATEMENT A] This material has been approved for public
// release and unlimited distribution. Please see Copyright notice for
// non-US Government use and distribution.
//
// DM17-0949
#ifndef Include_demangle_json
#define Include_demangle_json
#include "demangle.hpp"
#include "demangle_text.hpp"
#include "json.hpp"
namespace demangle {
class JsonOutput {
public:
using Builder = json::Builder;
using Object = json::Object;
using ObjectRef = json::ObjectRef;
public:
JsonOutput(Builder const & b) : builder(b) {}
void set_attributes(TextAttributes attr) {
text.set_attributes(attr);
}
ObjectRef convert(DemangledType const & sym) const;
ObjectRef operator()(DemangledType const & sym) const {
return convert(sym);
}
ObjectRef raw(DemangledType const & sym) const;
ObjectRef minimal(DemangledType const & sym) const;
private:
Builder const & builder;
TextOutput text;
void handle_symbol_type(Object & obj, DemangledType const & sym) const;
void handle_scope(Object & obj, DemangledType const & sym) const;
void handle_distance(Object & obj, DemangledType const & sym) const;
void handle_method_property(Object & obj, DemangledType const & sym) const;
void handle_namespace(Object & obj, DemangledType const & sym) const;
};
} // namespace demangle
#endif // Include_demangle_json
/* Local Variables: */
/* mode: c++ */
/* fill-column: 95 */
/* comment-column: 0 */
/* End: */