/contrib/groff/src/include/cmap.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 56 lines · 29 code · 8 blank · 19 comment · 0 complexity · 6ddad655b477759eaa1cc6a182cdaf1f MD5 · raw file

  1. // -*- C++ -*-
  2. /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
  3. Written by James Clark (jjc@jclark.com)
  4. This file is part of groff.
  5. groff is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 2, or (at your option) any later
  8. version.
  9. groff is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License along
  14. with groff; see the file COPYING. If not, write to the Free Software
  15. Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
  16. #ifndef UCHAR_MAX
  17. #define UCHAR_MAX 255
  18. #endif
  19. enum cmap_builtin { CMAP_BUILTIN };
  20. class cmap {
  21. public:
  22. cmap();
  23. cmap(cmap_builtin);
  24. int operator()(unsigned char) const;
  25. unsigned char &operator[](unsigned char);
  26. friend class cmap_init;
  27. private:
  28. unsigned char v[UCHAR_MAX+1];
  29. };
  30. inline int cmap::operator()(unsigned char c) const
  31. {
  32. return v[c];
  33. }
  34. inline unsigned char &cmap::operator[](unsigned char c)
  35. {
  36. return v[c];
  37. }
  38. extern cmap cmlower;
  39. extern cmap cmupper;
  40. static class cmap_init {
  41. static int initialised;
  42. public:
  43. cmap_init();
  44. } _cmap_init;