diff --git a/include/athena/IStream.hpp b/include/athena/IStream.hpp
index e61e1fe..5247866 100644
--- a/include/athena/IStream.hpp
+++ b/include/athena/IStream.hpp
@@ -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
};
}
}
diff --git a/include/athena/IStreamReader.hpp b/include/athena/IStreamReader.hpp
index b05f387..cf8a221 100644
--- a/include/athena/IStreamReader.hpp
+++ b/include/athena/IStreamReader.hpp
@@ -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.
* 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
IStreamReader& operator>>(IStreamReader& lhs, T& rhs)
diff --git a/include/athena/IStreamWriter.hpp b/include/athena/IStreamWriter.hpp
index 137f173..8829aef 100644
--- a/include/athena/IStreamWriter.hpp
+++ b/include/athena/IStreamWriter.hpp
@@ -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.
* 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
diff --git a/include/athena/MemoryWriter.hpp b/include/athena/MemoryWriter.hpp
index 0ae1e62..ee78102 100644
--- a/include/athena/MemoryWriter.hpp
+++ b/include/athena/MemoryWriter.hpp
@@ -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;}