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 $
29 # include "Exceptions.hh"
34 printTitles (UAS_Pointer<UAS_Common> doc, int level) {
36 for (i = 0; i < level; i ++)
37 fprintf (stderr, " ");
38 fprintf (stderr, "%s\n", (char *) doc->title ());
39 UAS_Pointer<UAS_Common> curDoc;
40 if (doc->type() == UAS_BOOK) {
43 fprintf (stderr, "********** %s \n", (char *) curDoc->title ());
44 curDoc = curDoc->next();
47 UAS_List<UAS_Common> theList = doc->children ();
48 for (i = 0; i < theList.length(); i ++)
49 printTitles (theList[i], level + 1);
56 printLocs (UAS_Pointer<UAS_Common> doc, int level) {
57 for (int i = 0; i < level; i ++)
59 UAS_String theLoc = doc->locator();
62 UAS_String loc = doc->id();
63 (void) sprintf (buf, "mmdb:LOCATOR=%s", (char *) loc);
64 UAS_Pointer<UAS_Common> theDoc = UAS_Common::create(buf);
65 cerr << (char *) theLoc << ", " << (char *) theDoc->title() << endl;
67 cerr << (char *) theLoc << endl;
69 UAS_List<UAS_Common> kids = doc->children();
70 for (i = 0; i < kids.length(); i ++) {
71 printLocs (kids[i], level + 1);
75 int main (int, char *[]) {
77 UAS_Common::initialize ();
78 UAS_List<UAS_String> locList = UAS_Common::rootLocators ();
79 for (int i = 0; i < locList.length(); i ++) {
80 UAS_String &cur = locList[i];
81 UAS_Pointer<UAS_Common> curDoc = UAS_Common::create(cur);
82 UAS_Pointer<UAS_Collection> curCol = (UAS_Collection *)
83 ((UAS_Common *) curDoc);
84 printLocs (curCol->root(), 0);
85 curDoc = curCol->root();
87 UAS_Common::destroy (curDoc);
89 UAS_Common::finalize ();