epoc32/include/stdapis/stlportv5/libstdcppwsd.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/stlportv5/libstdcppwsd.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,308 @@
     1.4 +/*
     1.5 +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +* Name        : libcppwsd.h
    1.19 +* Part of     : standard c++ library (wsd definitions)
    1.20 +* 
    1.21 +*
    1.22 +*/
    1.23 +
    1.24 +
    1.25 +
    1.26 +#ifndef LIBSTDCPPWSD_H_
    1.27 +#define LIBSTDCPPWSD_H_
    1.28 +
    1.29 +#ifdef __SYMBIAN32__WSD__   //stuff for WSD
    1.30 +
    1.31 +
    1.32 +// ******************************  WSD RELATED ************************//
    1.33 +#include <e32std.h>
    1.34 +#include <pls.h> // For emulator WSD API
    1.35 +#include <typeinfo>
    1.36 +#include <locale>
    1.37 +#include <clocale>             
    1.38 +#include <vector>
    1.39 +#include <string>
    1.40 +#include <hash_map>
    1.41 +#include <cfloat>
    1.42 +#include <cmath>
    1.43 +#include <assert.h>
    1.44 +#include <stl/_new.h>
    1.45 +#include <stl/_map.h>
    1.46 +#include <stl/_locale.h>
    1.47 +#include <stl/_numpunct.h>
    1.48 +#include <stl/_alloc.h>
    1.49 +#include <stl/_fstream.h>
    1.50 +#include <stl/_codecvt.h>
    1.51 +#include <stl/_collate.h>
    1.52 +#include <stl/_ctype.h>
    1.53 +#include <stl/_pthread_alloc.h>
    1.54 +#include <stl/_monetary.h>
    1.55 +#include <stl/_threads.h>
    1.56 +
    1.57 +
    1.58 +// Global hash tables for category objects.
    1.59 +typedef std::hash_map<std::string, std::pair<void*, size_t>, std::hash<std::string>, std::equal_to<std::string> > Category_Map;
    1.60 +
    1.61 +#define LOCALE_ID_MAX		39
    1.62 +/*
    1.63 + * The following functions are used to make allocations internal to the 
    1.64 + * C++ library.These are only required on the emulator as these are 
    1.65 + * static variables in the actual STLPort implementation but in order to
    1.66 + * save them on the ewsd, they need to allocated on heap.
    1.67 + */
    1.68 +IMPORT_C void* WSDAlloc(unsigned int size);
    1.69 +IMPORT_C int   WSDFree(void*);
    1.70 +
    1.71 +// ******************************************************//
    1.72 +//  ***   all WSD definitions here
    1.73 +// ******************************************************//
    1.74 +class _Libcpp_wsd
    1.75 +{
    1.76 +public:
    1.77 +	//_locale.h
    1.78 +	size_t locale_id_S_max;
    1.79 +	
    1.80 +	//locale_impl.h
    1.81 +	std::locale *_Stl_classic_locale;	
    1.82 +	std::locale *_Stl_global_locale;
    1.83 +	
    1.84 +	void* __Loc_init_buf;
    1.85 +	
    1.86 +	std::_Refcount_Base *_Loc_init_S_count;
    1.87 +	
    1.88 +	//locale.cpp
    1.89 +	__stl_atomic_t _S_index;
    1.90 +	std::_STLP_STATIC_MUTEX locale_Index_lock;
    1.91 +
    1.92 +	//_ios_base.h
    1.93 +	bool ios_base_S_was_synced;
    1.94 +	long ios_base_Init_S_count; 	//ios_base::Init class	
    1.95 +	std::ios_base::Init *_IosInit;
    1.96 +	
    1.97 +	//ios.cpp
    1.98 +	int ios_base_xalloc_S_index;
    1.99 +	std::_STLP_STATIC_MUTEX ios_base_xalloc_lock; 
   1.100 +
   1.101 +	//locale_catalog.cpp
   1.102 +	Category_Map *_S_ctype_hash;
   1.103 +	Category_Map *_S_numeric_hash;
   1.104 +	Category_Map *_S_time_hash;
   1.105 +	Category_Map *_S_collate_hash;
   1.106 +	Category_Map *_S_monetary_hash;
   1.107 +	Category_Map *_S_messages_hash;
   1.108 +	
   1.109 +	std::_STLP_STATIC_MUTEX locale_catalog_category_hash_lock;
   1.110 +
   1.111 +	//iostream.cpp
   1.112 +	std::istream  *wsd_cin;
   1.113 +	std::ostream  *wsd_cout;
   1.114 +	std::ostream  *wsd_cerr;
   1.115 +	std::ostream  *wsd_clog;
   1.116 +#ifndef _STLP_NO_WCHAR_T
   1.117 +	std::wistream *wsd_wcin;
   1.118 +	std::wostream *wsd_wcout;
   1.119 +	std::wostream *wsd_wcerr;
   1.120 +	std::wostream *wsd_wclog;
   1.121 +#endif
   1.122 +
   1.123 +	//numpunct.cpp
   1.124 +	std::string numpunct_char_m_truename;
   1.125 +	std::string numpunct_char_m_falsename;
   1.126 +	std::string numpunct_char_m_grouping;
   1.127 +# ifndef _STLP_NO_WCHAR_T
   1.128 +	std::wstring numpunct_wchar_m_truename;
   1.129 +	std::wstring numpunct_wchar_m_falsename;
   1.130 +	std::string  numpunct_wchar_m_grouping;
   1.131 +# endif
   1.132 +	
   1.133 +	//monetary.cpp
   1.134 +	std::string monetary_S_empty_string;	
   1.135 +# ifndef _STLP_NO_WCHAR_T
   1.136 +	std::wstring monetary_S_empty_wstring;
   1.137 +# endif //_STLP_NO_WCHAR_T
   1.138 +
   1.139 +	//_fstream.h
   1.140 +	size_t fstream_Filebuf_base_M_page_size;
   1.141 +	
   1.142 +	//allocators.cpp
   1.143 +	std::__oom_handler_type wsd__oom_handler;
   1.144 +	std::_STLP_STATIC_MUTEX wsd_allocator_S_lock;
   1.145 +	size_t wsd__node_alloc_impl_S_heap_size;
   1.146 +	char* wsd_S_start_free;
   1.147 +	char* wsd_S_end_free;
   1.148 +	void* wsd_S_free_list[16];	
   1.149 +	
   1.150 +	std::_STLP_STATIC_MUTEX wsd_pt_S_chunk_allocator_lock;
   1.151 +	char *wsd_pt_S_start_free;
   1.152 +	char *wsd_pt_S_end_free;
   1.153 +	size_t wsd_pt_S_heap_size;
   1.154 +	stlp_priv::_Pthread_alloc::__state_type *wsd_pt_S_free_per_thread_states;
   1.155 +	pthread_key_t wsd_pt_S_key;
   1.156 +	bool wsd_pt_S_key_initialized;
   1.157 +	
   1.158 +	//_threads.h
   1.159 +	std::_STLP_STATIC_MUTEX _threads_S_swap_lock;
   1.160 +	std::_STLP_STATIC_MUTEX _threads_0_S_swap_lock;
   1.161 +	unsigned _mutex_max;
   1.162 +	unsigned _mutex_last;
   1.163 +	
   1.164 +# ifndef _STLP_NO_MBSTATE_T
   1.165 +	std::locale::id codecvt_char_char_mbstate_id;
   1.166 +# ifndef _STLP_NO_WCHAR_T
   1.167 +	std::locale::id codecvt_wchar_char_mbstate_id;
   1.168 +# endif
   1.169 +# endif		//_STLP_NO_MBSTATE_T
   1.170 +	std::locale::id collate_char_id;
   1.171 +
   1.172 +	std::locale::id ctype_char_id;
   1.173 +
   1.174 +	std::locale::id moneypunct_char_true_id;
   1.175 +
   1.176 +	std::locale::id moneypunct_char_false_id;
   1.177 +
   1.178 +	std::locale::id messages_char_id;
   1.179 +
   1.180 +	std::locale::id numpunct_char_id;
   1.181 +
   1.182 +# ifndef _STLP_NO_WCHAR_T
   1.183 +	std::locale::id collate_wchar_id;
   1.184 +
   1.185 +	std::locale::id ctype_wchar_id;
   1.186 +
   1.187 +	std::locale::id moneypunct_wchar_true_id;
   1.188 +
   1.189 +	std::locale::id moneypunct_wchar_false_id;
   1.190 +
   1.191 +	std::locale::id numpunct_wchar_id;
   1.192 +
   1.193 +	std::locale::id messages_wchar_id;
   1.194 +
   1.195 +	std::locale::id num_get_wchar_istreambuf_iterator_id;
   1.196 +
   1.197 +	std::locale::id num_get_wchar_wchar_const_id;
   1.198 +
   1.199 +	std::locale::id num_put_wchar_ostreambuf_iterator_id;
   1.200 +
   1.201 +	std::locale::id num_put_wchar_wchar_id;
   1.202 +
   1.203 +	std::locale::id time_get_wchar_istreambuf_iterator_id;
   1.204 +
   1.205 +	std::locale::id time_get_wchar_wchar_const_id;
   1.206 +
   1.207 +	std::locale::id time_put_wchar_ostreambuf_iterator_id;
   1.208 +
   1.209 +	std::locale::id time_put_wchar_wchar_id;
   1.210 +
   1.211 +	std::locale::id money_get_wchar_istreambuf_iterator_id;
   1.212 +
   1.213 +	std::locale::id money_get_wchar_wchar_const_id;
   1.214 +
   1.215 +	std::locale::id money_put_wchar_ostreambuf_iterator_id;
   1.216 +
   1.217 +	std::locale::id money_put_wchar_wchar_id;
   1.218 +#endif
   1.219 +
   1.220 +	std::locale::id time_get_char_istreambuf_iterator_id;
   1.221 +
   1.222 +	std::locale::id time_get_char_char_const_id;
   1.223 +
   1.224 +	std::locale::id time_put_char_ostreambuf_iterator_id;
   1.225 +
   1.226 +	std::locale::id time_put_char_char_id;
   1.227 +
   1.228 +	std::locale::id num_get_char_istreambuf_iterator_id;
   1.229 +
   1.230 +	std::locale::id num_get_char_char_const_id;
   1.231 +
   1.232 +	std::locale::id num_put_char_ostreambuf_iterator_id;
   1.233 +
   1.234 +	std::locale::id num_put_char_char_id;
   1.235 +
   1.236 +	std::locale::id num_put_char_back_insert_iterator_id;
   1.237 +
   1.238 +	std::locale::id money_get_char_istreambuf_iterator_id;
   1.239 +
   1.240 +	std::locale::id money_get_char_char_const_id;
   1.241 +
   1.242 +	std::locale::id money_put_char_ostreambuf_iterator_id;
   1.243 +
   1.244 +	std::locale::id money_put_char_char_id;
   1.245 +
   1.246 +	std::map<std::string, std::locale::id> ctype_charT_ids; 		//for ctype<charT>
   1.247 +	std::map<std::string, std::locale::id> numpunct_charT_ids; 	//for numpunct<charT>
   1.248 +	std::map<std::string, std::locale::id> moneypunct_charT_ids;	//for moneypunct<charT>
   1.249 +		
   1.250 +#ifdef _STLP_DEBUG
   1.251 +	std::string *_Nameless;
   1.252 +#endif	
   1.253 +	// ****** end of static var definition
   1.254 +	
   1.255 +    bool is_Initialized;
   1.256 +    
   1.257 +    //constructor
   1.258 +    _Libcpp_wsd();
   1.259 +    
   1.260 +    //destructor	
   1.261 +    ~_Libcpp_wsd();
   1.262 +
   1.263 +};
   1.264 +
   1.265 +
   1.266 +//declaraions for wsd initialization functions
   1.267 +void locale_impl_init();
   1.268 +void locale_index_lock_init();
   1.269 +void monetary_empty_string_init();
   1.270 +void global_iostream_init();
   1.271 +void stdcpp_allocators_init();
   1.272 +void filebuf_page_size_init();
   1.273 +
   1.274 +#ifdef _STLP_DEBUG
   1.275 +inline std::string*& get_Nameless();
   1.276 +#endif
   1.277 +
   1.278 +namespace _STLP_PRIV_NAME {
   1.279 +void locale_catalog_category_hash_lock_init();
   1.280 +void Category_Map_Init();
   1.281 +_STLP_END_NAMESPACE
   1.282 +
   1.283 +
   1.284 +const TUid KLibstdcppUID = {0x20017610};
   1.285 +
   1.286 +//cleanup all the WSD allocations
   1.287 +IMPORT_C void CleanupWSD();
   1.288 +
   1.289 +//return the global class pointer
   1.290 +IMPORT_C _Libcpp_wsd& get_libcpp_wsd();
   1.291 +
   1.292 +#ifdef _STLP_DEBUG
   1.293 +inline std::string*& get_Nameless()
   1.294 +	{
   1.295 +	return get_libcpp_wsd()._Nameless;
   1.296 +	}
   1.297 +#endif
   1.298 +
   1.299 +
   1.300 +// ******************************************************//
   1.301 +
   1.302 +//locale wsd functions
   1.303 +#include "wsd_locales.h"
   1.304 +
   1.305 +//streams wsd functions
   1.306 +#include "wsd_streams.h"
   1.307 +
   1.308 +// ******************************************************//
   1.309 +#endif
   1.310 +
   1.311 +#endif /*LIBSTDCPPWSD_H_*/