/usr/include/osgEarth/XmlUtils is in libosgearth-dev 2.9.0+dfsg-1.
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 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 Pelican Mapping
* http://osgearth.org
*
* osgEarth 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_XML_UTILS_H
#define OSGEARTH_XML_UTILS_H
#include <osgEarth/Common>
#include <osgEarth/Config>
#include <osgEarth/StringUtils>
#include <osgEarth/URI>
#include <osg/Referenced>
#include <osg/ref_ptr>
#include <string>
#include <vector>
#include <map>
#include <stack>
// XML support utilites.
namespace osgEarth
{
class OSGEARTH_EXPORT XmlNode : public osg::Referenced
{
public:
XmlNode();
virtual ~XmlNode() { }
virtual bool isElement() const =0;
virtual bool isText() const =0;
};
typedef std::vector<osg::ref_ptr<XmlNode> > XmlNodeList;
typedef std::map<std::string,std::string> XmlAttributes;
class OSGEARTH_EXPORT XmlElement : public XmlNode
{
public:
XmlElement( const std::string& name );
XmlElement( const std::string& name, const XmlAttributes& attrs );
XmlElement( const Config& conf );
virtual ~XmlElement() { }
const std::string& getName() const;
void setName( const std::string& name );
XmlAttributes& getAttrs();
const XmlAttributes& getAttrs() const;
const std::string& getAttr( const std::string& key ) const;
XmlNodeList& getChildren();
const XmlNodeList& getChildren() const;
XmlElement* getSubElement( const std::string& name ) const;
XmlNodeList getSubElements( const std::string& name ) const;
/**
* Finds the first element matching the name. This will match the
* current element (this), or the first matching element in this
* nodes subhierarchy.
*/
const XmlElement* findElement(const std::string& name) const;
std::string getText() const;
std::string getSubElementText( const std::string& tag ) const;
void addSubElement(const std::string& tag, const std::string& text);
void addSubElement(const std::string& tag, const Properties& attrs, const std::string& text);
virtual Config getConfig(const std::string& sourceURI) const;
public: // XmlNode
virtual bool isElement() const { return true; }
virtual bool isText() const { return false; }
virtual bool isInclude() const { return toLower(name) == "xi:include"; }
private:
std::string name;
XmlAttributes attrs;
XmlNodeList children;
};
typedef std::vector<osg::ref_ptr<XmlElement> > XmlElementList;
typedef std::stack<osg::ref_ptr<XmlElement> > XmlElementStack;
typedef std::stack<XmlElement*> XmlElementNoRefStack;
class OSGEARTH_EXPORT XmlText : public XmlNode
{
public:
XmlText( const std::string& value );
virtual ~XmlText() { }
const std::string& getValue() const;
public: // XmlNode
virtual bool isElement() const { return false; }
virtual bool isText() const { return true; }
private:
std::string value;
};
class OSGEARTH_EXPORT XmlDocument : public XmlElement
{
public:
XmlDocument();
XmlDocument( const Config& conf );
virtual ~XmlDocument();
static XmlDocument* load( const std::string& location, const osgDB::Options* dbOptions =0L );
static XmlDocument* load( const URI& uri, const osgDB::Options* dbOptions =0L );
static XmlDocument* load( std::istream& in, const URIContext& context =URIContext() );
void store( std::ostream& out ) const;
const std::string& getName() const;
virtual Config getConfig() const;
protected:
URI _sourceURI;
std::string _name;
osg::ref_ptr<XmlElement> _root;
};
}
#endif // OSGEARTH_XML_UTILS_H
|