summaryrefslogtreecommitdiffstats
path: root/quanta/project/projectlist.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /quanta/project/projectlist.h
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/project/projectlist.h')
-rw-r--r--quanta/project/projectlist.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/quanta/project/projectlist.h b/quanta/project/projectlist.h
new file mode 100644
index 00000000..505fbfd0
--- /dev/null
+++ b/quanta/project/projectlist.h
@@ -0,0 +1,115 @@
+/***********************************************************************
+ projectlist.h - List of ProjectURL's
+ -------------------
+ begin : June 19 2004
+ copyright : (C) 2004 by Jens Herden <jens@kdewebdev.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PROJECTLIST_H
+#define PROJECTLIST_H
+
+#include "projecturl.h"
+#include "qextfileinfo.h"
+
+class QDomDocument;
+
+
+/**
+ @short Container for the project files.
+
+ For fast lookup this container is based on QDict.
+ The key is generated without a trailing '/' so it doesn't matter if you
+ search for a folder in this container with or without trailing '/'
+*/
+
+class ProjectList : public ProjectUrlList
+{
+public:
+ /** 1009 is a guess for maximum files in an average project, this number should be prime (@ref QDict)
+ */
+ ProjectList( int size = 1009 );
+ ~ProjectList() {};
+
+ typedef QDictIterator<ProjectURL> Iterator;
+
+ /** resets @ref m_baseURL */
+ void clear();
+
+ /**
+ reads entries from the dom tree
+ invalid entries gets removed!
+ @return true if an old structure was found
+ */
+ bool readFromXML(QDomDocument &dom, const KURL &baseURL,
+ const KURL &templateURL, const QRegExp &excludeRx);
+ /**
+ @return the relative URL
+ */
+ KURL toRelative(const KURL &url) const
+ {
+ return QExtFileInfo::toRelative(url, m_baseURL, false);
+ }
+
+ /**
+ removes an url from the list and deletes the corresponding node
+
+ @return true if url was in list
+ */
+ bool removeFromListAndXML(const KURL &url);
+
+ /** @return true if url is in container
+ */
+ bool contains(const KURL &url) const;
+
+ /** @return pointer to the entry or 0 if not found
+ */
+ ProjectURL * find(const KURL &url) const;
+
+ /**
+ Attention: never delete the object you have given here because the
+ container takes ownership and deletes it later!
+
+ @param the ProjectURL to add to the container
+ */
+ void insert(ProjectURL *url);
+
+ /** @return true if url is in container and a folder
+ */
+ bool isFolder(const KURL &url) const;
+
+private:
+ KURL m_baseURL;
+
+ /**
+ private because I want to control the key.
+ use insert(ProjectURL *url) instead.
+ */
+ void insert(const QString & key, const ProjectURL * item);
+
+ /**
+ private because I want to control the key.
+ use find(const KURL &url) instead.
+ */
+ ProjectURL *find ( const QString & key ) const;
+
+ /**
+ private because I want to control the key.
+ */
+ bool remove ( const QString & key );
+
+ /**
+ private because I want to control the key.
+ */
+ void replace(const QString & key, const ProjectURL * item);
+};
+
+#endif // PROJECTFILES_H