Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

utf8hebrewpoints.cpp

00001 /******************************************************************************
00002  *
00003  * UTF8HebrewPoints - SWFilter decendant to remove UTF-8 Hebrew vowel points
00004  *
00005  */
00006 
00007 
00008 #include <stdlib.h>
00009 #include <stdio.h>
00010 #include <utf8hebrewpoints.h>
00011 
00012 
00013 const char UTF8HebrewPoints::on[] = "On";
00014 const char UTF8HebrewPoints::off[] = "Off";
00015 const char UTF8HebrewPoints::optName[] = "Hebrew Vowel Points";
00016 const char UTF8HebrewPoints::optTip[] = "Toggles Hebrew Vowel Points";
00017 
00018 UTF8HebrewPoints::UTF8HebrewPoints() {
00019         option = true;
00020         options.push_back(on);
00021         options.push_back(off);
00022 }
00023 
00024 UTF8HebrewPoints::~UTF8HebrewPoints(){};
00025 
00026 void UTF8HebrewPoints::setOptionValue(const char *ival)
00027 {
00028         option = (!stricmp(ival, on));
00029 }
00030 
00031 const char *UTF8HebrewPoints::getOptionValue()
00032 {
00033         return (option) ? on:off;
00034 }
00035 
00036 char UTF8HebrewPoints::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
00037 {
00038         if (!option) {
00039                 unsigned char *to, *from;
00040 
00041                 to = (unsigned char*)text;      
00042                 //The UTF-8 range 0xD6 0xB0 to 0xD6 0xBF excluding 0xD6 0x consist of Hebrew cantillation marks so block those out.
00043                 for (from = (unsigned char*)text; *from; from++) {
00044                         if ((*from == 0xD6) && (*(from + 1) >= 0xB0 && *(from + 1) <= 0xBF) && (*(from + 1) != 0xBE)) {
00045                                 from++;
00046                         }
00047                         else {
00048                                 *to++ = *from;
00049                         }
00050                 }
00051                 *to++ = 0;
00052                 *to = 0;
00053      }
00054         return 0;
00055 }

Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by doxygen1.2.15