Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkPDFDict Class Referencefinal

#include <SkPDFTypes.h>

Inheritance diagram for SkPDFDict:
SkPDFObject

Public Member Functions

 SkPDFDict (const char type[]=nullptr)
 
 ~SkPDFDict () override
 
void emitObject (SkWStream *stream) const override
 
size_t size () const
 
void reserve (int n)
 
void insertObject (const char key[], std::unique_ptr< SkPDFObject > &&)
 
void insertObject (SkString, std::unique_ptr< SkPDFObject > &&)
 
void insertRef (const char key[], SkPDFIndirectReference)
 
void insertRef (SkString, SkPDFIndirectReference)
 
void insertBool (const char key[], bool value)
 
void insertInt (const char key[], int32_t value)
 
void insertInt (const char key[], size_t value)
 
void insertScalar (const char key[], SkScalar value)
 
void insertColorComponentF (const char key[], SkScalar value)
 
void insertName (const char key[], const char nameValue[])
 
void insertName (const char key[], SkString nameValue)
 
void insertByteString (const char key[], const char value[])
 
void insertTextString (const char key[], const char value[])
 
void insertByteString (const char key[], SkString value)
 
void insertTextString (const char key[], SkString value)
 
void insertUnion (const char key[], SkPDFUnion &&)
 
- Public Member Functions inherited from SkPDFObject
 SkPDFObject ()=default
 
virtual void emitObject (SkWStream *stream) const =0
 
virtual ~SkPDFObject ()=default
 

Detailed Description

A dictionary object in a PDF.

Definition at line 136 of file SkPDFTypes.h.

Constructor & Destructor Documentation

◆ SkPDFDict()

SkPDFDict::SkPDFDict ( const char  type[] = nullptr)
explicit

Create a PDF dictionary.

Parameters
typeThe value of the Type entry, nullptr for no type.

Definition at line 450 of file SkPDFTypes.cpp.

450 {
451 if (type) {
452 this->insertName("Type", type);
453 }
454}
GLenum type
void insertName(const char key[], const char nameValue[])
Definition: SkPDFTypes.cpp:512

◆ ~SkPDFDict()

SkPDFDict::~SkPDFDict ( )
override

Definition at line 448 of file SkPDFTypes.cpp.

448{}

Member Function Documentation

◆ emitObject()

void SkPDFDict::emitObject ( SkWStream stream) const
overridevirtual

Subclasses must implement this method to print the object to the PDF file.

Parameters
catalogThe object catalog to use.
streamThe writable output stream to send the output to.

Implements SkPDFObject.

Definition at line 456 of file SkPDFTypes.cpp.

456 {
457 stream->writeText("<<");
458 for (size_t i = 0; i < fRecords.size(); ++i) {
459 const std::pair<SkPDFUnion, SkPDFUnion>& record = fRecords[i];
460 record.first.emitObject(stream);
461 stream->writeText(" ");
462 record.second.emitObject(stream);
463 if (i + 1 < fRecords.size()) {
464 stream->writeText("\n");
465 }
466 }
467 stream->writeText(">>");
468}

◆ insertBool()

void SkPDFDict::insertBool ( const char  key[],
bool  value 
)

Add the value to the dictionary with the given key.

Parameters
keyThe text of the key for this dictionary entry.
valueThe value for this dictionary entry.

Definition at line 492 of file SkPDFTypes.cpp.

492 {
493 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Bool(value));
494}
static SkPDFUnion Bool(bool)
Definition: SkPDFTypes.cpp:317
static SkPDFUnion Name(const char *)
Definition: SkPDFTypes.cpp:325
uint8_t value

◆ insertByteString() [1/2]

void SkPDFDict::insertByteString ( const char  key[],
const char  value[] 
)

Definition at line 520 of file SkPDFTypes.cpp.

520 {
521 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::ByteString(value));
522}
static SkPDFUnion ByteString(const char *)
Definition: SkPDFTypes.cpp:331

◆ insertByteString() [2/2]

void SkPDFDict::insertByteString ( const char  key[],
SkString  value 
)

Definition at line 528 of file SkPDFTypes.cpp.

528 {
529 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::ByteString(std::move(value)));
530}

◆ insertColorComponentF()

void SkPDFDict::insertColorComponentF ( const char  key[],
SkScalar  value 
)

Definition at line 504 of file SkPDFTypes.cpp.

504 {
505 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::ColorComponentF(value));
506}
static SkPDFUnion ColorComponentF(float)
Definition: SkPDFTypes.cpp:313

