update Expat and XMLStorage files

svn path=/trunk/; revision=13667
This commit is contained in:
Martin Fuchs 2005-02-20 10:21:20 +00:00
parent c7a7f1b757
commit c011b2f3f4
5 changed files with 1153 additions and 22 deletions

View file

@ -347,7 +347,7 @@ public:
*lprcClipRect = rect;
assert(lpFrameInfo->cb>=sizeof(OLEINPLACEFRAMEINFO));
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->fMDIApp = FALSE; //@@
lpFrameInfo->hwndFrame = 0;
lpFrameInfo->haccel = 0;
lpFrameInfo->cAccelEntries = 0;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,101 @@
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file COPYING for copying permission.
*/
#ifndef Expat_External_INCLUDED
#define Expat_External_INCLUDED 1
/* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
achieve some different behavior, but doing so it not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
"library boundary." This will default to cdecl, and
try really hard to tell the compiler that's what we
want.
XMLIMPORT - Whatever magic is needed to note that a function is
to be imported from a dynamically loaded library
(.dll, .so, or .sl, depending on your platform).
The XMLCALL macro was added in Expat 1.95.7. The only one which is
expected to be directly useful in client code is XMLCALL.
Note that on at least some Unix versions, the Expat library must be
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
#if defined(XML_USE_MSC_EXTENSIONS)
#define XMLCALL __cdecl
#elif defined(__GNUC__) && defined(__i386)
#define XMLCALL __attribute__((cdecl))
#else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
#define XMLCALL
#endif
#endif /* not defined XMLCALL */
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
#ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
#ifdef XML_USE_MSC_EXTENSIONS
#define XMLIMPORT __declspec(dllimport)
#endif
#endif
#endif /* not defined XML_STATIC */
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XML_UNICODE_WCHAR_T
#define XML_UNICODE
#endif
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
#ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
#else
typedef unsigned short XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#ifdef __cplusplus
}
#endif
#endif /* not Expat_External_INCLUDED */

View file

@ -431,6 +431,12 @@ std::string XMLReaderBase::get_error_string() const
case XML_ERROR_ABORTED: return "XML_ERROR_ABORTED";
case XML_ERROR_FINISHED: return "XML_ERROR_FINISHED";
case XML_ERROR_SUSPEND_PE: return "XML_ERROR_SUSPEND_PE";
#endif
#if XML_MAJOR_VERSION>=2
/* Added in 2.0. */
case XML_ERROR_RESERVED_PREFIX_XML: return "XML_ERROR_RESERVED_PREFIX_XML";
case XML_ERROR_RESERVED_PREFIX_XMLNS: return "XML_ERROR_RESERVED_PREFIX_XMLNS";
case XML_ERROR_RESERVED_NAMESPACE_URI: return "XML_ERROR_RESERVED_NAMESPACE_URI";
#endif
}

View file

@ -612,6 +612,23 @@ struct XMLNode : public XS_String
return out;
}
protected:
Children _children;
AttributeMap _attributes;
std::string _leading;
std::string _content;
std::string _end_leading;
std::string _trailing;
XMLNode* get_first_child() const
{
if (!_children.empty())
return _children.front();
else
return NULL;
}
XMLNode* find(const XS_String& name, int n=0) const
{
for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
@ -670,23 +687,6 @@ struct XMLNode : public XS_String
/// relative XPath create function
XMLNode* create_relative(const char* path);
protected:
Children _children;
AttributeMap _attributes;
std::string _leading;
std::string _content;
std::string _end_leading;
std::string _trailing;
XMLNode* get_first_child() const
{
if (!_children.empty())
return _children.front();
else
return NULL;
}
void write_worker(std::ostream& out, int indent) const;
void pretty_write_worker(std::ostream& out, int indent) const;
void smart_write_worker(std::ostream& out, int indent) const;
@ -1533,6 +1533,8 @@ struct XMLReaderBase
return out.str();
}
std::string get_instructions() const {return _instructions;}
XML_Error get_error_code() {return XML_GetErrorCode(_parser);}
std::string get_error_string() const;
@ -1541,6 +1543,7 @@ protected:
XML_Parser _parser;
std::string _xml_version;
std::string _encoding;
std::string _instructions;
std::string _content;
enum {TAG_NONE, TAG_START, TAG_END} _last_tag;
@ -1592,11 +1595,14 @@ struct XMLHeader
if (!_doctype.empty())
out << _doctype << '\n';
if (!_additional.empty())
out << _additional << '\n';
}
std::string _version;
std::string _encoding;
std::string _doctype;
std::string _additional;
};
@ -1640,6 +1646,8 @@ struct XMLDoc : public XMLNode
{
XML_Status status = reader.read();
_header._additional = reader.get_instructions();
if (status == XML_STATUS_ERROR) {
std::ostringstream out;
@ -1656,6 +1664,8 @@ struct XMLDoc : public XMLNode
{
XML_Status status = reader.read();
_header._additional = reader.get_instructions();
if (status == XML_STATUS_ERROR) {
std::ostringstream out;
@ -1669,9 +1679,9 @@ struct XMLDoc : public XMLNode
}
/// write XML stream preserving previous white space and comments
std::ostream& write(std::ostream& out, WRITE_MODE mode=FORMAT_SMART, const XMLHeader& header=XMLHeader()) const
std::ostream& write(std::ostream& out, WRITE_MODE mode=FORMAT_SMART) const
{
header.print(out);
_header.print(out);
if (!_children.empty())
_children.front()->write(out);
@ -1685,11 +1695,11 @@ struct XMLDoc : public XMLNode
return write(out, FORMAT_PRETTY);
}
void write(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART, const XMLHeader& header=XMLHeader()) const
void write(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
{
tofstream out(path);
write(out, mode, header);
write(out, mode);
}
void write_formating(LPCTSTR path) const
@ -1699,6 +1709,7 @@ struct XMLDoc : public XMLNode
write_formating(out);
}
XMLHeader _header;
XML_Error _last_error;
std::string _last_error_msg;
};