1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | #pragma once
|
9 |
|
10 | #include <climits>
|
11 | #include <memory>
|
12 | #include <string>
|
13 | #include <vector>
|
14 |
|
15 | namespace facebook {
|
16 | namespace react {
|
17 |
|
18 | #ifndef NDEBUG
|
19 | #define RN_DEBUG_STRING_CONVERTIBLE 1
|
20 | #endif
|
21 |
|
22 | #if RN_DEBUG_STRING_CONVERTIBLE
|
23 |
|
24 | class DebugStringConvertible;
|
25 |
|
26 | using SharedDebugStringConvertible =
|
27 | std::shared_ptr<const DebugStringConvertible>;
|
28 | using SharedDebugStringConvertibleList =
|
29 | std::vector<SharedDebugStringConvertible>;
|
30 |
|
31 | struct DebugStringConvertibleOptions {
|
32 | bool format{true};
|
33 | int maximumDepth{INT_MAX};
|
34 | };
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | class DebugStringConvertible {
|
41 | public:
|
42 | virtual ~DebugStringConvertible() = default;
|
43 |
|
44 |
|
45 |
|
46 | virtual std::string getDebugName() const;
|
47 |
|
48 |
|
49 |
|
50 | virtual std::string getDebugValue() const;
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | virtual SharedDebugStringConvertibleList getDebugChildren() const;
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | virtual SharedDebugStringConvertibleList getDebugProps() const;
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | virtual std::string getDebugDescription(
|
66 | DebugStringConvertibleOptions options = {},
|
67 | int depth = 0) const;
|
68 |
|
69 |
|
70 |
|
71 | virtual std::string getDebugPropsDescription(
|
72 | DebugStringConvertibleOptions options = {},
|
73 | int depth = 0) const;
|
74 | virtual std::string getDebugChildrenDescription(
|
75 | DebugStringConvertibleOptions options = {},
|
76 | int depth = 0) const;
|
77 | };
|
78 |
|
79 | #else
|
80 |
|
81 | class DebugStringConvertible {};
|
82 |
|
83 | #endif
|
84 |
|
85 | }
|
86 | }
|