Stroika Library
3.0d16
Help-Home
Loading...
Searching...
No Matches
ToSeekableInputStream.h
Go to the documentation of this file.
1
/*
2
* Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3
*/
4
#ifndef _Stroika_Foundation_Streams_ToSeekableInputStream_h_
5
#define _Stroika_Foundation_Streams_ToSeekableInputStream_h_ 1
6
7
#include "Stroika/Foundation/StroikaPreComp.h"
8
9
#include "
Stroika/Foundation/Streams/InputStream.h
"
10
#include "
Stroika/Foundation/Traversal/Iterable.h
"
11
12
/**
13
* \file
14
*
15
* \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
16
*/
17
18
namespace
Stroika::Foundation::Streams::ToSeekableInputStream {
19
20
using
InputStream::Ptr;
21
22
/**
23
* Not all input streams are seekable, but throwing a little memory at it, its easy to assure they are all
24
* seekable.
25
*
26
* That's what this utility does: maps the given input stream into a functionally identical one, except possibly
27
* adding seekability.
28
*
29
* If the argument stream is already seekable, New () just returns its argument (so perhaps a misnomer but I thought better
30
* to follow factory pattern).
31
*
32
* \par Example Usage
33
* \code
34
* InputStream::Ptr<Character> in = ToSeekableInputStream::New<Character> (existingInputStream);
35
* \endcode
36
*
37
* \note this helper does not require it be given the input stream at SeekOffset 0, but for pretty obvious reasons
38
* it cannot produce a stream that permits seeking backwards from where it starts. This is checked via assertions.
39
*
40
* \note this helper may be problematic with very large streams, as it caches the stream in memory as it reads, and would
41
* eventually run out.
42
*/
43
template
<
typename
ELEMENT_TYPE>
44
auto
New (
const
Ptr<ELEMENT_TYPE>& in) -> Ptr<ELEMENT_TYPE>;
45
46
}
47
48
/*
49
********************************************************************************
50
***************************** Implementation Details ***************************
51
********************************************************************************
52
*/
53
#include "ToSeekableInputStream.inl"
54
55
#endif
/*_Stroika_Foundation_Streams_ToSeekableInputStream_h_*/
InputStream.h
Iterable.h
Library
Sources
Stroika
Foundation
Streams
ToSeekableInputStream.h
Generated by
1.9.8