comparison modules/converter/converter.h @ 486:7ee8da32da98

Unify all in modules/
author David Demelier <markand@malikania.fr>
date Fri, 13 Nov 2015 09:26:46 +0100
parents
children f48bb09bccc7
comparison
equal deleted inserted replaced
485:898d8b29a4f1 486:7ee8da32da98
1 /*
2 * Converter.h -- iconv based converter
3 *
4 * Copyright (c) 2013-2015 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef _CONVERTER_H_
20 #define _CONVERTER_H_
21
22 /**
23 * @file Converter.h
24 * @brief Converter using libiconv
25 */
26
27 #include <string>
28
29 /**
30 * @class Converter
31 * @brief Convert string between different encodings
32 */
33 class Converter {
34 public:
35 /**
36 * Convert the string into a different encoding.
37 *
38 * @param from the from encoding
39 * @param to the destination encoding
40 * @param input the string to convert
41 * @return the converted string
42 * @throw std::invalid_argument on invalid sequence
43 */
44 static std::string convert(const char *from,
45 const char *to,
46 const std::string &input);
47 };
48
49 #endif // !_CONVERTER_H_