/usr/include/elektra/keyio.hpp is in libelektra-dev 0.8.14-5.
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 | #ifndef ELEKTRA_KEY_IO_HPP
#define ELEKTRA_KEY_IO_HPP
#include <key.hpp>
#include <iostream>
namespace kdb
{
/**
* @brief Stream the name of a key
*
* If you also want to stream the value, use the plugin framework.
*
* @param os the stream to write to
* @param k the key which name should be streamed
*
* @return the stream
*/
inline std::ostream & operator << (std::ostream & os, kdb::Key const & k)
{
os << k.getName();
return os;
}
/**
* @brief Reads a line with a keys name
*
* @param is the stream to read from
* @param k the key whose name will be set
*
* Use unsetf(std::ios_base::skipws) on the stream if the keyname is
* terminated with an null character and not a newline.
*
* @return the stream
*/
inline std::istream & operator >> (std::istream & is, kdb::Key & k)
{
std::string name;
char delim = '\0';
if (is.flags() & std::ios_base::skipws)
{
delim = '\n';
}
getline(is, name, delim);
k.setName(name);
return is;
}
}
#endif
|