◆ insertInt() [1/2]

void SkPDFDict::insertInt ( const char  key[],
int32_t  value 
)

Definition at line 496 of file SkPDFTypes.cpp.

496 {
497 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Int(value));
498}
static SkPDFUnion Int(int32_t)
Definition: SkPDFTypes.cpp:305

◆ insertInt() [2/2]

void SkPDFDict::insertInt ( const char  key[],
size_t  value 
)

Definition at line 500 of file SkPDFTypes.cpp.

500 {
501 this->insertInt(key, SkToS32(value));
502}
constexpr int32_t SkToS32(S x)
Definition: SkTo.h:25
void insertInt(const char key[], int32_t value)
Definition: SkPDFTypes.cpp:496

◆ insertName() [1/2]

void SkPDFDict::insertName ( const char  key[],
const char  nameValue[] 
)

Definition at line 512 of file SkPDFTypes.cpp.

512 {
513 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Name(name));
514}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ insertName() [2/2]

void SkPDFDict::insertName ( const char  key[],
SkString  nameValue 
)

Definition at line 516 of file SkPDFTypes.cpp.

516 {
517 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Name(std::move(name)));
518}

◆ insertObject() [1/2]

void SkPDFDict::insertObject ( const char  key[],
std::unique_ptr< SkPDFObject > &&  objSp 
)

Add the value to the dictionary with the given key.

Parameters
keyThe text of the key for this dictionary entry.
valueThe value for this dictionary entry.

Definition at line 484 of file SkPDFTypes.cpp.

484 {
485 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Object(std::move(objSp)));
486}
static SkPDFUnion Object(std::unique_ptr< SkPDFObject >)
Definition: SkPDFTypes.cpp:353

◆ insertObject() [2/2]

void SkPDFDict::insertObject ( SkString  key,
std::unique_ptr< SkPDFObject > &&  objSp 
)

Definition at line 487 of file SkPDFTypes.cpp.

487 {
488 fRecords.emplace_back(SkPDFUnion::Name(std::move(key)),
489 SkPDFUnion::Object(std::move(objSp)));
490}

◆ insertRef() [1/2]

void SkPDFDict::insertRef ( const char  key[],
SkPDFIndirectReference  ref 
)

Definition at line 476 of file SkPDFTypes.cpp.

476 {
477 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Ref(ref));
478}
static SkPDFUnion Ref(SkPDFIndirectReference)
Definition: SkPDFTypes.cpp:358

◆ insertRef() [2/2]

void SkPDFDict::insertRef ( SkString  key,
SkPDFIndirectReference  ref 
)

Definition at line 480 of file SkPDFTypes.cpp.

480 {
481 fRecords.emplace_back(SkPDFUnion::Name(std::move(key)), SkPDFUnion::Ref(ref));
482}

◆ insertScalar()

void SkPDFDict::insertScalar ( const char  key[],
SkScalar  value 
)

Definition at line 508 of file SkPDFTypes.cpp.

508 {
509 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::Scalar(value));
510}
static SkPDFUnion Scalar(SkScalar)
Definition: SkPDFTypes.cpp:321

◆ insertTextString() [1/2]

void SkPDFDict::insertTextString ( const char  key[],
const char  value[] 
)

Definition at line 524 of file SkPDFTypes.cpp.

524 {
525 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::TextString(value));
526}
static SkPDFUnion TextString(const char *)
Definition: SkPDFTypes.cpp:336

◆ insertTextString() [2/2]

void SkPDFDict::insertTextString ( const char  key[],
SkString  value 
)

Definition at line 532 of file SkPDFTypes.cpp.

532 {
533 fRecords.emplace_back(SkPDFUnion::Name(key), SkPDFUnion::TextString(std::move(value)));
534}

◆ insertUnion()

void SkPDFDict::insertUnion ( const char  key[],
SkPDFUnion &&  value 
)

Definition at line 536 of file SkPDFTypes.cpp.

536 {
537 fRecords.emplace_back(SkPDFUnion::Name(key), std::move(value));
538}

◆ reserve()

void SkPDFDict::reserve ( int  n)

Preallocate space for n key-value pairs

Definition at line 472 of file SkPDFTypes.cpp.

472 {
473 fRecords.reserve(n);
474}

◆ size()

size_t SkPDFDict::size ( ) const

The size of the dictionary.

Definition at line 470 of file SkPDFTypes.cpp.

470{ return fRecords.size(); }

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