dbad8323cde09d89ff899b6d10cebb1a02aa2947
[platform/core/location/maps-plugin-here.git] / inc / engine / internal / EncodingConversion.h
1 /*
2  * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3  * This software, including documentation, is protected by copyright controlled by
4  * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5  * storing, adapting or translating, any or all of this material requires the prior
6  * written consent of HERE Global B.V. You may use this
7  * Software in accordance with the terms and conditions defined in the
8  * HERE Location Platform Services Terms and Conditions, available at
9  * http://developer.here.com/terms-conditions-base
10  *
11  * As an additional permission to the above, you may distribute Software,
12  * in object code format as part of an Application, according to, and subject to, terms and
13  * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14  * You may distribute such object code format Application under terms of your choice,
15  * provided that the header and source files of the Software have not been modified.
16  */
17
18 #ifndef ENCODING_CONVERSION_H
19 #define ENCODING_CONVERSION_H
20
21 #include "common/HereMaps_global.h"
22
23 #include <string>
24
25 #ifndef TIZEN_MIGRATION
26 namespace Tizen{ namespace Base{ class ByteBuffer; } }
27 #endif
28
29 HERE_MAPS_BEGIN_NAMESPACE
30
31 /**
32  * This class offers encoding conversion utilities between UTF-8 and platform
33  * default string encoding.
34  */
35 class EncodingConversion
36 {
37 public:
38     /**
39      * This method converts a platform string to UTF-8.
40      *
41      * @param sSrc A constant reference to a platform string to convert.
42      *
43      * @param sDst A reference to a string object holding the results of
44      *        conversion to UTF-8.
45      *
46      * @return Always <code>true</code>.
47      */
48     static bool ToUTF8(const WString& sSrc, std::string& sDst);
49
50
51     /**
52      * This method converts a UTF-8 string to a platform string.
53      * 
54      * @param sSrc A constant reference to an unsigned character buffer
55      *        containing the string to convert. 
56      * 
57      * @param uLen A value representing the length of the buffer containing the
58      *        string to covert.
59      * 
60      * @param sDst A reference to a string object holding the results of
61      *        conversion from UTF-8.
62      * 
63      * @return Always <code>true</code>.
64      */
65     static bool FromUTF8(const char* pSrc, size_t uLen, WString& sDst);
66
67 private:
68     HERE_MAPS_NO_COPY_NO_ASSIGN(EncodingConversion);
69 };
70
71
72 HERE_MAPS_END_NAMESPACE
73
74 #endif