faubackup2/src/common output_handling.cpp,1.5,1.6 output_handling.hpp,1.3,1.4
Martin Waitz <[email protected]> Wed, 15 Jun 2005 09:12:22 +0000
| Newsgroups | gmane.comp.sysutils.backup.faubackup.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/faubackup/faubackup2/src/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv813/src/common
Modified Files:
output_handling.cpp output_handling.hpp
Log Message:
allow to use boost::format instead of plain strings in output functions
Index: output_handling.hpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/common/output_handling.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** output_handling.hpp 14 Jun 2005 20:45:35 -0000 1.3
--- output_handling.hpp 15 Jun 2005 09:12:11 -0000 1.4
***************
*** 2,5 ****
--- 2,6 ----
#define __output_handling_include__
+ #include <boost/format.hpp>
#include <errno.h>
#include <stdint.h>
***************
*** 26,32 ****
--- 27,46 ----
public:
MessageHandling();
+ void critical(boost::format fmter, int errNo);
void critical(string message, int errNo);
+ void non_critical(boost::format fmter, int errNo);
void non_critical(string message, int errNo);
+ void warning(boost::format fmter, int errNo);
void warning(string message, int errNo);
+ inline void information(boost::format fmter, int level)
+ {
+ if(verbose >= level) {
+ if(verbose == NORMAL_OUTPUT)
+ std::cerr << fmter << std::endl;
+ else
+ std::cerr << instance_name << ": " << fmter
+ << std::endl;
+ }
+ }
inline void information(string message, int level)
{
Index: output_handling.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/common/output_handling.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** output_handling.cpp 15 Jun 2005 07:47:07 -0000 1.5
--- output_handling.cpp 15 Jun 2005 09:12:11 -0000 1.6
***************
*** 3,11 ****
#include "common/output_handling.hpp"
#include <iostream>
#include <string>
- #include <errno.h>
-
#include "common/system_calls.hpp"
#include "common/int_handler.hpp"
--- 3,11 ----
#include "common/output_handling.hpp"
+ #include <boost/format.hpp>
+ #include <errno.h>
#include <iostream>
#include <string>
#include "common/system_calls.hpp"
#include "common/int_handler.hpp"
***************
*** 34,37 ****
--- 34,48 ----
}
+ void MessageHandling::critical(boost::format fmter, int errNo)
+ {
+ cerr << instance_name << _(": FATAL: ") << fmter;
+ if (errNo != 0 )
+ cerr << " " << strerror(errNo) << endl;
+ else
+ cerr << endl;
+ error++;
+ fatal();
+ }
+
void MessageHandling::critical(string message, int errNo)
{
***************
*** 45,48 ****
--- 56,71 ----
}
+ void MessageHandling::non_critical(boost::format fmter, int errNo)
+ {
+
+ cerr << instance_name << _(": Error: ") << fmter;
+ if (errNo != 0 )
+ cerr << " " << strerror(errNo) << endl;
+ else
+ cerr << endl;
+ error++;
+ errno = 0;
+ }
+
void MessageHandling::non_critical(string message, int errNo)
{
***************
*** 56,59 ****
--- 79,93 ----
errno = 0;
}
+
+ void MessageHandling::warning(boost::format fmter, int errNo)
+ {
+ cerr << instance_name << _(": warning: ") << fmter;
+ if (errNo != 0 )
+ cerr << " " << strerror(errNo) << endl;
+ else
+ cerr << endl;
+ errno = 0;
+ }
+
void MessageHandling::warning(string message, int errNo)
{
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click