diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
commit | 7a00574163029c0c2b649878c95d5acbd083564a (patch) | |
tree | c13cc5736025834df2874ed87ee8598070025ea6 /src/modules/filters/thmlvariants.cpp | |
parent | b745315323de9f27538edac9453205ca70e6186e (diff) |
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'src/modules/filters/thmlvariants.cpp')
-rw-r--r-- | src/modules/filters/thmlvariants.cpp | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/src/modules/filters/thmlvariants.cpp b/src/modules/filters/thmlvariants.cpp index 4f28dbe..1a57971 100644 --- a/src/modules/filters/thmlvariants.cpp +++ b/src/modules/filters/thmlvariants.cpp @@ -1,10 +1,11 @@ /****************************************************************************** * - * thmlvariants - SWFilter descendant to hide or show textual variants - * in a ThML module. + * thmlvariants.cpp - SWFilter descendant to hide or show textual variants + * in a ThML module * + * $Id: thmlvariants.cpp 2980 2013-09-14 21:51:47Z scribe $ * - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2002-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -24,50 +25,39 @@ #include <thmlvariants.h> #include <utilstr.h> -SWORD_NAMESPACE_START -const char ThMLVariants::primary[] = "Primary Reading"; -const char ThMLVariants::secondary[] = "Secondary Reading"; -const char ThMLVariants::all[] = "All Readings"; +SWORD_NAMESPACE_START -const char ThMLVariants::optName[] = "Textual Variants"; -const char ThMLVariants::optTip[] = "Switch between Textual Variants modes"; +namespace { + static const char oName[] = "Textual Variants"; + static const char oTip[] = "Switch between Textual Variants modes"; + static const char *choices[4] = { "Primary Reading", "Secondary Reading", "All Readings", "" }; -ThMLVariants::ThMLVariants() { - option = false; - options.push_back(primary); - options.push_back(secondary); - options.push_back(all); + static const StringList *oValues() { + static const StringList oVals(&choices[0], &choices[3]); + return &oVals; + } } -ThMLVariants::~ThMLVariants() { +ThMLVariants::ThMLVariants() : SWOptionFilter(oName, oTip, oValues()) { } -void ThMLVariants::setOptionValue(const char *ival) -{ - if (!stricmp(ival, primary)) option = 0; - else if (!stricmp(ival, secondary)) option = 1; - else option = 2; -} -const char *ThMLVariants::getOptionValue() -{ - if (option == 0) { - return primary; - } - else if (option == 1) { - return secondary; - } - else { - return all; - } +ThMLVariants::~ThMLVariants() { } + char ThMLVariants::processText(SWBuf &text, const SWKey *key, const SWModule *module) { - if ( option == 0 || option == 1) { //we want primary or variant only + + int option = 0; + if (optionValue == choices[0]) option = 0; + else if (optionValue == choices[1]) option = 1; + else option = 2; + + if (option == 0 || option == 1) { //we want primary or variant only bool intoken = false; bool hide = false; bool invar = false; @@ -127,7 +117,4 @@ char ThMLVariants::processText(SWBuf &text, const SWKey *key, const SWModule *mo - - - SWORD_NAMESPACE_END |