Formattingt fixes

This commit is contained in:
Marian Krivos 2015-08-22 22:09:19 +02:00
parent 81e495150c
commit ce003c5522
5 changed files with 143 additions and 34 deletions

View File

@ -1,15 +1,32 @@
// file : xml/content -*- C++ -*-
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
//
// Content.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: Content
//
// Definition of the Content enum.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef POCO_XML_CONTENT
#define POCO_XML_CONTENT
namespace Poco
{
namespace XML
{
/// XML content model. C++11 enum class emulated for C++98.
struct Content
{

View File

@ -1,4 +1,18 @@
// file : cutl/xml/QName.hxx
//
// QName.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: QName
//
// Definition of the QName class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
@ -28,31 +42,12 @@ public:
QName(const std::string& ns, const std::string& name);
QName(const std::string& ns, const std::string& name, const std::string& prefix);
const std::string& namespace_() const
{
return _ns;
}
const std::string& name() const
{
return _name;
}
const std::string& prefix() const
{
return _prefix;
}
std::string& namespace_()
{
return _ns;
}
std::string& name()
{
return _name;
}
std::string& prefix()
{
return _prefix;
}
const std::string& namespace_() const;
const std::string& name() const;
const std::string& prefix() const;
std::string& namespace_();
std::string& name();
std::string& prefix();
// Printable representation in the [<namespace>#]<name> form.
//
@ -82,7 +77,45 @@ private:
std::string _prefix;
};
inline const std::string& QName::namespace_() const
{
return _ns;
}
inline const std::string& QName::name() const
{
return _name;
}
inline const std::string& QName::prefix() const
{
return _prefix;
}
inline std::string& QName::namespace_()
{
return _ns;
}
inline std::string& QName::name()
{
return _name;
}
inline std::string& QName::prefix()
{
return _prefix;
}
XML_API std::ostream& operator<<(std::ostream&, const QName&);
}
}

View File

@ -1,25 +1,43 @@
// file : cutl/xml/value-traits.hxx
//
// ValueTraits.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: ValueTraits
//
// Definition of the ValueTraits templates.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef POCO_XML_VALUE_TRAITS_HXX
#define POCO_XML_VALUE_TRAITS_HXX
#include "XMLStreamParserException.h"
#include "XMLStreamSerializerException.h"
#include <string>
#include <cstddef> // std::size_t
#include <iostream>
#include <sstream>
#include "XMLStreamParserException.h"
#include "XMLStreamSerializerException.h"
namespace Poco
{
namespace XML
{
class XMLStreamParser;
class XMLStreamSerializer;
template<typename T>
struct default_value_traits
{
@ -30,6 +48,7 @@ struct default_value_traits
serialize(const T&, const XMLStreamSerializer&);
};
template<>
struct XML_API default_value_traits<bool>
{
@ -42,6 +61,7 @@ struct XML_API default_value_traits<bool>
}
};
template<>
struct XML_API default_value_traits<std::string>
{
@ -56,16 +76,19 @@ struct XML_API default_value_traits<std::string>
}
};
template<typename T>
struct ValueTraits: default_value_traits<T>
{
};
template<typename T, std::size_t N>
struct ValueTraits<T[N]> : default_value_traits<const T*>
{
};
template<typename T>
T default_value_traits<T>::parse(std::string s, const XMLStreamParser& p)
{
@ -76,6 +99,7 @@ T default_value_traits<T>::parse(std::string s, const XMLStreamParser& p)
return r;
}
template<typename T>
std::string default_value_traits<T>::serialize(const T& v, const XMLStreamSerializer& s)
{
@ -84,6 +108,8 @@ std::string default_value_traits<T>::serialize(const T& v, const XMLStreamSerial
throw XMLStreamSerializerException(s, "invalid value");
return os.str();
}
}
}

View File

@ -1,4 +1,18 @@
// file : cutl/xml/QName.cxx
//
// QName.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: QName
//
// Definition of the QName class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file

View File

@ -1,17 +1,35 @@
// file : cutl/xml/value-traits.cxx
//
// ValueTraits.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: ValueTraits
//
// Definition of the ValueTraits templates.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include "Poco/XML/XMLStreamParser.h"
#include "Poco/XML/XMLStreamParserException.h"
using namespace std;
namespace Poco
{
namespace XML
{
bool default_value_traits<bool>::parse(string s, const XMLStreamParser& p)
{
if (s == "true" || s == "1" || s == "True" || s == "TRUE")
@ -22,5 +40,6 @@ bool default_value_traits<bool>::parse(string s, const XMLStreamParser& p)
throw XMLStreamParserException(p, "invalid bool value '" + s + "'");
}
}
}