The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utf8hebrewpoints.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * utf8hebrewpoints.cpp - SWFilter descendant to remove UTF-8 Hebrew
4  * vowel points
5  *
6  * $Id: utf8hebrewpoints.cpp 2980 2013-09-14 21:51:47Z scribe $
7  *
8  * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
9  * CrossWire Bible Society
10  * P. O. Box 2528
11  * Tempe, AZ 85280-2528
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU General Public License as published by the
15  * Free Software Foundation version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * General Public License for more details.
21  *
22  */
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include <utf8hebrewpoints.h>
27 
28 
30 
31 namespace {
32 
33  static const char oName[] = "Hebrew Vowel Points";
34  static const char oTip[] = "Toggles Hebrew Vowel Points";
35 
36  static const StringList *oValues() {
37  static const SWBuf choices[3] = {"On", "Off", ""};
38  static const StringList oVals(&choices[0], &choices[2]);
39  return &oVals;
40  }
41 }
42 
43 
45 }
46 
47 
49 
50 
51 char UTF8HebrewPoints::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
52  if (!option) {
53  //The UTF-8 range 0xD6 0xB0 to 0xD6 0xBF excluding 0xD6 0xBE consist of Hebrew cantillation marks so block those out.
54  SWBuf orig = text;
55  const unsigned char* from = (unsigned char*)orig.c_str();
56  for (text = ""; *from; from++) {
57  if ((*from == 0xD6) && (*(from + 1) >= 0xB0 && *(from + 1) <= 0xBF) && (*(from + 1) != 0xBE)) {
58  from++;
59  }
60  else {
61  text += *from;
62  }
63  }
64  }
65  return 0;
66 }
67 
68 
#define SWORD_NAMESPACE_START
Definition: defs.h:39
Definition: swbuf.h:47
SWText * module
Definition: osis2mod.cpp:105
static const StringList * oValues()
const char * c_str() const
Definition: swbuf.h:158
std::list< SWBuf > StringList
Definition: swmodule.cpp:91
static const char oName[]
virtual ~UTF8HebrewPoints()
static const char * choices[4]
static const char oTip[]
#define SWORD_NAMESPACE_END
Definition: defs.h:40
Definition: swkey.h:77
virtual char processText(SWBuf &text, const SWKey *key=0, const SWModule *module=0)