filters

command.h

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 #ifndef __LATEXPARSER_COMMAND_H__
00021 #define __LATEXPARSER_COMMAND_H__
00022 
00023 #include "param.h"
00024 //#include "option.h"
00025 #include "element.h"
00026 
00027 #include <qstring.h>
00028 #include <qmap.h>
00029 #include <qptrlist.h>
00030 
00031 class Command: public Element
00032 {
00033     public:
00034         Command();
00038         Command(const char* command);
00039 
00043         Command(const char* name, QPtrList<QPtrList<Element> >* groups);
00044 
00049         Command(const char* name, QPtrList<QPtrList<Param> >* options,
00050                 QPtrList<QPtrList<Element> >* groups);
00051 
00056         Command(const char* name, QPtrList<QPtrList<Param> >* params, QPtrList<Param>* options, QPtrList<QPtrList<Element> >* groups);
00057 
00058         ~Command();
00059 
00060         QString getName() const { return _name; }
00061 
00062         QPtrList<QPtrList<Param> > getParams() const { return _params; }
00063         
00064         QPtrList<Param> getOptions() const { return _options; }
00065         
00066         QPtrList<QPtrList<Element> > getChildren() const { return _elements; }
00067 
00068         void setName(const char* name) { _name = name; }
00069         void addParam(const char* param);
00070         //void addParam(QString key, QString value) { _params.append(new Param(key, value)); }
00071         //void addParams(QPtrList<Param> params) { _params = params; }
00072         void addGroups(QPtrList<QPtrList<Element> >* elts) { _elements = *elts; }
00073 
00074         void addOption(const char* option);
00075         void addOption(QString key, QString value) { _options.append(new Param(key, value)); }
00076     
00077         void addChild(QPtrList<Element>* elt) { _elements.append(elt); }
00078 
00079         /* useful method */
00080         void print(int tab = 0);
00081 
00082     private:
00083         QString _name;
00084         QPtrList<QPtrList<Param> > _params;
00085         QPtrList<Param> _options;
00086         QPtrList<QPtrList<Element> > _elements;
00087 
00088 };
00089 
00090 #endif /* __LATEXPARSER_COMMAND_H__ */
00091 
KDE Home | KDE Accessibility Home | Description of Access Keys