common/serialise.h

Go to the documentation of this file.
00001 /* @file serialise.h
00002  * @brief functions to convert classes to strings and back
00003  *
00004  * Copyright (C) 2006,2007 Olly Betts
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 #ifndef XAPIAN_INCLUDED_SERIALISE_H
00022 #define XAPIAN_INCLUDED_SERIALISE_H
00023 
00024 #include <xapian/visibility.h>
00025 #include <string>
00026 #include "noreturn.h"
00027 
00028 // Forward class declarations:
00029 
00030 namespace Xapian {
00031     class Document;
00032     class Error;
00033     class MSet;
00034     class RSet;
00035     class Weight;
00036 }
00037 
00038 class Stats;
00039 
00048 XAPIAN_VISIBILITY_DEFAULT
00049 std::string encode_length(size_t len);
00050 
00061 XAPIAN_VISIBILITY_DEFAULT
00062 size_t decode_length(const char ** p, const char *end, bool check_remaining);
00063 
00070 XAPIAN_VISIBILITY_DEFAULT
00071 std::string serialise_error(const Xapian::Error &e);
00072 
00085 XAPIAN_VISIBILITY_DEFAULT
00086 XAPIAN_NORETURN(
00087 void unserialise_error(const std::string &error_string,
00088                        const std::string &prefix,
00089                        const std::string &new_context));
00090 
00097 std::string serialise_stats(const Stats &stats);
00098 
00105 Stats unserialise_stats(const std::string &s);
00106 
00113 std::string serialise_mset_pre_30_5(const Xapian::MSet &mset);
00114 
00121 std::string serialise_mset(const Xapian::MSet &mset);
00122 
00129 Xapian::MSet unserialise_mset(const std::string &s);
00130 
00137 std::string serialise_rset(const Xapian::RSet &omrset);
00138 
00145 Xapian::RSet unserialise_rset(const std::string &s);
00146 
00153 XAPIAN_VISIBILITY_DEFAULT
00154 std::string serialise_document(const Xapian::Document &doc);
00155 
00162 XAPIAN_VISIBILITY_DEFAULT
00163 Xapian::Document unserialise_document(const std::string &s);
00164 
00165 #endif

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.