2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: uasdrv.cc /main/4 1996/06/11 16:45:11 cde-hal $
28 # include "Exceptions.hh"
33 printTitles (UAS_Pointer<UAS_Common> doc, int level) {
35 for (i = 0; i < level; i ++)
36 fprintf (stderr, " ");
37 fprintf (stderr, "%s\n", (char *) doc->title ());
38 UAS_Pointer<UAS_Common> curDoc;
39 if (doc->type() == UAS_BOOK) {
42 fprintf (stderr, "********** %s \n", (char *) curDoc->title ());
43 curDoc = curDoc->next();
46 UAS_List<UAS_Common> theList = doc->children ();
47 for (i = 0; i < theList.length(); i ++)
48 printTitles (theList[i], level + 1);
55 printLocs (UAS_Pointer<UAS_Common> doc, int level) {
56 for (int i = 0; i < level; i ++)
58 UAS_String theLoc = doc->locator();
61 UAS_String loc = doc->id();
62 (void) sprintf (buf, "mmdb:LOCATOR=%s", (char *) loc);
63 UAS_Pointer<UAS_Common> theDoc = UAS_Common::create(buf);
64 cerr << (char *) theLoc << ", " << (char *) theDoc->title() << endl;
66 cerr << (char *) theLoc << endl;
68 UAS_List<UAS_Common> kids = doc->children();
69 for (i = 0; i < kids.length(); i ++) {
70 printLocs (kids[i], level + 1);
74 int main (int, char *[]) {
76 UAS_Common::initialize ();
77 UAS_List<UAS_String> locList = UAS_Common::rootLocators ();
78 for (int i = 0; i < locList.length(); i ++) {
79 UAS_String &cur = locList[i];
80 UAS_Pointer<UAS_Common> curDoc = UAS_Common::create(cur);
81 UAS_Pointer<UAS_Collection> curCol = (UAS_Collection *)
82 ((UAS_Common *) curDoc);
83 printLocs (curCol->root(), 0);
84 curDoc = curCol->root();
86 UAS_Common::destroy (curDoc);
88 UAS_Common::finalize ();