• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 #ifndef CEF_INCLUDE_INTERNAL_CEF_STRING_H_
31 #define CEF_INCLUDE_INTERNAL_CEF_STRING_H_
32 #pragma once
33 
34 // The CEF interface is built with one string type as the default. Comment out
35 // all but one of the CEF_STRING_TYPE_* defines below to specify the default.
36 // If you change the default you MUST recompile all of CEF.
37 
38 // Build with the UTF8 string type as default.
39 // #define CEF_STRING_TYPE_UTF8 1
40 
41 // Build with the UTF16 string type as default.
42 #define CEF_STRING_TYPE_UTF16 1
43 
44 // Build with the wide string type as default.
45 // #define CEF_STRING_TYPE_WIDE 1
46 
47 #include "include/internal/cef_string_types.h"
48 
49 #ifdef __cplusplus
50 #include "include/internal/cef_string_wrappers.h"
51 #if defined(CEF_STRING_TYPE_UTF16)
52 typedef CefStringUTF16 CefString;
53 #elif defined(CEF_STRING_TYPE_UTF8)
54 typedef CefStringUTF8 CefString;
55 #elif defined(CEF_STRING_TYPE_WIDE)
56 typedef CefStringWide CefString;
57 #endif
58 #endif  // __cplusplus
59 
60 #if defined(CEF_STRING_TYPE_UTF8)
61 typedef char cef_char_t;
62 typedef cef_string_utf8_t cef_string_t;
63 typedef cef_string_userfree_utf8_t cef_string_userfree_t;
64 #define cef_string_set cef_string_utf8_set
65 #define cef_string_copy cef_string_utf8_copy
66 #define cef_string_clear cef_string_utf8_clear
67 #define cef_string_userfree_alloc cef_string_userfree_utf8_alloc
68 #define cef_string_userfree_free cef_string_userfree_utf8_free
69 #define cef_string_from_ascii cef_string_utf8_copy
70 #define cef_string_to_utf8 cef_string_utf8_copy
71 #define cef_string_from_utf8 cef_string_utf8_copy
72 #define cef_string_to_utf16 cef_string_utf8_to_utf16
73 #define cef_string_from_utf16 cef_string_utf16_to_utf8
74 #define cef_string_to_wide cef_string_utf8_to_wide
75 #define cef_string_from_wide cef_string_wide_to_utf8
76 #elif defined(CEF_STRING_TYPE_UTF16)
77 typedef char16 cef_char_t;
78 typedef cef_string_userfree_utf16_t cef_string_userfree_t;
79 typedef cef_string_utf16_t cef_string_t;
80 #define cef_string_set cef_string_utf16_set
81 #define cef_string_copy cef_string_utf16_copy
82 #define cef_string_clear cef_string_utf16_clear
83 #define cef_string_userfree_alloc cef_string_userfree_utf16_alloc
84 #define cef_string_userfree_free cef_string_userfree_utf16_free
85 #define cef_string_from_ascii cef_string_ascii_to_utf16
86 #define cef_string_to_utf8 cef_string_utf16_to_utf8
87 #define cef_string_from_utf8 cef_string_utf8_to_utf16
88 #define cef_string_to_utf16 cef_string_utf16_copy
89 #define cef_string_from_utf16 cef_string_utf16_copy
90 #define cef_string_to_wide cef_string_utf16_to_wide
91 #define cef_string_from_wide cef_string_wide_to_utf16
92 #elif defined(CEF_STRING_TYPE_WIDE)
93 typedef wchar_t cef_char_t;
94 typedef cef_string_wide_t cef_string_t;
95 typedef cef_string_userfree_wide_t cef_string_userfree_t;
96 #define cef_string_set cef_string_wide_set
97 #define cef_string_copy cef_string_wide_copy
98 #define cef_string_clear cef_string_wide_clear
99 #define cef_string_userfree_alloc cef_string_userfree_wide_alloc
100 #define cef_string_userfree_free cef_string_userfree_wide_free
101 #define cef_string_from_ascii cef_string_ascii_to_wide
102 #define cef_string_to_utf8 cef_string_wide_to_utf8
103 #define cef_string_from_utf8 cef_string_utf8_to_wide
104 #define cef_string_to_utf16 cef_string_wide_to_utf16
105 #define cef_string_from_utf16 cef_string_utf16_to_wide
106 #define cef_string_to_wide cef_string_wide_copy
107 #define cef_string_from_wide cef_string_wide_copy
108 #else
109 #error Please choose a string type.
110 #endif
111 
112 #endif  // CEF_INCLUDE_INTERNAL_CEF_STRING_H_
113