37 static const char *
classes[] = {
"TreeKeyIdx",
"TreeKey",
"SWKey",
"SWObject", 0};
68 SWLOGD(
"Couldn't open file: %s. errno: %d", buf.
c_str(), errno);
112 size = (int)strlen(userData) + 1;
140 while (iterator.
parent > -1) {
184 if (iterator.
offset != target) {
185 while ((iterator.
next != target) && (iterator.
next > -1))
187 if (iterator.
next > -1) {
207 while (lastSib.
next > -1) {
211 lastSib.
next = idxOffset;
264 if (iterator.
offset != target) {
265 while ((iterator.
next != target) && (iterator.
next > -1)) {
268 if (iterator.
next > -1) {
292 char *buf =
new char [ strlen (ipath) + 20 ];
297 if ((path[strlen(path)-1] ==
'/') || (path[strlen(path)-1] ==
'\\'))
298 path[strlen(path)-1] = 0;
300 sprintf(buf,
"%s.dat", path);
306 sprintf(buf,
"%s.idx", path);
470 bool newFiles =
true;
518 SWBuf leaf = strtok(buf,
"/");
522 bool ok, inChild =
false;
531 leaf = strtok(0,
"/");
617 static SWBuf fullPath;
620 while (parent.
parent > -1) {
626 return fullPath.
c_str();
#define SWORD_NAMESPACE_START
long seek(long offset, int whence)
FileDesc * open(const char *path, int mode, bool tryDowngrade)
virtual const char * getUserData(int *size=0) const
virtual const char * getLocalName()
virtual void copyFrom(const TreeKeyIdx &ikey)
virtual void decrement(int steps=1)
static SWLog * getSystemLog()
virtual void assureKeyPath(const char *keyPath=0)
virtual int compare(const SWKey &ikey)
virtual int _compare(const TreeKeyIdx &ikey)
virtual void setUserData(const char *userData, int size=0)
virtual void insertBefore()
virtual SWKey * clone() const
static signed char create(const char *path)
virtual bool previousSibling()
virtual bool nextSibling()
long write(const void *buf, long count)
void getTreeNodeFromDatOffset(long ioffset, TreeNode *buf) const
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
void close(FileDesc *file)
virtual const char * getText() const
const char * c_str() const
static int removeFile(const char *fName)
virtual int compare(const SWKey &ikey)
virtual void copyFrom(const SWKey &ikey)
void setOffset(unsigned long offset)
char getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const
#define SWDYNAMIC_CAST(className, object)
virtual bool hasChildren()
#define KEYERR_OUTOFBOUNDS
unsigned long size() const
virtual void increment(int steps=1)
class TreeKeyIdx::TreeNode currentNode
static unsigned int CREAT
virtual void setPosition(SW_POSITION p)
void saveTreeNode(TreeNode *node)
virtual const char * setLocalName(const char *)
TreeKeyIdx(const TreeKeyIdx &ikey)
static unsigned int IWRITE
static unsigned int WRONLY
long read(void *buf, long count)
static SWORD_NAMESPACE_START const char * classes[]
static unsigned int IREAD
#define SWORD_NAMESPACE_END
unsigned long getOffset() const
SWBuf & setFormatted(const char *format,...)
virtual SWKEY_OPERATORS void setText(const char *ikey)
void saveTreeNodeOffsets(TreeNode *node)
virtual bool firstChild()
virtual void appendChild()
static const SWClass classdef(classes)
static FileMgr * getSystemFileMgr()