umbrello API Documentation

petalnode.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2006                                                    *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 #ifndef PETALNODE__H
00013 #define PETALNODE__H
00014 
00015 #include <qstring.h>
00016 #include <qpair.h>
00017 #include <qvaluelist.h>
00018 #include <qstringlist.h>
00019 
00040 class PetalNode {
00041 public:
00048     struct StringOrNode {
00049         QString string;
00050         PetalNode *node;
00051         StringOrNode() { node = 0; }
00052         virtual ~StringOrNode() { }
00053         bool isEmpty() { return (string.isEmpty() && node == 0); }
00054     };
00055     typedef QPair<QString, StringOrNode> NameValue;
00056     typedef QValueList<NameValue> NameValueList;
00057 
00058     enum NodeType { nt_object, nt_list };
00059 
00060     PetalNode(NodeType nt);
00061     virtual ~PetalNode();
00062 
00063     // getters
00064     NodeType type() const;
00065     QStringList initialArgs() const;  // name and other initial args
00066     QString name() const;  // convenience function: equal to initialArgs().first()
00067     NameValueList attributes() const;
00068     // setters
00069     //void setType(NodeType nt);   see constructor
00070     void setInitialArgs(const QStringList& args);
00071     void setAttributes(NameValueList vl);
00072     // utilities
00078     StringOrNode findAttribute(const QString& name) const;
00079 private:
00080     NodeType m_type;
00081     QStringList m_initialArgs;
00082     NameValueList m_attributes;
00083 };
00084 
00085 #endif
00086 
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:59 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003