2 * 2011+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include "eblob_gen.h"
18 eblob_dir_source::eblob_dir_source(const std::string
&path
) : itr(fs::path(path
))
22 eblob_dir_source::~eblob_dir_source()
26 bool eblob_dir_source::next(const bool prepend
, const struct timespec
*ts
, std::string
&name
, std::string
&data
)
31 std::ifstream
file(itr
->path().string().c_str(), std::ios::binary
| std::ios::in
);
32 std::filebuf
*pbuf
= file
.rdbuf();
36 size_t size
= pbuf
->pubseekoff(0, std::ios::end
, std::ios::in
);
37 pbuf
->pubseekpos(0, std::ios::in
);
39 prepend_data(data
, size
, (struct timespec
*)ts
);
44 name
.assign(itr
->leaf());
45 data
.append(ss
.str());