author | simon <simon> | 2002-04-30 14:26:53 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:26:53 (UTC) |
commit | 5dae945f8ec25a811efb10eb71d606ce8da4429f (patch) (side-by-side diff) | |
tree | c12689435fbfb2abd6aedfcbd88208c1cb69407f | |
parent | 3c1b87ffa621f872c72228733a078511e56d2daf (diff) | |
download | opie-5dae945f8ec25a811efb10eb71d606ce8da4429f.zip opie-5dae945f8ec25a811efb10eb71d606ce8da4429f.tar.gz opie-5dae945f8ec25a811efb10eb71d606ce8da4429f.tar.bz2 |
- put the xml tree classes into the Opie namespace
-rw-r--r-- | libopie/tododb.cpp | 2 | ||||
-rw-r--r-- | libopie/xmltree.cc | 1 | ||||
-rw-r--r-- | libopie/xmltree.h | 5 | ||||
-rw-r--r-- | libopie2/opiecore/xmltree.cc | 1 | ||||
-rw-r--r-- | libopie2/opiecore/xmltree.h | 5 |
5 files changed, 14 insertions, 0 deletions
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index 33fa177..fe8b8bf 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp @@ -1,32 +1,34 @@ #include <qdir.h> #include <opie/tododb.h> #include <opie/xmltree.h> #include <opie/todoresource.h> #include <qpe/palmtoprecord.h> #include <qpe/global.h> +using namespace Opie; + namespace { class FileToDoResource : public ToDoResource { public: FileToDoResource() {}; bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ // prepare the XML XMLElement *tasks = new XMLElement( ); tasks->setTagName("Tasks" ); for( QValueList<ToDoEvent>::ConstIterator it = m_todos.begin(); it != m_todos.end(); ++it ){ XMLElement::AttributeMap map; XMLElement *task = new XMLElement(); map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); map.insert( "Priority", QString::number( (*it).priority() ) ); QArray<int> arrat = (*it).categories(); QString attr; for(uint i=0; i < arrat.count(); i++ ){ attr.append(QString::number(arrat[i])+";" ); } if(!attr.isEmpty() ) // remove the last ; attr.remove(attr.length()-1, 1 ); map.insert( "Categories", attr ); //else diff --git a/libopie/xmltree.cc b/libopie/xmltree.cc index 408e3c6..27db5b3 100644 --- a/libopie/xmltree.cc +++ b/libopie/xmltree.cc @@ -3,48 +3,49 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpe/stringutil.h> #include <opie/xmltree.h> #include <qxml.h> #include <assert.h> +using namespace Opie; XMLElement::XMLElement() : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) { } XMLElement::~XMLElement() { XMLElement *n = m_first; while ( n ) { XMLElement *tmp = n; n = n->m_next; delete tmp; } } void XMLElement::appendChild( XMLElement *child ) { if ( child->m_parent ) child->m_parent->removeChild( child ); child->m_parent = this; diff --git a/libopie/xmltree.h b/libopie/xmltree.h index ed93c23..4a6b6d9 100644 --- a/libopie/xmltree.h +++ b/libopie/xmltree.h @@ -4,48 +4,51 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __bookmarks_h__ #define __bookmarks_h__ #include <qstring.h> #include <qmap.h> #include <qtextstream.h> +namespace Opie +{ + /** * A small xml lib written by Simon Hausmann. */ class XMLElement { public: typedef QMap<QString, QString> AttributeMap; /** * The constructor of XMLElement */ XMLElement(); ~XMLElement(); /** appendChild appends a child to the XMLElement behind the last element. * The ownership of the child get's transfered to the * this XMLElement. * If child is already the child of another parent * it's get removed from the other parent first. */ void appendChild( XMLElement *child ); /** inserts newChild after refChild. If newChild is the child * of another parent the child will get removed. @@ -88,25 +91,27 @@ public: void setAttribute( const QString &attr, const QString &value ); void save( QTextStream &stream, uint indent = 0 ); XMLElement *namedItem( const QString &name ); XMLElement *clone() const; static XMLElement *load( const QString &fileName ); private: QString m_tag; QString m_value; AttributeMap m_attributes; XMLElement *m_parent; XMLElement *m_next; XMLElement *m_prev; XMLElement *m_first; XMLElement *m_last; XMLElement( const XMLElement &rhs ); XMLElement &operator=( const XMLElement &rhs ); }; +} // namespace Opie + #endif diff --git a/libopie2/opiecore/xmltree.cc b/libopie2/opiecore/xmltree.cc index 408e3c6..27db5b3 100644 --- a/libopie2/opiecore/xmltree.cc +++ b/libopie2/opiecore/xmltree.cc @@ -3,48 +3,49 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpe/stringutil.h> #include <opie/xmltree.h> #include <qxml.h> #include <assert.h> +using namespace Opie; XMLElement::XMLElement() : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) { } XMLElement::~XMLElement() { XMLElement *n = m_first; while ( n ) { XMLElement *tmp = n; n = n->m_next; delete tmp; } } void XMLElement::appendChild( XMLElement *child ) { if ( child->m_parent ) child->m_parent->removeChild( child ); child->m_parent = this; diff --git a/libopie2/opiecore/xmltree.h b/libopie2/opiecore/xmltree.h index ed93c23..4a6b6d9 100644 --- a/libopie2/opiecore/xmltree.h +++ b/libopie2/opiecore/xmltree.h @@ -4,48 +4,51 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __bookmarks_h__ #define __bookmarks_h__ #include <qstring.h> #include <qmap.h> #include <qtextstream.h> +namespace Opie +{ + /** * A small xml lib written by Simon Hausmann. */ class XMLElement { public: typedef QMap<QString, QString> AttributeMap; /** * The constructor of XMLElement */ XMLElement(); ~XMLElement(); /** appendChild appends a child to the XMLElement behind the last element. * The ownership of the child get's transfered to the * this XMLElement. * If child is already the child of another parent * it's get removed from the other parent first. */ void appendChild( XMLElement *child ); /** inserts newChild after refChild. If newChild is the child * of another parent the child will get removed. @@ -88,25 +91,27 @@ public: void setAttribute( const QString &attr, const QString &value ); void save( QTextStream &stream, uint indent = 0 ); XMLElement *namedItem( const QString &name ); XMLElement *clone() const; static XMLElement *load( const QString &fileName ); private: QString m_tag; QString m_value; AttributeMap m_attributes; XMLElement *m_parent; XMLElement *m_next; XMLElement *m_prev; XMLElement *m_first; XMLElement *m_last; XMLElement( const XMLElement &rhs ); XMLElement &operator=( const XMLElement &rhs ); }; +} // namespace Opie + #endif |