1 | // SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later |
2 | // Copyright 2011, SIL International, All rights reserved. |
3 | |
4 | // debug.h |
5 | // |
6 | // Created on: 22 Dec 2011 |
7 | // Author: tim |
8 | |
9 | #pragma once |
10 | |
11 | #if !defined GRAPHITE2_NTRACING |
12 | |
13 | #include <utility> |
14 | #include "inc/json.h" |
15 | #include "inc/Position.h" |
16 | |
17 | namespace graphite2 |
18 | { |
19 | |
20 | class CharInfo; |
21 | class Segment; |
22 | class Slot; |
23 | |
24 | typedef std::pair<const Segment * const, const Slot * const> dslot; |
25 | struct objectid |
26 | { |
27 | char name[16]; |
28 | objectid(const dslot &) throw(); |
29 | objectid(const Segment * const p) throw(); |
30 | }; |
31 | |
32 | |
33 | json & operator << (json & j, const Position &) throw(); |
34 | json & operator << (json & j, const Rect &) throw(); |
35 | json & operator << (json & j, const CharInfo &) throw(); |
36 | json & operator << (json & j, const dslot &) throw(); |
37 | json & operator << (json & j, const objectid &) throw(); |
38 | json & operator << (json & j, const telemetry &) throw(); |
39 | |
40 | |
41 | |
42 | inline |
43 | json & operator << (json & j, const Position & p) throw() |
44 | { |
45 | return j << json::flat << json::array << p.x << p.y << json::close; |
46 | } |
47 | |
48 | |
49 | inline |
50 | json & operator << (json & j, const Rect & p) throw() |
51 | { |
52 | return j << json::flat << json::array << p.bl.x << p.bl.y << p.tr.x << p.tr.y << json::close; |
53 | } |
54 | |
55 | |
56 | inline |
57 | json & operator << (json & j, const objectid & sid) throw() |
58 | { |
59 | return j << sid.name; |
60 | } |
61 | |
62 | |
63 | } // namespace graphite2 |
64 | |
65 | #endif //!defined GRAPHITE2_NTRACING |
66 | |
67 | |