- Main Page
- Related Pages
- Classes
- Files
- Examples

- File List
- File Members

# skype-binary.h

Go to the documentation of this file.

    00001
    00002 #ifndef __SKYPE_BINARY_H
    00003 #define __SKYPE_BINARY_H
    00004
    00005 #include <stdlib.h> //size_t
    00006 #include <string.h>
    00007
    00008 /*! \class SEBinary skype-binary.h "skype-binary.h"
    00009  *  \brief SEBinary Represents a BLOB. This used, for example, for avatar images.
    00010  */
    00011 class SEBinary
    00012 {
    00013 public:
    00014         SEBinary() : ref(0), buffer(0), len(0) {}
    00015         SEBinary(const SEBinary &b) : ref(0), buffer(0), len(0) {
    00016                 set(b.buffer, b.len);
    00017         }
    00018         SEBinary(unsigned char * buf, size_t length) : ref(0), buffer(0), len(0) {
    00019                 set(buf, length);
    00020         }
    00021         SEBinary(char * buf, size_t length) : ref(0), buffer(0), len(0) {
    00022                 set(buf, length);
    00023         }
    00024         ~SEBinary() {
    00025                 free(buffer);
    00026         }
    00027         void set(const void *buf, size_t new_size);
    00028         void resize(size_t new_size);
    00029         void reserve(size_t new_size) {
    00030                 resize (new_size);
    00031         }
    00032         void set_at_offset(unsigned int offset, const void *buf, size_t new_size);
    00033         size_t getSize() const {
    00034                 return len;
    00035         }
    00036         size_t size() const {
    00037                 return len;
    00038         }
    00039         operator const char *(void) const {
    00040                 return (const char *)buffer;
    00041         }
    00042         const char *data(void) const {
    00043                 return (const char *)buffer;
    00044         }
    00045         char *data(void) {
    00046                 return (char *)buffer;
    00047         }
    00048         operator char *(void) {
    00049                 return (char *)buffer;
    00050         }
    00051         bool operator ==(const SEBinary &b) const;
    00052         bool operator !=(const SEBinary &b) const {
    00053                 return !operator==(b);
    00054         }
    00055         const SEBinary & operator=(const SEBinary &b);
    00056 private:
    00057         unsigned int ref;
    00058         unsigned char* buffer;
    00059         size_t len;
    00060 };
    00061
    00062 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

(c) Skype Technologies S.A. Confidential/Proprietary

Last updated: Fri Mar 16 2012