Jpp
Public Member Functions | Private Types | Private Attributes | List of all members
JLANG::JWhiteSpacesFacet Class Reference

Auxiliary class to specify white space character(s) in currect locale. More...

#include <JWhiteSpacesFacet.hh>

Inheritance diagram for JLANG::JWhiteSpacesFacet:
JLANG::JMask

Public Member Functions

 JWhiteSpacesFacet (const std::locale &loc, const std::string &ws)
 Constructor. More...
 

Private Types

typedef std::ctype< char > ctype
 

Private Attributes

ctype::mask mask_set [ctype::table_size]
 

Detailed Description

Auxiliary class to specify white space character(s) in currect locale.

Definition at line 35 of file JWhiteSpacesFacet.hh.

Member Typedef Documentation

◆ ctype

typedef std::ctype<char> JLANG::JMask::ctype
inherited

Definition at line 25 of file JWhiteSpacesFacet.hh.

Constructor & Destructor Documentation

◆ JWhiteSpacesFacet()

JLANG::JWhiteSpacesFacet::JWhiteSpacesFacet ( const std::locale &  loc,
const std::string &  ws 
)
inline

Constructor.

Parameters
loccurrent locale
wswhite space character(s)

Definition at line 46 of file JWhiteSpacesFacet.hh.

47  :
48  JMask(),
50  {
51  using namespace std;
52 
53  char buffer[table_size];
54 
55  for (unsigned int i = 0; i != table_size; ++i) {
56  buffer[i] = (char) i;
57  }
58 
59  use_facet<JMask::ctype>(loc).is(buffer, buffer + table_size, mask_set);
60 
61  for (unsigned int i = 0; i != table_size; ++i) {
62  if (mask_set[i] & JMask::ctype::space) {
63  mask_set[i] ^= JMask::ctype::space;
64  }
65  }
66 
67  for (string::const_iterator i = ws.begin(); i != ws.end(); ++i) {
68  mask_set[(int) *i] |= JMask::ctype::space;
69  }
70  }

Member Data Documentation

◆ mask_set

ctype::mask JLANG::JMask::mask_set[ctype::table_size]
protectedinherited

Definition at line 28 of file JWhiteSpacesFacet.hh.


The documentation for this class was generated from the following file:
JLANG::JMask::ctype
std::ctype< char > ctype
Definition: JWhiteSpacesFacet.hh:25
loc
char * loc(char *orig)
JLANG::JMask::mask_set
ctype::mask mask_set[ctype::table_size]
Definition: JWhiteSpacesFacet.hh:28
JLANG::JMask
Auxiliary class to ensure that the mask set is defined prior to the ctype<>() constructor call.
Definition: JWhiteSpacesFacet.hh:22
std
Definition: jaanetDictionary.h:36