/usr/include/Poco/XML/ValueTraits.h is in libpoco-dev 1.8.0.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | //
// ValueTraits.h
//
// 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
//
#ifndef XML_ValueTraits_INCLUDED
#define XML_ValueTraits_INCLUDED
#include "XMLStreamParserException.h"
#include <string>
#include <cstddef>
#include <iostream>
#include <sstream>
namespace Poco {
namespace XML {
class XMLStreamParser;
class XMLStreamSerializer;
template <typename T>
struct DefaultValueTraits
{
static T
parse(std::string, const XMLStreamParser&);
static std::string
serialize(const T&, const XMLStreamSerializer&);
};
template <>
struct XML_API DefaultValueTraits<bool>
{
static bool
parse(std::string, const XMLStreamParser&);
static std::string serialize(bool v, const XMLStreamSerializer&)
{
return v ? "true" : "false";
}
};
template <>
struct XML_API DefaultValueTraits<std::string>
{
static std::string parse(std::string s, const XMLStreamParser&)
{
return s;
}
static std::string serialize(const std::string& v, const XMLStreamSerializer&)
{
return v;
}
};
template <typename T>
struct ValueTraits: DefaultValueTraits<T>
{
};
template <typename T, std::size_t N>
struct ValueTraits<T[N]> : DefaultValueTraits<const T*>
{
};
template <typename T>
T DefaultValueTraits<T>::parse(std::string s, const XMLStreamParser& p)
{
T r;
std::istringstream is(s);
if (!(is >> r && is.eof()))
throw XMLStreamParserException(p, "invalid value '" + s + "'");
return r;
}
} } // namespace Poco::XML
#endif // XML_ValueTraits_INCLUDED
|