source: gsdl/trunk/common-src/src/lib/OIDtools.h@ 18050

Last change on this file since 18050 was 15418, checked in by mdewsnip, 16 years ago

(Untangling colservr/recpt) Split recpt/OIDtools into two: lib/OIDtools.cpp/h contains the purely string-based functions (may be used by the colservr), and recpt/recptprototools.cpp/h contains the functions requiring a call to the colservr (get_info() etc.).

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1/**********************************************************************
2 *
3 * OIDtools.h --
4 * Copyright (C) 1999-2008 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26#ifndef OIDTOOLS_H
27#define OIDTOOLS_H
28
29#include "text_t.h"
30
31
32void get_oid (const text_t &OID, text_t &to, size_t level);
33
34// returns (in top) the top level of OID (i.e. everything
35// up until the first dot)
36void get_top (const text_t &OID, text_t &top);
37
38// checks if OID is top level (i.e. contains no dots)
39bool is_top (const text_t &OID);
40
41// get_parents_array loads the parents array with all the parents of the
42// document or classification specified by OID (not including OID itself)
43void get_parents_array (const text_t &OID, text_tarray &parents);
44
45// get_parent returns the parent of the document or classification
46// specified by OID
47text_t get_parent (const text_t& OID);
48
49// takes an OID like ".2.3 and replaces the " with parent
50void translate_parent (text_t &OID, const text_t &parent);
51
52// shrink_parent does the opposite to translate_parent
53void shrink_parent (text_t &OID);
54
55// checks if OID uses ".fc", ".lc", ".pr", ".ns",
56// or ".ps" syntax (first child, last child, parent,
57// next sibling, previous sibling)
58bool needs_translating (const text_t &OID);
59
60// strips the ".fc", ".lc", ".pr", ".ns",
61// or ".ps" suffix from the end of OID
62void strip_suffix (text_t &OID);
63
64// is_child_of returns true if OID2 is a child of OID1
65bool is_child_of(const text_t &OID1, const text_t &OID2);
66
67
68#endif
Note: See TracBrowser for help on using the repository browser.