Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
SkPDF::AttributeList Class Reference

#include <SkPDFDocument.h>

Inheritance diagram for SkPDF::AttributeList:
SkNoncopyable

Public Member Functions

 AttributeList ()
 
 ~AttributeList ()
 
void appendInt (const char *owner, const char *name, int value)
 
void appendFloat (const char *owner, const char *name, float value)
 
void appendName (const char *owner, const char *attrName, const char *value)
 
void appendFloatArray (const char *owner, const char *name, const std::vector< float > &value)
 
void appendNodeIdArray (const char *owner, const char *attrName, const std::vector< int > &nodeIds)
 

Friends

class ::SkPDFTagTree
 

Detailed Description

Attributes for nodes in the PDF tree.

Definition at line 30 of file SkPDFDocument.h.

Constructor & Destructor Documentation

◆ AttributeList()

SkPDF::AttributeList::AttributeList ( )
default

◆ ~AttributeList()

SkPDF::AttributeList::~AttributeList ( )
default

Member Function Documentation

◆ appendFloat()

void SkPDF::AttributeList::appendFloat ( const char *  owner,
const char *  name,
float  value 
)

Definition at line 113 of file SkPDFTag.cpp.

114 {
115 if (!fAttrs)
116 fAttrs = SkPDFMakeArray();
117 std::unique_ptr<SkPDFDict> attrDict = SkPDFMakeDict();
118 attrDict->insertName("O", owner);
119 attrDict->insertScalar(name, value);
120 fAttrs->appendObject(std::move(attrDict));
121}
static std::unique_ptr< SkPDFDict > SkPDFMakeDict(const char *type=nullptr)
Definition: SkPDFTypes.h:185
static std::unique_ptr< SkPDFArray > SkPDFMakeArray(Args... args)
Definition: SkPDFTypes.h:125
uint8_t value
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ appendFloatArray()

void SkPDF::AttributeList::appendFloatArray ( const char *  owner,
const char *  name,
const std::vector< float > &  value 
)

Definition at line 133 of file SkPDFTag.cpp.

134 {
135 if (!fAttrs)
136 fAttrs = SkPDFMakeArray();
137 std::unique_ptr<SkPDFDict> attrDict = SkPDFMakeDict();
138 attrDict->insertName("O", owner);
139 std::unique_ptr<SkPDFArray> pdfArray = SkPDFMakeArray();
140 for (float element : value) {
141 pdfArray->appendScalar(element);
142 }
143 attrDict->insertObject(name, std::move(pdfArray));
144 fAttrs->appendObject(std::move(attrDict));
145}

◆ appendInt()

void SkPDF::AttributeList::appendInt ( const char *  owner,
const char *  name,
int  value 
)

Definition at line 103 of file SkPDFTag.cpp.

104 {
105 if (!fAttrs)
106 fAttrs = SkPDFMakeArray();
107 std::unique_ptr<SkPDFDict> attrDict = SkPDFMakeDict();
108 attrDict->insertName("O", owner);
109 attrDict->insertInt(name, value);
110 fAttrs->appendObject(std::move(attrDict));
111}

◆ appendName()

void SkPDF::AttributeList::appendName ( const char *  owner,
const char *  attrName,
const char *  value 
)

Definition at line 123 of file SkPDFTag.cpp.

124 {
125 if (!fAttrs)
126 fAttrs = SkPDFMakeArray();
127 std::unique_ptr<SkPDFDict> attrDict = SkPDFMakeDict();
128 attrDict->insertName("O", owner);
129 attrDict->insertName(name, value);
130 fAttrs->appendObject(std::move(attrDict));
131}

◆ appendNodeIdArray()

void SkPDF::AttributeList::appendNodeIdArray ( const char *  owner,
const char *  attrName,
const std::vector< int > &  nodeIds 
)

Definition at line 147 of file SkPDFTag.cpp.

150 {
151 if (!fAttrs)
152 fAttrs = SkPDFMakeArray();
153 std::unique_ptr<SkPDFDict> attrDict = SkPDFMakeDict();
154 attrDict->insertName("O", owner);
155 std::unique_ptr<SkPDFArray> pdfArray = SkPDFMakeArray();
156 for (int nodeId : nodeIds) {
157 SkString idString = SkPDFTagNode::nodeIdToString(nodeId);
158 pdfArray->appendByteString(idString);
159 }
160 attrDict->insertObject(name, std::move(pdfArray));
161 fAttrs->appendObject(std::move(attrDict));
162}
static SkString nodeIdToString(int nodeId)
Definition: SkPDFTag.cpp:66

Friends And Related Function Documentation

◆ ::SkPDFTagTree

friend class ::SkPDFTagTree
friend

Definition at line 49 of file SkPDFDocument.h.


The documentation for this class was generated from the following files: