filters

env.cc

00001 /* This file is part of the KDE project
00002  * Copyright (C) 2003 Robert JACOLIN <rjacolin@ifrance.com>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "env.h"
00021 #include <iostream.h>
00022 
00023 Env::Env()
00024 {
00025     setType(Element::LATEX_ENV);
00026 }
00027 
00028 Env::Env(const char* command)
00029 {
00030     setType(Element::LATEX_ENV);
00031     /* Parse the command name */
00032     QString pattern = QString(command);
00033     int pos = pattern.find("{");
00034     /* Remove \begin{ at the begining and the } at the end. */
00035     if(pos != -1)
00036         _name = pattern.mid(pos + 1, pattern.length() - pos - 2);
00037     _name = _name.stripWhiteSpace();
00038 }
00039 
00040 Env::Env(QString name) : _name(name)
00041 {
00042     setType(Element::LATEX_ENV);
00043     _name = _name.stripWhiteSpace();
00044 }
00045 
00046 Env::~Env()
00047 {
00048 }
00049 
00050 void Env::setChildren(QPtrList<Element>* children)
00051 {
00052     if(children != NULL)
00053         _children = *children;
00054 }
00055 
00056 void Env::print(int tab)
00057 {
00058     cout << "ENV " << getName().latin1() << "{" << endl;
00059     
00060     Element* elt;
00061     for ( elt = _children.first(); elt; elt = _children.next() )
00062     {
00063         elt->print(tab);
00064     }
00065     cout << "}" << endl;
00066 }
KDE Home | KDE Accessibility Home | Description of Access Keys