Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=c3df55fcf29e4f741abd15261e4c3b65dec3f59c

commit c3df55fcf29e4f741abd15261e4c3b65dec3f59c
Author: Michel Hermier <herm...@frugalware.org>
Date:   Mon Oct 27 10:44:19 2014 +0100

libpacman: Move package graph code to its own class.

diff --git a/lib/libpacman/CMakeLists.txt b/lib/libpacman/CMakeLists.txt
index c196048..7989e83 100644
--- a/lib/libpacman/CMakeLists.txt
+++ b/lib/libpacman/CMakeLists.txt
@@ -60,6 +60,7 @@ set(LIBPACMAN_SOURCES
group.cpp
handle.cpp
package.cpp
+       package_graph.cpp
packages_transaction.cpp
pacman.cpp
server.cpp
diff --git a/lib/libpacman/handle.h b/lib/libpacman/handle.h
index ed504fd..a205f8d 100644
--- a/lib/libpacman/handle.h
+++ b/lib/libpacman/handle.h
@@ -29,6 +29,7 @@

#include "io/ffilelock.h"
#include "package.h"
+#include "package_graph.h"
#include "trans.h"

#include "kernel/fobject.h"
diff --git a/lib/libpacman/package.cpp b/lib/libpacman/package.cpp
index 55daac4..ad87ad8 100644
--- a/lib/libpacman/package.cpp
+++ b/lib/libpacman/package.cpp
@@ -390,26 +390,4 @@ bool PackageMatcher::match(const package_ptr package, int 
mask) const
return _pacman_strmatcher_match(m_strmatcher, package, m_flags & mask);
}

-package_node::package_node(const str &name)
-       : m_name(name) // PKG_NAME_LEN
-{ }
-
-package_node::~package_node()
-{ }
-
-bool package_node::operator < (const package_node &o) const
-{
-       return m_name < o.m_name;
-}
-
-const str &package_node::name() const
-{
-       return m_name;
-}
-
-bool libpacman::operator < (const libpacman::package_node_ptr &pn1, const 
libpacman::package_node_ptr &pn2)
-{
-       return pn1->name() < pn2->name();
-}
-
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h
index b5dae10..915a27f 100644
--- a/lib/libpacman/package.h
+++ b/lib/libpacman/package.h
@@ -195,33 +195,6 @@ private:
int m_flags;
FStrMatcher m_strmatcher_internal;
};
-
-       class package_node
-               : public flib::refcounted
-       {
-       public:
-               package_node(const flib::str &name);
-               ~package_node();
-               bool operator < (const package_node &o) const;
-
-               const flib::str &name() const;
-
-       private:
-               flib::str m_name;
-               libpacman::package_set m_packages;
-       };
-
-       typedef flib::refcounted_ptr<libpacman::package_node> package_node_ptr;
-       bool operator < (const package_node_ptr &pn1, const package_node_ptr 
&pn2);
-
-       typedef flib::set<libpacman::package_node_ptr> package_node_set;
-
-       class package_graph
-               : package_node_set
-       {
-       public:
-               using package_node_set::package_node_set;
-       };
} // namespace libpacman

const libpacman::package_ptr _pacman_pkg_isin(const char *needle, const 
libpacman::package_list &haystack);
diff --git a/lib/libpacman/package_graph.cpp b/lib/libpacman/package_graph.cpp
new file mode 100644
index 0000000..3d95bd5
--- /dev/null
+++ b/lib/libpacman/package_graph.cpp
@@ -0,0 +1,71 @@
+/*
+ *  package.c
+ *
+ *  Copyright (c) 2014 by Michel Hermier <herm...@frugalware.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.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ */
+
+#include "config.h"
+
+/* pacman-g2 */
+#include "package.h"
+
+#include "db/localdb_files.h"
+#include "util.h"
+#include "error.h"
+#include "db.h"
+#include "deps.h"
+#include "handle.h"
+#include "pacman.h"
+#include "versioncmp.h"
+
+#include "io/archive.h"
+#include "util/log.h"
+#include "fstdlib.h"
+#include "fstring.h"
+
+#include <sys/utsname.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+
+using namespace flib;
+using namespace libpacman;
+
+package_node::package_node(const str &name)
+       : m_name(name) // PKG_NAME_LEN
+{ }
+
+package_node::~package_node()
+{ }
+
+bool package_node::operator < (const package_node &o) const
+{
+       return m_name < o.m_name;
+}
+
+const str &package_node::name() const
+{
+       return m_name;
+}
+
+bool libpacman::operator < (const libpacman::package_node_ptr &pn1, const 
libpacman::package_node_ptr &pn2)
+{
+       return pn1->name() < pn2->name();
+}
+
+/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/package_graph.h b/lib/libpacman/package_graph.h
new file mode 100644
index 0000000..e9f0443
--- /dev/null
+++ b/lib/libpacman/package_graph.h
@@ -0,0 +1,58 @@
+/*
+ *  package_graph.h
+ *
+ *  Copyright (c) 2014 by Michel Hermier <herm...@frugalware.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.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ */
+#ifndef _PACMAN_PACKAGE_GRAPH_H
+#define _PACMAN_PACKAGE_GRAPH_H
+
+#include "util/fset.h"
+
+namespace libpacman {
+
+       class package_node
+               : public flib::refcounted
+       {
+       public:
+               package_node(const flib::str &name);
+               ~package_node();
+               bool operator < (const package_node &o) const;
+
+               const flib::str &name() const;
+
+       private:
+               flib::str m_name;
+               libpacman::package_set m_packages;
+       };
+
+       typedef flib::refcounted_ptr<libpacman::package_node> package_node_ptr;
+       bool operator < (const package_node_ptr &pn1, const package_node_ptr 
&pn2);
+
+       typedef flib::set<libpacman::package_node_ptr> package_node_set;
+
+       class package_graph
+               : package_node_set
+       {
+       public:
+               using package_node_set::package_node_set;
+       };
+} // namespace libpacman
+
+#endif /* _PACMAN_PACKAGE_GRAPH_H */
+
+/* vim: set ts=2 sw=2 noet: */
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to