epoc32/include/stdapis/stlportv5/libstdcppwsd.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2008-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 * Name        : libcppwsd.h
    16 * Part of     : standard c++ library (wsd definitions)
    17 * 
    18 *
    19 */
    20 
    21 
    22 
    23 #ifndef LIBSTDCPPWSD_H_
    24 #define LIBSTDCPPWSD_H_
    25 
    26 #ifdef __SYMBIAN32__WSD__   //stuff for WSD
    27 
    28 
    29 // ******************************  WSD RELATED ************************//
    30 #include <e32std.h>
    31 #include <pls.h> // For emulator WSD API
    32 #include <typeinfo>
    33 #include <locale>
    34 #include <clocale>             
    35 #include <vector>
    36 #include <string>
    37 #include <hash_map>
    38 #include <cfloat>
    39 #include <cmath>
    40 #include <assert.h>
    41 #include <stl/_new.h>
    42 #include <stl/_map.h>
    43 #include <stl/_locale.h>
    44 #include <stl/_numpunct.h>
    45 #include <stl/_alloc.h>
    46 #include <stl/_fstream.h>
    47 #include <stl/_codecvt.h>
    48 #include <stl/_collate.h>
    49 #include <stl/_ctype.h>
    50 #include <stl/_pthread_alloc.h>
    51 #include <stl/_monetary.h>
    52 #include <stl/_threads.h>
    53 
    54 
    55 // Global hash tables for category objects.
    56 typedef std::hash_map<std::string, std::pair<void*, size_t>, std::hash<std::string>, std::equal_to<std::string> > Category_Map;
    57 
    58 #define LOCALE_ID_MAX		39
    59 /*
    60  * The following functions are used to make allocations internal to the 
    61  * C++ library.These are only required on the emulator as these are 
    62  * static variables in the actual STLPort implementation but in order to
    63  * save them on the ewsd, they need to allocated on heap.
    64  */
    65 IMPORT_C void* WSDAlloc(unsigned int size);
    66 IMPORT_C int   WSDFree(void*);
    67 
    68 // ******************************************************//
    69 //  ***   all WSD definitions here
    70 // ******************************************************//
    71 class _Libcpp_wsd
    72 {
    73 public:
    74 	//_locale.h
    75 	size_t locale_id_S_max;
    76 	
    77 	//locale_impl.h
    78 	std::locale *_Stl_classic_locale;	
    79 	std::locale *_Stl_global_locale;
    80 	
    81 	void* __Loc_init_buf;
    82 	
    83 	std::_Refcount_Base *_Loc_init_S_count;
    84 	
    85 	//locale.cpp
    86 	__stl_atomic_t _S_index;
    87 	std::_STLP_STATIC_MUTEX locale_Index_lock;
    88 
    89 	//_ios_base.h
    90 	bool ios_base_S_was_synced;
    91 	long ios_base_Init_S_count; 	//ios_base::Init class	
    92 	std::ios_base::Init *_IosInit;
    93 	
    94 	//ios.cpp
    95 	int ios_base_xalloc_S_index;
    96 	std::_STLP_STATIC_MUTEX ios_base_xalloc_lock; 
    97 
    98 	//locale_catalog.cpp
    99 	Category_Map *_S_ctype_hash;
   100 	Category_Map *_S_numeric_hash;
   101 	Category_Map *_S_time_hash;
   102 	Category_Map *_S_collate_hash;
   103 	Category_Map *_S_monetary_hash;
   104 	Category_Map *_S_messages_hash;
   105 	
   106 	std::_STLP_STATIC_MUTEX locale_catalog_category_hash_lock;
   107 
   108 	//iostream.cpp
   109 	std::istream  *wsd_cin;
   110 	std::ostream  *wsd_cout;
   111 	std::ostream  *wsd_cerr;
   112 	std::ostream  *wsd_clog;
   113 #ifndef _STLP_NO_WCHAR_T
   114 	std::wistream *wsd_wcin;
   115 	std::wostream *wsd_wcout;
   116 	std::wostream *wsd_wcerr;
   117 	std::wostream *wsd_wclog;
   118 #endif
   119 
   120 	//numpunct.cpp
   121 	std::string numpunct_char_m_truename;
   122 	std::string numpunct_char_m_falsename;
   123 	std::string numpunct_char_m_grouping;
   124 # ifndef _STLP_NO_WCHAR_T
   125 	std::wstring numpunct_wchar_m_truename;
   126 	std::wstring numpunct_wchar_m_falsename;
   127 	std::string  numpunct_wchar_m_grouping;
   128 # endif
   129 	
   130 	//monetary.cpp
   131 	std::string monetary_S_empty_string;	
   132 # ifndef _STLP_NO_WCHAR_T
   133 	std::wstring monetary_S_empty_wstring;
   134 # endif //_STLP_NO_WCHAR_T
   135 
   136 	//_fstream.h
   137 	size_t fstream_Filebuf_base_M_page_size;
   138 	
   139 	//allocators.cpp
   140 	std::__oom_handler_type wsd__oom_handler;
   141 	std::_STLP_STATIC_MUTEX wsd_allocator_S_lock;
   142 	size_t wsd__node_alloc_impl_S_heap_size;
   143 	char* wsd_S_start_free;
   144 	char* wsd_S_end_free;
   145 	void* wsd_S_free_list[16];	
   146 	
   147 	std::_STLP_STATIC_MUTEX wsd_pt_S_chunk_allocator_lock;
   148 	char *wsd_pt_S_start_free;
   149 	char *wsd_pt_S_end_free;
   150 	size_t wsd_pt_S_heap_size;
   151 	stlp_priv::_Pthread_alloc::__state_type *wsd_pt_S_free_per_thread_states;
   152 	pthread_key_t wsd_pt_S_key;
   153 	bool wsd_pt_S_key_initialized;
   154 	
   155 	//_threads.h
   156 	std::_STLP_STATIC_MUTEX _threads_S_swap_lock;
   157 	std::_STLP_STATIC_MUTEX _threads_0_S_swap_lock;
   158 	unsigned _mutex_max;
   159 	unsigned _mutex_last;
   160 	
   161 # ifndef _STLP_NO_MBSTATE_T
   162 	std::locale::id codecvt_char_char_mbstate_id;
   163 # ifndef _STLP_NO_WCHAR_T
   164 	std::locale::id codecvt_wchar_char_mbstate_id;
   165 # endif
   166 # endif		//_STLP_NO_MBSTATE_T
   167 	std::locale::id collate_char_id;
   168 
   169 	std::locale::id ctype_char_id;
   170 
   171 	std::locale::id moneypunct_char_true_id;
   172 
   173 	std::locale::id moneypunct_char_false_id;
   174 
   175 	std::locale::id messages_char_id;
   176 
   177 	std::locale::id numpunct_char_id;
   178 
   179 # ifndef _STLP_NO_WCHAR_T
   180 	std::locale::id collate_wchar_id;
   181 
   182 	std::locale::id ctype_wchar_id;
   183 
   184 	std::locale::id moneypunct_wchar_true_id;
   185 
   186 	std::locale::id moneypunct_wchar_false_id;
   187 
   188 	std::locale::id numpunct_wchar_id;
   189 
   190 	std::locale::id messages_wchar_id;
   191 
   192 	std::locale::id num_get_wchar_istreambuf_iterator_id;
   193 
   194 	std::locale::id num_get_wchar_wchar_const_id;
   195 
   196 	std::locale::id num_put_wchar_ostreambuf_iterator_id;
   197 
   198 	std::locale::id num_put_wchar_wchar_id;
   199 
   200 	std::locale::id time_get_wchar_istreambuf_iterator_id;
   201 
   202 	std::locale::id time_get_wchar_wchar_const_id;
   203 
   204 	std::locale::id time_put_wchar_ostreambuf_iterator_id;
   205 
   206 	std::locale::id time_put_wchar_wchar_id;
   207 
   208 	std::locale::id money_get_wchar_istreambuf_iterator_id;
   209 
   210 	std::locale::id money_get_wchar_wchar_const_id;
   211 
   212 	std::locale::id money_put_wchar_ostreambuf_iterator_id;
   213 
   214 	std::locale::id money_put_wchar_wchar_id;
   215 #endif
   216 
   217 	std::locale::id time_get_char_istreambuf_iterator_id;
   218 
   219 	std::locale::id time_get_char_char_const_id;
   220 
   221 	std::locale::id time_put_char_ostreambuf_iterator_id;
   222 
   223 	std::locale::id time_put_char_char_id;
   224 
   225 	std::locale::id num_get_char_istreambuf_iterator_id;
   226 
   227 	std::locale::id num_get_char_char_const_id;
   228 
   229 	std::locale::id num_put_char_ostreambuf_iterator_id;
   230 
   231 	std::locale::id num_put_char_char_id;
   232 
   233 	std::locale::id num_put_char_back_insert_iterator_id;
   234 
   235 	std::locale::id money_get_char_istreambuf_iterator_id;
   236 
   237 	std::locale::id money_get_char_char_const_id;
   238 
   239 	std::locale::id money_put_char_ostreambuf_iterator_id;
   240 
   241 	std::locale::id money_put_char_char_id;
   242 
   243 	std::map<std::string, std::locale::id> ctype_charT_ids; 		//for ctype<charT>
   244 	std::map<std::string, std::locale::id> numpunct_charT_ids; 	//for numpunct<charT>
   245 	std::map<std::string, std::locale::id> moneypunct_charT_ids;	//for moneypunct<charT>
   246 		
   247 #ifdef _STLP_DEBUG
   248 	std::string *_Nameless;
   249 #endif	
   250 	// ****** end of static var definition
   251 	
   252     bool is_Initialized;
   253     
   254     //constructor
   255     _Libcpp_wsd();
   256     
   257     //destructor	
   258     ~_Libcpp_wsd();
   259 
   260 };
   261 
   262 
   263 //declaraions for wsd initialization functions
   264 void locale_impl_init();
   265 void locale_index_lock_init();
   266 void monetary_empty_string_init();
   267 void global_iostream_init();
   268 void stdcpp_allocators_init();
   269 void filebuf_page_size_init();
   270 
   271 #ifdef _STLP_DEBUG
   272 inline std::string*& get_Nameless();
   273 #endif
   274 
   275 namespace _STLP_PRIV_NAME {
   276 void locale_catalog_category_hash_lock_init();
   277 void Category_Map_Init();
   278 _STLP_END_NAMESPACE
   279 
   280 
   281 const TUid KLibstdcppUID = {0x20017610};
   282 
   283 //cleanup all the WSD allocations
   284 IMPORT_C void CleanupWSD();
   285 
   286 //return the global class pointer
   287 IMPORT_C _Libcpp_wsd& get_libcpp_wsd();
   288 
   289 #ifdef _STLP_DEBUG
   290 inline std::string*& get_Nameless()
   291 	{
   292 	return get_libcpp_wsd()._Nameless;
   293 	}
   294 #endif
   295 
   296 
   297 // ******************************************************//
   298 
   299 //locale wsd functions
   300 #include "wsd_locales.h"
   301 
   302 //streams wsd functions
   303 #include "wsd_streams.h"
   304 
   305 // ******************************************************//
   306 #endif
   307 
   308 #endif /*LIBSTDCPPWSD_H_*/