menu: added new Keywords tag to .desktop files
[barry.git] / src / pipe.cc
blob39056d9e7fbbd111582a388f940fd9c5026fbe63
1 ///
2 /// \file pipe.cc
3 /// Connector class to join parsers and builders together
4 ///
6 /*
7 Copyright (C) 2010-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "pipe.h"
24 namespace Barry {
26 Pipe::Pipe(Builder &builder)
27 : m_builder(builder)
31 Pipe::~Pipe()
35 bool Pipe::PumpEntry(Parser &parser, const IConverter *ic)
37 // if false, end of series, so pass that on to the caller
38 if( !m_builder.FetchRecord(m_buffer, ic) )
39 return false;
41 // pass the data into the parser
42 parser.ParseRecord(m_buffer, ic);
43 return true;
46 /// Reads all items from builder, feeding them into the parser,
47 /// until the builder's Retrieve() signals the end of the series.
48 void Pipe::PumpSeries(Parser &parser, const IConverter *ic)
50 while( PumpEntry(parser, ic) )
54 /// Reads all series from the builder, feeding them into the parser,
55 /// until the builder's EndOfFile() is true.
56 void Pipe::PumpFile(Parser &parser, const IConverter *ic)
58 while( !m_builder.EndOfFile() ) {
59 PumpSeries(parser, ic);
63 } // namespace Barry