mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-08-18 12:52:53 -04:00
clean up and format code
This commit is contained in:
@@ -7,26 +7,30 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUFileInputStream : public JSURandomInputStream {
|
||||
public:
|
||||
JSUFileInputStream(JKRFile* file);
|
||||
public:
|
||||
JSUFileInputStream(JKRFile* file);
|
||||
|
||||
virtual int readData(void* buf, s32 len);
|
||||
virtual int getLength() const { return ((JKRFile*)this->mObject)->getFileSize(); }
|
||||
virtual int getPosition() const { return this->mPosition; }
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from);
|
||||
virtual int readData(void* buf, s32 len);
|
||||
virtual int getLength() const {
|
||||
return ((JKRFile*)this->mObject)->getFileSize();
|
||||
}
|
||||
virtual int getPosition() const {
|
||||
return this->mPosition;
|
||||
}
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from);
|
||||
|
||||
/* These two functions are shown in the symbol map, but are unused. */
|
||||
// bool open(const char* path);
|
||||
// bool close();
|
||||
|
||||
protected:
|
||||
const void* mObject;
|
||||
s32 mPosition;
|
||||
/* These two functions are shown in the symbol map, but are unused. */
|
||||
// bool open(const char* path);
|
||||
// bool close();
|
||||
|
||||
protected:
|
||||
const void* mObject;
|
||||
s32 mPosition;
|
||||
};
|
||||
|
||||
class JSUFileOutputStream : public JSURandomOutputStream {
|
||||
public:
|
||||
JSUFileOutputStream(JKRFile *);
|
||||
public:
|
||||
JSUFileOutputStream(JKRFile*);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,114 +6,132 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUInputStream : public JSUIosBase {
|
||||
public:
|
||||
virtual ~JSUInputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
public:
|
||||
virtual ~JSUInputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
|
||||
int read(void* buf, s32 size);
|
||||
char* read(char* buf);
|
||||
char* readString();
|
||||
char* readString(char* buf, u16 len);
|
||||
int read(void* buf, s32 size);
|
||||
char* read(char* buf);
|
||||
char* readString();
|
||||
char* readString(char* buf, u16 len);
|
||||
|
||||
int read(s8& p) { return this->read(&p, sizeof(s8)); } /* @fabricated */
|
||||
int read(u8& p) { return this->read(&p, sizeof(u8)); }
|
||||
int read(bool& p) { return this->read(&p, sizeof(bool)); }
|
||||
int read(s16& p) { return this->read(&p, sizeof(s16)); } /* @fabricated */
|
||||
int read(u16& p) { return this->read(&p, sizeof(u16)); } /* @fabricated */
|
||||
int read(s32& p) { return this->read(&p, sizeof(s32)); } /* @fabricated */
|
||||
int read(u32& p) { return this->read(&p, sizeof(u32)); }
|
||||
int read(s64& p) { return this->read(&p, sizeof(s64)); } /* @fabricated */
|
||||
int read(u64& p) { return this->read(&p, sizeof(u64)); } /* @fabricated */
|
||||
int read(s8& p) {
|
||||
return this->read(&p, sizeof(s8));
|
||||
} /* @fabricated */
|
||||
int read(u8& p) {
|
||||
return this->read(&p, sizeof(u8));
|
||||
}
|
||||
int read(bool& p) {
|
||||
return this->read(&p, sizeof(bool));
|
||||
}
|
||||
int read(s16& p) {
|
||||
return this->read(&p, sizeof(s16));
|
||||
} /* @fabricated */
|
||||
int read(u16& p) {
|
||||
return this->read(&p, sizeof(u16));
|
||||
} /* @fabricated */
|
||||
int read(s32& p) {
|
||||
return this->read(&p, sizeof(s32));
|
||||
} /* @fabricated */
|
||||
int read(u32& p) {
|
||||
return this->read(&p, sizeof(u32));
|
||||
}
|
||||
int read(s64& p) {
|
||||
return this->read(&p, sizeof(s64));
|
||||
} /* @fabricated */
|
||||
int read(u64& p) {
|
||||
return this->read(&p, sizeof(u64));
|
||||
} /* @fabricated */
|
||||
|
||||
u8 read8b() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
u8 read8b() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
|
||||
u16 read16b() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
u16 read16b() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
|
||||
u32 read32b() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
u32 read32b() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
|
||||
/* @fabricated */
|
||||
s8 readS8() {
|
||||
s8 b;
|
||||
this->read(&b, sizeof(s8));
|
||||
return b;
|
||||
}
|
||||
/* @fabricated */
|
||||
s8 readS8() {
|
||||
s8 b;
|
||||
this->read(&b, sizeof(s8));
|
||||
return b;
|
||||
}
|
||||
|
||||
u8 readU8() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
u8 readU8() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
|
||||
s16 readS16() {
|
||||
s16 s;
|
||||
this->read(&s, sizeof(s16));
|
||||
return s;
|
||||
}
|
||||
s16 readS16() {
|
||||
s16 s;
|
||||
this->read(&s, sizeof(s16));
|
||||
return s;
|
||||
}
|
||||
|
||||
u16 readU16() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
u16 readU16() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
|
||||
s32 readS32() {
|
||||
s32 i;
|
||||
this->read(&i, sizeof(s32));
|
||||
return i;
|
||||
}
|
||||
s32 readS32() {
|
||||
s32 i;
|
||||
this->read(&i, sizeof(s32));
|
||||
return i;
|
||||
}
|
||||
|
||||
u32 readU32() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
u32 readU32() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(s8& p) {
|
||||
this->read(&p, sizeof(s8));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(s8& p) {
|
||||
this->read(&p, sizeof(s8));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u8& p) {
|
||||
this->read(&p, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u8& p) {
|
||||
this->read(&p, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(s16& p) {
|
||||
this->read(&p, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(s16& p) {
|
||||
this->read(&p, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u16& p) {
|
||||
this->read(&p, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u16& p) {
|
||||
this->read(&p, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u32& p) {
|
||||
this->read(&p, sizeof(u32));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u32& p) {
|
||||
this->read(&p, sizeof(u32));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class JSUOutputStream : protected JSUIosBase {
|
||||
public:
|
||||
virtual ~JSUOutputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
public:
|
||||
virtual ~JSUOutputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,16 +6,24 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUIosBase {
|
||||
public:
|
||||
inline JSUIosBase() : mState(GOOD) { }
|
||||
public:
|
||||
inline JSUIosBase() : mState(GOOD) {
|
||||
}
|
||||
|
||||
virtual ~JSUIosBase() { }
|
||||
virtual ~JSUIosBase() {
|
||||
}
|
||||
|
||||
bool isGood() { return !this->mState; }
|
||||
void clrState(EIoState ioState) { this->mState &= ~ioState; }
|
||||
void setState(EIoState ioState) { this->mState |= ioState; }
|
||||
bool isGood() {
|
||||
return !this->mState;
|
||||
}
|
||||
void clrState(EIoState ioState) {
|
||||
this->mState &= ~ioState;
|
||||
}
|
||||
void setState(EIoState ioState) {
|
||||
this->mState |= ioState;
|
||||
}
|
||||
|
||||
u8 mState;
|
||||
u8 mState;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
+184
-125
@@ -5,11 +5,9 @@
|
||||
|
||||
class JSUPtrLink;
|
||||
|
||||
class JSUPtrList
|
||||
{
|
||||
public:
|
||||
JSUPtrList()
|
||||
{
|
||||
class JSUPtrList {
|
||||
public:
|
||||
JSUPtrList() {
|
||||
initiate();
|
||||
}
|
||||
|
||||
@@ -17,207 +15,268 @@ public:
|
||||
~JSUPtrList();
|
||||
|
||||
void initiate();
|
||||
void setFirst(JSUPtrLink *);
|
||||
bool append(JSUPtrLink *);
|
||||
bool prepend(JSUPtrLink *);
|
||||
bool insert(JSUPtrLink *, JSUPtrLink *);
|
||||
bool remove(JSUPtrLink *);
|
||||
JSUPtrLink *getNthLink(u32 idx) const;
|
||||
void setFirst(JSUPtrLink*);
|
||||
bool append(JSUPtrLink*);
|
||||
bool prepend(JSUPtrLink*);
|
||||
bool insert(JSUPtrLink*, JSUPtrLink*);
|
||||
bool remove(JSUPtrLink*);
|
||||
JSUPtrLink* getNthLink(u32 idx) const;
|
||||
|
||||
JSUPtrLink *getFirstLink() const { return mHead; }
|
||||
JSUPtrLink *getLastLink() const { return mTail; }
|
||||
u32 getNumLinks() const { return mLinkCount; }
|
||||
JSUPtrLink* getFirstLink() const {
|
||||
return mHead;
|
||||
}
|
||||
JSUPtrLink* getLastLink() const {
|
||||
return mTail;
|
||||
}
|
||||
u32 getNumLinks() const {
|
||||
return mLinkCount;
|
||||
}
|
||||
|
||||
JSUPtrLink *mHead; // _0
|
||||
JSUPtrLink *mTail; // _4
|
||||
JSUPtrLink* mHead; // _0
|
||||
JSUPtrLink* mTail; // _4
|
||||
u32 mLinkCount; // _8
|
||||
};
|
||||
|
||||
class JSUPtrLink
|
||||
{
|
||||
public:
|
||||
JSUPtrLink(void *);
|
||||
class JSUPtrLink {
|
||||
public:
|
||||
JSUPtrLink(void*);
|
||||
~JSUPtrLink();
|
||||
|
||||
void *getObjectPtr() const { return mData; }
|
||||
JSUPtrList *getList() const { return mPtrList; }
|
||||
JSUPtrLink *getNext() const { return mNext; }
|
||||
JSUPtrLink *getPrev() const { return mPrev; }
|
||||
void* getObjectPtr() const {
|
||||
return mData;
|
||||
}
|
||||
JSUPtrList* getList() const {
|
||||
return mPtrList;
|
||||
}
|
||||
JSUPtrLink* getNext() const {
|
||||
return mNext;
|
||||
}
|
||||
JSUPtrLink* getPrev() const {
|
||||
return mPrev;
|
||||
}
|
||||
|
||||
void *mData; // _0
|
||||
JSUPtrList *mPtrList; // _4
|
||||
JSUPtrLink *mPrev; // _8
|
||||
JSUPtrLink *mNext; // _C
|
||||
void* mData; // _0
|
||||
JSUPtrList* mPtrList; // _4
|
||||
JSUPtrLink* mPrev; // _8
|
||||
JSUPtrLink* mNext; // _C
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class JSULink; // friend class? i'm C++ noob
|
||||
template <class T> class JSULink; // friend class? i'm C++ noob
|
||||
|
||||
template <class T>
|
||||
class JSUList : public JSUPtrList
|
||||
{
|
||||
public:
|
||||
JSUList(bool thing) : JSUPtrList(thing)
|
||||
{
|
||||
template <class T> class JSUList : public JSUPtrList {
|
||||
public:
|
||||
JSUList(bool thing) : JSUPtrList(thing) {
|
||||
}
|
||||
JSUList() : JSUPtrList()
|
||||
{
|
||||
JSUList() : JSUPtrList() {
|
||||
}
|
||||
|
||||
bool append(JSULink<T> *link) { return JSUPtrList::append((JSUPtrLink *)link); }
|
||||
bool prepend(JSULink<T> *link) { return JSUPtrList::prepend((JSUPtrLink *)link); }
|
||||
bool insert(JSULink<T> *before, JSULink<T> *link) { return JSUPtrList::insert((JSUPtrLink *)before, (JSUPtrLink *)link); }
|
||||
bool remove(JSULink<T> *link) { return JSUPtrList::remove((JSUPtrLink *)link); }
|
||||
bool append(JSULink<T>* link) {
|
||||
return JSUPtrList::append((JSUPtrLink*)link);
|
||||
}
|
||||
bool prepend(JSULink<T>* link) {
|
||||
return JSUPtrList::prepend((JSUPtrLink*)link);
|
||||
}
|
||||
bool insert(JSULink<T>* before, JSULink<T>* link) {
|
||||
return JSUPtrList::insert((JSUPtrLink*)before, (JSUPtrLink*)link);
|
||||
}
|
||||
bool remove(JSULink<T>* link) {
|
||||
return JSUPtrList::remove((JSUPtrLink*)link);
|
||||
}
|
||||
|
||||
JSULink<T> *getFirst() const { return (JSULink<T> *)getFirstLink(); }
|
||||
JSULink<T> *getLast() const { return (JSULink<T> *)getLastLink(); }
|
||||
JSULink<T> *getEnd() const { return nullptr; }
|
||||
JSULink<T>* getFirst() const {
|
||||
return (JSULink<T>*)getFirstLink();
|
||||
}
|
||||
JSULink<T>* getLast() const {
|
||||
return (JSULink<T>*)getLastLink();
|
||||
}
|
||||
JSULink<T>* getEnd() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u32 getNumLinks() const { return mLinkCount; }
|
||||
u32 getNumLinks() const {
|
||||
return mLinkCount;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSUListIterator
|
||||
{
|
||||
public:
|
||||
JSUListIterator()
|
||||
: mLink(nullptr)
|
||||
{
|
||||
template <typename T> class JSUListIterator {
|
||||
public:
|
||||
JSUListIterator() : mLink(nullptr) {
|
||||
}
|
||||
JSUListIterator(JSULink<T> *link)
|
||||
: mLink(link)
|
||||
{
|
||||
JSUListIterator(JSULink<T>* link) : mLink(link) {
|
||||
}
|
||||
JSUListIterator(JSUList<T> *list)
|
||||
: mLink(list->getFirst())
|
||||
{
|
||||
JSUListIterator(JSUList<T>* list) : mLink(list->getFirst()) {
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator=(JSULink<T> *link)
|
||||
{
|
||||
JSUListIterator<T>& operator=(JSULink<T>* link) {
|
||||
this->mLink = link;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T *getObject() { return this->mLink->getObject(); }
|
||||
T* getObject() {
|
||||
return this->mLink->getObject();
|
||||
}
|
||||
|
||||
bool operator==(JSULink<T> const *other) const { return this->mLink == other; }
|
||||
bool operator!=(JSULink<T> const *other) const { return this->mLink != other; }
|
||||
bool operator==(JSUListIterator<T> const &other) const { return this->mLink == other.mLink; }
|
||||
bool operator!=(JSUListIterator<T> const &other) const { return this->mLink != other.mLink; }
|
||||
bool operator==(JSULink<T> const* other) const {
|
||||
return this->mLink == other;
|
||||
}
|
||||
bool operator!=(JSULink<T> const* other) const {
|
||||
return this->mLink != other;
|
||||
}
|
||||
bool operator==(JSUListIterator<T> const& other) const {
|
||||
return this->mLink == other.mLink;
|
||||
}
|
||||
bool operator!=(JSUListIterator<T> const& other) const {
|
||||
return this->mLink != other.mLink;
|
||||
}
|
||||
|
||||
JSUListIterator<T> operator++(int)
|
||||
{
|
||||
JSUListIterator<T> operator++(int) {
|
||||
JSUListIterator<T> prev = *this;
|
||||
this->mLink = this->mLink->getNext();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator++()
|
||||
{
|
||||
JSUListIterator<T>& operator++() {
|
||||
this->mLink = this->mLink->getNext();
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUListIterator<T> operator--(int)
|
||||
{
|
||||
JSUListIterator<T> operator--(int) {
|
||||
JSUListIterator<T> prev = *this;
|
||||
this->mLink = this->mLink->getPrev();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator--()
|
||||
{
|
||||
JSUListIterator<T>& operator--() {
|
||||
this->mLink = this->mLink->getPrev();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T &operator*() { return *this->getObject(); }
|
||||
T& operator*() {
|
||||
return *this->getObject();
|
||||
}
|
||||
|
||||
T *operator->() { return this->getObject(); }
|
||||
T* operator->() {
|
||||
return this->getObject();
|
||||
}
|
||||
|
||||
// private:
|
||||
JSULink<T> *mLink;
|
||||
JSULink<T>* mLink;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class JSULink : public JSUPtrLink
|
||||
{
|
||||
public:
|
||||
JSULink(void *pData) : JSUPtrLink(pData)
|
||||
{
|
||||
template <class T> class JSULink : public JSUPtrLink {
|
||||
public:
|
||||
JSULink(void* pData) : JSUPtrLink(pData) {
|
||||
}
|
||||
|
||||
T *getObject() const { return (T *)mData; }
|
||||
JSUList<T> *getList() const { return (JSUList<T> *)JSUPtrLink::getList(); } // fabricated, offcial name: getSupervisor
|
||||
JSULink<T> *getNext() const { return (JSULink<T> *)JSUPtrLink::getNext(); }
|
||||
JSULink<T> *getPrev() const { return (JSULink<T> *)JSUPtrLink::getPrev(); }
|
||||
T* getObject() const {
|
||||
return (T*)mData;
|
||||
}
|
||||
JSUList<T>* getList() const {
|
||||
return (JSUList<T>*)JSUPtrLink::getList();
|
||||
} // fabricated, offcial name: getSupervisor
|
||||
JSULink<T>* getNext() const {
|
||||
return (JSULink<T>*)JSUPtrLink::getNext();
|
||||
}
|
||||
JSULink<T>* getPrev() const {
|
||||
return (JSULink<T>*)JSUPtrLink::getPrev();
|
||||
}
|
||||
|
||||
~JSULink()
|
||||
{
|
||||
~JSULink() {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> // TODO: most of these inlines are probably wrong: rework
|
||||
class JSUTree : public JSUList<T>, public JSULink<T>
|
||||
{
|
||||
public:
|
||||
JSUTree(T *owner) : JSUList<T>(), JSULink<T>(owner) {}
|
||||
~JSUTree() {}
|
||||
class JSUTree : public JSUList<T>, public JSULink<T> {
|
||||
public:
|
||||
JSUTree(T* owner) : JSUList<T>(), JSULink<T>(owner) {
|
||||
}
|
||||
~JSUTree() {
|
||||
}
|
||||
|
||||
bool appendChild(JSUTree<T> *child) { return this->append(child); }
|
||||
bool prependChild(JSUTree<T> *child) { return this->prepend(child); }
|
||||
bool removeChild(JSUTree<T> *child) { return this->remove(child); }
|
||||
bool insertChild(JSUTree<T> *before, JSUTree<T> *child) { return this->insert(before, child); }
|
||||
bool appendChild(JSUTree<T>* child) {
|
||||
return this->append(child);
|
||||
}
|
||||
bool prependChild(JSUTree<T>* child) {
|
||||
return this->prepend(child);
|
||||
}
|
||||
bool removeChild(JSUTree<T>* child) {
|
||||
return this->remove(child);
|
||||
}
|
||||
bool insertChild(JSUTree<T>* before, JSUTree<T>* child) {
|
||||
return this->insert(before, child);
|
||||
}
|
||||
|
||||
JSUTree<T> *getEndChild() const { return nullptr; }
|
||||
JSUTree<T> *getFirstChild() const { return (JSUTree<T> *)this->getFirstLink(); }
|
||||
JSUTree<T> *getLastChild() const { return (JSUTree<T> *)this->getLast(); }
|
||||
JSUTree<T> *getNextChild() const { return (JSUTree<T> *)this->mNext; }
|
||||
JSUTree<T> *getPrevChild() const { return (JSUTree<T> *)this->getPrev(); }
|
||||
u32 getNumChildren() const { return this->mLinkCount; }
|
||||
T *getObject() const { return (T *)this->mData; }
|
||||
JSUTree<T> *getParent() const { return (JSUTree<T> *)this->mPtrList; }
|
||||
JSUTree<T>* getEndChild() const {
|
||||
return nullptr;
|
||||
}
|
||||
JSUTree<T>* getFirstChild() const {
|
||||
return (JSUTree<T>*)this->getFirstLink();
|
||||
}
|
||||
JSUTree<T>* getLastChild() const {
|
||||
return (JSUTree<T>*)this->getLast();
|
||||
}
|
||||
JSUTree<T>* getNextChild() const {
|
||||
return (JSUTree<T>*)this->mNext;
|
||||
}
|
||||
JSUTree<T>* getPrevChild() const {
|
||||
return (JSUTree<T>*)this->getPrev();
|
||||
}
|
||||
u32 getNumChildren() const {
|
||||
return this->mLinkCount;
|
||||
}
|
||||
T* getObject() const {
|
||||
return (T*)this->mData;
|
||||
}
|
||||
JSUTree<T>* getParent() const {
|
||||
return (JSUTree<T>*)this->mPtrList;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSUTreeIterator
|
||||
{
|
||||
public:
|
||||
JSUTreeIterator() : mTree(nullptr) {}
|
||||
JSUTreeIterator(JSUTree<T> *tree) : mTree(tree) {}
|
||||
template <typename T> class JSUTreeIterator {
|
||||
public:
|
||||
JSUTreeIterator() : mTree(nullptr) {
|
||||
}
|
||||
JSUTreeIterator(JSUTree<T>* tree) : mTree(tree) {
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> &operator=(JSUTree<T> *tree)
|
||||
{
|
||||
JSUTreeIterator<T>& operator=(JSUTree<T>* tree) {
|
||||
this->mTree = tree;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T *getObject() const { return mTree->getObject(); }
|
||||
T* getObject() const {
|
||||
return mTree->getObject();
|
||||
}
|
||||
|
||||
bool operator==(JSUTree<T> *other) { return this->mTree == other; }
|
||||
bool operator==(JSUTree<T>* other) {
|
||||
return this->mTree == other;
|
||||
}
|
||||
|
||||
bool operator!=(const JSUTree<T> *other) const { return this->mTree != other; }
|
||||
bool operator!=(const JSUTree<T>* other) const {
|
||||
return this->mTree != other;
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> operator++(int)
|
||||
{
|
||||
JSUTreeIterator<T> operator++(int) {
|
||||
JSUTreeIterator<T> prev = *this;
|
||||
this->mTree = this->mTree->getNextChild();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> &operator++()
|
||||
{
|
||||
JSUTreeIterator<T>& operator++() {
|
||||
this->mTree = this->mTree->getNextChild();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T &operator*() { return *this->getObject(); }
|
||||
T& operator*() {
|
||||
return *this->getObject();
|
||||
}
|
||||
|
||||
T *operator->() const { return mTree->getObject(); }
|
||||
T* operator->() const {
|
||||
return mTree->getObject();
|
||||
}
|
||||
|
||||
private:
|
||||
JSUTree<T> *mTree;
|
||||
private:
|
||||
JSUTree<T>* mTree;
|
||||
};
|
||||
|
||||
#endif /* JSULIST_H */
|
||||
|
||||
@@ -7,35 +7,39 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSURandomInputStream : public JSUInputStream {
|
||||
public:
|
||||
virtual ~JSURandomInputStream() { }
|
||||
public:
|
||||
virtual ~JSURandomInputStream() {
|
||||
}
|
||||
|
||||
virtual int getAvailable() const { return this->getLength() - this->getPosition(); }
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
virtual int getAvailable() const {
|
||||
return this->getLength() - this->getPosition();
|
||||
}
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
};
|
||||
|
||||
class JSURandomOutputStream : public JSUOutputStream {
|
||||
public:
|
||||
virtual ~JSURandomOutputStream() { }
|
||||
public:
|
||||
virtual ~JSURandomOutputStream() {
|
||||
}
|
||||
|
||||
virtual int getAvailable() const;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
virtual int getAvailable() const;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
#ifndef JSUSTREAMENUM_H
|
||||
#define JSUSTREAMENUM_H
|
||||
|
||||
enum JSUStreamSeekFrom {
|
||||
SEEK_SET = 0,
|
||||
SEEK_CUR = 1,
|
||||
SEEK_END = 2
|
||||
};
|
||||
enum JSUStreamSeekFrom { SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2 };
|
||||
|
||||
enum EIoState {
|
||||
GOOD = 0,
|
||||
EOF = 1
|
||||
};
|
||||
enum EIoState { GOOD = 0, EOF = 1 };
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user