1 /***************************************************************************
2  *
3  *  gbfosis.h -	Implementation of GBFOSIS
4  *
5  * $Id: gbfosis.h 2833 2013-06-29 06:40:28Z chrislit $
6  *
7  * Copyright 2002-2013 CrossWire Bible Society (http://www.crosswire.org)
8  *	CrossWire Bible Society
9  *	P. O. Box 2528
10  *	Tempe, AZ  85280-2528
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation version 2.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  */
22 
23 #ifndef GBFOSIS_H
24 #define GBFOSIS_H
25 
26 #include <swfilter.h>
27 #include <stack>
28 #include <swbuf.h>
29 
30 SWORD_NAMESPACE_START
31 
32 
33 class SWDLLEXPORT QuoteStack {
34 private:
35 	class QuoteInstance {
36 	public:
37 		char startChar;
38 		char level;
39 		SWBuf uniqueID;
40 		char continueCount;
41 		QuoteInstance(char startChar = '\"', char level = 1, SWBuf uniqueID = "", char continueCount = 0) {
42 			this->startChar     = startChar;
43 			this->level         = level;
44 			this->uniqueID      = uniqueID;
45 			this->continueCount = continueCount;
46 		}
47 		void pushStartStream(SWBuf &text);
48 	};
49 
50 	typedef std::stack<QuoteInstance> QuoteInstanceStack;
51 	QuoteInstanceStack quotes;
52 public:
53 	QuoteStack();
54 	virtual ~QuoteStack();
55 	void handleQuote(char *buf, char *quotePos, SWBuf &text);
56 	void clear();
empty()57 	bool empty() { return quotes.empty(); }
58 };
59 
60 /** this filter converts GBF text to OSIS text
61  */
62 class SWDLLEXPORT GBFOSIS : public SWFilter {
63 public:
64 	GBFOSIS();
65 	virtual ~GBFOSIS();
66 	char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
67 };
68 
69 SWORD_NAMESPACE_END
70 #endif /* THMLOSIS_H */
71