![]() |
![]() |
![]() |
00001 // This may look like C code, but it is really -*- C++ -*- 00002 // 00003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 00004 // 00005 // Reference counted container class for Binary Large Objects (BLOBs) 00006 // 00007 00008 #if !defined(Magick_BlobRef_header) 00009 #define Magick_BlobRef_header 00010 00011 #include "Magick++/Include.h" 00012 #include <string> 00013 00014 namespace Magick 00015 { 00016 // Forward decl 00017 class BlobRef; 00018 00019 class MagickDLLDecl Blob 00020 { 00021 00022 public: 00023 00024 enum Allocator 00025 { 00026 MallocAllocator, 00027 NewAllocator 00028 }; 00029 00030 // Default constructor 00031 Blob ( void ); 00032 00033 // Construct object with data, making a copy of the supplied data. 00034 Blob ( const void* data_, size_t length_ ); 00035 00036 // Copy constructor (reference counted) 00037 Blob ( const Blob& blob_ ); 00038 00039 // Destructor (reference counted) 00040 virtual ~Blob (); 00041 00042 // Assignment operator (reference counted) 00043 Blob& operator= ( const Blob& blob_ ); 00044 00045 // Update object contents from Base64-encoded string representation. 00046 void base64 ( const std::string base64_ ); 00047 // Return Base64-encoded string representation. 00048 std::string base64 ( void ); 00049 00050 // Update object contents, making a copy of the supplied data. 00051 // Any existing data in the object is deallocated. 00052 void update ( const void* data_, size_t length_ ); 00053 00054 // Update object contents, using supplied pointer directly (no 00055 // copy). Any existing data in the object is deallocated. The user 00056 // must ensure that the pointer supplied is not deleted or 00057 // otherwise modified after it has been supplied to this method. 00058 // Specify allocator_ as "MallocAllocator" if memory is allocated 00059 // via the C language malloc() function, or "NewAllocator" if 00060 // memory is allocated via C++ 'new'. 00061 void updateNoCopy ( void* data_, size_t length_, 00062 Allocator allocator_ = NewAllocator ); 00063 00064 // Obtain pointer to data. The user should never try to modify or 00065 // free this data since the Blob class manages its own data. The 00066 // user must be finished with the data before allowing the Blob to 00067 // be destroyed since the pointer is invalid once the Blob is 00068 // destroyed. 00069 const void* data ( void ) const; 00070 00071 // Obtain data length 00072 size_t length ( void ) const; 00073 00074 protected: 00075 00076 private: 00077 BlobRef * _blobRef; 00078 }; 00079 00080 } // namespace Magick 00081 00082 #endif // Magick_BlobRef_header
1.3.7
ImageMagick Copyright © 2004, ImageMagick Studio LLC