mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 02:22:57 +01:00
style and consistency fixes
This commit is contained in:
parent
5b74121119
commit
6741e90bba
@ -21,7 +21,6 @@
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#if defined(_DEBUG)
|
||||
# include <iostream>
|
||||
@ -41,7 +40,7 @@ class Foundation_API Bugcheck
|
||||
/// automatically provide useful context information.
|
||||
{
|
||||
public:
|
||||
static void assertion(const char* cond, const char* file, int line, const char* text = NULL);
|
||||
static void assertion(const char* cond, const char* file, int line, const char* text = 0);
|
||||
/// An assertion failed. Break into the debugger, if
|
||||
/// possible, then throw an AssertionViolationException.
|
||||
|
||||
@ -72,7 +71,7 @@ public:
|
||||
/// possible.
|
||||
|
||||
protected:
|
||||
static std::string what(const char* msg, const char* file, int line, const char* text = NULL);
|
||||
static std::string what(const char* msg, const char* file, int line, const char* text = 0);
|
||||
};
|
||||
|
||||
|
||||
@ -86,10 +85,10 @@ protected:
|
||||
#define poco_assert_dbg(cond) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
#define poco_assert_msg_dbg(cond, text) \
|
||||
#define poco_assert_msg_dbg(cond, text) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__, text); else (void) 0
|
||||
#else
|
||||
#define poco_assert_msg_dbg(cond, text)
|
||||
#define poco_assert_msg_dbg(cond, text)
|
||||
#define poco_assert_dbg(cond)
|
||||
#endif
|
||||
|
||||
@ -97,9 +96,11 @@ protected:
|
||||
#define poco_assert(cond) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
|
||||
#define poco_assert_msg(cond, text) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__, text); else (void) 0
|
||||
|
||||
|
||||
#define poco_check_ptr(ptr) \
|
||||
if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
typedef Int64 ClockVal; /// monotonic clock value in microsecond resolution
|
||||
typedef Int64 ClockDiff; /// difference between two clock values in microseconds
|
||||
|
||||
static const ClockVal CLOCKVAL_MIN; /// minimum clock value
|
||||
static const ClockVal CLOCKVAL_MAX; /// maximum clock value
|
||||
|
||||
Clock();
|
||||
/// Creates a Clock with the current system clock value.
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace Poco {
|
||||
|
||||
class Timespan;
|
||||
|
||||
|
||||
class Foundation_API Timestamp
|
||||
/// A Timestamp stores a monotonic* time value
|
||||
/// with (theoretical) microseconds resolution.
|
||||
@ -47,8 +48,8 @@ public:
|
||||
typedef Int64 UtcTimeVal; /// monotonic UTC time value in 100 nanosecond resolution
|
||||
typedef Int64 TimeDiff; /// difference between two timestamps in microseconds
|
||||
|
||||
static const TimeVal Min;
|
||||
static const TimeVal Max;
|
||||
static const TimeVal TIMEVAL_MIN; /// minimum timestamp value
|
||||
static const TimeVal TIMEVAL_MAX; /// maximum timestamp value
|
||||
|
||||
Timestamp();
|
||||
/// Creates a timestamp with the current time.
|
||||
|
@ -25,7 +25,15 @@ namespace Poco {
|
||||
|
||||
void Bugcheck::assertion(const char* cond, const char* file, int line, const char* text)
|
||||
{
|
||||
Debugger::enter(std::string("Assertion violation: ") + cond + (text != NULL ? (std::string(" (") + text + std::string(")")) : ""), file, line);
|
||||
std::string message("Assertion violation: ");
|
||||
message += cond;
|
||||
if (text)
|
||||
{
|
||||
message += " (";
|
||||
message += text;
|
||||
message += ")";
|
||||
}
|
||||
Debugger::enter(message, file, line);
|
||||
throw AssertionViolationException(what(cond, file, line, text));
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,16 @@
|
||||
#include "Poco/UnWindows.h"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
const Clock::ClockVal Clock::CLOCKVAL_MIN = std::numeric_limits<Clock::ClockVal>::min();
|
||||
const Clock::ClockVal Clock::CLOCKVAL_MAX = std::numeric_limits<Clock::ClockVal>::max();
|
||||
|
||||
|
||||
Clock::Clock()
|
||||
{
|
||||
update();
|
||||
|
@ -19,10 +19,10 @@
|
||||
#include "Poco/Exception.h"
|
||||
#include <algorithm>
|
||||
#ifdef min
|
||||
#undef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#undef max
|
||||
#endif
|
||||
#include <limits>
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
@ -148,6 +148,10 @@ void GetSystemTimeAsFileTimeWithMillisecondResolution(FILETIME* pFT)
|
||||
namespace Poco {
|
||||
|
||||
|
||||
const Timestamp::TimeVal Timestamp::TIMEVAL_MIN = std::numeric_limits<Timestamp::TimeVal>::min();
|
||||
const Timestamp::TimeVal Timestamp::TIMEVAL_MAX = std::numeric_limits<Timestamp::TimeVal>::max();
|
||||
|
||||
|
||||
Timestamp::Timestamp()
|
||||
{
|
||||
update();
|
||||
@ -267,8 +271,6 @@ Timestamp& Timestamp::operator -= (const Timespan& span)
|
||||
return *this -= span.totalMicroseconds();
|
||||
}
|
||||
|
||||
const Timestamp::TimeVal Timestamp::Min = std::numeric_limits<Timestamp::TimeVal>::min();
|
||||
const Timestamp::TimeVal Timestamp::Max = std::numeric_limits<Timestamp::TimeVal>::max();
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user