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: BookCaseDB.C /main/4 1996/10/26 18:17:13 cde-hal $ */
25 #include "BookCaseDB.h"
29 /*--------------------------------------------------------------------
31 * The BookCase is represented as a database (a directory) containing
32 * several tables (files).
34 * As the tables are shared by many tasks within the bookcase task,
35 * they are accessed through the bookcase, and created here...
37 *--------------------------------------------------------------------*/
39 /* This will be placed in a global .h file eventually */
40 #define LINK_CODE 1333
43 BookCaseDB::BookCaseDB(const char *dir)
46 for(int i = 0; i < TableQty; i++){
52 //--------------------------------------------------------------------
61 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
63 //--------------------------------------------------------------------
65 BookCaseDB::table(int tid, int a)
67 static Schema schema[] = {
68 { BookMeta, "BookMeta", DOC_CODE, 6 },
69 { NodeMeta, "NodeMeta", NODE_CODE, 8 },
70 { NodeSGML, "NodeSGML", SGML_CONTENT_CODE, 3 },
71 { Link, "Link", LINK_CODE, 3 },
72 { Locator, "Locator", LOCATOR_CODE, 5 },
73 { TOCTree, "ContentsTree", TOC_CODE, 5 },
74 { TOCPath, "ContentsPath", DLP_CODE, 4 },
75 { Graphics, "Graphics", GRAPHIC_CODE, 7 },
76 { StyleSheet, "StyleSheet", NODE_CODE, 3 },
77 { XRef, "XRef", XREF_CODE, 4 },
80 assert(tid >= 0 && tid < TableQty);
81 assert(schema[tid].id == tid); /* just be sure the code doesn't get out
85 f_tables[tid] = DB::table(schema[tid].name,
94 BookCaseDB::~BookCaseDB()
96 for( int i = 0; i < TableQty; i++ ) {
98 delete f_tables[i]; f_tables[i] = 0;