1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * OIDtools.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: OIDtools.h 406 1999-07-20 03:01:15Z sjboddie $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 |
|
---|
13 | #ifndef OIDTOOLS_H
|
---|
14 | #define OIDTOOLS_H
|
---|
15 |
|
---|
16 | #include "text_t.h"
|
---|
17 | #include "recptproto.h"
|
---|
18 |
|
---|
19 | // returns (in top) the top level of OID (i.e. everything
|
---|
20 | // up until the first dot)
|
---|
21 | void get_top (const text_t &OID, text_t &top);
|
---|
22 |
|
---|
23 | // checks if OID is top level (i.e. contains no dots)
|
---|
24 | bool is_top (const text_t &OID);
|
---|
25 |
|
---|
26 | // get_parents_array loads the parents array with all the parents of the
|
---|
27 | // document or classification specified by OID (not including OID itself)
|
---|
28 | void get_parents_array (const text_t &OID, text_tarray &parents);
|
---|
29 |
|
---|
30 | // get_info does a protocol call and returns (in response) the info
|
---|
31 | // associated with OID. The metadata array should be loaded with whatever
|
---|
32 | // metadata fields are to be requested
|
---|
33 | bool get_info (const text_t &OID, const text_t &collection,
|
---|
34 | const text_tarray &metadata, bool getParents,
|
---|
35 | recptproto *collectproto, FilterResponse_t &response,
|
---|
36 | ostream &logout);
|
---|
37 |
|
---|
38 | // has_children returns true if OID has children
|
---|
39 | bool has_children (const text_t &OID, const text_t &collection,
|
---|
40 | recptproto *collectproto, ostream &logout);
|
---|
41 |
|
---|
42 | // get_children does a protocol call and returns (in response) the OIDs and
|
---|
43 | // metadata of all the children of OID. The metadata array should be loaded
|
---|
44 | // with whatever metadata fields are to be requested.
|
---|
45 | bool get_children (const text_t &OID, const text_t &collection,
|
---|
46 | const text_tarray &metadata, bool getParents,
|
---|
47 | recptproto *collectproto, FilterResponse_t &response,
|
---|
48 | ostream &logout);
|
---|
49 |
|
---|
50 | // get_parent returns the parent of the document or classification
|
---|
51 | // specified by OID
|
---|
52 | text_t get_parent (text_t OID);
|
---|
53 |
|
---|
54 | // takes an OID like ".2.3 and replaces the " with parent
|
---|
55 | void translate_parent (text_t &OID, const text_t &parent);
|
---|
56 |
|
---|
57 | // shrink_parent does the opposite to translate_parent
|
---|
58 | void shrink_parent (text_t &OID);
|
---|
59 |
|
---|
60 | // checks if OID uses ".fc", ".lc", ".pr", ".ns",
|
---|
61 | // or ".ps" syntax (first child, last child, parent,
|
---|
62 | // next sibling, previous sibling)
|
---|
63 | bool needs_translating (const text_t &OID);
|
---|
64 |
|
---|
65 | // strips the ".fc", ".lc", ".pr", ".ns",
|
---|
66 | // or ".ps" suffix from the end of OID
|
---|
67 | void strip_suffix (text_t &OID);
|
---|
68 |
|
---|
69 | // get_contents returns OIDs and metadata of all contents
|
---|
70 | // below (and including) OID.
|
---|
71 | // at present the only metadata being returned for each is
|
---|
72 | // Title and haschildren
|
---|
73 | void get_contents (const text_t &topOID, const text_t &classifytype, int &totalcols,
|
---|
74 | const text_t &collection, recptproto *collectproto,
|
---|
75 | FilterResponse_t &response, ostream &logout);
|
---|
76 |
|
---|
77 | // is_child_of returns true if OID2 is a child of OID1
|
---|
78 | bool is_child_of(const text_t &OID1, const text_t &OID2);
|
---|
79 |
|
---|
80 |
|
---|
81 | #endif
|
---|