PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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