blob: ff779613cc4211bfbd3a52de1cfce987172a6fc9 (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>utf8cantillation.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>utf8cantillation.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> *</font>
00003 <font class="comment"> * UTF8Cantillation - SWFilter decendant to remove UTF-8 Hebrew cantillation</font>
00004 <font class="comment"> *</font>
00005 <font class="comment"> */</font>
00006
00007
00008 <font class="preprocessor">#include <stdlib.h></font>
00009 <font class="preprocessor">#include <stdio.h></font>
00010 <font class="preprocessor">#include <utf8cantillation.h></font>
00011
00012
00013 <font class="keyword">const</font> <font class="keywordtype">char</font> UTF8Cantillation::on[] = <font class="stringliteral">"On"</font>;
00014 <font class="keyword">const</font> <font class="keywordtype">char</font> UTF8Cantillation::off[] = <font class="stringliteral">"Off"</font>;
00015 <font class="keyword">const</font> <font class="keywordtype">char</font> UTF8Cantillation::optName[] = <font class="stringliteral">"Hebrew Cantillation"</font>;
00016 <font class="keyword">const</font> <font class="keywordtype">char</font> UTF8Cantillation::optTip[] = <font class="stringliteral">"Toggles Hebrew Cantillation Marks"</font>;
00017
00018 UTF8Cantillation::UTF8Cantillation() {
00019 option = <font class="keyword">false</font>;
00020 options.push_back(on);
00021 options.push_back(off);
00022 }
00023
00024 UTF8Cantillation::~UTF8Cantillation(){};
00025
00026 <font class="keywordtype">void</font> UTF8Cantillation::setOptionValue(<font class="keyword">const</font> <font class="keywordtype">char</font> *ival)
00027 {
00028 option = (!stricmp(ival, on));
00029 }
00030
00031 <font class="keyword">const</font> <font class="keywordtype">char</font> *UTF8Cantillation::getOptionValue()
00032 {
00033 <font class="keywordflow">return</font> (option) ? on:off;
00034 }
00035
00036 <font class="keywordtype">char</font> UTF8Cantillation::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module)
00037 {
00038 <font class="keywordflow">if</font> (!option) {
00039 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *to, *from;
00040 to = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>*)text;
00041 <font class="comment">//The UTF-8 range 0xD6 0x90 to 0xD6 0xAF and 0xD7 0x84 consist of Hebrew cantillation marks so block those out.</font>
00042 <font class="keywordflow">for</font> (from = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>*)text; *from; from++) {
00043 <font class="keywordflow">if</font> (*from != 0xD6) {
00044 <font class="keywordflow">if</font> (*from == 0xD7 && *(from + 1) == 0x84) {
00045 from++;
00046 }
00047 <font class="keywordflow">else</font> {
00048 *to++ = *from;
00049 }
00050 }
00051 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (*(from + 1) < 0x90 || *(from + 1) > 0xAF) {
00052 *to++ = *from;
00053 from++;
00054 *to++ = *from;
00055 }
00056 <font class="keywordflow">else</font> {
00057 from++;
00058 }
00059 }
00060 *to++ = 0;
00061 *to = 0;
00062 }
00063 <font class="keywordflow">return</font> 0;
00064 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|