aboutsummaryrefslogtreecommitdiff
path: root/paludis/action.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-05 15:38:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-05 15:43:08 +0000
commit522e51d46065cfe715694ba313a804bb7c83491a (patch)
treed05d6a84daf8faf4cdf7e2bcf78cdcf08a4c96ed /paludis/action.cc
parent0ed619a90ccade52eb2492f6a6ffb2008beda437 (diff)
downloadpaludis-522e51d46065cfe715694ba313a804bb7c83491a.tar.gz
paludis-522e51d46065cfe715694ba313a804bb7c83491a.tar.xz
Tweak actions, create output manager info
Avoid having multiple confusing and different ways of stringifying an action. Don't store actual actions or repositories in create output manager info classes. Allow serialisation of CreateOutputManagerInfo.
Diffstat (limited to 'paludis/action.cc')
-rw-r--r--paludis/action.cc129
1 files changed, 83 insertions, 46 deletions
diff --git a/paludis/action.cc b/paludis/action.cc
index c130391df..05f966e35 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -222,67 +222,104 @@ SupportsActionTestBase::~SupportsActionTestBase()
{
}
-namespace
+ActionFailedError::ActionFailedError(const std::string & msg) throw () :
+ Exception(msg)
{
- struct ActionStringifier
- {
- std::string visit(const InstallAction & a)
- {
- std::string s("install to ");
- if (a.options.destination())
- s.append(stringify(a.options.destination()->name()));
- else
- s.append("nowhere");
- return s;
- }
+}
- std::string visit(const UninstallAction &)
- {
- return "uninstall";
- }
+ActionAbortedError::ActionAbortedError(const std::string & msg) throw () :
+ Exception(msg)
+{
+}
- std::string visit(const PretendAction &)
- {
- return "pretend";
- }
+const std::string
+FetchAction::simple_name() const
+{
+ return FetchAction::class_simple_name();
+}
- std::string visit(const ConfigAction &)
- {
- return "config";
- }
+const std::string
+InstallAction::simple_name() const
+{
+ return InstallAction::class_simple_name();
+}
- std::string visit(const InfoAction &)
- {
- return "info";
- }
+const std::string
+UninstallAction::simple_name() const
+{
+ return UninstallAction::class_simple_name();
+}
- std::string visit(const FetchAction &)
- {
- return "fetch";
- }
+const std::string
+PretendAction::simple_name() const
+{
+ return PretendAction::class_simple_name();
+}
- std::string visit(const PretendFetchAction &)
- {
- return "pretend fetch";
- }
- };
+const std::string
+PretendFetchAction::simple_name() const
+{
+ return PretendFetchAction::class_simple_name();
}
-std::ostream &
-paludis::operator<< (std::ostream & s, const Action & a)
+const std::string
+ConfigAction::simple_name() const
{
- ActionStringifier t;
- return s << a.accept_returning<std::string>(t);
+ return ConfigAction::class_simple_name();
}
-ActionFailedError::ActionFailedError(const std::string & msg) throw () :
- Exception(msg)
+const std::string
+InfoAction::simple_name() const
{
+ return InfoAction::class_simple_name();
}
-ActionAbortedError::ActionAbortedError(const std::string & msg) throw () :
- Exception(msg)
+const std::string
+FetchAction::class_simple_name()
+{
+ return "fetch";
+}
+
+const std::string
+FetchAction::ignore_unfetched_flag_name()
+{
+ return "ignore_unfetched";
+}
+
+const std::string
+InstallAction::class_simple_name()
+{
+ return "install";
+}
+
+const std::string
+UninstallAction::class_simple_name()
+{
+ return "uninstall";
+}
+
+const std::string
+PretendAction::class_simple_name()
+{
+ return "pretend";
+}
+
+const std::string
+PretendFetchAction::class_simple_name()
+{
+ return "pretend-fetch";
+}
+
+const std::string
+InfoAction::class_simple_name()
+{
+ return "info";
+}
+
+const std::string
+ConfigAction::class_simple_name()
{
+ return "config";
}
template class PrivateImplementationPattern<FetchAction>;