2011-01-10 02:31:12 +01:00
|
|
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
2010-10-20 17:12:46 +02:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef _XML_READER_IMPL_H
|
|
|
|
#define _XML_READER_IMPL_H
|
|
|
|
|
|
|
|
#include "../include/cef.h"
|
2011-01-07 22:34:20 +01:00
|
|
|
#include "base/threading/platform_thread.h"
|
2010-10-20 17:12:46 +02:00
|
|
|
#include <libxml/xmlreader.h>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
// Implementation of CefXmlReader
|
2011-05-20 16:42:25 +02:00
|
|
|
class CefXmlReaderImpl : public CefXmlReader
|
2010-10-20 17:12:46 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CefXmlReaderImpl();
|
|
|
|
~CefXmlReaderImpl();
|
|
|
|
|
|
|
|
// Initialize the reader context.
|
|
|
|
bool Initialize(CefRefPtr<CefStreamReader> stream,
|
2010-11-22 18:49:46 +01:00
|
|
|
EncodingType encodingType, const CefString& URI);
|
2010-10-20 17:12:46 +02:00
|
|
|
|
2010-10-21 17:19:43 +02:00
|
|
|
virtual bool MoveToNextNode();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool Close();
|
|
|
|
virtual bool HasError();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetError();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual NodeType GetType();
|
|
|
|
virtual int GetDepth();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetLocalName();
|
|
|
|
virtual CefString GetPrefix();
|
|
|
|
virtual CefString GetQualifiedName();
|
|
|
|
virtual CefString GetNamespaceURI();
|
|
|
|
virtual CefString GetBaseURI();
|
|
|
|
virtual CefString GetXmlLang();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool IsEmptyElement();
|
|
|
|
virtual bool HasValue();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetValue();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool HasAttributes();
|
|
|
|
virtual size_t GetAttributeCount();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetAttribute(int index);
|
|
|
|
virtual CefString GetAttribute(const CefString& qualifiedName);
|
|
|
|
virtual CefString GetAttribute(const CefString& localName,
|
|
|
|
const CefString& namespaceURI);
|
|
|
|
virtual CefString GetInnerXml();
|
|
|
|
virtual CefString GetOuterXml();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual int GetLineNumber();
|
|
|
|
virtual bool MoveToAttribute(int index);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual bool MoveToAttribute(const CefString& qualifiedName);
|
|
|
|
virtual bool MoveToAttribute(const CefString& localName,
|
|
|
|
const CefString& namespaceURI);
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool MoveToFirstAttribute();
|
|
|
|
virtual bool MoveToNextAttribute();
|
|
|
|
virtual bool MoveToCarryingElement();
|
|
|
|
|
|
|
|
// Add another line to the error string.
|
2010-11-22 18:49:46 +01:00
|
|
|
void AppendError(const CefString& error_str);
|
2010-10-20 17:12:46 +02:00
|
|
|
|
|
|
|
// Verify that the reader exists and is being accessed from the correct
|
|
|
|
// thread.
|
|
|
|
bool VerifyContext();
|
|
|
|
|
|
|
|
protected:
|
2011-01-07 22:34:20 +01:00
|
|
|
base::PlatformThreadId supported_thread_id_;
|
2010-11-09 22:06:39 +01:00
|
|
|
CefRefPtr<CefStreamReader> stream_;
|
2010-10-20 17:12:46 +02:00
|
|
|
xmlTextReaderPtr reader_;
|
2010-11-22 18:49:46 +01:00
|
|
|
std::stringstream error_buf_;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefXMLReaderImpl);
|
2010-10-20 17:12:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _XML_READER_IMPL_H
|