github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/internal/cef_string.h (about)

     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  
    48  #include "include/internal/cef_string_types.h"
    49  
    50  #ifdef __cplusplus
    51  #include "include/internal/cef_string_wrappers.h"
    52  #if defined(CEF_STRING_TYPE_UTF16)
    53  typedef CefStringUTF16 CefString;
    54  #elif defined(CEF_STRING_TYPE_UTF8)
    55  typedef CefStringUTF8 CefString;
    56  #elif defined(CEF_STRING_TYPE_WIDE)
    57  typedef CefStringWide CefString;
    58  #endif
    59  #endif  // __cplusplus
    60  
    61  #if defined(CEF_STRING_TYPE_UTF8)
    62  typedef char cef_char_t;
    63  typedef cef_string_utf8_t cef_string_t;
    64  typedef cef_string_userfree_utf8_t cef_string_userfree_t;
    65  #define cef_string_set cef_string_utf8_set
    66  #define cef_string_copy cef_string_utf8_copy
    67  #define cef_string_clear cef_string_utf8_clear
    68  #define cef_string_userfree_alloc cef_string_userfree_utf8_alloc
    69  #define cef_string_userfree_free cef_string_userfree_utf8_free
    70  #define cef_string_from_ascii cef_string_utf8_copy
    71  #define cef_string_to_utf8 cef_string_utf8_copy
    72  #define cef_string_from_utf8 cef_string_utf8_copy
    73  #define cef_string_to_utf16 cef_string_utf8_to_utf16
    74  #define cef_string_from_utf16 cef_string_utf16_to_utf8
    75  #define cef_string_to_wide cef_string_utf8_to_wide
    76  #define cef_string_from_wide cef_string_wide_to_utf8
    77  #elif defined(CEF_STRING_TYPE_UTF16)
    78  typedef char16 cef_char_t;
    79  typedef cef_string_userfree_utf16_t cef_string_userfree_t;
    80  // typedef cef_string_utf16_t cef_string_t;
    81  #define cef_string_t cef_string_utf16_t
    82  #define cef_string_set cef_string_utf16_set
    83  #define cef_string_copy cef_string_utf16_copy
    84  #define cef_string_clear cef_string_utf16_clear
    85  #define cef_string_userfree_alloc cef_string_userfree_utf16_alloc
    86  #define cef_string_userfree_free cef_string_userfree_utf16_free
    87  #define cef_string_from_ascii cef_string_ascii_to_utf16
    88  #define cef_string_to_utf8 cef_string_utf16_to_utf8
    89  #define cef_string_from_utf8 cef_string_utf8_to_utf16
    90  #define cef_string_to_utf16 cef_string_utf16_copy
    91  #define cef_string_from_utf16 cef_string_utf16_copy
    92  #define cef_string_to_wide cef_string_utf16_to_wide
    93  #define cef_string_from_wide cef_string_wide_to_utf16
    94  #elif defined(CEF_STRING_TYPE_WIDE)
    95  typedef wchar_t cef_char_t;
    96  typedef cef_string_wide_t cef_string_t;
    97  typedef cef_string_userfree_wide_t cef_string_userfree_t;
    98  #define cef_string_set cef_string_wide_set
    99  #define cef_string_copy cef_string_wide_copy
   100  #define cef_string_clear cef_string_wide_clear
   101  #define cef_string_userfree_alloc cef_string_userfree_wide_alloc
   102  #define cef_string_userfree_free cef_string_userfree_wide_free
   103  #define cef_string_from_ascii cef_string_ascii_to_wide
   104  #define cef_string_to_utf8 cef_string_wide_to_utf8
   105  #define cef_string_from_utf8 cef_string_utf8_to_wide
   106  #define cef_string_to_utf16 cef_string_wide_to_utf16
   107  #define cef_string_from_utf16 cef_string_utf16_to_wide
   108  #define cef_string_to_wide cef_string_wide_copy
   109  #define cef_string_from_wide cef_string_wide_copy
   110  #else
   111  #error Please choose a string type.
   112  #endif
   113  
   114  #endif  // CEF_INCLUDE_INTERNAL_CEF_STRING_H_