lib/cdb++/cdb++.h
changeset 2 b3afb9f1e801
parent 0 6f7a81934006
equal deleted inserted replaced
1:30113bfbe723 2:b3afb9f1e801
     1 // Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca>
     1 /* $Id: cdb++.h 633 2005-09-04 04:20:59Z bruce $ */
       
     2 // Copyright (C) 1999,2000,2005 Bruce Guenter <bruceg@em.ca>
     2 //
     3 //
     3 // This program is free software; you can redistribute it and/or modify
     4 // This program is free software; you can redistribute it and/or modify
     4 // it under the terms of the GNU General Public License as published by
     5 // it under the terms of the GNU General Public License as published by
     5 // the Free Software Foundation; either version 2 of the License, or
     6 // the Free Software Foundation; either version 2 of the License, or
     6 // (at your option) any later version.
     7 // (at your option) any later version.
    19 
    20 
    20 #include "mystring/mystring.h"
    21 #include "mystring/mystring.h"
    21 #include "cdb++/datum.h"
    22 #include "cdb++/datum.h"
    22 #include "fdbuf/fdbuf.h"
    23 #include "fdbuf/fdbuf.h"
    23 
    24 
    24 typedef unsigned long uint32;
    25 typedef unsigned uint32;
    25 
    26 
    26 #define CDBMAKE_HPLIST 1000
    27 #define CDBMAKE_HPLIST 1000
    27 
    28 
    28 class cdb_reader
    29 class cdb_reader
    29 {
    30 {
    30 private:
    31 private:
    31   fdibuf in;
    32   unsigned char* map;
    32   uint32 eod;
    33   size_t size;
    33   uint32 pos;
    34   unsigned char* ptr;
       
    35   unsigned char* eod;
    34   bool failed;
    36   bool failed;
    35   bool eof;
    37   bool eof;
    36 
    38 
    37   unsigned char header[2048];
       
    38   
       
    39   void abort();
    39   void abort();
    40   int seek(const mystring& key, uint32& len);
    40   char* seek(const mystring& key, uint32& len);
    41 public:
    41 public:
    42   cdb_reader(const mystring& filename);
    42   cdb_reader(const mystring& filename);
    43   ~cdb_reader();
    43   ~cdb_reader();
    44 
    44 
    45   bool firstrec();
    45   bool firstrec();