Skip to content
This repository
tree: 359e374ef1
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (30 sloc) 1.001 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#ifndef NODE_TAGLIB_BUFFERSTREAM_H
#define NODE_TAGLIB_BUFFERSTREAM_H

#include <node.h>

#include <taglib.h>
#include <tstring.h>
#include <tiostream.h>

namespace node_taglib {
class BufferStream : public TagLib::IOStream {
public:
    BufferStream(v8::Handle<v8::Object> buffer);

    ~BufferStream();

    TagLib::FileName name() const { return TagLib::String::null.toCString(); }

    TagLib::ByteVector readBlock(TagLib::ulong length);
    void writeBlock(const TagLib::ByteVector &data);
    void insert(const TagLib::ByteVector &data, TagLib::ulong start=0, TagLib::ulong replace=0);
    void removeBlock(TagLib::ulong start=0, TagLib::ulong length=0);
    bool readOnly() const { return true; }
    bool isOpen() const { return true; }
    void seek(long offset, TagLib::IOStream::Position p=TagLib::IOStream::Beginning);
    void clear();
    long tell() const;
    long length();
    void truncate(long length);

private:
    char *m_data;
    long m_length;
    long m_offset;
};
}
#endif
Something went wrong with that request. Please try again.