[188] | 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 346 1999-07-07 05:47:41Z sjboddie $
|
---|
| 9 | *
|
---|
| 10 | *********************************************************************/
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | #ifndef OIDTOOLS_H
|
---|
| 14 | #define OIDTOOLS_H
|
---|
| 15 |
|
---|
| 16 | #include "text_t.h"
|
---|
[248] | 17 | #include "recptproto.h"
|
---|
[188] | 18 |
|
---|
[211] | 19 | // returns (in top) the top level of OID (i.e. everything
|
---|
[189] | 20 | // up until the first dot)
|
---|
[211] | 21 | void get_top (const text_t &OID, text_t &top);
|
---|
[188] | 22 |
|
---|
[211] | 23 | // checks if OID is top level (i.e. contains no dots)
|
---|
| 24 | bool is_top (const text_t &OID);
|
---|
[188] | 25 |
|
---|
[211] | 26 | // get_parents_array loads the parents array with all the parents of the
|
---|
[274] | 27 | // document or classification specified by OID (not including OID itself)
|
---|
[211] | 28 | void get_parents_array (const text_t &OID, text_tarray &parents);
|
---|
| 29 |
|
---|
[248] | 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,
|
---|
[278] | 34 | const text_tarray &metadata, bool getParents,
|
---|
| 35 | recptproto *collectproto, FilterResponse_t &response,
|
---|
| 36 | ostream &logout);
|
---|
[211] | 37 |
|
---|
[257] | 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 |
|
---|
[248] | 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, recptproto *collectproto,
|
---|
| 47 | FilterResponse_t &response, ostream &logout);
|
---|
| 48 |
|
---|
[211] | 49 | // get_parent returns the parent of the document or classification
|
---|
| 50 | // specified by OID
|
---|
| 51 | text_t get_parent (text_t OID);
|
---|
| 52 |
|
---|
[248] | 53 | // takes an OID like ".2.3 and replaces the " with parent
|
---|
| 54 | void translate_parent (text_t &OID, const text_t &parent);
|
---|
[211] | 55 |
|
---|
[248] | 56 | // shrink_parent does the opposite to translate_parent
|
---|
| 57 | void shrink_parent (text_t &OID);
|
---|
| 58 |
|
---|
| 59 | // checks if OID uses ".fc", ".lc", ".pr", ".ns",
|
---|
| 60 | // or ".ps" syntax (first child, last child, parent,
|
---|
| 61 | // next sibling, previous sibling)
|
---|
| 62 | bool needs_translating (const text_t &OID);
|
---|
| 63 |
|
---|
[280] | 64 | // strips the ".fc", ".lc", ".pr", ".ns",
|
---|
| 65 | // or ".ps" suffix from the end of OID
|
---|
| 66 | void strip_suffix (text_t &OID);
|
---|
| 67 |
|
---|
[257] | 68 | // get_contents returns OIDs and metadata of all contents
|
---|
| 69 | // below (and including) OID.
|
---|
| 70 | // at present the only metadata being returned for each is
|
---|
| 71 | // Title and haschildren
|
---|
| 72 | void get_contents (const text_t &topOID, const text_t &classifytype, int &totalcols,
|
---|
| 73 | const text_t &collection, recptproto *collectproto,
|
---|
| 74 | FilterResponse_t &response, ostream &logout);
|
---|
| 75 |
|
---|
[346] | 76 | // is_child_of returns true if OID2 is a child of OID1
|
---|
| 77 | bool is_child_of(const text_t &OID1, const text_t &OID2);
|
---|
| 78 |
|
---|
| 79 |
|
---|
[188] | 80 | #endif
|
---|