mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 12:18:01 +01:00
Merge branch 'poco-1.10.1' into devel
This commit is contained in:
@@ -45,8 +45,8 @@ template <typename PlaceholderT, unsigned int SizeV = POCO_SMALL_OBJECT_SIZE>
|
||||
union Placeholder
|
||||
/// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small
|
||||
/// object optimization, when enabled).
|
||||
///
|
||||
/// If Holder<Type> fits into POCO_SMALL_OBJECT_SIZE bytes of storage,
|
||||
///
|
||||
/// If Holder<Type> fits into POCO_SMALL_OBJECT_SIZE bytes of storage,
|
||||
/// it will be placement-new-allocated into the local buffer
|
||||
/// (i.e. there will be no heap-allocation). The local buffer size is one byte
|
||||
/// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
private:
|
||||
#endif
|
||||
typedef typename std::aligned_storage<SizeV + 1>::type AlignerType;
|
||||
|
||||
|
||||
PlaceholderT* pHolder;
|
||||
mutable char holder[SizeV + 1];
|
||||
AlignerType aligner;
|
||||
@@ -110,8 +110,8 @@ template <typename PlaceholderT>
|
||||
union Placeholder
|
||||
/// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small
|
||||
/// object optimization, when enabled).
|
||||
///
|
||||
/// If Holder<Type> fits into POCO_SMALL_OBJECT_SIZE bytes of storage,
|
||||
///
|
||||
/// If Holder<Type> fits into POCO_SMALL_OBJECT_SIZE bytes of storage,
|
||||
/// it will be placement-new-allocated into the local buffer
|
||||
/// (i.e. there will be no heap-allocation). The local buffer size is one byte
|
||||
/// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
#if !defined(POCO_MSVC_VERSION) || (defined(POCO_MSVC_VERSION) && (POCO_MSVC_VERSION > 80))
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
||||
PlaceholderT* pHolder;
|
||||
|
||||
friend class Any;
|
||||
@@ -167,8 +167,8 @@ public:
|
||||
Any(const ValueType & value)
|
||||
/// Creates an any which stores the init parameter inside.
|
||||
///
|
||||
/// Example:
|
||||
/// Any a(13);
|
||||
/// Example:
|
||||
/// Any a(13);
|
||||
/// Any a(string("12345"));
|
||||
{
|
||||
construct(value);
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
|
||||
Any& swap(Any& other)
|
||||
/// Swaps the content of the two Anys.
|
||||
///
|
||||
///
|
||||
/// When small object optimization is enabled, swap only
|
||||
/// has no-throw guarantee when both (*this and other)
|
||||
/// objects are allocated on the heap.
|
||||
@@ -230,14 +230,14 @@ public:
|
||||
Any& operator = (const ValueType& rhs)
|
||||
/// Assignment operator for all types != Any.
|
||||
///
|
||||
/// Example:
|
||||
/// Any a = 13;
|
||||
/// Example:
|
||||
/// Any a = 13;
|
||||
/// Any a = string("12345");
|
||||
{
|
||||
construct(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Any& operator = (const Any& rhs)
|
||||
/// Assignment operator for Any.
|
||||
{
|
||||
@@ -248,14 +248,14 @@ public:
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool empty() const
|
||||
/// Returns true if the Any is empty.
|
||||
{
|
||||
char buf[POCO_SMALL_OBJECT_SIZE] = { 0 };
|
||||
return 0 == std::memcmp(_valueHolder.holder, buf, POCO_SMALL_OBJECT_SIZE);
|
||||
}
|
||||
|
||||
|
||||
const std::type_info & type() const
|
||||
/// Returns the type information of the stored content.
|
||||
/// If the Any is empty typeid(void) is returned.
|
||||
@@ -335,7 +335,7 @@ private:
|
||||
else
|
||||
_valueHolder.erase();
|
||||
}
|
||||
|
||||
|
||||
void destruct()
|
||||
{
|
||||
content()->~ValueHolder();
|
||||
@@ -357,8 +357,8 @@ private:
|
||||
_pHolder(new Holder<ValueType>(value))
|
||||
/// Creates an any which stores the init parameter inside.
|
||||
///
|
||||
/// Example:
|
||||
/// Any a(13);
|
||||
/// Example:
|
||||
/// Any a(13);
|
||||
/// Any a(string("12345"));
|
||||
{
|
||||
}
|
||||
@@ -385,8 +385,8 @@ private:
|
||||
Any& operator = (const ValueType& rhs)
|
||||
/// Assignment operator for all types != Any.
|
||||
///
|
||||
/// Example:
|
||||
/// Any a = 13;
|
||||
/// Example:
|
||||
/// Any a = 13;
|
||||
/// Any a = string("12345");
|
||||
{
|
||||
Any(rhs).swap(*this);
|
||||
@@ -428,7 +428,7 @@ private:
|
||||
template <typename ValueType>
|
||||
class Holder: public ValueHolder
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Holder(const ValueType& value):
|
||||
_held(value)
|
||||
{
|
||||
@@ -480,9 +480,9 @@ private:
|
||||
template <typename ValueType>
|
||||
ValueType* AnyCast(Any* operand)
|
||||
/// AnyCast operator used to extract the ValueType from an Any*. Will return a pointer
|
||||
/// to the stored value.
|
||||
/// to the stored value.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// Example Usage:
|
||||
/// MyType* pTmp = AnyCast<MyType*>(pAny).
|
||||
/// Will return NULL if the cast fails, i.e. types don't match.
|
||||
{
|
||||
@@ -495,7 +495,7 @@ ValueType* AnyCast(Any* operand)
|
||||
template <typename ValueType>
|
||||
const ValueType* AnyCast(const Any* operand)
|
||||
/// AnyCast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer
|
||||
/// to the stored value.
|
||||
/// to the stored value.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// const MyType* pTmp = AnyCast<MyType*>(pAny).
|
||||
@@ -509,7 +509,7 @@ template <typename ValueType>
|
||||
ValueType AnyCast(Any& operand)
|
||||
/// AnyCast operator used to extract a copy of the ValueType from an Any&.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// Example Usage:
|
||||
/// MyType tmp = AnyCast<MyType>(anAny).
|
||||
/// Will throw a BadCastException if the cast fails.
|
||||
/// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ...
|
||||
@@ -540,7 +540,7 @@ template <typename ValueType>
|
||||
ValueType AnyCast(const Any& operand)
|
||||
/// AnyCast operator used to extract a copy of the ValueType from an const Any&.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// Example Usage:
|
||||
/// MyType tmp = AnyCast<MyType>(anAny).
|
||||
/// Will throw a BadCastException if the cast fails.
|
||||
/// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ...
|
||||
@@ -555,20 +555,24 @@ ValueType AnyCast(const Any& operand)
|
||||
|
||||
template <typename ValueType>
|
||||
const ValueType& RefAnyCast(const Any & operand)
|
||||
/// AnyCast operator used to return a const reference to the internal data.
|
||||
/// AnyCast operator used to return a const reference to the internal data.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// Example Usage:
|
||||
/// const MyType& tmp = RefAnyCast<MyType>(anAny);
|
||||
{
|
||||
ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand));
|
||||
std::string s = "RefAnyCast: Failed to convert between Any types ";
|
||||
if (operand._pHolder)
|
||||
if (!result)
|
||||
{
|
||||
s.append(1, '(');
|
||||
s.append(operand._pHolder->type().name());
|
||||
s.append(" => ");
|
||||
s.append(typeid(ValueType).name());
|
||||
s.append(1, ')');
|
||||
std::string s = "RefAnyCast: Failed to convert between Any types ";
|
||||
if (operand._pHolder)
|
||||
{
|
||||
s.append(1, '(');
|
||||
s.append(operand._pHolder->type().name());
|
||||
s.append(" => ");
|
||||
s.append(typeid(ValueType).name());
|
||||
s.append(1, ')');
|
||||
}
|
||||
throw BadCastException(s);
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
@@ -578,7 +582,7 @@ template <typename ValueType>
|
||||
ValueType& RefAnyCast(Any& operand)
|
||||
/// AnyCast operator used to return a reference to the internal data.
|
||||
///
|
||||
/// Example Usage:
|
||||
/// Example Usage:
|
||||
/// MyType& tmp = RefAnyCast<MyType>(anAny);
|
||||
{
|
||||
ValueType* result = AnyCast<ValueType>(&operand);
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// DirectoryIterator_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Filesystem
|
||||
// Module: DirectoryIterator
|
||||
//
|
||||
// Definition of the DirectoryIteratorImpl class for WIN32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_DirectoryIterator_WIN32_INCLUDED
|
||||
#define Foundation_DirectoryIterator_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API DirectoryIteratorImpl
|
||||
{
|
||||
public:
|
||||
DirectoryIteratorImpl(const std::string& path);
|
||||
~DirectoryIteratorImpl();
|
||||
|
||||
void duplicate();
|
||||
void release();
|
||||
|
||||
const std::string& get() const;
|
||||
const std::string& next();
|
||||
|
||||
private:
|
||||
HANDLE _fh;
|
||||
WIN32_FIND_DATA _fd;
|
||||
std::string _current;
|
||||
int _rc;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
const std::string& DirectoryIteratorImpl::get() const
|
||||
{
|
||||
return _current;
|
||||
}
|
||||
|
||||
|
||||
inline void DirectoryIteratorImpl::duplicate()
|
||||
{
|
||||
++_rc;
|
||||
}
|
||||
|
||||
|
||||
inline void DirectoryIteratorImpl::release()
|
||||
{
|
||||
if (--_rc == 0)
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_DirectoryIterator_WIN32_INCLUDED
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// Environment_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Core
|
||||
// Module: Environment
|
||||
//
|
||||
// Definition of the EnvironmentImpl class for WIN32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_Environment_WIN32_INCLUDED
|
||||
#define Foundation_Environment_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API EnvironmentImpl
|
||||
{
|
||||
public:
|
||||
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||
|
||||
static std::string getImpl(const std::string& name);
|
||||
static bool hasImpl(const std::string& name);
|
||||
static void setImpl(const std::string& name, const std::string& value);
|
||||
static std::string osNameImpl();
|
||||
static std::string osDisplayNameImpl();
|
||||
static std::string osVersionImpl();
|
||||
static std::string osArchitectureImpl();
|
||||
static std::string nodeNameImpl();
|
||||
static void nodeIdImpl(NodeId& id);
|
||||
static unsigned processorCountImpl();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_Environment_WIN32_INCLUDED
|
||||
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// File_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Filesystem
|
||||
// Module: File
|
||||
//
|
||||
// Definition of the FileImpl class for WIN32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_File_WIN32_INCLUDED
|
||||
#define Foundation_File_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API FileImpl
|
||||
{
|
||||
protected:
|
||||
enum Options
|
||||
{
|
||||
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
|
||||
};
|
||||
|
||||
typedef UInt64 FileSizeImpl;
|
||||
|
||||
FileImpl();
|
||||
FileImpl(const std::string& path);
|
||||
virtual ~FileImpl();
|
||||
void swapImpl(FileImpl& file);
|
||||
void setPathImpl(const std::string& path);
|
||||
const std::string& getPathImpl() const;
|
||||
bool existsImpl() const;
|
||||
bool canReadImpl() const;
|
||||
bool canWriteImpl() const;
|
||||
bool canExecuteImpl() const;
|
||||
bool isFileImpl() const;
|
||||
bool isDirectoryImpl() const;
|
||||
bool isLinkImpl() const;
|
||||
bool isDeviceImpl() const;
|
||||
bool isHiddenImpl() const;
|
||||
Timestamp createdImpl() const;
|
||||
Timestamp getLastModifiedImpl() const;
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path, int options = 0) const;
|
||||
void renameToImpl(const std::string& path, int options = 0);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
FileSizeImpl totalSpaceImpl() const;
|
||||
FileSizeImpl usableSpaceImpl() const;
|
||||
FileSizeImpl freeSpaceImpl() const;
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
|
||||
friend class FileHandle;
|
||||
friend class DirectoryIteratorImpl;
|
||||
friend class WindowsDirectoryWatcherStrategy;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const std::string& FileImpl::getPathImpl() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_File_WIN32_INCLUDED
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// LogFile_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Logging
|
||||
// Module: LogFile
|
||||
//
|
||||
// Definition of the LogFileImpl class using the Windows file APIs.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_LogFile_WIN32_INCLUDED
|
||||
#define Foundation_LogFile_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API LogFileImpl
|
||||
/// The implementation of LogFile for Windows.
|
||||
/// The native filesystem APIs are used for
|
||||
/// total control over locking behavior.
|
||||
{
|
||||
public:
|
||||
LogFileImpl(const std::string& path);
|
||||
~LogFileImpl();
|
||||
void writeImpl(const std::string& text, bool flush);
|
||||
UInt64 sizeImpl() const;
|
||||
Timestamp creationDateImpl() const;
|
||||
const std::string& pathImpl() const;
|
||||
|
||||
private:
|
||||
void createFile();
|
||||
|
||||
std::string _path;
|
||||
HANDLE _hFile;
|
||||
Timestamp _creationDate;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_LogFile_WIN32_INCLUDED
|
||||
@@ -73,7 +73,7 @@ class Foundation_API Logger: public Channel
|
||||
/// are used. The macros also add the source file path and line
|
||||
/// number into the log message so that it is available to formatters.
|
||||
/// Variants of these macros that allow message formatting with Poco::format()
|
||||
/// are also available.
|
||||
/// are also available.
|
||||
///
|
||||
/// Examples:
|
||||
/// poco_warning(logger, "This is a warning");
|
||||
@@ -88,20 +88,20 @@ public:
|
||||
|
||||
void setChannel(Channel::Ptr pChannel);
|
||||
/// Attaches the given Channel to the Logger.
|
||||
|
||||
|
||||
Channel::Ptr getChannel() const;
|
||||
/// Returns the Channel attached to the logger.
|
||||
|
||||
|
||||
void setLevel(int level);
|
||||
/// Sets the Logger's log level.
|
||||
///
|
||||
/// See Message::Priority for valid log levels.
|
||||
/// Setting the log level to zero turns off
|
||||
/// logging for that Logger.
|
||||
|
||||
|
||||
int getLevel() const;
|
||||
/// Returns the Logger's log level.
|
||||
|
||||
|
||||
void setLevel(const std::string& level);
|
||||
/// Sets the Logger's log level using a symbolic value.
|
||||
///
|
||||
@@ -126,17 +126,17 @@ public:
|
||||
void log(const Message& msg);
|
||||
/// Logs the given message if its priority is
|
||||
/// greater than or equal to the Logger's log level.
|
||||
|
||||
|
||||
void log(const Exception& exc);
|
||||
/// Logs the given exception with priority PRIO_ERROR.
|
||||
/// Logs the given exception with priority PRIO_ERROR.
|
||||
|
||||
void log(const Exception& exc, const char* file, int line);
|
||||
/// Logs the given exception with priority PRIO_ERROR.
|
||||
/// Logs the given exception with priority PRIO_ERROR.
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
|
||||
/// internally for performance reasons.
|
||||
|
||||
void fatal(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_FATAL,
|
||||
/// creates a Message with priority PRIO_FATAL
|
||||
@@ -151,10 +151,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void fatal(const std::string &fmt, T arg1, Args&&... args)
|
||||
void fatal(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_FATAL);
|
||||
}
|
||||
@@ -173,10 +173,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void critical(const std::string &fmt, T arg1, Args&&... args)
|
||||
void critical(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_CRITICAL);
|
||||
}
|
||||
@@ -195,10 +195,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void error(const std::string &fmt, T arg1, Args&&... args)
|
||||
void error(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_ERROR);
|
||||
}
|
||||
@@ -217,10 +217,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void warning(const std::string &fmt, T arg1, Args&&... args)
|
||||
void warning(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_WARNING);
|
||||
}
|
||||
@@ -239,10 +239,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void notice(const std::string &fmt, T arg1, Args&&... args)
|
||||
void notice(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_NOTICE);
|
||||
}
|
||||
@@ -261,10 +261,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void information(const std::string &fmt, T arg1, Args&&... args)
|
||||
void information(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_INFORMATION);
|
||||
}
|
||||
@@ -283,10 +283,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void debug(const std::string &fmt, T arg1, Args&&... args)
|
||||
void debug(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_DEBUG);
|
||||
}
|
||||
@@ -305,10 +305,10 @@ public:
|
||||
///
|
||||
/// File must be a static string, such as the value of
|
||||
/// the __FILE__ macro. The string is not copied
|
||||
/// internally for performance reasons.
|
||||
/// internally for performance reasons.
|
||||
|
||||
template <typename T, typename... Args>
|
||||
void trace(const std::string &fmt, T arg1, Args&&... args)
|
||||
void trace(const std::string& fmt, T arg1, Args&&... args)
|
||||
{
|
||||
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_TRACE);
|
||||
}
|
||||
@@ -317,17 +317,17 @@ public:
|
||||
/// Logs the given message, followed by the data in buffer.
|
||||
///
|
||||
/// The data in buffer is written in canonical hex+ASCII form:
|
||||
/// Offset (4 bytes) in hexadecimal, followed by sixteen
|
||||
/// Offset (4 bytes) in hexadecimal, followed by sixteen
|
||||
/// space-separated, two column, hexadecimal bytes,
|
||||
/// followed by the same sixteen bytes as ASCII characters.
|
||||
/// For bytes outside the range 32 .. 127, a dot is printed.
|
||||
|
||||
bool is(int level) const;
|
||||
/// Returns true if at least the given log level is set.
|
||||
|
||||
|
||||
bool fatal() const;
|
||||
/// Returns true if the log level is at least PRIO_FATAL.
|
||||
|
||||
|
||||
bool critical() const;
|
||||
/// Returns true if the log level is at least PRIO_CRITICAL.
|
||||
|
||||
@@ -353,18 +353,18 @@ public:
|
||||
/// Replaces all occurrences of $0 in fmt with the string given in arg and
|
||||
/// returns the result. To include a dollar sign in the result string,
|
||||
/// specify two dollar signs ($$) in the format string.
|
||||
|
||||
|
||||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1);
|
||||
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
|
||||
/// returns the result. To include a dollar sign in the result string,
|
||||
/// specify two dollar signs ($$) in the format string.
|
||||
|
||||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2);
|
||||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2);
|
||||
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
|
||||
/// returns the result. To include a dollar sign in the result string,
|
||||
/// specify two dollar signs ($$) in the format string.
|
||||
|
||||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3);
|
||||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3);
|
||||
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
|
||||
/// returns the result. To include a dollar sign in the result string,
|
||||
/// specify two dollar signs ($$) in the format string.
|
||||
@@ -372,11 +372,11 @@ public:
|
||||
static void formatDump(std::string& message, const void* buffer, std::size_t length);
|
||||
/// Creates a hex-dump of the given buffer and appends it to the
|
||||
/// given message string.
|
||||
|
||||
|
||||
static void setLevel(const std::string& name, int level);
|
||||
/// Sets the given log level on all loggers that are
|
||||
/// descendants of the Logger with the given name.
|
||||
|
||||
|
||||
static void setChannel(const std::string& name, Channel::Ptr pChannel);
|
||||
/// Attaches the given Channel to all loggers that are
|
||||
/// descendants of the Logger with the given name.
|
||||
@@ -399,35 +399,35 @@ public:
|
||||
/// probably use get() instead.
|
||||
/// The only time this method should be used is during
|
||||
/// program initialization, when only one thread is running.
|
||||
|
||||
|
||||
static Logger& create(const std::string& name, Channel::Ptr pChannel, int level = Message::PRIO_INFORMATION);
|
||||
/// Creates and returns a reference to a Logger with the
|
||||
/// given name. The Logger's Channel and log level as set as
|
||||
/// specified.
|
||||
|
||||
|
||||
static Logger& root();
|
||||
/// Returns a reference to the root logger, which is the ultimate
|
||||
/// ancestor of all Loggers.
|
||||
|
||||
|
||||
static Ptr has(const std::string& name);
|
||||
/// Returns a pointer to the Logger with the given name if it
|
||||
/// exists, or a null pointer otherwise.
|
||||
|
||||
|
||||
static void destroy(const std::string& name);
|
||||
/// Destroys the logger with the specified name. Does nothing
|
||||
/// if the logger is not found.
|
||||
///
|
||||
/// After a logger has been destroyed, all references to it
|
||||
/// become invalid.
|
||||
|
||||
/// become invalid.
|
||||
|
||||
static void shutdown();
|
||||
/// Shuts down the logging framework and releases all
|
||||
/// Loggers.
|
||||
|
||||
|
||||
static void names(std::vector<std::string>& names);
|
||||
/// Fills the given vector with the names
|
||||
/// of all currently defined loggers.
|
||||
|
||||
|
||||
static int parseLevel(const std::string& level);
|
||||
/// Parses a symbolic log level from a string and
|
||||
/// returns the resulting numeric level.
|
||||
@@ -444,15 +444,15 @@ public:
|
||||
/// - trace
|
||||
///
|
||||
/// The level is not case sensitive.
|
||||
|
||||
static const std::string ROOT; /// The name of the root logger ("").
|
||||
|
||||
|
||||
static const std::string ROOT; /// The name of the root logger ("").
|
||||
|
||||
protected:
|
||||
typedef std::map<std::string, Ptr> LoggerMap;
|
||||
|
||||
Logger(const std::string& name, Channel::Ptr pChannel, int level);
|
||||
~Logger();
|
||||
|
||||
|
||||
void log(const std::string& text, Message::Priority prio);
|
||||
void log(const std::string& text, Message::Priority prio, const char* file, int line);
|
||||
|
||||
@@ -467,7 +467,7 @@ private:
|
||||
Logger();
|
||||
Logger(const Logger&);
|
||||
Logger& operator = (const Logger&);
|
||||
|
||||
|
||||
std::string _name;
|
||||
Channel::Ptr _pChannel;
|
||||
int _level;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// NamedEvent_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Processes
|
||||
// Module: NamedEvent
|
||||
//
|
||||
// Definition of the NamedEventImpl class for Windows.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_NamedEvent_WIN32_INCLUDED
|
||||
#define Foundation_NamedEvent_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API NamedEventImpl
|
||||
{
|
||||
protected:
|
||||
NamedEventImpl(const std::string& name);
|
||||
~NamedEventImpl();
|
||||
void setImpl();
|
||||
void waitImpl();
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
HANDLE _event;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_NamedEvent_WIN32_INCLUDED
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// NamedMutex_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Processes
|
||||
// Module: NamedMutex
|
||||
//
|
||||
// Definition of the NamedMutexImpl class for Windows.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_NamedMutex_WIN32_INCLUDED
|
||||
#define Foundation_NamedMutex_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API NamedMutexImpl
|
||||
{
|
||||
protected:
|
||||
NamedMutexImpl(const std::string& name);
|
||||
~NamedMutexImpl();
|
||||
void lockImpl();
|
||||
bool tryLockImpl();
|
||||
void unlockImpl();
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
HANDLE _mutex;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_NamedMutex_WIN32_INCLUDED
|
||||
@@ -1,49 +0,0 @@
|
||||
//
|
||||
// Path_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Filesystem
|
||||
// Module: Path
|
||||
//
|
||||
// Definition of the PathImpl class for WIN32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_Path_WIN32_INCLUDED
|
||||
#define Foundation_Path_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API PathImpl
|
||||
{
|
||||
public:
|
||||
static std::string currentImpl();
|
||||
static std::string homeImpl();
|
||||
static std::string configHomeImpl();
|
||||
static std::string dataHomeImpl();
|
||||
static std::string cacheHomeImpl();
|
||||
static std::string tempHomeImpl();
|
||||
static std::string tempImpl();
|
||||
static std::string configImpl();
|
||||
static std::string nullImpl();
|
||||
static std::string systemImpl();
|
||||
static std::string expandImpl(const std::string& path);
|
||||
static void listRootsImpl(std::vector<std::string>& roots);
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_Path_WIN32_INCLUDED
|
||||
@@ -1,84 +0,0 @@
|
||||
//
|
||||
// Process_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Processes
|
||||
// Module: Process
|
||||
//
|
||||
// Definition of the ProcessImpl class for WIN32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_Process_WIN32_INCLUDED
|
||||
#define Foundation_Process_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Pipe;
|
||||
|
||||
|
||||
class Foundation_API ProcessHandleImpl: public RefCountedObject
|
||||
{
|
||||
public:
|
||||
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
|
||||
~ProcessHandleImpl();
|
||||
|
||||
UInt32 id() const;
|
||||
HANDLE process() const;
|
||||
int wait() const;
|
||||
int tryWait() const;
|
||||
void closeHandle();
|
||||
|
||||
private:
|
||||
HANDLE _hProcess;
|
||||
UInt32 _pid;
|
||||
|
||||
ProcessHandleImpl(const ProcessHandleImpl&);
|
||||
ProcessHandleImpl& operator = (const ProcessHandleImpl&);
|
||||
};
|
||||
|
||||
|
||||
class Foundation_API ProcessImpl
|
||||
{
|
||||
public:
|
||||
typedef UInt32 PIDImpl;
|
||||
typedef std::vector<std::string> ArgsImpl;
|
||||
typedef std::map<std::string, std::string> EnvImpl;
|
||||
|
||||
static PIDImpl idImpl();
|
||||
static void timesImpl(long& userTime, long& kernelTime);
|
||||
static ProcessHandleImpl* launchImpl(
|
||||
const std::string& command,
|
||||
const ArgsImpl& args,
|
||||
const std::string& initialDirectory,
|
||||
Pipe* inPipe,
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static bool isRunningImpl(const ProcessHandleImpl& handle);
|
||||
static bool isRunningImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
static std::string terminationEventName(PIDImpl pid);
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_Process_WIN32_INCLUDED
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
static bool isRunningImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
static std::string terminationEventName(PIDImpl pid);
|
||||
static bool mustEscapeArg(const std::string& arg);
|
||||
static std::string escapeArg(const std::string& arg);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// SharedLibrary_WIN32.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: SharedLibrary
|
||||
// Module: SharedLibrary
|
||||
//
|
||||
// Definition of the SharedLibraryImpl class for Win32.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_SharedLibrary_WIN32_INCLUDED
|
||||
#define Foundation_SharedLibrary_WIN32_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Mutex.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API SharedLibraryImpl
|
||||
{
|
||||
protected:
|
||||
SharedLibraryImpl();
|
||||
~SharedLibraryImpl();
|
||||
void loadImpl(const std::string& path, int flags);
|
||||
void unloadImpl();
|
||||
bool isLoadedImpl() const;
|
||||
void* findSymbolImpl(const std::string& name);
|
||||
const std::string& getPathImpl() const;
|
||||
static std::string suffixImpl();
|
||||
static bool setSearchPathImpl(const std::string& path);
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
void* _handle;
|
||||
static FastMutex _mutex;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_SharedLibrary_WIN32_INCLUDED
|
||||
Reference in New Issue
Block a user