blob: 35fedf77e33f1df93b3241e8e71ea2fbaf3c6894 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/******************************************************************************
*
* UTF8HebrewPoints - SWFilter decendant to remove UTF-8 Hebrew vowel points
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <utf8hebrewpoints.h>
SWORD_NAMESPACE_START
const char UTF8HebrewPoints::on[] = "On";
const char UTF8HebrewPoints::off[] = "Off";
const char UTF8HebrewPoints::optName[] = "Hebrew Vowel Points";
const char UTF8HebrewPoints::optTip[] = "Toggles Hebrew Vowel Points";
UTF8HebrewPoints::UTF8HebrewPoints() {
option = true;
options.push_back(on);
options.push_back(off);
}
UTF8HebrewPoints::~UTF8HebrewPoints(){};
void UTF8HebrewPoints::setOptionValue(const char *ival)
{
option = (!stricmp(ival, on));
}
const char *UTF8HebrewPoints::getOptionValue()
{
return (option) ? on:off;
}
char UTF8HebrewPoints::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
{
if (!option) {
unsigned char *to, *from;
to = (unsigned char*)text;
//The UTF-8 range 0xD6 0xB0 to 0xD6 0xBF excluding 0xD6 0x consist of Hebrew cantillation marks so block those out.
for (from = (unsigned char*)text; *from; from++) {
if ((*from == 0xD6) && (*(from + 1) >= 0xB0 && *(from + 1) <= 0xBF) && (*(from + 1) != 0xBE)) {
from++;
}
else {
*to++ = *from;
}
}
*to++ = 0;
*to = 0;
}
return 0;
}
SWORD_NAMESPACE_END
|