/usr/include/elektra/keysetio.hpp is in libelektra-dev 0.8.7-4.
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 | #ifndef ELEKTRA_KEYSET_IO_HPP
#define ELEKTRA_KEYSET_IO_HPP
#include <iostream>
#include <keyio.hpp>
#include <keyset.hpp>
namespace kdb
{
/**
* @brief Outputs line per line the keynames
*
* To output values you should use the plugin framework.
*
* @param os the stream to write to
* @param cks the keyset which should be streamed
*
* @return the stream
*/
inline std::ostream & operator << (std::ostream & os, kdb::KeySet const & cks)
{
kdb::KeySet & ks = const_cast<kdb::KeySet &>(cks);
cursor_t c = ks.getCursor();
ks.rewind();
kdb::Key k;
while (k=ks.next())
{
os << k << std::endl;
}
ks.setCursor(c);
return os;
}
/**
* @brief Reads line per line key names and appends those keys to ks.
*
* To input values you need to use the plugin framework.
*
* @param is the stream to read from
* @param ks the keyset to append to
*
* @return the stream
*/
inline std::istream & operator >> (std::istream & is, kdb::KeySet & ks)
{
cursor_t c = ks.getCursor();
while (!is.eof())
{
kdb::Key k;
is >> k;
ks.append(k);
}
ks.setCursor(c); // jump back to previous cursor
return is;
}
}
#endif
|