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
17namespace graphite2
18{
19
20class CharInfo;
21class Segment;
22class Slot;
23
24typedef std::pair<const Segment * const, const Slot * const> dslot;
25struct objectid
26{
27 char name[16];
28 objectid(const dslot &) throw();
29 objectid(const Segment * const p) throw();
30};
31
32
33json & operator << (json & j, const Position &) throw();
34json & operator << (json & j, const Rect &) throw();
35json & operator << (json & j, const CharInfo &) throw();
36json & operator << (json & j, const dslot &) throw();
37json & operator << (json & j, const objectid &) throw();
38json & operator << (json & j, const telemetry &) throw();
39
40
41
42inline
43json & operator << (json & j, const Position & p) throw()
44{
45 return j << json::flat << json::array << p.x << p.y << json::close;
46}
47
48
49inline
50json & 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
56inline
57json & 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