output_manager.hh

00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_HH
00021 #define PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_HH 1
00022 
00023 #include <paludis/output_manager-fwd.hh>
00024 #include <paludis/util/attributes.hh>
00025 #include <paludis/util/instantiation_policy.hh>
00026 #include <iosfwd>
00027 
00028 namespace paludis
00029 {
00030     class PALUDIS_VISIBLE OutputManager :
00031         private InstantiationPolicy<OutputManager, instantiation_method::NonCopyableTag>
00032     {
00033         public:
00034             virtual ~OutputManager() = 0;
00035 
00036             virtual std::ostream & stdout_stream() PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00037             virtual std::ostream & stderr_stream() PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00038 
00039             /**
00040              * An out of band message that might want to be logged or handled
00041              * in a special way.
00042              *
00043              * The caller must still also display the message to
00044              * stdout_stream() as appropriate.
00045              */
00046             virtual void message(const MessageType, const std::string &) = 0;
00047 
00048             /**
00049              * Called if an action succeeds. This can be used to, for example,
00050              * unlink the files behind a to-disk logged output manager.
00051              *
00052              * If an OutputManager is destroyed without having had this method
00053              * called, it should assume failure. This might mean keeping rather
00054              * than removing log files, for example.
00055              *
00056              * Further messages and output may occur even after a call to this
00057              * method.
00058              *
00059              * Calls to this method are done by the caller, not by whatever
00060              * carries out the action in question.
00061              */
00062             virtual void succeeded() = 0;
00063     };
00064 }
00065 
00066 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4