mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
merge XMLStreamParser from develop
This commit is contained in:
41
XML/src/ValueTraits.cpp
Normal file
41
XML/src/ValueTraits.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// ValueTraits.cpp
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: ValueTraits
|
||||
//
|
||||
// Definition of the ValueTraits templates.
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/).
|
||||
// Copyright (c) 2009-2013 Code Synthesis Tools CC.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/XML/XMLStreamParser.h"
|
||||
#include "Poco/XML/XMLStreamParserException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
bool DefaultValueTraits<bool>::parse(std::string s, const XMLStreamParser& p)
|
||||
{
|
||||
if (s == "true" || s == "1" || s == "True" || s == "TRUE")
|
||||
return true;
|
||||
else if (s == "false" || s == "0" || s == "False" || s == "FALSE")
|
||||
return false;
|
||||
else
|
||||
throw XMLStreamParserException(p, "invalid bool value '" + s + "'");
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
Reference in New Issue
Block a user