Magick++ 7.1.2-32
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
Magick::Blob Class Reference
Inheritance diagram for Magick::Blob:
myBlob

Public Types

enum  Allocator { MallocAllocator , NewAllocator }

Public Member Functions

 Blob (const void *data_, const size_t length_)
 Blob (const Blob &blob_)
Blob & operator= (const Blob &blob_)
void base64 (const std::string base64_)
std::string base64 (void) const
const void * data (void) const
size_t length (void) const
void update (const void *data_, size_t length_)
void updateNoCopy (void *data_, size_t length_, Allocator allocator_=NewAllocator)

Private Attributes

BlobRef_blobRef

Detailed Description

Definition at line 22 of file Blob.h.

Member Enumeration Documentation

◆ Allocator

enum Magick::Blob::Allocator

Definition at line 26 of file Blob.h.

27 {
28 MallocAllocator,
29 NewAllocator
30 };

Constructor & Destructor Documentation

◆ Blob() [1/3]

Magick::Blob::Blob ( void )

Definition at line 19 of file Blob.cpp.

20 : _blobRef(new Magick::BlobRef(0,0))
21{
22}

◆ Blob() [2/3]

Magick::Blob::Blob ( const void * data_,
const size_t length_ )

Definition at line 24 of file Blob.cpp.

25 : _blobRef(new Magick::BlobRef(data_, length_))
26{
27}

◆ Blob() [3/3]

Magick::Blob::Blob ( const Blob & blob_)

Definition at line 29 of file Blob.cpp.

30 : _blobRef(blob_._blobRef)
31{
32 // Increase reference count
33 _blobRef->increase();
34}

◆ ~Blob()

Magick::Blob::~Blob ( )
virtual

Definition at line 36 of file Blob.cpp.

37{
38 try
39 {
40 if (_blobRef->decrease() == 0)
41 delete _blobRef;
42 }
43 catch(Magick::Exception&)
44 {
45 }
46
47 _blobRef=(Magick::BlobRef *) NULL;
48}

Member Function Documentation

◆ base64() [1/2]

void Magick::Blob::base64 ( const std::string base64_)

Definition at line 63 of file Blob.cpp.

64{
65 size_t
66 length;
67
68 unsigned char
69 *decoded;
70
71 decoded=Base64Decode(base64_.c_str(),&length);
72
73 if(decoded)
74 updateNoCopy(static_cast<void*>(decoded),length,
75 Magick::Blob::MallocAllocator);
76}

◆ base64() [2/2]

std::string Magick::Blob::base64 ( void ) const

Definition at line 78 of file Blob.cpp.

79{
80 size_t
81 encoded_length;
82
83 char
84 *encoded;
85
86 std::string
87 result;
88
89 encoded_length=0;
90 encoded=Base64Encode(static_cast<const unsigned char*>(data()),length(),
91 &encoded_length);
92
93 if(encoded)
94 {
95 result=std::string(encoded,encoded_length);
96 encoded=(char *) RelinquishMagickMemory(encoded);
97 return result;
98 }
99
100 return(std::string());
101}

◆ data()

const void * Magick::Blob::data ( void ) const

Definition at line 103 of file Blob.cpp.

104{
105 return(_blobRef->data);
106}

◆ length()

size_t Magick::Blob::length ( void ) const

Definition at line 108 of file Blob.cpp.

109{
110 return(_blobRef->length);
111}

◆ operator=()

Magick::Blob & Magick::Blob::operator= ( const Blob & blob_)

Definition at line 50 of file Blob.cpp.

51{
52 if (this != &blob_)
53 {
54 blob_._blobRef->increase();
55 if (_blobRef->decrease() == 0)
56 delete _blobRef;
57
58 _blobRef=blob_._blobRef;
59 }
60 return(*this);
61}

◆ update()

void Magick::Blob::update ( const void * data_,
size_t length_ )

Definition at line 113 of file Blob.cpp.

114{
115 if (_blobRef->decrease() == 0)
116 delete _blobRef;
117
118 _blobRef=new Magick::BlobRef(data_,length_);
119}

◆ updateNoCopy()

void Magick::Blob::updateNoCopy ( void * data_,
size_t length_,
Allocator allocator_ = NewAllocator )

Definition at line 121 of file Blob.cpp.

123{
124 if (_blobRef->decrease() == 0)
125 delete _blobRef;
126
127 _blobRef=new Magick::BlobRef((const void*) NULL,0);
128 _blobRef->data=data_;
129 _blobRef->length=length_;
130 _blobRef->allocator=allocator_;
131}

Field Documentation

◆ _blobRef

BlobRef* Magick::Blob::_blobRef
private

Definition at line 77 of file Blob.h.


The documentation for this class was generated from the following files:
  • /home/cristy/Attic/Build/ImageMagick-7.1.2/rpmbuild/BUILD/ImageMagick-7.1.2-build/ImageMagick-7.1.2-32/Magick++/lib/Magick++/Blob.h
  • /home/cristy/Attic/Build/ImageMagick-7.1.2/rpmbuild/BUILD/ImageMagick-7.1.2-build/ImageMagick-7.1.2-32/Magick++/lib/Blob.cpp