source: trunk/gsdl/src/colservr/gdbmclass.h@ 124

Last change on this file since 124 was 124, checked in by sjboddie, 25 years ago

removed unused collection parameter from several functions

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/**********************************************************************
2 *
3 * gdbmclass.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: gdbmclass.h 124 1999-01-21 21:20:15Z sjboddie $
9 *
10 *********************************************************************/
11
12
13#ifndef GDBMCLASS_H
14#define GDBMCLASS_H
15
16
17
18#ifdef __WIN32__
19#include "autoconf.h"
20#include "systems.h"
21#include "gdbmconst.h"
22#include "gdbm.h"
23
24#else
25#include <gdbm.h>
26#endif
27
28
29class gdbm_info {
30public:
31 int docnum; // 'd'
32 text_t title; // 't'
33 text_t parent; // 'p'
34 text_t classification; // 'x'
35 text_t contents; // 'c'
36 text_t jobnum; // 'j'
37 text_t OID; // 'o'
38 text_t author; // 'a'
39 text_t source; // 's'
40 text_t date; // 'i'
41
42 void clear ();
43};
44
45
46class gdbmclass {
47public:
48 gdbmclass() {gdbmfile = NULL; logout = &cerr;};
49 ~gdbmclass() {};
50
51 // returns 0 if failed, 1 if opened
52 int opendatabase (const text_t &filename);
53 void closedatabase ();
54
55 // returns 0 on success, -1 on failure
56 int getinfo (text_t key, gdbm_info &info);
57 void setlogout (ostream *thelogout) {logout = thelogout;}
58 int exists (text_t key);
59
60protected:
61 text_t openfile;
62 GDBM_FILE gdbmfile;
63 ostream *logout;
64
65 int getkeydata (text_t key, text_t &data);
66 int getinfoline (text_t::iterator &here, text_t::iterator end,
67 text_t &key, text_t &value);
68};
69
70
71// a few useful functions
72
73int is_top_level (const text_t &targetdoc);
74int is_book (const text_t &targetdoc);
75void get_book_top (const text_t &targetdoc, text_t &book_top);
76void get_book (const text_t &targetdoc, text_t &book);
77void get_parent_section (text_t &section);
78void get_parent_section (text_t &parentsection, text_t &childsection);
79int count_dots (text_t::const_iterator first, text_t::const_iterator last);
80int count_dots (const text_t &targetdoc);
81int is_section_top (const text_t &targetdoc);
82void remove_tags (text_t &text);
83
84void separate_parts (const text_t &targetdoc, gdbmclass &gdbm,
85 text_t &classification, text_t &booksection);
86void split_targetdoc (const text_t &targetdoc, text_t &classification,
87 text_t &booksection);
88void splitstring (const text_t &string, vector<text_t> &array);
89void get_parents (const text_t &targetdoc, vector<text_t> &parents);
90void get_siblings (const text_t &classification, const text_t &booksection,
91 gdbmclass &gdbm, vector<text_t> &siblings);
92int are_same_chapter(text_t section1, text_t section2);
93void get_first_section(const text_t &instring, text_t &returnstring);
94int is_number (text_t &text);
95text_t get_section_str(const text_t &str);
96void alphabetize_string_english (text_t &text);
97void alphabetize_string_name (text_t &text);
98char ** string_add (char **array, int *len, char *str);
99void string_sort (char **array, int len);
100void string_free(char **array, int len);
101text_t format_date (const text_t &date);
102void format_month (text_t &month);
103void format_day(text_t &day);
104
105
106#endif
Note: See TracBrowser for help on using the repository browser.