00001 /* 00002 * Copyright (c) 2010 Remko Tronçon 00003 * Licensed under the GNU General Public License v3. 00004 * See Documentation/Licenses/GPLv3.txt for more information. 00005 */ 00006 00007 #pragma once 00008 00009 #include <boost/format.hpp> 00010 #include <iostream> 00011 00012 namespace Swift { 00013 inline boost::format format(const std::string& s) { 00014 using namespace boost::io; 00015 try { 00016 boost::format fmter(s); 00017 fmter.exceptions(no_error_bits); 00018 return fmter; 00019 } 00020 catch (...) { 00021 std::cerr << "Error: Invalid translation: " << s << std::endl; 00022 throw; 00023 } 00024 } 00025 }