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: LcfTask.C /main/3 1996/10/26 18:17:58 cde-hal $
25 * (c) Copyright 1996 Digital Equipment Corporation.
26 * (c) Copyright 1996 Hewlett-Packard Company.
27 * (c) Copyright 1996 International Business Machines Corp.
28 * (c) Copyright 1996 Sun Microsystems, Inc.
29 * (c) Copyright 1996 Novell, Inc.
30 * (c) Copyright 1996 FUJITSU LIMITED.
31 * (c) Copyright 1996 Hitachi.
34 /* exported interfaces */
37 /* imported interfaces */
44 #include "BookTasks.h"
45 #include "BookCaseDB.h"
47 //--------------------------------------------------------------------
48 LcfTask::LcfTask( NodeTask *f_parent, const Token &t )
50 assert( f_parent != NULL );
55 //--------------------------------------------------------------------
57 LcfTask::markup( const Token &t )
60 ComplexTask::markup(t);
62 if ( t.type() == START ) {
63 if ( t.LookupAttr( OLAF::OL_id ) ) {
64 OL_Data *LocData = new OL_Data ( t, OLAF::OL_id, REMOVE_SPACES );
67 * Add subtask only if I know Data will be available
70 if ( LocData->DataWillBeAvailable() ) {
71 addSubTask( LocData );
73 OL_Data *RefData = new OL_Data(t, OLAF::OL_XRefLabel, IGNORE_ON);
74 addSubTask( RefData );
76 else { delete LocData; }
79 else if ( t.type() == END ) {
80 /* only write out all the locator if I am at the end f_node */
81 if ( t.level() == f_base ) {
88 //--------------------------------------------------------------------
92 ComplexTask::removeAllSubTasks();
95 //--------------------------------------------------------------------
97 LcfTask::write_record()
99 const char *NodeLocator = f_node->locator();
101 for ( int i = 0; i < ComplexTask::used; i++ ) {
102 OL_Data *task = (OL_Data * )subtask(i);
103 if ( !task->ContentIsEmpty() ) {
104 DBTable *tbl = f_node->book()->bookcase()->table(BookCaseDB::Locator);
105 tbl->insert( STRING_CODE, task->content(),
106 STRING_CODE, NodeLocator,
107 STRING_CODE, task->filename(),
108 INTEGER_CODE, task->line_no(),
113 for ( int i = 0; i < ComplexTask::used; i+=2 ) {
114 OL_Data* task = (OL_Data * )subtask(i);
115 OL_Data* reftask = (OL_Data * )subtask(i+1);
117 if ( !task->ContentIsEmpty() ) {
118 DBTable *tbl = f_node->book()->bookcase()->table(BookCaseDB::Locator);
120 const char* reflabel = "";
121 if ( !reftask->ContentIsEmpty() ) {
122 const char* content = reftask->content();
123 if (strlen(content) < 256)
127 tbl->insert( STRING_CODE, task->content(),
128 STRING_CODE, NodeLocator,
129 STRING_CODE, reflabel,
130 STRING_CODE, task->filename(),
131 INTEGER_CODE, task->line_no(),