Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
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 char ws)
 Constructor.
 
 JWhiteSpacesFacet (const std::locale &loc, const std::string &ws)
 Constructor.
 

Private Types

typedef std::ctype< char > ctype
 

Private Member Functions

void configure (const std::locale &loc, const std::string &ws)
 Configure.
 

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

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

Definition at line 25 of file JWhiteSpacesFacet.hh.

Constructor & Destructor Documentation

◆ JWhiteSpacesFacet() [1/2]

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

Constructor.

Parameters
loccurrent locale
wswhite space character

Definition at line 46 of file JWhiteSpacesFacet.hh.

47 :
48 JMask(),
50 {
51 configure(loc, std::string(1, ws));
52 }
ctype::mask mask_set[ctype::table_size]
std::ctype< char > ctype
void configure(const std::locale &loc, const std::string &ws)
Configure.
char * loc(char *orig)

◆ JWhiteSpacesFacet() [2/2]

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

Constructor.

Parameters
loccurrent locale
wswhite space character(s)

Definition at line 61 of file JWhiteSpacesFacet.hh.

62 :
63 JMask(),
65 {
66 configure(loc, ws);
67 }

Member Function Documentation

◆ configure()

void JLANG::JWhiteSpacesFacet::configure ( const std::locale & loc,
const std::string & ws )
inlineprivate

Configure.

Parameters
loccurrent locale
wswhite space character(s)

Definition at line 76 of file JWhiteSpacesFacet.hh.

78 {
79 using namespace std;
80
81 char buffer[table_size];
82
83 for (unsigned int i = 0; i != table_size; ++i) {
84 buffer[i] = (char) i;
85 }
86
87 use_facet<JMask::ctype>(loc).is(buffer, buffer + table_size, mask_set);
88
89 for (unsigned int i = 0; i != table_size; ++i) {
90 if (mask_set[i] & JMask::ctype::space) {
91 mask_set[i] ^= JMask::ctype::space;
92 }
93 }
94
95 for (string::const_iterator i = ws.begin(); i != ws.end(); ++i) {
96 mask_set[(int) *i] |= JMask::ctype::space;
97 }
98 }

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: