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.3 2002/06/20 20:23:10 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         void init();
00063 
00064 public:
00065         TreeKeyIdx(const TreeKeyIdx &ikey);
00066         TreeKeyIdx (const char *idxPath, int fileMode = -1);
00067         ~TreeKeyIdx ();
00068 
00069 
00070         virtual const char *getLocalName();
00071         virtual const char *setLocalName(const char *);
00072 
00073         virtual const char *getUserData(int *size = 0);
00074         virtual void setUserData(const char *userData, int size = 0);
00075 
00076         virtual const char *getFullName() const;
00077 
00078         virtual void root();
00079         virtual bool parent();
00080 
00081         virtual bool firstChild();
00082         virtual bool nextSibling();
00083         virtual bool previousSibling();
00084 
00085         virtual bool hasChildren();
00086 
00087         virtual void append();
00088         virtual void appendChild();
00089         virtual void insertBefore();
00090 
00091         virtual void remove();
00092         virtual void save();
00093 
00094         virtual void copyFrom(const TreeKeyIdx &ikey);
00095         virtual void copyFrom(const SWKey & ikey);
00096 
00097         virtual SWKey &operator = (const TreeKeyIdx &ikey) { copyFrom(ikey); return *this; }
00098         void setOffset(unsigned long offset);
00099         unsigned long getOffset() const;
00100 
00101         SWKEY_OPERATORS
00102 
00103         virtual void setText(const char *ikey);
00104         virtual void setPosition(SW_POSITION p);
00105         virtual const char *getText() const;
00106         virtual int _compare (const TreeKeyIdx & ikey);
00107         virtual int compare(const SWKey &ikey);
00108         virtual void decrement(int steps = 1);
00109         virtual void increment(int steps = 1);
00110         virtual char Traversable () { return 1; }
00111 
00112         static signed char create(const char *path);
00113 };
00114 
00115 
00116 #endif

Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by doxygen1.2.15