debug.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // debug.h
  4. //
  5. // Created on: 22 Dec 2011
  6. // Author: tim
  7. #pragma once
  8. #if !defined GRAPHITE2_NTRACING
  9. #include <utility>
  10. #include "inc/json.h"
  11. #include "inc/Position.h"
  12. namespace graphite2
  13. {
  14. class CharInfo;
  15. class Segment;
  16. class Slot;
  17. typedef std::pair<const Segment * const, const Slot * const> dslot;
  18. struct objectid
  19. {
  20. char name[16];
  21. objectid(const dslot &) throw();
  22. objectid(const Segment * const p) throw();
  23. };
  24. json & operator << (json & j, const Position &) throw();
  25. json & operator << (json & j, const Rect &) throw();
  26. json & operator << (json & j, const CharInfo &) throw();
  27. json & operator << (json & j, const dslot &) throw();
  28. json & operator << (json & j, const objectid &) throw();
  29. json & operator << (json & j, const telemetry &) throw();
  30. inline
  31. json & operator << (json & j, const Position & p) throw()
  32. {
  33. return j << json::flat << json::array << p.x << p.y << json::close;
  34. }
  35. inline
  36. json & operator << (json & j, const Rect & p) throw()
  37. {
  38. return j << json::flat << json::array << p.bl.x << p.bl.y << p.tr.x << p.tr.y << json::close;
  39. }
  40. inline
  41. json & operator << (json & j, const objectid & sid) throw()
  42. {
  43. return j << sid.name;
  44. }
  45. } // namespace graphite2
  46. #endif //!defined GRAPHITE2_NTRACING