Loading...
Searching...
No Matches
Magick::Blob Class Reference
Inheritance diagram for Magick::Blob:

## 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.

{
MallocAllocator,
NewAllocator
};

## Constructor & Destructor Documentation

## Blob() [1/3]

Magick::Blob::Blob | ( | void |  | ) |

Definition at line 21 of file Blob.cpp.

: _blobRef(new Magick::BlobRef(0,0))
{
}

## Blob() [2/3]

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

Definition at line 26 of file Blob.cpp.

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

## Blob() [3/3]

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

Definition at line 31 of file Blob.cpp.

: _blobRef(blob_._blobRef)
{
// Increase reference count
_blobRef->increase();
}

## ~Blob()

Magick::Blob::~Blob | ( |  | ) |

virtual

Definition at line 38 of file Blob.cpp.

{
try
{
if (_blobRef->decrease() == 0)
delete _blobRef;
}
catch(Magick::Exception&)
{
}
_blobRef=(Magick::BlobRef *) NULL;
}

## Member Function Documentation

## base64() [1/2]

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

Definition at line 65 of file Blob.cpp.

{
size_t
length;
unsigned char
*decoded;
decoded=Base64Decode(base64_.c_str(),&length);
if(decoded)
updateNoCopy(static_cast<void*>(decoded),length,
Magick::Blob::MallocAllocator);
}

## base64() [2/2]

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

Definition at line 80 of file Blob.cpp.

{
size_t
encoded_length;
char
*encoded;
std::string
result;
encoded_length=0;
encoded=Base64Encode(static_cast<const unsigned char*>(data()),length(),
&encoded_length);
if(encoded)
{
result=std::string(encoded,encoded_length);
encoded=(char *) RelinquishMagickMemory(encoded);
return result;
}
return(std::string());
}

## data()

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

Definition at line 105 of file Blob.cpp.

{
return(_blobRef->data);
}

## length()

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

Definition at line 110 of file Blob.cpp.

{
return(_blobRef->length);
}

## operator=()

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

Definition at line 52 of file Blob.cpp.

{
if (this != &blob_)
{
blob_._blobRef->increase();
if (_blobRef->decrease() == 0)
delete _blobRef;
_blobRef=blob_._blobRef;
}
return(*this);
}

## update()

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

Definition at line 115 of file Blob.cpp.

{
if (_blobRef->decrease() == 0)
delete _blobRef;
_blobRef=new Magick::BlobRef(data_,length_);
}

## updateNoCopy()

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

Definition at line 123 of file Blob.cpp.

{
if (_blobRef->decrease() == 0)
delete _blobRef;
_blobRef=new Magick::BlobRef((const void*) NULL,0);
_blobRef->data=data_;
_blobRef->length=length_;
_blobRef->allocator=allocator_;
}

## 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:

- Blob.h
- Blob.cpp