apps/elftosb/common/Blob.h
/*
* File: Blob.h
*
* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
* See included license file for license details.
*/
#if !defined(_Blob_h_)
#define _Blob_h_
#include "stdafx.h"
class Blob
{
public:
Blob();
Blob(const uint8_t *data, unsigned length);
Blob(const Blob &other);
virtual ~Blob();
void setData(const uint8_t *data, unsigned length);
void setLength(unsigned length);
void append(const uint8_t *newData, unsigned newDataLength);
void clear();
void relinquish();
uint8_t *getData() { return m_data; }
const uint8_t *getData() const { return m_data; }
unsigned getLength() const { return m_length; }
operator uint8_t *() { return m_data; }
operator const uint8_t *() const { return m_data; }
protected:
uint8_t *m_data;
unsigned m_length;
};
#endif // _Blob_h_
Blob::Blob
Blob()
Default constructor.
Definition: apps/elftosb/common/Blob.cpp:13
Blob::m_length
unsigned m_length
Number of bytes pointed to by m_data.
Definition: apps/elftosb/common/Blob.h:66
Blob::m_data
uint8_t * m_data
The binary data held by this object.
Definition: apps/elftosb/common/Blob.h:65
Blob::~Blob
virtual ~Blob()
Destructor.
Definition: apps/elftosb/common/Blob.cpp:40
Blob::setData
void setData(const uint8_t *data, unsigned length)
Replaces the blob&#39;s data.
Definition: apps/elftosb/common/Blob.cpp:54
Blob::relinquish
void relinquish()
Tell the blob that it no longer owns its data.
Definition: apps/elftosb/common/Blob.cpp:118
Blob::setLength
void setLength(unsigned length)
Change the size of the blob&#39;s data.
Definition: apps/elftosb/common/Blob.cpp:66
Blob::append
void append(const uint8_t *newData, unsigned newDataLength)
Adds data to the end of the blob.
Definition: apps/elftosb/common/Blob.cpp:98
Blob::clear
void clear()
Disposes of the data.
Definition: apps/elftosb/common/Blob.cpp:107
Blob
Manages a binary object of arbitrary length.
Definition: apps/elftosb/common/Blob.h:18