/usr/include/x86_64-linux-gnu/zypp/PoolQueryUtil.tcc is in libzypp-dev 15.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/PoolQueryUtil.tcc
*
* including fstream is not hell here because this header only included
* by implementation file, header doesn't need include it.
*/
#ifndef ZYPP_POOLQUERYUTIL_TCC
#define ZYPP_POOLQUERYUTIL_TCC
#include <fstream>
#include "zypp/Pathname.h"
#include "zypp/PoolQuery.h"
#include "zypp/base/String.h"
namespace zypp
{
/**
* sends to output iterator all queries readed from file.
*
* \code
* list<PoolQuery> s;
* insert_iterator<list<PoolQuery> > ii(s, s.end());
* readPoolQueriesFromStream(f,ii);
* \endcode
*/
template <class OutputIterator>
void readPoolQueriesFromFile(const zypp::filesystem::Pathname &file,
OutputIterator out )
{
bool found;
std::ifstream fin( file.c_str() );
if (!fin)
ZYPP_THROW(Exception(str::form("Cannot open file %s",file.c_str())));
do
{
zypp::PoolQuery q;
found = q.recover( fin );
if (found)
*out++ = q;
} while ( found );
fin.close();
}
/**
* Writes all queries from begin to end.
*/
template <class InputIterator>
void writePoolQueriesToFile(const zypp::filesystem::Pathname &file,
InputIterator begin, InputIterator end )
{
std::ofstream fout( file.c_str(), std::ios_base::out | std::ios_base::trunc );
if (!fout)
ZYPP_THROW(Exception(str::form("Cannot open file %s",file.c_str())));
for_( it, begin, end )
{
it->serialize( fout );
}
fout.close();
}
}
#endif // ZYPP_POOLQUERYUTIL_H
|