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