/usr/include/dolfin/io/SAX2AttributeParser.h is in libdolfin-dev 1.4.0+dfsg-4.
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 | // Copyright (C) 2009 Ola Skavhaug
//
// This file is part of DOLFIN.
//
// DOLFIN 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.
//
// DOLFIN 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 License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Anders Logg 2011
//
// First added: 2009-03-03
// Last changed: 2011-11-14
#ifndef __SAXHANDLER_H
#define __SAXHANDLER_H
#include <string>
#include <boost/lexical_cast.hpp>
#include <libxml/parser.h>
namespace dolfin
{
class GenericVector;
class Mesh;
class Parameters;
class SAX2AttributeParser
{
public:
template<typename T>
static T parse(const xmlChar* name, const xmlChar** attrs,
const char* attribute, std::size_t num_attributes)
{
// Check that we got the data
if (!attrs)
{
dolfin_error("SAX2AttributeParser.h",
"parse XML file using SAX interface",
"Missing attribute \"%s\" for <%s> in XML file",
attribute, name);
}
// Parse data
for (std::size_t i = 0; i < num_attributes; i++)
{
// Check for attribute
if (xmlStrcasecmp(attrs[5*i], (xmlChar *) attribute) == 0)
{
if (!attrs[5*i + 3])
{
dolfin_error("SAX2AttributeParser.h",
"value for attribute \"%s\" of <%s> missing in XML file",
attribute, name);
}
std::string value(attrs[5*i + 3], attrs[5*i + 4]);
return boost::lexical_cast<T, std::string>(value);
}
}
// Didn't get the value
dolfin_error("SAX2AttributeParser.h",
"value for attribute \"%s\" of <%s> missing in XML file",
attribute, name);
return boost::lexical_cast<T, std::string>("0");
}
};
}
#endif
|