00001 00004 /* Copyright (C) 2009 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_STR_H 00022 #define XAPIAN_INCLUDED_STR_H 00023 00024 #include "xapian/visibility.h" 00025 00026 #include <string> 00027 00028 namespace Xapian { 00029 namespace Internal { 00030 00032 XAPIAN_VISIBILITY_DEFAULT 00033 std::string str(int value); 00034 00036 XAPIAN_VISIBILITY_DEFAULT 00037 std::string str(unsigned int value); 00038 00040 XAPIAN_VISIBILITY_DEFAULT 00041 std::string str(long value); 00042 00044 XAPIAN_VISIBILITY_DEFAULT 00045 std::string str(unsigned long value); 00046 00048 XAPIAN_VISIBILITY_DEFAULT 00049 std::string str(long long value); 00050 00052 XAPIAN_VISIBILITY_DEFAULT 00053 std::string str(unsigned long long value); 00054 00056 XAPIAN_VISIBILITY_DEFAULT 00057 std::string str(double value); 00058 00060 XAPIAN_VISIBILITY_DEFAULT 00061 std::string str(const void * value); 00062 00068 inline std::string str(const std::string & value) { return value; } 00069 00071 inline std::string str(const char * value) { return value; } 00072 00074 inline std::string str(bool value) { 00075 return std::string(1, '0' | static_cast<char>(value)); 00076 } 00077 00078 } 00079 } 00080 00081 using Xapian::Internal::str; 00082 00083 #endif // XAPIAN_INCLUDED_STR_H