gbfosis.h

00001 /***************************************************************************
00002  *
00003  * $Id: gbfosis.h 1864 2005-11-20 06:06:40Z scribe $
00004  *
00005  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00006  *      CrossWire Bible Society
00007  *      P. O. Box 2528
00008  *      Tempe, AZ  85280-2528
00009  *
00010  * This program is free software; you can redistribute it and/or modify it
00011  * under the terms of the GNU General Public License as published by the
00012  * Free Software Foundation version 2.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  */
00020 
00021 #ifndef GBFOSIS_H
00022 #define GBFOSIS_H
00023 
00024 #include <swfilter.h>
00025 #include <stack>
00026 #include <swbuf.h>
00027 
00028 SWORD_NAMESPACE_START
00029 
00030 
00031 class SWDLLEXPORT QuoteStack {
00032 private:
00033         class QuoteInstance {
00034         public:
00035                 char startChar;
00036                 char level;
00037                 SWBuf uniqueID;
00038                 char continueCount;
00039                 QuoteInstance(char startChar = '\"', char level = 1, SWBuf uniqueID = "", char continueCount = 0) {
00040                         this->startChar     = startChar;
00041                         this->level         = level;
00042                         this->uniqueID      = uniqueID;
00043                         this->continueCount = continueCount;
00044                 }
00045                 void pushStartStream(SWBuf &text);
00046         };
00047 
00048         typedef std::stack<QuoteInstance> QuoteInstanceStack;
00049         QuoteInstanceStack quotes;
00050 public:
00051         QuoteStack();
00052         virtual ~QuoteStack();
00053         void handleQuote(char *buf, char *quotePos, SWBuf &text);
00054         void clear();
00055         bool empty() { return quotes.empty(); }
00056 };
00057 
00060 class SWDLLEXPORT GBFOSIS : public SWFilter {
00061 public:
00062         GBFOSIS();
00063         virtual ~GBFOSIS();
00064         char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
00065 };
00066 
00067 SWORD_NAMESPACE_END
00068 #endif /* THMLOSIS_H */