~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/xml/XSLTProcessor.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the XSL implementation.
 
3
 *
 
4
 * Copyright (C) 2004, 2007, 2008 Apple, Inc. All rights reserved.
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Library General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Library General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Library General Public License
 
17
 * along with this library; see the file COPYING.LIB.  If not, write to
 
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301, USA.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef XSLTProcessor_h
 
24
#define XSLTProcessor_h
 
25
 
 
26
#if ENABLE(XSLT)
 
27
 
 
28
#include "Node.h"
 
29
#include "XSLStyleSheet.h"
 
30
#include <wtf/HashMap.h>
 
31
#include <wtf/text/StringHash.h>
 
32
 
 
33
#if !USE(QXMLQUERY)
 
34
#include <libxml/parserInternals.h>
 
35
#include <libxslt/documents.h>
 
36
#endif
 
37
 
 
38
namespace WebCore {
 
39
 
 
40
class Frame;
 
41
class Document;
 
42
class DocumentFragment;
 
43
 
 
44
class XSLTProcessor : public RefCounted<XSLTProcessor> {
 
45
public:
 
46
    static PassRefPtr<XSLTProcessor> create() { return adoptRef(new XSLTProcessor); }
 
47
    ~XSLTProcessor();
 
48
 
 
49
    void setXSLStyleSheet(PassRefPtr<XSLStyleSheet> styleSheet) { m_stylesheet = styleSheet; }
 
50
    bool transformToString(Node* source, String& resultMIMEType, String& resultString, String& resultEncoding);
 
51
    PassRefPtr<Document> createDocumentFromSource(const String& source, const String& sourceEncoding, const String& sourceMIMEType, Node* sourceNode, Frame* frame);
 
52
    
 
53
    // DOM methods
 
54
    void importStylesheet(PassRefPtr<Node> style)
 
55
    {
 
56
        if (style)
 
57
            m_stylesheetRootNode = style;
 
58
    }
 
59
    PassRefPtr<DocumentFragment> transformToFragment(Node* source, Document* ouputDoc);
 
60
    PassRefPtr<Document> transformToDocument(Node* source);
 
61
    
 
62
    void setParameter(const String& namespaceURI, const String& localName, const String& value);
 
63
    String getParameter(const String& namespaceURI, const String& localName) const;
 
64
    void removeParameter(const String& namespaceURI, const String& localName);
 
65
    void clearParameters() { m_parameters.clear(); }
 
66
 
 
67
    void reset();
 
68
 
 
69
#if !USE(QXMLQUERY)
 
70
    static void parseErrorFunc(void* userData, xmlError*);
 
71
    static void genericErrorFunc(void* userData, const char* msg, ...);
 
72
    
 
73
    // Only for libXSLT callbacks
 
74
    XSLStyleSheet* xslStylesheet() const { return m_stylesheet.get(); }
 
75
#endif
 
76
 
 
77
    typedef HashMap<String, String> ParameterMap;
 
78
 
 
79
private:
 
80
    XSLTProcessor() { }
 
81
 
 
82
    RefPtr<XSLStyleSheet> m_stylesheet;
 
83
    RefPtr<Node> m_stylesheetRootNode;
 
84
    ParameterMap m_parameters;
 
85
};
 
86
 
 
87
}
 
88
 
 
89
#endif
 
90
#endif