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: FirstOf.C /main/3 1996/08/21 15:46:47 drk $ */
24 /* exported interfaces */
27 /* imported interfaces */
31 #include "Expression.h"
34 #include "ConcatTask.h"
36 #include "AttributeData.h"
37 #include "GenericId.h"
41 //---------------------------------------------------------------------
42 FirstOf::FirstOf( const Token &t,
44 ActionType mode ):BaseData(t,mode)
48 for ( OL_Expression *local_list = el->first();
50 local_list = el->next(local_list) ) {
52 switch ( local_list->type() ) {
55 addSubTask( new Content( t,mode) );
59 addSubTask( new Concat ( t,
60 (ExprList *) local_list->data_list(),
65 addSubTask( new FirstOf( t,
66 (ExprList *)local_list->data_list(),
71 addSubTask( new GenericId(t,
77 addSubTask( new Literal( t,
78 (const char *)local_list->data_list(),
83 addSubTask( new AttributeData( t,
95 //--------------------------------------------------------------------------
97 FirstOf::markup( const Token &t )
100 if ( ignore_status && !Dispatch::OutsideIgnoreScope() ) {
106 ComplexTask::markup( t );
108 if ( t.type() == END ) {
110 if ( t.level() == f_base ) {
114 for ( int i = 0; i < ComplexTask::used; i++ ) {
115 BaseData *task = ( BaseData *)ComplexTask::subtask(i);
116 if ( task->DataIsComplete() ) {
117 ValueBuffer.writeStr( task->content() );
123 ComplexTask::removeAllSubTasks();