Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_xmltext.h
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCRT_XML_CFX_XMLTEXT_H_
8#define CORE_FXCRT_XML_CFX_XMLTEXT_H_
9
10#include "core/fxcrt/widestring.h"
11#include "core/fxcrt/xml/cfx_xmlnode.h"
12
13class CFX_XMLDocument;
14
15class CFX_XMLText : public CFX_XMLNode {
16 public:
17 explicit CFX_XMLText(const WideString& wsText);
19
20 // CFX_XMLNode
21 Type GetType() const override;
22 CFX_XMLNode* Clone(CFX_XMLDocument* doc) override;
23 void Save(const RetainPtr<IFX_RetainableWriteStream>& pXMLStream) override;
24
25 const WideString& GetText() const { return text_; }
26 void SetText(const WideString& wsText) { text_ = wsText; }
27
28 private:
29 WideString text_;
30};
31
32inline bool IsXMLText(const CFX_XMLNode* pNode) {
33 CFX_XMLNode::Type type = pNode->GetType();
34 return type == CFX_XMLNode::Type::kText ||
36}
37
39 return pNode && IsXMLText(pNode) ? static_cast<CFX_XMLText*>(pNode) : nullptr;
40}
41
42inline const CFX_XMLText* ToXMLText(const CFX_XMLNode* pNode) {
43 return pNode && IsXMLText(pNode) ? static_cast<const CFX_XMLText*>(pNode)
44 : nullptr;
45}
46
47#endif // CORE_FXCRT_XML_CFX_XMLTEXT_H_
CFX_XMLCharData * ToXMLCharData(CFX_XMLNode *pNode)
const CFX_XMLText * ToXMLText(const CFX_XMLNode *pNode)
Definition cfx_xmltext.h:42
bool IsXMLText(const CFX_XMLNode *pNode)
Definition cfx_xmltext.h:32
CFX_XMLText * ToXMLText(CFX_XMLNode *pNode)
Definition cfx_xmltext.h:38
Type GetType() const override
CFX_XMLCharData(const WideString &wsCData)
void Save(const RetainPtr< IFX_RetainableWriteStream > &pXMLStream) override
~CFX_XMLCharData() override
CFX_XMLNode * Clone(CFX_XMLDocument *doc) override
virtual Type GetType() const =0
void SetText(const WideString &wsText)
Definition cfx_xmltext.h:26
~CFX_XMLText() override
const WideString & GetText() const
Definition cfx_xmltext.h:25
CFX_XMLText(const WideString &wsText)
void Save(const RetainPtr< IFX_RetainableWriteStream > &pXMLStream) override
Type GetType() const override
CFX_XMLNode * Clone(CFX_XMLDocument *doc) override