#ifndef Uint8Array_h
#define Uint8Array_h
#include "wtf/IntegralTypedArrayBase.h"
namespace WTF {
class ArrayBuffer;
class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
public:
static inline PassRefPtr<Uint8Array> create(unsigned length);
static inline PassRefPtr<Uint8Array> create(const unsigned char* array, unsigned length);
static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
static inline PassRefPtr<Uint8Array> createUninitialized(unsigned length);
using TypedArrayBase<unsigned char>::set;
using IntegralTypedArrayBase<unsigned char>::set;
inline PassRefPtr<Uint8Array> subarray(int start) const;
inline PassRefPtr<Uint8Array> subarray(int start, int end) const;
virtual ViewType type() const OVERRIDE
{
return TypeUint8;
}
protected:
inline Uint8Array(PassRefPtr<ArrayBuffer>,
unsigned byteOffset,
unsigned length);
friend class TypedArrayBase<unsigned char>;
};
PassRefPtr<Uint8Array> Uint8Array::create(unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(length);
}
PassRefPtr<Uint8Array> Uint8Array::create(const unsigned char* array, unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(array, length);
}
PassRefPtr<Uint8Array> Uint8Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(buffer, byteOffset, length);
}
PassRefPtr<Uint8Array> Uint8Array::createUninitialized(unsigned length)
{
return TypedArrayBase<unsigned char>::createUninitialized<Uint8Array>(length);
}
Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<unsigned char>(buffer, byteOffset, length)
{
}
PassRefPtr<Uint8Array> Uint8Array::subarray(int start) const
{
return subarray(start, length());
}
PassRefPtr<Uint8Array> Uint8Array::subarray(int start, int end) const
{
return subarrayImpl<Uint8Array>(start, end);
}
}
using WTF::Uint8Array;
#endif