/usr/include/gnash/asobj/XML_as.h is in gnash-dev 0.8.11~git20160109-1build1.
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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | // XML_as.h: ActionScript 3 "XMLDocument" class, for Gnash.
//
// Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef GNASH_ASOBJ3_XMLDOCUMENT_H
#define GNASH_ASOBJ3_XMLDOCUMENT_H
#include "XMLNode_as.h"
#include "dsodefs.h"
#include "StringPredicates.h"
#include <map>
#include <string>
namespace gnash {
// Forward declarations
class fn_call;
class URL;
/// Implements XML (AS2) and flash.xml.XMLDocument (AS3) class.
//
/// This class interface is identical in AS3 and AS2; it is probably
/// included in AS3 for backward compatibility.
//
/// The class definition is necessary because XML is encoded differently
/// in AMF.
class XML_as : public XMLNode_as
{
public:
typedef std::string::const_iterator xml_iterator;
enum ParseStatus {
XML_OK = 0,
XML_UNTERMINATED_CDATA = -2,
XML_UNTERMINATED_XML_DECL = -3,
XML_UNTERMINATED_DOCTYPE_DECL = -4,
XML_UNTERMINATED_COMMENT = -5,
XML_UNTERMINATED_ELEMENT = -6,
XML_OUT_OF_MEMORY = -7,
XML_UNTERMINATED_ATTRIBUTE = -8,
XML_MISSING_CLOSE_TAG = -9,
XML_MISSING_OPEN_TAG = -10
};
enum LoadStatus {
XML_LOADED_UNDEFINED = -1,
XML_LOADED_FALSE = false,
XML_LOADED_TRUE = true
};
/// Create an XML object.
//
/// An XMLDocument is always user-created, so always starts with an
/// associated object.
XML_as(as_object& object);
XML_as(as_object& object, const std::string& xml);
~XML_as() {};
/// Convert the XML object to a string
//
/// This calls XMLNode::toString after adding an xmlDecl and
/// docTypeDecl
//
/// @param o The ostream to write the string to.
/// @param encode Whether to URL encode the node values.
void toString(std::ostream& o, bool encode) const;
const std::string& getXMLDecl() const {
return _xmlDecl;
}
void setXMLDecl(const std::string& xml) {
_xmlDecl = xml;
}
const std::string& getDocTypeDecl() const {
return _docTypeDecl;
}
void setDocTypeDecl(const std::string& docType) {
_docTypeDecl = docType;
}
const std::string& getContentType() const {
return _contentType;
}
void setContentType(const std::string& contentType) {
_contentType = contentType;
}
// Methods
/// Parses an XML document into the specified XML object tree.
//
/// This reads in an XML file from disk and parses into into a memory
/// resident tree which can be walked through later.
///
/// Calls to this function clear any precedently parsed data.
///
void parseXML(const std::string& xml);
int status() const {
return _status;
}
void setStatus(ParseStatus st) {
_status = st;
}
LoadStatus loaded() const {
return _loaded;
}
void setLoaded(LoadStatus st) {
_loaded = st;
}
/// Return current ignoreWhite property.
bool ignoreWhite() const {
return _ignoreWhite;
}
/// Set ignoreWhite property.
void ignoreWhite(bool ignore) {
_ignoreWhite = ignore;
}
private:
typedef std::map<std::string, std::string, StringNoCaseLessThan> Attributes;
void parseTag(XMLNode_as*& node, xml_iterator& it, xml_iterator end);
void parseAttribute(XMLNode_as* node, xml_iterator& it,
xml_iterator end, Attributes& attributes);
void parseDocTypeDecl( xml_iterator& it, xml_iterator end);
void parseText(XMLNode_as* node, xml_iterator& it, xml_iterator end,
bool ignoreWhite);
void parseXMLDecl(xml_iterator& it, xml_iterator end);
void parseComment(XMLNode_as* node, xml_iterator& it, xml_iterator end);
void parseCData(XMLNode_as* node, xml_iterator& it, xml_iterator end);
/// Clear all properties.
//
/// This removes all children, resets doctype and xml decls, and
/// sets status to XML.
void clear();
// -1 if never asked to load anything
// 0 if asked to load but not yet loaded (or failure)
// 1 if successfully loaded
LoadStatus _loaded;
// Nominally used to store ParseStatus, but can be any int value.
int _status;
std::string _docTypeDecl;
std::string _xmlDecl;
std::string _contentType;
bool _ignoreWhite;
};
/// Escape using XML entities.
//
/// Note this is not the same as a URL escape.
void escapeXML(std::string& text);
void unescapeXML(std::string& text);
/// Register the XML class.
void xml_class_init(as_object& where, const ObjectURI& uri);
/// Register XML native functions.
void registerXMLNative(as_object& where);
} // namespace gnash
#endif
// local Variables:
// mode: C++
// indent-tabs-mode: t
// End:
|