mirror of https://github.com/libAthena/athena.git
* Add fill to Stream
This commit is contained in:
parent
a19520ea1e
commit
dfb0ce0b4f
|
@ -272,6 +272,9 @@ public:
|
|||
*/
|
||||
void writeString(const std::string& str);
|
||||
|
||||
void fill(Uint8 val, Uint64 length);
|
||||
void fill(Int8 val, Uint64 length);
|
||||
|
||||
void setProgressCallback(std::function<void(int)> cb);
|
||||
protected:
|
||||
void loadData();
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Sakura
|
|||
|
||||
template <typename T>
|
||||
class Vector2D
|
||||
{ifndef
|
||||
{
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
|
|
|
@ -74,6 +74,8 @@ protected:
|
|||
virtual void writeBool (bool){THROW_NOT_IMPLEMENTED_EXCEPTION();}
|
||||
virtual void writeString(const std::string&){THROW_NOT_IMPLEMENTED_EXCEPTION();}
|
||||
virtual void writeUnicode(const std::string&){THROW_NOT_IMPLEMENTED_EXCEPTION();}
|
||||
virtual void fill(Uint8, Uint64) {THROW_NOT_IMPLEMENTED_EXCEPTION();}
|
||||
virtual void fill(Int8, Uint64) {THROW_NOT_IMPLEMENTED_EXCEPTION();}
|
||||
};
|
||||
}
|
||||
#endif // STREAM_HPP
|
||||
|
|
|
@ -460,6 +460,17 @@ void BinaryWriter::writeString(const std::string& str)
|
|||
writeUByte(0);
|
||||
}
|
||||
|
||||
void BinaryWriter::fill(Uint8 val, Uint64 length)
|
||||
{
|
||||
while ((length--) > 0)
|
||||
writeUByte(val);
|
||||
}
|
||||
|
||||
void BinaryWriter::fill(Int8 val, Uint64 length)
|
||||
{
|
||||
fill((Uint8)val, length);
|
||||
}
|
||||
|
||||
void BinaryWriter::setProgressCallback(std::function<void (int)> cb)
|
||||
{
|
||||
m_progressCallback = cb;
|
||||
|
|
Loading…
Reference in New Issue