aboutsummaryrefslogtreecommitdiff
path: root/doc/api/cplusplus/examples/example_action.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 16:07:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 16:07:13 +0000
commit58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f (patch)
treebb8bf797880968675d55865997bc8ff72c66fcf3 /doc/api/cplusplus/examples/example_action.cc
parent768e6a2a4f80d4589e262f3241cdbc2273e029a5 (diff)
downloadpaludis-58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f.tar.gz
paludis-58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f.tar.xz
Update for output manager function
Diffstat (limited to 'doc/api/cplusplus/examples/example_action.cc')
-rw-r--r--doc/api/cplusplus/examples/example_action.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index d62f9df0e..45eacd85e 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -23,6 +23,19 @@ using namespace examples;
using std::cout;
using std::endl;
+namespace
+{
+ /* Some actions need an OutputManager, but to avoid chicken / egg problems
+ * they take a function that creates an OutputManager as a parameter. Here
+ * we just use a StandardOutputManager, which sticks everything to stdout /
+ * stderr. More complex clients may use Environment::create_output_manager
+ * to use the user's preferences for logging etc. */
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+}
+
int main(int argc, char * argv[])
{
int exit_status(0);
@@ -63,7 +76,7 @@ int main(int argc, char * argv[])
FetchAction fetch_action(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
- value_for<n::output_manager>(new StandardOutputManager()),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
try