Merge remote-tracking branch 'pocoproject/develop' into develop

This commit is contained in:
FrancisANDRE 2015-08-24 14:34:28 +02:00
commit d75119648b
10 changed files with 18942 additions and 8619 deletions

3
.gitignore vendored
View File

@ -114,6 +114,9 @@ cmake-build/
# Temporary files #
###################
*.bak
CodeGeneration
RemotingNG
XSD
# openssl binaries #
####################

View File

@ -136,7 +136,8 @@ void SessionImpl::open(const std::string& connect)
}
_dataTypes.fillTypeInfo(_db);
addProperty("dataTypeInfo",
addProperty("dataTypeInfo",
&SessionImpl::setDataTypeInfo,
&SessionImpl::dataTypeInfo);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -231,6 +231,12 @@ POCO_DECLARE_EXCEPTION(Foundation_API, PoolOverflowException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, NoPermissionException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, OutOfMemoryException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, DataException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, InterruptedException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, IndexOutOfBoundsException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, UnsupportedOperationException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, EmptyStackException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, StackOverflowException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, ArithmeticException, RuntimeException)
POCO_DECLARE_EXCEPTION(Foundation_API, DataFormatException, DataException)
POCO_DECLARE_EXCEPTION(Foundation_API, SyntaxException, DataException)

View File

@ -23,9 +23,9 @@
#include "Poco/Foundation.h"
#include "Poco/Formatter.h"
#include "Poco/Message.h"
#include <vector>
namespace Poco {
@ -105,6 +105,8 @@ public:
/// for details.
/// * times: Specifies whether times are adjusted for local time
/// or taken as they are in UTC. Supported values are "local" and "UTC".
/// * priorityNames: Provide a comma-separated list of custom priority names,
/// e.g. "Fatal, Critical, Error, Warning, Notice, Information, Debug, Trace"
///
/// If any other property name is given, a PropertyNotSupported
/// exception is thrown.
@ -116,9 +118,10 @@ public:
static const std::string PROP_PATTERN;
static const std::string PROP_TIMES;
static const std::string PROP_PRIORITY_NAMES;
protected:
static const std::string& getPriorityName(int);
const std::string& getPriorityName(int);
/// Returns a string for the given priority value.
private:
@ -139,9 +142,13 @@ private:
/// which contains the message key, any text that needs to be written first
/// a property in case of %[] and required length.
void parsePriorityNames();
std::vector<PatternAction> _patternActions;
bool _localTime;
std::string _pattern;
std::string _priorityNames;
std::string _priorities[9];
};

View File

@ -155,6 +155,13 @@ POCO_IMPLEMENT_EXCEPTION(NoPermissionException, RuntimeException, "No permission
POCO_IMPLEMENT_EXCEPTION(OutOfMemoryException, RuntimeException, "Out of memory")
POCO_IMPLEMENT_EXCEPTION(DataException, RuntimeException, "Data error")
POCO_IMPLEMENT_EXCEPTION(InterruptedException, RuntimeException, "Interrupted")
POCO_IMPLEMENT_EXCEPTION(IndexOutOfBoundsException, RuntimeException, "Index out of bounds")
POCO_IMPLEMENT_EXCEPTION(UnsupportedOperationException, RuntimeException, "Unsupported operation")
POCO_IMPLEMENT_EXCEPTION(EmptyStackException, RuntimeException, "Empty stack")
POCO_IMPLEMENT_EXCEPTION(StackOverflowException, RuntimeException, "Stack overflow")
POCO_IMPLEMENT_EXCEPTION(ArithmeticException, RuntimeException, "Arithmetic error")
POCO_IMPLEMENT_EXCEPTION(DataFormatException, DataException, "Bad data format")
POCO_IMPLEMENT_EXCEPTION(SyntaxException, DataException, "Syntax error")
POCO_IMPLEMENT_EXCEPTION(CircularReferenceException, DataException, "Circular reference")

View File

@ -24,6 +24,7 @@
#include "Poco/Timezone.h"
#include "Poco/Environment.h"
#include "Poco/NumberParser.h"
#include "Poco/StringTokenizer.h"
namespace Poco {
@ -31,11 +32,13 @@ namespace Poco {
const std::string PatternFormatter::PROP_PATTERN = "pattern";
const std::string PatternFormatter::PROP_TIMES = "times";
const std::string PatternFormatter::PROP_PRIORITY_NAMES = "priorityNames";
PatternFormatter::PatternFormatter():
_localTime(false)
{
parsePriorityNames();
}
@ -43,6 +46,7 @@ PatternFormatter::PatternFormatter(const std::string& format):
_localTime(false),
_pattern(format)
{
parsePriorityNames();
parsePattern();
}
@ -204,6 +208,11 @@ void PatternFormatter::setProperty(const std::string& name, const std::string& v
{
_localTime = (value == "local");
}
else if (name == PROP_PRIORITY_NAMES)
{
_priorityNames = value;
parsePriorityNames();
}
else
{
Formatter::setProperty(name, value);
@ -217,6 +226,8 @@ std::string PatternFormatter::getProperty(const std::string& name) const
return _pattern;
else if (name == PROP_TIMES)
return _localTime ? "local" : "UTC";
else if (name == PROP_PRIORITY_NAMES)
return _priorityNames;
else
return Formatter::getProperty(name);
}
@ -239,10 +250,31 @@ namespace
}
void PatternFormatter::parsePriorityNames()
{
for (int i = 0; i <= 8; i++)
{
_priorities[i] = priorities[i];
}
if (!_priorityNames.empty())
{
StringTokenizer st(_priorityNames, ",;", StringTokenizer::TOK_TRIM);
if (st.count() == 8)
{
for (int i = 1; i <= 8; i++)
{
_priorities[i] = st[i - 1];
}
}
else throw Poco::SyntaxException("priorityNames property must specify a comma-separated list of 8 property names");
}
}
const std::string& PatternFormatter::getPriorityName(int prio)
{
poco_assert (1 <= prio && prio <= 8);
return priorities[prio];
return _priorities[prio];
}

View File

@ -93,6 +93,21 @@ void PatternFormatterTest::testPatternFormatter()
fmt.setProperty("pattern", "start %v[8] end");
fmt.format(msg, result);
assert (result == "start stSource end");
result.clear();
fmt.setProperty("pattern", "%p");
fmt.setProperty("priorityNames", "FAT, CRI, ERR, WRN, NTC, INF, DBG, TRC");
fmt.format(msg, result);
assert (result == "ERR");
try
{
fmt.setProperty("priorityNames", "FAT, CRI,");
fail("invalid value, must throw");
}
catch (Poco::SyntaxException&)
{
}
}

View File

@ -79,7 +79,7 @@ if (UNIX AND NOT ANDROID )
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
set(SYSLIBS dl)
else (APPLE)
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOCO_HAVE_FD_EPOLL)
set(SYSLIBS pthread dl rt)
endif (APPLE)
endif(UNIX AND NOT ANDROID )