Add GenericFileElement::copyPreferablyFromBuffer()
This commit is contained in:
parent
6741e9ca0f
commit
03383a18b9
|
@ -192,6 +192,7 @@ public:
|
|||
void makeBuffer();
|
||||
void discardBuffer();
|
||||
void copyBuffer(std::ostream &targetStream);
|
||||
void copyPreferablyFromBuffer(std::ostream &targetStream);
|
||||
const std::unique_ptr<char[]> &buffer();
|
||||
implementationType *denoteFirstChild(uint32 offset);
|
||||
|
||||
|
@ -845,6 +846,16 @@ inline void GenericFileElement<ImplementationType>::copyBuffer(std::ostream &tar
|
|||
targetStream.write(m_buffer.get(), totalSize());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Copies buffered data to \a targetStream if data has been buffered; copies from input stream otherwise.
|
||||
* \remarks So this is copyBuffer() with a fallback to copyEntirely().
|
||||
*/
|
||||
template <class ImplementationType>
|
||||
inline void GenericFileElement<ImplementationType>::copyPreferablyFromBuffer(std::ostream &targetStream)
|
||||
{
|
||||
m_buffer ? copyBuffer(targetStream) : copyEntirely(targetStream);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns buffered data. The returned array is totalSize() bytes long.
|
||||
* \remarks Data must have been buffered using the makeBuffer() method.
|
||||
|
|
Loading…
Reference in New Issue