Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:11:37

0001 // This may look like C code, but it is really -*- C++ -*-
0002 //
0003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
0004 //
0005 // Copyright @ 2015 ImageMagick Studio LLC, a non-profit organization
0006 // dedicated to making software imaging solutions freely available.
0007 //
0008 // Reference counted container class for Binary Large Objects (BLOBs)
0009 //
0010 
0011 #if !defined(Magick_BlobRef_header)
0012 #define Magick_BlobRef_header
0013 
0014 #include "Magick++/Include.h"
0015 #include <string>
0016 
0017 namespace Magick
0018 {
0019   // Forward decl
0020   class BlobRef;
0021 
0022   class MagickPPExport Blob
0023   {
0024   public:
0025 
0026     enum Allocator
0027     {
0028       MallocAllocator,
0029       NewAllocator
0030     };
0031 
0032     // Default constructor
0033     Blob(void);
0034 
0035     // Construct object with data, making a copy of the supplied data.
0036     Blob(const void* data_,const size_t length_);
0037 
0038     // Copy constructor (reference counted)
0039     Blob(const Blob& blob_);
0040 
0041     // Destructor (reference counted)
0042     virtual ~Blob();
0043 
0044     // Assignment operator (reference counted)
0045     Blob& operator=(const Blob& blob_);
0046 
0047     // Update object contents from Base64-encoded string representation.
0048     void base64(const std::string base64_);
0049     // Return Base64-encoded string representation.
0050     std::string base64(void) const;
0051 
0052     // Obtain pointer to data. The user should never try to modify or
0053     // free this data since the Blob class manages its own data. The
0054     // user must be finished with the data before allowing the Blob to
0055     // be destroyed since the pointer is invalid once the Blob is
0056     // destroyed.
0057     const void* data(void) const;
0058 
0059     // Obtain data length.
0060     size_t length(void) const;
0061 
0062     // Update object contents, making a copy of the supplied data.
0063     // Any existing data in the object is deallocated.
0064     void update(const void* data_,const size_t length_);
0065 
0066     // Update object contents, using supplied pointer directly (no
0067     // copy). Any existing data in the object is deallocated.  The user
0068     // must ensure that the pointer supplied is not deleted or
0069     // otherwise modified after it has been supplied to this method.
0070     // Specify allocator_ as "MallocAllocator" if memory is allocated
0071     // via the C language malloc() function, or "NewAllocator" if
0072     // memory is allocated via C++ 'new'.
0073     void updateNoCopy(void* data_,const size_t length_,
0074       const Allocator allocator_=NewAllocator);
0075 
0076   private:
0077     BlobRef *_blobRef;
0078   };
0079 
0080 } // namespace Magick
0081 
0082 #endif // Magick_BlobRef_header