LCOV - code coverage report
Current view: top level - include - cset.h (source / functions) Hit Total Coverage
Test: GNU roff Lines: 2 2 100.0 %
Date: 2026-01-16 17:51:41 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
       2             :      Written by James Clark (jjc@jclark.com)
       3             : 
       4             : This file is part of groff, the GNU roff typesetting system.
       5             : 
       6             : groff is free software; you can redistribute it and/or modify it under
       7             : the terms of the GNU General Public License as published by the Free
       8             : Software Foundation, either version 3 of the License, or
       9             : (at your option) any later version.
      10             : 
      11             : groff is distributed in the hope that it will be useful, but WITHOUT ANY
      12             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14             : for more details.
      15             : 
      16             : You should have received a copy of the GNU General Public License
      17             : along with this program.  If not, see <http://www.gnu.org/licenses/>. */
      18             : 
      19             : #ifdef HAVE_CC_LIMITS_H
      20             : #include <limits.h>
      21             : #else /* not HAVE_CC_LIMITS_H */
      22             : #ifndef UCHAR_MAX
      23             : #define UCHAR_MAX 255
      24             : #endif
      25             : #endif /* not HAVE_CC_LIMITS_H */
      26             : 
      27             : enum cset_builtin { CSET_BUILTIN };
      28             : 
      29             : class cset {
      30             : public:
      31             :   cset();
      32             :   cset(cset_builtin);
      33             :   cset(const char *);
      34             :   cset(const unsigned char *);
      35             :   int operator()(unsigned char) const;
      36             : 
      37             :   cset &operator|=(const cset &);
      38             :   cset &operator|=(unsigned char);
      39             : 
      40             :   friend class cset_init;
      41             : private:
      42             :   char v[UCHAR_MAX+1];
      43             :   void clear();
      44             : };
      45             : 
      46   143263009 : inline int cset::operator()(unsigned char c) const
      47             : {
      48   143263009 :   return v[c];
      49             : }
      50             : 
      51             : inline cset &cset::operator|=(unsigned char c)
      52             : {
      53             :   v[c] = 1;
      54             :   return *this;
      55             : }
      56             : 
      57             : extern cset csalpha;
      58             : extern cset csupper;
      59             : extern cset cslower;
      60             : extern cset csdigit;
      61             : extern cset csxdigit;
      62             : extern cset csspace;
      63             : extern cset cspunct;
      64             : extern cset csalnum;
      65             : extern cset csprint;
      66             : extern cset csgraph;
      67             : extern cset cscntrl;
      68             : 
      69             : static class cset_init {
      70             :   static int initialised;
      71             : public:
      72             :   cset_init();
      73             : } _cset_init;
      74             : 
      75             : // Local Variables:
      76             : // fill-column: 72
      77             : // mode: C++
      78             : // End:
      79             : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72:

Generated by: LCOV version 1.14