The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rawstr.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * rawstr.h - class RawStr: a helper class for modules with string
4  * keys, uncompressed, with entry sizes specified by to 2 bytes
5  *
6  * $Id: rawstr.h 3786 2020-08-30 11:35:14Z scribe $
7  *
8  * Copyright 1997-2013 CrossWire Bible Society (http://www.crosswire.org)
9  * CrossWire Bible Society
10  * P. O. Box 2528
11  * Tempe, AZ 85280-2528
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU General Public License as published by the
15  * Free Software Foundation version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * General Public License for more details.
21  *
22  */
23 
24 #ifndef RAWSTR_H
25 #define RAWSTR_H
26 
27 #include <defs.h>
28 #include <sysdata.h>
29 
31 
32 class SWBuf;
33 class FileDesc;
34 
36 
37 private:
38  static int instance; // number of instantiated RawStr objects or derivitives
39  char *path;
41  mutable long lastoff; // for caching and optimizing
42 
43 
44 protected:
47  void doSetText(const char *key, const char *buf, long len = -1);
48  void doLinkEntry(const char *destkey, const char *srckey);
49  static const int IDXENTRYSIZE;
50 
51 public:
52  static const char nl;
53  RawStr(const char *ipath, int fileMode = -1, bool caseSensitive = false);
54  virtual ~RawStr();
55  void getIDXBuf(long ioffset, char **buf) const;
56  void getIDXBufDat(long ioffset, char **buf) const;
57  signed char findOffset(const char *key, SW_u32 *start, SW_u16 *size, long away = 0, SW_u32 *idxoff = 0) const;
58  void readText(SW_u32 start, SW_u16 *size, char **idxbuf, SWBuf &buf) const;
59  static signed char createModule(const char *path);
60 };
61 
63 #endif
#define SWORD_NAMESPACE_START
Definition: defs.h:39
long lastoff
Definition: rawstr.h:41
static int instance
Definition: rawstr.h:38
Definition: swbuf.h:47
#define SWDLLEXPORT
Definition: defs.h:171
char * path
Definition: rawstr.h:39
static const char nl
Definition: rawstr.h:52
FileDesc * idxfd
Definition: rawstr.h:45
unsigned short SW_u16
Definition: sysdata.h:38
Definition: rawstr.h:35
static const int IDXENTRYSIZE
Definition: rawstr.h:49
int size
Definition: regex.c:5043
FileDesc * datfd
Definition: rawstr.h:46
unsigned int SW_u32
Definition: sysdata.h:41
#define SWORD_NAMESPACE_END
Definition: defs.h:40
bool caseSensitive
Definition: rawstr.h:40