/usr/include/openturns/XMLchar_traits.hxx is in libopenturns-dev 1.9-5.
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | // -*- C++ -*-
/**
* @brief This file provides a definition for char traits for old versions of GCC
*
* Copyright 2005-2017 Airbus-EDF-IMACS-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef OPENTURNS_XMLCHAR_TRAITS_HXX
#define OPENTURNS_XMLCHAR_TRAITS_HXX
#include "openturns/OTprivate.hxx"
#include "openturns/OTconfig.hxx"
#include <string>
#if defined OPENTURNS_HAVE_LIBXML2
#if defined(__GNUC__) && GCC_VERSION < 30400 /* below GCC 3.4.0 */
#include <libxml/xmlstring.h>
namespace std
{
template<typename _CharT>
static void
char_traits<_CharT>::
assign(char_type& __c1, const char_type& __c2)
{
__c1 = __c2;
}
template<typename _CharT>
static bool
char_traits<_CharT>::
eq(const char_type& __c1, const char_type& __c2)
{
return __c1 == __c2;
}
template<typename _CharT>
static bool
char_traits<_CharT>::
lt(const char_type& __c1, const char_type& __c2)
{
return __c1 < __c2;
}
template<typename _CharT>
static typename char_traits<_CharT>::char_type
char_traits<_CharT>::
to_char_type(const int_type& __c)
{
return static_cast<char_type>(__c);
}
template<typename _CharT>
static typename char_traits<_CharT>::int_type
char_traits<_CharT>::
to_int_type(const char_type& __c)
{
return static_cast<int_type>(__c);
}
template<typename _CharT>
static bool
char_traits<_CharT>::
eq_int_type(const int_type& __c1, const int_type& __c2)
{
return __c1 == __c2;
}
template<typename _CharT>
static typename char_traits<_CharT>::int_type
char_traits<_CharT>::
eof()
{
return static_cast<int_type>(EOF);
}
template<typename _CharT>
static typename char_traits<_CharT>::int_type
char_traits<_CharT>::
not_eof(const int_type& __c)
{
return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type());
}
template<typename _CharT>
static int
char_traits<_CharT>::
compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
{
for (std::size_t __i = 0; __i < __n; ++__i)
if (lt(__s1[__i], __s2[__i]))
return -1;
else if (lt(__s2[__i], __s1[__i]))
return 1;
return 0;
}
template<typename _CharT>
static std::size_t
char_traits<_CharT>::
length(const char_type* __p)
{
std::size_t __i = 0;
while (!eq(__p[__i], char_type()))
++__i;
return __i;
}
template<typename _CharT>
static const typename char_traits<_CharT>::char_type*
char_traits<_CharT>::
find(const char_type* __s, std::size_t __n, const char_type& __a)
{
for (std::size_t __i = 0; __i < __n; ++__i)
if (eq(__s[__i], __a))
return __s + __i;
return 0;
}
template<typename _CharT>
static typename char_traits<_CharT>::char_type*
char_traits<_CharT>::
move(char_type* __s1, const char_type* __s2, std::size_t __n)
{
return static_cast<_CharT*>(memmove(__s1, __s2,
__n * sizeof(char_type)));
}
template<typename _CharT>
static typename char_traits<_CharT>::char_type*
char_traits<_CharT>::
copy(char_type* __s1, const char_type* __s2, std::size_t __n)
{
// NB: Inline std::copy so no recursive dependencies.
std::copy(__s2, __s2 + __n, __s1);
return __s1;
}
template<typename _CharT>
static typename char_traits<_CharT>::char_type*
char_traits<_CharT>::
assign(char_type* __s, std::size_t __n, char_type __a)
{
// NB: Inline std::fill_n so no recursive dependencies.
std::fill_n(__s, __n, __a);
return __s;
}
}
#endif
#endif /* HAS_LIXML2 */
#endif /* OPENTURNS_XMLCHAR_TRAITS_HXX */
|