1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/files/pipe_paging.cc Wed Mar 24 23:44:53 2021 +0100
1.3 @@ -0,0 +1,35 @@
1.4 +#include "pipe_paging.h"
1.5 +
1.6 +PipePaging::PipePaging()
1.7 +{
1.8 +}
1.9 +
1.10 +/* Add a region to the sequence. */
1.11 +
1.12 +void PipePaging::add_region(PageMapper *mapper)
1.13 +{
1.14 + _regions.push_back(mapper);
1.15 +}
1.16 +
1.17 +/* Return the first region in the sequence. */
1.18 +
1.19 +PageMapper *PipePaging::first_region()
1.20 +{
1.21 + return _regions.front();
1.22 +}
1.23 +
1.24 +/* Return the next region for the reader. If only a single region remains, with
1.25 + the reader wishing to move to the next, return NULL. */
1.26 +
1.27 +PageMapper *PipePaging::next_region()
1.28 +{
1.29 + if (_regions.size() > 1)
1.30 + {
1.31 + _regions.pop_front();
1.32 + return _regions.front();
1.33 + }
1.34 + else
1.35 + return NULL;
1.36 +}
1.37 +
1.38 +// vim: tabstop=4 expandtab shiftwidth=4