21 #ifndef XAPIAN_INCLUDED_PRETTY_H 22 #define XAPIAN_INCLUDED_PRETTY_H 47 explicit Literal(
const char * lit) : _lit(lit) { }
48 explicit Literal(
const std::string & s) : _lit(s.c_str()) { }
52 template<
class S,
class T>
54 operator<<(PrettyOStream<S> &ps,
const T & t)
69 operator<<(PrettyOStream<S> &ps,
const Literal & t)
75 template<
class S,
class T>
77 operator<<(PrettyOStream<S> &ps,
const T * t)
87 template<
class S,
class T>
89 operator<<(PrettyOStream<S> &ps,
const T ** t)
97 operator<<(PrettyOStream<S> &ps,
const void * t)
99 ps.
os <<
"(void*)" << t;
107 if (ch < 32 || ch >= 127) {
109 if (ch >= 7 && ch <= 13) {
110 os <<
"abtnvfr"[ch - 7];
112 os << char('0' | (ch >> 6));
113 os << char('0' | ((ch >> 3) & 7));
114 os << char(
'0' | (ch & 7));
116 }
else if (ch ==
'\\') {
118 }
else if (ch ==
'"') {
127 operator<<(PrettyOStream<S> &ps,
const char *
str)
139 operator<<(PrettyOStream<S> &ps,
const std::string &
str)
142 for (std::string::const_iterator i =
str.begin(); i !=
str.end(); ++i) {
151 operator<<(PrettyOStream<S> &ps, std::string &)
153 ps.
os <<
"std::string&";
159 operator<<(PrettyOStream<S> &ps, std::string *)
161 ps.
os <<
"std::string*";
167 operator<<(PrettyOStream<S> &ps,
unsigned char ch)
170 if (ch < 32 || ch >= 127) {
172 if (ch >= 7 && ch <= 13) {
173 ps.os <<
"abtnvfr"[ch - 7];
174 }
else if (ch ==
'\0') {
177 ps.os <<
"0123456789abcdef"[ch >> 4];
178 ps.os <<
"0123456789abcdef"[ch & 0x0f];
180 }
else if (ch ==
'\\') {
182 }
else if (ch ==
'\'') {
193 operator<<(PrettyOStream<S> &ps,
bool b)
195 ps.
os << (b ?
"true" :
"false");
213 ps.
os <<
"(Xapian::termcount*)" << (
void*)p;
217 template<
class S,
typename T>
219 operator<<(PrettyOStream<S> &ps, std::list<T> &) {
220 ps.
os <<
"std::list&";
224 template<
class S,
typename T>
226 operator<<(PrettyOStream<S> &ps,
const std::list<T> &) {
227 ps.
os <<
"std::list";
232 template<
class S,
typename K,
typename V>
234 operator<<(PrettyOStream<S> &ps, std::map<K, V> *) {
235 ps.
os <<
"std::map*";
239 template<
class S,
typename K,
typename V>
241 operator<<(PrettyOStream<S> &ps, std::map<K, V> &) {
242 ps.
os <<
"std::map&";
246 template<
class S,
typename K,
typename V>
248 operator<<(PrettyOStream<S> &ps,
const std::map<K, V> & m) {
249 ps.
os <<
"std::map(" << m.size() <<
')';
254 template<
class S,
typename T>
256 operator<<(PrettyOStream<S> &ps,
const std::vector<T> & v) {
257 ps.
os <<
"std::vector(" << v.size() <<
')';
262 template<
class S,
typename T,
typename U>
264 operator<<(PrettyOStream<S> &ps,
const std::pair<T, U>& v) {
265 ps.
os <<
"std::pair(" << v.first <<
", " << v.second <<
')';
295 #define XAPIAN_PRETTY_AS_CLASSNAME(C)\ 297 inline PrettyOStream<S> &\ 298 operator<<(PrettyOStream<S> &ps, const C &) {\ 324 ps.os <<
"(Xapian:Weight*)" << (
const void*)p;
333 ps.os <<
"RemoteConnection";
342 ps.os <<
"(Database::Internal*)" << (
const void*)p;
346 template<
class S,
class T>
349 ps.os <<
"intrusive_ptr->";
350 return ps << t.
get();
353 #endif // XAPIAN_INCLUDED_PRETTY_H The Xapian namespace contains public interfaces for the Xapian library.
void write_ch(std::ostream &os, unsigned char ch)
A RemoteConnection object provides a bidirectional connection to another RemoteConnection object on a...
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
Class managing a Btree table in a Glass database.
Base class for databases.
Class managing a Btree table in a Chert database.
Virtual base class for expand decider functor.
Literal(const std::string &s)
Class for calculating ESet term weights.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Registry for user subclasses.
S & os
The std::ostream object we're outputting to.
Base class for calculating distances between two lat/long coordinates.
string str(int value)
Convert int to std::string.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
Base class for matcher decision functor.
PrettyOStream & operator|(const T &t)
#define XAPIAN_PRETTY_AS_CLASSNAME(C)
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
Collates statistics while calculating term weight in an ESet.
A smart pointer that uses intrusive reference counting.
Abstract base class for weighting schemes.