summaryrefslogtreecommitdiffstats
blob: e5696b0953d3f75e39a20d2b86f2c036c7549bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 2010-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <iostream>

#include <boost/format.hpp>

namespace Swift {
    inline boost::format format(const std::string& s) {
        using namespace boost::io;
        try {
            boost::format fmter(s);
            fmter.exceptions(no_error_bits);
            return fmter;
        }
        catch (...) {
            std::cerr << "Error: Invalid translation: " << s << std::endl;
            throw;
        }
    }
}