genericopenlibs/cppstdlib/stl/src/string.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "stlport_prefix.h"
       
    19 
       
    20 #include <string>
       
    21 
       
    22 _STLP_BEGIN_NAMESPACE
       
    23 
       
    24 #if defined(_STLP_USE_WIDE_INTERFACE)
       
    25 _STLP_MOVE_TO_PRIV_NAMESPACE
       
    26 
       
    27 wstring __ASCIIToWide(const char *ascii) {
       
    28     size_t size = strlen(ascii);
       
    29     wchar_t* buff = new wchar_t[size+1];
       
    30     mbstowcs(buff, ascii, size);
       
    31     buff[size] = 0x00;
       
    32     wstring ret(buff);
       
    33     delete[] buff;
       
    34     return ret;
       
    35 }
       
    36 string __WideToASCII(const wchar_t *wide) {
       
    37     size_t size = wcslen(wide);
       
    38     char* buff = new char[size+1];
       
    39     wcstombs(buff, wide, size);
       
    40     buff[size] = 0;
       
    41     string ret(buff);
       
    42     delete[] buff;
       
    43     return ret;
       
    44 }
       
    45 _STLP_MOVE_TO_STD_NAMESPACE
       
    46 #endif
       
    47 
       
    48 #if !defined (_STLP_NO_FORCE_INSTANTIATE)
       
    49 
       
    50 template class _STLP_CLASS_DECLSPEC allocator<char>;
       
    51 
       
    52 _STLP_MOVE_TO_PRIV_NAMESPACE
       
    53 
       
    54 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char*, char, allocator<char> >;
       
    55 template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >;
       
    56 
       
    57 #  if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC)
       
    58 
       
    59 #    if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
       
    60 #      define basic_string _STLP_NON_DBG_NO_MEM_T_NAME(str)
       
    61 #    else
       
    62 #      define basic_string _STLP_NON_DBG_NAME(str)
       
    63 #    endif
       
    64 
       
    65 template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
       
    66 template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<char, char_traits<char>, allocator<char> > >;
       
    67 
       
    68 #    undef basic_string
       
    69 #  endif
       
    70 
       
    71 #  if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
       
    72 #    define basic_string _STLP_NO_MEM_T_NAME(str)
       
    73 #  else
       
    74 _STLP_MOVE_TO_STD_NAMESPACE
       
    75 #  endif
       
    76 
       
    77 template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
       
    78 
       
    79 #  if defined (basic_string)
       
    80 _STLP_MOVE_TO_STD_NAMESPACE
       
    81 #    undef basic_string
       
    82 #  endif
       
    83 
       
    84 #  if !defined (_STLP_NO_WCHAR_T)
       
    85 template class _STLP_CLASS_DECLSPEC allocator<wchar_t>;
       
    86 
       
    87 _STLP_MOVE_TO_PRIV_NAMESPACE
       
    88 
       
    89 template class _STLP_CLASS_DECLSPEC _String_base<wchar_t, allocator<wchar_t> >;
       
    90 
       
    91 #    if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC)
       
    92 #      if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
       
    93 #        define basic_string _STLP_NON_DBG_NO_MEM_T_NAME(str)
       
    94 #      else
       
    95 #        define basic_string _STLP_NON_DBG_NAME(str)
       
    96 #      endif
       
    97 
       
    98 template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
       
    99 template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
       
   100 
       
   101 #      undef basic_string
       
   102 #    endif
       
   103 
       
   104 #    if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
       
   105 #      define basic_string _STLP_NO_MEM_T_NAME(str)
       
   106 #    else
       
   107 _STLP_MOVE_TO_STD_NAMESPACE
       
   108 #    endif
       
   109 
       
   110 template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
       
   111 
       
   112 #    if defined (basic_string)
       
   113 _STLP_MOVE_TO_STD_NAMESPACE
       
   114 #      undef basic_string
       
   115 #    endif
       
   116 #  endif
       
   117 #endif
       
   118 
       
   119 _STLP_END_NAMESPACE