1 /******************************************************************************
2  *
3  *  rawverse.h -	code for class 'RawVerse'- a module that reads raw text
4  *			files:  ot and nt using indexs ??.bks ??.cps ??.vss
5  *			and provides lookup and parsing functions based on
6  *			class VerseKey
7  *
8  * $Id: rawverse.h 3134 2014-03-17 09:30:15Z chrislit $
9  *
10  * Copyright 1997-2013 CrossWire Bible Society (http://www.crosswire.org)
11  *	CrossWire Bible Society
12  *	P. O. Box 2528
13  *	Tempe, AZ  85280-2528
14  *
15  * This program is free software; you can redistribute it and/or modify it
16  * under the terms of the GNU General Public License as published by the
17  * Free Software Foundation version 2.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * General Public License for more details.
23  *
24  */
25 
26 #ifndef RAWVERSE_H
27 #define RAWVERSE_H
28 
29 
30 #include <defs.h>
31 
32 SWORD_NAMESPACE_START
33 
34 class FileDesc;
35 class SWBuf;
36 
37 class SWDLLEXPORT RawVerse {
38 
39 
40 	static int instance;		// number of instantiated RawVerse objects or derivitives
41 protected:
42 	FileDesc *idxfp[2];
43 	FileDesc *textfp[2];
44 
45 	char *path;
46 	void doSetText(char testmt, long idxoff, const char *buf, long len = -1);
47 	void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
48 
49 public:
50 	static const char nl;
51 	RawVerse(const char *ipath, int fileMode = -1);
52 	virtual ~RawVerse();
53 	void findOffset(char testmt, long idxoff, long *start,	unsigned short *end) const;
54 	void readText(char testmt, long start, unsigned short size, SWBuf &buf) const;
55 	static char createModule(const char *path, const char *v11n = "KJV");
56 };
57 
58 SWORD_NAMESPACE_END
59 #endif
60