[honey] Fix portability to systems without pread()
[xapian.git] / xapian-core / net / serialise.h
blob2519d45ff11bc4b0ea76cd277ede172e53e52909
1 /** @file serialise.h
2 * @brief functions to convert classes to strings and back
3 */
4 /* Copyright (C) 2006,2007,2008,2009,2012,2014 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_SERIALISE_H
22 #define XAPIAN_INCLUDED_SERIALISE_H
24 #include <string>
25 #include "xapian/weight.h"
27 // Forward class declarations:
29 namespace Xapian {
30 class Document;
31 class RSet;
34 /** Serialise a stats object.
36 * @param stats The stats object to serialise.
38 * @return Serialisation of @a stats.
40 std::string serialise_stats(const Xapian::Weight::Internal &stats);
42 /** Unserialise a serialised stats object.
44 * @param s The string to unserialise.
46 * @param stats The stats object to unserialise to.
48 void unserialise_stats(const std::string &s, Xapian::Weight::Internal &stats);
50 /** Serialise a Xapian::RSet object.
52 * @param rset The object to serialise.
54 * @return The serialisation of the Xapian::RSet object.
56 std::string serialise_rset(const Xapian::RSet &omrset);
58 /** Unserialise a serialised Xapian::RSet object.
60 * @param s The serialised object as a string.
62 * @return The unserialised Xapian::RSet object.
64 Xapian::RSet unserialise_rset(const std::string &s);
66 /** Serialise a Xapian::Document object.
68 * @param doc The object to serialise.
70 * @return The serialisation of the Xapian::Document object.
72 std::string serialise_document(const Xapian::Document &doc);
74 /** Unserialise a serialised Xapian::Document object.
76 * @param s The serialised object as a string.
78 * @return The unserialised Xapian::Document object.
80 Xapian::Document unserialise_document(const std::string &s);
82 #endif