Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

treekeyidx.h

00001 /******************************************************************************
00002  *  versekey.h - code for class 'versekey'- a standard Biblical verse key
00003  *
00004  * $Id: treekeyidx_8h-source.html,v 1.1 2002/04/03 20:54:08 mgruner Exp $
00005  *
00006  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00007  *      CrossWire Bible Society
00008  *      P. O. Box 2528
00009  *      Tempe, AZ  85280-2528
00010  *
00011  * This program is free software; you can redistribute it and/or modify it
00012  * under the terms of the GNU General Public License as published by the
00013  * Free Software Foundation version 2.
00014  *
00015  * This program is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * General Public License for more details.
00019  *
00020  */
00021 
00022 
00023 #ifndef TREEKEYIDX_H
00024 #define TREEKEYIDX_H
00025 
00026 #include <treekey.h>
00027 #include <sysdata.h>
00028 #include <filemgr.h>
00029 
00030 
00035 class SWDLLEXPORT TreeKeyIdx : public TreeKey {
00036 
00037         class TreeNode {
00038         public:
00039                 TreeNode();
00040                 ~TreeNode();
00041                 void clear();
00042                 __u32 offset;
00043                 __s32 parent;
00044                 __s32 next;
00045                 __s32 firstChild;
00046                 char *name;
00047                 __u16 dsize;
00048                 char *userData;
00049         } currentNode;
00050 
00051         static SWClass classdef;
00052 
00053         char *path;
00054 
00055         FileDesc *idxfd;
00056         FileDesc *datfd;
00057 
00058         void getTreeNodeFromDatOffset(long ioffset, TreeNode *buf) const;
00059         char getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const;
00060         void saveTreeNode(TreeNode *node);
00061         void saveTreeNodeOffsets(TreeNode *node);
00062 
00063 public:
00064         TreeKeyIdx(const TreeKeyIdx &ikey);
00065         TreeKeyIdx (const char *idxPath, int fileMode = -1);
00066         ~TreeKeyIdx ();
00067 
00068 
00069         virtual const char *getLocalName();
00070         virtual const char *setLocalName(const char *);
00071 
00072         virtual const char *getUserData(int *size = 0);
00073         virtual void setUserData(const char *userData, int size = 0);
00074 
00075         virtual const char *getFullName() const;
00076 
00077         virtual void root();
00078         virtual bool parent();
00079 
00080         virtual bool firstChild();
00081         virtual bool nextSibling();
00082         virtual bool previousSibling();
00083 
00084         virtual bool hasChildren();
00085 
00086         virtual void append();
00087         virtual void appendChild();
00088         virtual void insertBefore();
00089 
00090         virtual void remove();
00091         virtual void save();
00092 
00093         virtual void copyFrom(const TreeKeyIdx &ikey);
00094         virtual void copyFrom(const SWKey & ikey);
00095 
00096         virtual SWKey &operator = (const TreeKeyIdx &ikey) { copyFrom(ikey); return *this; }
00097         void setOffset(unsigned long offset);
00098         unsigned long getOffset() const;
00099 
00100         SWKEY_OPERATORS
00101 
00102         virtual void setText(const char *ikey);
00103         virtual void setPosition(SW_POSITION p);
00104         virtual const char *getText() const;
00105         virtual int _compare (const TreeKeyIdx & ikey);
00106         virtual int compare(const SWKey &ikey);
00107         virtual void decrement(int steps = 1);
00108         virtual void increment(int steps = 1);
00109         virtual char Traversable () { return 1; }
00110 
00111         static signed char create(const char *path);
00112 };
00113 
00114 
00115 #endif

Generated on Wed Apr 3 22:34:15 2002 for The Sword Project by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002