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_xmlinstruction.cpp
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#include "core/fxcrt/xml/cfx_xmlinstruction.h"
8
9#include "core/fxcrt/fx_codepage.h"
10#include "core/fxcrt/fx_extension.h"
11#include "core/fxcrt/xml/cfx_xmldocument.h"
12
13CFX_XMLInstruction::CFX_XMLInstruction(const WideString& wsTarget)
14 : name_(wsTarget) {}
15
16CFX_XMLInstruction::~CFX_XMLInstruction() = default;
17
18CFX_XMLNode::Type CFX_XMLInstruction::GetType() const {
19 return Type::kInstruction;
20}
21
22CFX_XMLNode* CFX_XMLInstruction::Clone(CFX_XMLDocument* doc) {
23 auto* node = doc->CreateNode<CFX_XMLInstruction>(name_);
24 node->target_data_ = target_data_;
25 return node;
26}
27
28void CFX_XMLInstruction::AppendData(const WideString& wsData) {
29 target_data_.push_back(wsData);
30}
31
32bool CFX_XMLInstruction::IsOriginalXFAVersion() const {
33 return name_.EqualsASCII("originalXFAVersion");
34}
35
36bool CFX_XMLInstruction::IsAcrobat() const {
37 return name_.EqualsASCII("acrobat");
38}
39
40void CFX_XMLInstruction::Save(
41 const RetainPtr<IFX_RetainableWriteStream>& pXMLStream) {
42 if (name_.EqualsASCIINoCase("xml")) {
43 pXMLStream->WriteString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
44 return;
45 }
46
47 pXMLStream->WriteString("<?");
48 pXMLStream->WriteString(name_.ToUTF8().AsStringView());
49 pXMLStream->WriteString(" ");
50
51 for (const WideString& target : target_data_) {
52 pXMLStream->WriteString(target.ToUTF8().AsStringView());
53 pXMLStream->WriteString(" ");
54 }
55
56 pXMLStream->WriteString("?>\n");
57}
void AppendData(const WideString &wsData)
CFX_XMLInstruction(const WideString &wsTarget)
Type GetType() const override
bool IsOriginalXFAVersion() const
CFX_XMLNode * Clone(CFX_XMLDocument *doc) override
~CFX_XMLInstruction() override
void Save(const RetainPtr< IFX_RetainableWriteStream > &pXMLStream) override