mirror of https://github.com/libAthena/athena.git
Merge branch 'master' of https://github.com/libAthena/athena
This commit is contained in:
commit
8d2fbad265
|
@ -12,21 +12,26 @@ std::ostream& operator<<(std::ostream& os, Endian& endian);
|
|||
class IStream
|
||||
{
|
||||
public:
|
||||
IStream() : m_hasError(false) {}
|
||||
IStream() {}
|
||||
virtual ~IStream() {}
|
||||
|
||||
virtual void setEndian(Endian) = 0;
|
||||
virtual Endian endian() const = 0;
|
||||
virtual bool isBigEndian() const = 0;
|
||||
virtual bool isLittleEndian()const = 0;
|
||||
inline void setEndian(Endian endian) { m_endian = endian; }
|
||||
inline Endian endian() const { return m_endian; }
|
||||
inline bool isBigEndian() const { return (m_endian == Endian::BigEndian); }
|
||||
inline bool isLittleEndian() const { return (m_endian == Endian::LittleEndian); }
|
||||
virtual void seek(atInt64, SeekOrigin) = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
bool hasError() const { return m_hasError; }
|
||||
protected:
|
||||
void setError() { m_hasError = true; }
|
||||
bool m_hasError;
|
||||
bool m_hasError = false;
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
Endian m_endian = BigEndian;
|
||||
#else
|
||||
Endian m_endian = LittleEndian;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,35 +20,6 @@ class IStreamReader : public IStream
|
|||
public:
|
||||
virtual ~IStreamReader() {}
|
||||
|
||||
/** @brief Sets the Endianness of the stream
|
||||
*
|
||||
* @param endian The Endianness to set
|
||||
*/
|
||||
inline void setEndian(Endian endian)
|
||||
{m_endian = endian;}
|
||||
|
||||
/** @brief Returns the current Endianness of the stream
|
||||
*
|
||||
* @return The current Stream Endianness
|
||||
*/
|
||||
inline Endian endian() const
|
||||
{return m_endian;}
|
||||
|
||||
/** @brief Returns whether the stream is BigEndian
|
||||
*
|
||||
* @return bool True for BigEndian; False for LittleEndian
|
||||
*/
|
||||
inline bool isBigEndian() const
|
||||
{return (m_endian == Endian::BigEndian);}
|
||||
|
||||
/** @brief Returns whether the stream is LittleEndian
|
||||
*
|
||||
* @return True for LittleEndian; False for BigEndian
|
||||
*/
|
||||
inline bool isLittleEndian()const
|
||||
{return (m_endian == Endian::LittleEndian);}
|
||||
|
||||
|
||||
/** @brief Sets the buffers position relative to the specified position.<br />
|
||||
* It seeks relative to the current position by default.
|
||||
* @param position where in the buffer to seek
|
||||
|
@ -1255,9 +1226,6 @@ public:
|
|||
readf(*this, vector.back());
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
Endian m_endian;
|
||||
};
|
||||
template <typename T>
|
||||
IStreamReader& operator>>(IStreamReader& lhs, T& rhs)
|
||||
|
|
|
@ -13,34 +13,6 @@ class IStreamWriter : public IStream
|
|||
{
|
||||
public:
|
||||
virtual ~IStreamWriter() {}
|
||||
/** @brief Sets the Endianness of the stream
|
||||
*
|
||||
* @param endian The Endianness to set
|
||||
*/
|
||||
inline void setEndian(Endian endian)
|
||||
{m_endian = endian;}
|
||||
|
||||
/** @brief Returns the current Endianness of the stream
|
||||
*
|
||||
* @return The current Stream Endianness
|
||||
*/
|
||||
inline Endian endian() const
|
||||
{return m_endian;}
|
||||
|
||||
/** @brief Returns whether the stream is BigEndian
|
||||
*
|
||||
* @return True for BigEndian; False for LittleEndian
|
||||
*/
|
||||
inline bool isBigEndian() const
|
||||
{return (m_endian == Endian::BigEndian);}
|
||||
|
||||
/** @brief Returns whether the stream is LittleEndian
|
||||
*
|
||||
* @return True for LittleEndian; False for BigEndian
|
||||
*/
|
||||
inline bool isLittleEndian() const
|
||||
{return (m_endian == Endian::LittleEndian);}
|
||||
|
||||
/** @brief Sets the buffers position relative to the specified position.<br />
|
||||
* It seeks relative to the current position by default.
|
||||
* @param position where in the buffer to seek
|
||||
|
@ -1106,9 +1078,6 @@ public:
|
|||
for (const T& item : vector)
|
||||
item.write(*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
Endian m_endian;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -47,9 +47,9 @@ public:
|
|||
inline atUint64 position() const
|
||||
{return m_position;}
|
||||
|
||||
/*! @brief Returns whether or not the stream is at the end.
|
||||
/*! @brief Returns the length of the stream.
|
||||
*
|
||||
* @return bool True if at end; False otherwise.
|
||||
* @return Int64 The length of the stream.
|
||||
*/
|
||||
inline atUint64 length() const
|
||||
{return m_length;}
|
||||
|
|
Loading…
Reference in New Issue