passenger-jmazzi 2.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +6 -0
- data/LICENSE +19 -0
- data/NEWS +270 -0
- data/README +45 -0
- data/Rakefile +918 -0
- data/benchmark/ApplicationPool.cpp +52 -0
- data/benchmark/accept_vs_socketpair_vs_named_pipes.rb +126 -0
- data/benchmark/dispatcher.rb +42 -0
- data/benchmark/overhead_of_password_checking.rb +81 -0
- data/benchmark/socket_connections_vs_persistent_pipe.rb +99 -0
- data/benchmark/unix_sockets_vs_pipes.rb +83 -0
- data/bin/passenger-config +46 -0
- data/bin/passenger-install-apache2-module +224 -0
- data/bin/passenger-install-nginx-module +474 -0
- data/bin/passenger-make-enterprisey +83 -0
- data/bin/passenger-memory-stats +301 -0
- data/bin/passenger-spawn-server +68 -0
- data/bin/passenger-status +125 -0
- data/bin/passenger-stress-test +344 -0
- data/debian/compat +1 -0
- data/debian/control +21 -0
- data/debian/postinst +24 -0
- data/debian/prerm +2 -0
- data/doc/ApplicationPool algorithm.txt +402 -0
- data/doc/Architectural overview.txt +334 -0
- data/doc/Doxyfile +241 -0
- data/doc/Security of user switching support.txt +197 -0
- data/doc/Users guide Apache.txt +1848 -0
- data/doc/Users guide Nginx.txt +769 -0
- data/doc/definitions.h +5 -0
- data/doc/images/by_sa.png +0 -0
- data/doc/images/conservative_spawning.png +0 -0
- data/doc/images/conservative_spawning.svg +248 -0
- data/doc/images/icons/README +5 -0
- data/doc/images/icons/callouts/1.png +0 -0
- data/doc/images/icons/callouts/10.png +0 -0
- data/doc/images/icons/callouts/11.png +0 -0
- data/doc/images/icons/callouts/12.png +0 -0
- data/doc/images/icons/callouts/13.png +0 -0
- data/doc/images/icons/callouts/14.png +0 -0
- data/doc/images/icons/callouts/15.png +0 -0
- data/doc/images/icons/callouts/2.png +0 -0
- data/doc/images/icons/callouts/3.png +0 -0
- data/doc/images/icons/callouts/4.png +0 -0
- data/doc/images/icons/callouts/5.png +0 -0
- data/doc/images/icons/callouts/6.png +0 -0
- data/doc/images/icons/callouts/7.png +0 -0
- data/doc/images/icons/callouts/8.png +0 -0
- data/doc/images/icons/callouts/9.png +0 -0
- data/doc/images/icons/caution.png +0 -0
- data/doc/images/icons/example.png +0 -0
- data/doc/images/icons/home.png +0 -0
- data/doc/images/icons/important.png +0 -0
- data/doc/images/icons/next.png +0 -0
- data/doc/images/icons/note.png +0 -0
- data/doc/images/icons/prev.png +0 -0
- data/doc/images/icons/tip.png +0 -0
- data/doc/images/icons/up.png +0 -0
- data/doc/images/icons/warning.png +0 -0
- data/doc/images/passenger_architecture.png +0 -0
- data/doc/images/passenger_architecture.svg +401 -0
- data/doc/images/phusion_banner.png +0 -0
- data/doc/images/smart-lv2.png +0 -0
- data/doc/images/smart-lv2.svg +320 -0
- data/doc/images/spawn_server_architecture.png +0 -0
- data/doc/images/spawn_server_architecture.svg +655 -0
- data/doc/images/typical_isolated_web_application.png +0 -0
- data/doc/images/typical_isolated_web_application.svg +213 -0
- data/doc/template/horo.rb +613 -0
- data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
- data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
- data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
- data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +71 -0
- data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
- data/doc/users_guide_snippets/tips.txt +173 -0
- data/ext/apache2/Bucket.cpp +190 -0
- data/ext/apache2/Bucket.h +87 -0
- data/ext/apache2/Configuration.cpp +798 -0
- data/ext/apache2/Configuration.h +405 -0
- data/ext/apache2/DirectoryMapper.h +296 -0
- data/ext/apache2/Hooks.cpp +1617 -0
- data/ext/apache2/Hooks.h +45 -0
- data/ext/apache2/LICENSE-CNRI.TXT +79 -0
- data/ext/apache2/mod_passenger.c +38 -0
- data/ext/boost/LICENSE.TXT +23 -0
- data/ext/boost/VERSION.TXT +1 -0
- data/ext/boost/algorithm/string/case_conv.hpp +176 -0
- data/ext/boost/algorithm/string/compare.hpp +199 -0
- data/ext/boost/algorithm/string/concept.hpp +83 -0
- data/ext/boost/algorithm/string/config.hpp +28 -0
- data/ext/boost/algorithm/string/constants.hpp +36 -0
- data/ext/boost/algorithm/string/detail/case_conv.hpp +112 -0
- data/ext/boost/algorithm/string/detail/find_format.hpp +193 -0
- data/ext/boost/algorithm/string/detail/find_format_all.hpp +263 -0
- data/ext/boost/algorithm/string/detail/find_format_store.hpp +71 -0
- data/ext/boost/algorithm/string/detail/finder.hpp +646 -0
- data/ext/boost/algorithm/string/detail/formatter.hpp +94 -0
- data/ext/boost/algorithm/string/detail/replace_storage.hpp +159 -0
- data/ext/boost/algorithm/string/detail/sequence.hpp +200 -0
- data/ext/boost/algorithm/string/detail/util.hpp +106 -0
- data/ext/boost/algorithm/string/erase.hpp +844 -0
- data/ext/boost/algorithm/string/find_format.hpp +269 -0
- data/ext/boost/algorithm/string/finder.hpp +270 -0
- data/ext/boost/algorithm/string/formatter.hpp +103 -0
- data/ext/boost/algorithm/string/replace.hpp +928 -0
- data/ext/boost/algorithm/string/sequence_traits.hpp +193 -0
- data/ext/boost/algorithm/string/yes_no_type.hpp +33 -0
- data/ext/boost/assert.hpp +50 -0
- data/ext/boost/bind.hpp +1689 -0
- data/ext/boost/bind/arg.hpp +62 -0
- data/ext/boost/bind/bind_cc.hpp +117 -0
- data/ext/boost/bind/bind_mf_cc.hpp +227 -0
- data/ext/boost/bind/bind_template.hpp +345 -0
- data/ext/boost/bind/mem_fn_cc.hpp +103 -0
- data/ext/boost/bind/mem_fn_template.hpp +1020 -0
- data/ext/boost/bind/placeholders.hpp +68 -0
- data/ext/boost/bind/storage.hpp +475 -0
- data/ext/boost/call_traits.hpp +24 -0
- data/ext/boost/checked_delete.hpp +69 -0
- data/ext/boost/concept/assert.hpp +46 -0
- data/ext/boost/concept/detail/concept_def.hpp +51 -0
- data/ext/boost/concept/detail/concept_undef.hpp +5 -0
- data/ext/boost/concept/detail/general.hpp +66 -0
- data/ext/boost/concept/detail/has_constraints.hpp +48 -0
- data/ext/boost/concept/usage.hpp +43 -0
- data/ext/boost/concept_check.hpp +988 -0
- data/ext/boost/config.hpp +70 -0
- data/ext/boost/config/abi/borland_prefix.hpp +27 -0
- data/ext/boost/config/abi/borland_suffix.hpp +12 -0
- data/ext/boost/config/abi/msvc_prefix.hpp +8 -0
- data/ext/boost/config/abi/msvc_suffix.hpp +8 -0
- data/ext/boost/config/abi_prefix.hpp +25 -0
- data/ext/boost/config/abi_suffix.hpp +26 -0
- data/ext/boost/config/auto_link.hpp +368 -0
- data/ext/boost/config/compiler/borland.hpp +209 -0
- data/ext/boost/config/compiler/comeau.hpp +59 -0
- data/ext/boost/config/compiler/common_edg.hpp +62 -0
- data/ext/boost/config/compiler/compaq_cxx.hpp +19 -0
- data/ext/boost/config/compiler/digitalmars.hpp +67 -0
- data/ext/boost/config/compiler/gcc.hpp +149 -0
- data/ext/boost/config/compiler/gcc_xml.hpp +30 -0
- data/ext/boost/config/compiler/greenhills.hpp +28 -0
- data/ext/boost/config/compiler/hp_acc.hpp +95 -0
- data/ext/boost/config/compiler/intel.hpp +162 -0
- data/ext/boost/config/compiler/kai.hpp +35 -0
- data/ext/boost/config/compiler/metrowerks.hpp +111 -0
- data/ext/boost/config/compiler/mpw.hpp +51 -0
- data/ext/boost/config/compiler/pgi.hpp +25 -0
- data/ext/boost/config/compiler/sgi_mipspro.hpp +28 -0
- data/ext/boost/config/compiler/sunpro_cc.hpp +98 -0
- data/ext/boost/config/compiler/vacpp.hpp +60 -0
- data/ext/boost/config/compiler/visualc.hpp +191 -0
- data/ext/boost/config/no_tr1/complex.hpp +28 -0
- data/ext/boost/config/no_tr1/functional.hpp +28 -0
- data/ext/boost/config/no_tr1/memory.hpp +28 -0
- data/ext/boost/config/no_tr1/utility.hpp +28 -0
- data/ext/boost/config/platform/aix.hpp +33 -0
- data/ext/boost/config/platform/amigaos.hpp +15 -0
- data/ext/boost/config/platform/beos.hpp +26 -0
- data/ext/boost/config/platform/bsd.hpp +73 -0
- data/ext/boost/config/platform/cygwin.hpp +51 -0
- data/ext/boost/config/platform/hpux.hpp +84 -0
- data/ext/boost/config/platform/irix.hpp +31 -0
- data/ext/boost/config/platform/linux.hpp +98 -0
- data/ext/boost/config/platform/macos.hpp +78 -0
- data/ext/boost/config/platform/qnxnto.hpp +31 -0
- data/ext/boost/config/platform/solaris.hpp +21 -0
- data/ext/boost/config/platform/win32.hpp +58 -0
- data/ext/boost/config/posix_features.hpp +95 -0
- data/ext/boost/config/requires_threads.hpp +92 -0
- data/ext/boost/config/select_compiler_config.hpp +115 -0
- data/ext/boost/config/select_platform_config.hpp +90 -0
- data/ext/boost/config/select_stdlib_config.hpp +68 -0
- data/ext/boost/config/stdlib/dinkumware.hpp +106 -0
- data/ext/boost/config/stdlib/libcomo.hpp +46 -0
- data/ext/boost/config/stdlib/libstdcpp3.hpp +73 -0
- data/ext/boost/config/stdlib/modena.hpp +30 -0
- data/ext/boost/config/stdlib/msl.hpp +59 -0
- data/ext/boost/config/stdlib/roguewave.hpp +153 -0
- data/ext/boost/config/stdlib/sgi.hpp +111 -0
- data/ext/boost/config/stdlib/stlport.hpp +201 -0
- data/ext/boost/config/stdlib/vacpp.hpp +18 -0
- data/ext/boost/config/suffix.hpp +566 -0
- data/ext/boost/config/user.hpp +124 -0
- data/ext/boost/cstdint.hpp +449 -0
- data/ext/boost/current_function.hpp +67 -0
- data/ext/boost/date_time/adjust_functors.hpp +178 -0
- data/ext/boost/date_time/c_time.hpp +91 -0
- data/ext/boost/date_time/compiler_config.hpp +149 -0
- data/ext/boost/date_time/constrained_value.hpp +98 -0
- data/ext/boost/date_time/date.hpp +197 -0
- data/ext/boost/date_time/date_clock_device.hpp +77 -0
- data/ext/boost/date_time/date_defs.hpp +26 -0
- data/ext/boost/date_time/date_duration.hpp +147 -0
- data/ext/boost/date_time/date_duration_types.hpp +269 -0
- data/ext/boost/date_time/date_facet.hpp +775 -0
- data/ext/boost/date_time/date_format_simple.hpp +159 -0
- data/ext/boost/date_time/date_formatting.hpp +127 -0
- data/ext/boost/date_time/date_formatting_limited.hpp +121 -0
- data/ext/boost/date_time/date_formatting_locales.hpp +233 -0
- data/ext/boost/date_time/date_generator_formatter.hpp +263 -0
- data/ext/boost/date_time/date_generator_parser.hpp +329 -0
- data/ext/boost/date_time/date_generators.hpp +509 -0
- data/ext/boost/date_time/date_iterator.hpp +101 -0
- data/ext/boost/date_time/date_names_put.hpp +320 -0
- data/ext/boost/date_time/date_parsing.hpp +299 -0
- data/ext/boost/date_time/dst_rules.hpp +391 -0
- data/ext/boost/date_time/filetime_functions.hpp +78 -0
- data/ext/boost/date_time/format_date_parser.hpp +731 -0
- data/ext/boost/date_time/gregorian/conversion.hpp +73 -0
- data/ext/boost/date_time/gregorian/formatters.hpp +162 -0
- data/ext/boost/date_time/gregorian/formatters_limited.hpp +81 -0
- data/ext/boost/date_time/gregorian/greg_calendar.hpp +47 -0
- data/ext/boost/date_time/gregorian/greg_date.hpp +135 -0
- data/ext/boost/date_time/gregorian/greg_day.hpp +57 -0
- data/ext/boost/date_time/gregorian/greg_day_of_year.hpp +38 -0
- data/ext/boost/date_time/gregorian/greg_duration.hpp +38 -0
- data/ext/boost/date_time/gregorian/greg_duration_types.hpp +34 -0
- data/ext/boost/date_time/gregorian/greg_month.hpp +105 -0
- data/ext/boost/date_time/gregorian/greg_weekday.hpp +66 -0
- data/ext/boost/date_time/gregorian/greg_year.hpp +53 -0
- data/ext/boost/date_time/gregorian/greg_ymd.hpp +33 -0
- data/ext/boost/date_time/gregorian/gregorian.hpp +38 -0
- data/ext/boost/date_time/gregorian/gregorian_io.hpp +777 -0
- data/ext/boost/date_time/gregorian/gregorian_types.hpp +109 -0
- data/ext/boost/date_time/gregorian/parsers.hpp +91 -0
- data/ext/boost/date_time/gregorian_calendar.hpp +70 -0
- data/ext/boost/date_time/gregorian_calendar.ipp +219 -0
- data/ext/boost/date_time/int_adapter.hpp +507 -0
- data/ext/boost/date_time/iso_format.hpp +303 -0
- data/ext/boost/date_time/locale_config.hpp +31 -0
- data/ext/boost/date_time/microsec_time_clock.hpp +205 -0
- data/ext/boost/date_time/parse_format_base.hpp +29 -0
- data/ext/boost/date_time/period.hpp +377 -0
- data/ext/boost/date_time/period_formatter.hpp +196 -0
- data/ext/boost/date_time/period_parser.hpp +196 -0
- data/ext/boost/date_time/posix_time/conversion.hpp +93 -0
- data/ext/boost/date_time/posix_time/date_duration_operators.hpp +114 -0
- data/ext/boost/date_time/posix_time/posix_time.hpp +39 -0
- data/ext/boost/date_time/posix_time/posix_time_config.hpp +178 -0
- data/ext/boost/date_time/posix_time/posix_time_duration.hpp +82 -0
- data/ext/boost/date_time/posix_time/posix_time_io.hpp +246 -0
- data/ext/boost/date_time/posix_time/posix_time_system.hpp +68 -0
- data/ext/boost/date_time/posix_time/posix_time_types.hpp +55 -0
- data/ext/boost/date_time/posix_time/ptime.hpp +65 -0
- data/ext/boost/date_time/posix_time/time_formatters.hpp +289 -0
- data/ext/boost/date_time/posix_time/time_parsers.hpp +44 -0
- data/ext/boost/date_time/posix_time/time_period.hpp +29 -0
- data/ext/boost/date_time/special_defs.hpp +25 -0
- data/ext/boost/date_time/special_values_formatter.hpp +96 -0
- data/ext/boost/date_time/special_values_parser.hpp +159 -0
- data/ext/boost/date_time/string_convert.hpp +33 -0
- data/ext/boost/date_time/string_parse_tree.hpp +278 -0
- data/ext/boost/date_time/strings_from_facet.hpp +123 -0
- data/ext/boost/date_time/time.hpp +190 -0
- data/ext/boost/date_time/time_clock.hpp +83 -0
- data/ext/boost/date_time/time_defs.hpp +33 -0
- data/ext/boost/date_time/time_duration.hpp +281 -0
- data/ext/boost/date_time/time_facet.hpp +1263 -0
- data/ext/boost/date_time/time_formatting_streams.hpp +119 -0
- data/ext/boost/date_time/time_iterator.hpp +52 -0
- data/ext/boost/date_time/time_parsing.hpp +321 -0
- data/ext/boost/date_time/time_resolution_traits.hpp +140 -0
- data/ext/boost/date_time/time_system_counted.hpp +254 -0
- data/ext/boost/date_time/time_system_split.hpp +213 -0
- data/ext/boost/date_time/wrapping_int.hpp +163 -0
- data/ext/boost/date_time/year_month_day.hpp +45 -0
- data/ext/boost/detail/atomic_count.hpp +124 -0
- data/ext/boost/detail/atomic_count_gcc.hpp +68 -0
- data/ext/boost/detail/atomic_count_gcc_x86.hpp +84 -0
- data/ext/boost/detail/atomic_count_pthreads.hpp +96 -0
- data/ext/boost/detail/atomic_count_solaris.hpp +59 -0
- data/ext/boost/detail/atomic_count_sync.hpp +57 -0
- data/ext/boost/detail/atomic_count_win32.hpp +63 -0
- data/ext/boost/detail/bad_weak_ptr.hpp +59 -0
- data/ext/boost/detail/call_traits.hpp +164 -0
- data/ext/boost/detail/endian.hpp +73 -0
- data/ext/boost/detail/indirect_traits.hpp +487 -0
- data/ext/boost/detail/iterator.hpp +494 -0
- data/ext/boost/detail/lcast_precision.hpp +184 -0
- data/ext/boost/detail/limits.hpp +449 -0
- data/ext/boost/detail/reference_content.hpp +141 -0
- data/ext/boost/detail/shared_count.hpp +375 -0
- data/ext/boost/detail/sp_counted_base.hpp +81 -0
- data/ext/boost/detail/sp_counted_base_acc_ia64.hpp +150 -0
- data/ext/boost/detail/sp_counted_base_cw_ppc.hpp +170 -0
- data/ext/boost/detail/sp_counted_base_cw_x86.hpp +158 -0
- data/ext/boost/detail/sp_counted_base_gcc_ia64.hpp +157 -0
- data/ext/boost/detail/sp_counted_base_gcc_ppc.hpp +181 -0
- data/ext/boost/detail/sp_counted_base_gcc_sparc.hpp +166 -0
- data/ext/boost/detail/sp_counted_base_gcc_x86.hpp +173 -0
- data/ext/boost/detail/sp_counted_base_nt.hpp +107 -0
- data/ext/boost/detail/sp_counted_base_pt.hpp +135 -0
- data/ext/boost/detail/sp_counted_base_solaris.hpp +113 -0
- data/ext/boost/detail/sp_counted_base_sync.hpp +151 -0
- data/ext/boost/detail/sp_counted_base_w32.hpp +130 -0
- data/ext/boost/detail/sp_counted_impl.hpp +231 -0
- data/ext/boost/detail/sp_typeinfo.hpp +83 -0
- data/ext/boost/detail/workaround.hpp +202 -0
- data/ext/boost/enable_shared_from_this.hpp +73 -0
- data/ext/boost/function.hpp +66 -0
- data/ext/boost/function/detail/function_iterate.hpp +16 -0
- data/ext/boost/function/detail/maybe_include.hpp +267 -0
- data/ext/boost/function/detail/prologue.hpp +25 -0
- data/ext/boost/function/function_base.hpp +762 -0
- data/ext/boost/function/function_template.hpp +969 -0
- data/ext/boost/function_equal.hpp +28 -0
- data/ext/boost/get_pointer.hpp +29 -0
- data/ext/boost/implicit_cast.hpp +29 -0
- data/ext/boost/integer_traits.hpp +236 -0
- data/ext/boost/io/ios_state.hpp +431 -0
- data/ext/boost/io_fwd.hpp +67 -0
- data/ext/boost/is_placeholder.hpp +31 -0
- data/ext/boost/iterator.hpp +59 -0
- data/ext/boost/iterator/detail/config_def.hpp +135 -0
- data/ext/boost/iterator/detail/config_undef.hpp +25 -0
- data/ext/boost/iterator/detail/enable_if.hpp +86 -0
- data/ext/boost/iterator/detail/facade_iterator_category.hpp +200 -0
- data/ext/boost/iterator/detail/minimum_category.hpp +116 -0
- data/ext/boost/iterator/interoperable.hpp +50 -0
- data/ext/boost/iterator/iterator_adaptor.hpp +366 -0
- data/ext/boost/iterator/iterator_categories.hpp +188 -0
- data/ext/boost/iterator/iterator_facade.hpp +879 -0
- data/ext/boost/iterator/iterator_traits.hpp +92 -0
- data/ext/boost/iterator/reverse_iterator.hpp +69 -0
- data/ext/boost/iterator/transform_iterator.hpp +188 -0
- data/ext/boost/lexical_cast.hpp +1205 -0
- data/ext/boost/limits.hpp +146 -0
- data/ext/boost/mem_fn.hpp +389 -0
- data/ext/boost/mpl/always.hpp +39 -0
- data/ext/boost/mpl/and.hpp +60 -0
- data/ext/boost/mpl/apply.hpp +229 -0
- data/ext/boost/mpl/apply_fwd.hpp +107 -0
- data/ext/boost/mpl/apply_wrap.hpp +203 -0
- data/ext/boost/mpl/arg.hpp +131 -0
- data/ext/boost/mpl/arg_fwd.hpp +28 -0
- data/ext/boost/mpl/assert.hpp +370 -0
- data/ext/boost/mpl/aux_/adl_barrier.hpp +48 -0
- data/ext/boost/mpl/aux_/arg_typedef.hpp +31 -0
- data/ext/boost/mpl/aux_/arity.hpp +39 -0
- data/ext/boost/mpl/aux_/arity_spec.hpp +67 -0
- data/ext/boost/mpl/aux_/common_name_wknd.hpp +34 -0
- data/ext/boost/mpl/aux_/config/adl.hpp +40 -0
- data/ext/boost/mpl/aux_/config/arrays.hpp +30 -0
- data/ext/boost/mpl/aux_/config/bind.hpp +33 -0
- data/ext/boost/mpl/aux_/config/compiler.hpp +64 -0
- data/ext/boost/mpl/aux_/config/ctps.hpp +30 -0
- data/ext/boost/mpl/aux_/config/dtp.hpp +46 -0
- data/ext/boost/mpl/aux_/config/eti.hpp +47 -0
- data/ext/boost/mpl/aux_/config/gcc.hpp +23 -0
- data/ext/boost/mpl/aux_/config/has_apply.hpp +32 -0
- data/ext/boost/mpl/aux_/config/has_xxx.hpp +33 -0
- data/ext/boost/mpl/aux_/config/integral.hpp +38 -0
- data/ext/boost/mpl/aux_/config/intel.hpp +21 -0
- data/ext/boost/mpl/aux_/config/lambda.hpp +32 -0
- data/ext/boost/mpl/aux_/config/msvc.hpp +21 -0
- data/ext/boost/mpl/aux_/config/msvc_typename.hpp +26 -0
- data/ext/boost/mpl/aux_/config/nttp.hpp +41 -0
- data/ext/boost/mpl/aux_/config/overload_resolution.hpp +29 -0
- data/ext/boost/mpl/aux_/config/pp_counter.hpp +26 -0
- data/ext/boost/mpl/aux_/config/preprocessor.hpp +39 -0
- data/ext/boost/mpl/aux_/config/static_constant.hpp +25 -0
- data/ext/boost/mpl/aux_/config/ttp.hpp +41 -0
- data/ext/boost/mpl/aux_/config/use_preprocessed.hpp +19 -0
- data/ext/boost/mpl/aux_/config/workaround.hpp +19 -0
- data/ext/boost/mpl/aux_/full_lambda.hpp +354 -0
- data/ext/boost/mpl/aux_/has_apply.hpp +32 -0
- data/ext/boost/mpl/aux_/has_type.hpp +23 -0
- data/ext/boost/mpl/aux_/include_preprocessed.hpp +42 -0
- data/ext/boost/mpl/aux_/integral_wrapper.hpp +93 -0
- data/ext/boost/mpl/aux_/lambda_arity_param.hpp +25 -0
- data/ext/boost/mpl/aux_/lambda_support.hpp +169 -0
- data/ext/boost/mpl/aux_/msvc_never_true.hpp +34 -0
- data/ext/boost/mpl/aux_/na.hpp +95 -0
- data/ext/boost/mpl/aux_/na_assert.hpp +34 -0
- data/ext/boost/mpl/aux_/na_fwd.hpp +31 -0
- data/ext/boost/mpl/aux_/na_spec.hpp +175 -0
- data/ext/boost/mpl/aux_/nested_type_wknd.hpp +48 -0
- data/ext/boost/mpl/aux_/nttp_decl.hpp +35 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/and.hpp +69 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply.hpp +169 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp +52 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp +84 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/arg.hpp +123 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/bind.hpp +561 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp +52 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp +558 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/or.hpp +69 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp +105 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/quote.hpp +123 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp +101 -0
- data/ext/boost/mpl/aux_/preprocessor/def_params_tail.hpp +105 -0
- data/ext/boost/mpl/aux_/preprocessor/enum.hpp +62 -0
- data/ext/boost/mpl/aux_/preprocessor/filter_params.hpp +28 -0
- data/ext/boost/mpl/aux_/preprocessor/params.hpp +65 -0
- data/ext/boost/mpl/aux_/preprocessor/sub.hpp +65 -0
- data/ext/boost/mpl/aux_/static_cast.hpp +27 -0
- data/ext/boost/mpl/aux_/template_arity.hpp +189 -0
- data/ext/boost/mpl/aux_/template_arity_fwd.hpp +23 -0
- data/ext/boost/mpl/aux_/type_wrapper.hpp +47 -0
- data/ext/boost/mpl/aux_/value_wknd.hpp +89 -0
- data/ext/boost/mpl/aux_/yes_no.hpp +58 -0
- data/ext/boost/mpl/bind.hpp +551 -0
- data/ext/boost/mpl/bind_fwd.hpp +99 -0
- data/ext/boost/mpl/bool.hpp +39 -0
- data/ext/boost/mpl/bool_fwd.hpp +33 -0
- data/ext/boost/mpl/eval_if.hpp +71 -0
- data/ext/boost/mpl/has_xxx.hpp +272 -0
- data/ext/boost/mpl/identity.hpp +45 -0
- data/ext/boost/mpl/if.hpp +135 -0
- data/ext/boost/mpl/int.hpp +22 -0
- data/ext/boost/mpl/int_fwd.hpp +27 -0
- data/ext/boost/mpl/integral_c.hpp +51 -0
- data/ext/boost/mpl/integral_c_fwd.hpp +32 -0
- data/ext/boost/mpl/integral_c_tag.hpp +26 -0
- data/ext/boost/mpl/lambda.hpp +29 -0
- data/ext/boost/mpl/lambda_fwd.hpp +57 -0
- data/ext/boost/mpl/limits/arity.hpp +21 -0
- data/ext/boost/mpl/logical.hpp +21 -0
- data/ext/boost/mpl/next.hpp +19 -0
- data/ext/boost/mpl/next_prior.hpp +49 -0
- data/ext/boost/mpl/not.hpp +51 -0
- data/ext/boost/mpl/or.hpp +61 -0
- data/ext/boost/mpl/placeholders.hpp +100 -0
- data/ext/boost/mpl/protect.hpp +55 -0
- data/ext/boost/mpl/quote.hpp +140 -0
- data/ext/boost/mpl/size_t.hpp +25 -0
- data/ext/boost/mpl/size_t_fwd.hpp +28 -0
- data/ext/boost/mpl/void.hpp +76 -0
- data/ext/boost/mpl/void_fwd.hpp +26 -0
- data/ext/boost/next_prior.hpp +51 -0
- data/ext/boost/non_type.hpp +27 -0
- data/ext/boost/noncopyable.hpp +36 -0
- data/ext/boost/none.hpp +28 -0
- data/ext/boost/none_t.hpp +24 -0
- data/ext/boost/operators.hpp +943 -0
- data/ext/boost/optional.hpp +18 -0
- data/ext/boost/optional/optional.hpp +922 -0
- data/ext/boost/optional/optional_fwd.hpp +22 -0
- data/ext/boost/preprocessor/arithmetic/add.hpp +51 -0
- data/ext/boost/preprocessor/arithmetic/dec.hpp +288 -0
- data/ext/boost/preprocessor/arithmetic/inc.hpp +288 -0
- data/ext/boost/preprocessor/arithmetic/sub.hpp +50 -0
- data/ext/boost/preprocessor/array/data.hpp +28 -0
- data/ext/boost/preprocessor/array/elem.hpp +29 -0
- data/ext/boost/preprocessor/array/size.hpp +28 -0
- data/ext/boost/preprocessor/cat.hpp +35 -0
- data/ext/boost/preprocessor/comma_if.hpp +17 -0
- data/ext/boost/preprocessor/config/config.hpp +70 -0
- data/ext/boost/preprocessor/control/detail/while.hpp +536 -0
- data/ext/boost/preprocessor/control/expr_iif.hpp +31 -0
- data/ext/boost/preprocessor/control/if.hpp +30 -0
- data/ext/boost/preprocessor/control/iif.hpp +34 -0
- data/ext/boost/preprocessor/control/while.hpp +312 -0
- data/ext/boost/preprocessor/debug/error.hpp +33 -0
- data/ext/boost/preprocessor/detail/auto_rec.hpp +293 -0
- data/ext/boost/preprocessor/detail/check.hpp +48 -0
- data/ext/boost/preprocessor/detail/is_binary.hpp +30 -0
- data/ext/boost/preprocessor/empty.hpp +17 -0
- data/ext/boost/preprocessor/enum.hpp +17 -0
- data/ext/boost/preprocessor/enum_params.hpp +17 -0
- data/ext/boost/preprocessor/facilities/empty.hpp +21 -0
- data/ext/boost/preprocessor/facilities/identity.hpp +23 -0
- data/ext/boost/preprocessor/identity.hpp +17 -0
- data/ext/boost/preprocessor/inc.hpp +17 -0
- data/ext/boost/preprocessor/iterate.hpp +17 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/lower1.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/upper1.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/iter/forward1.hpp +1342 -0
- data/ext/boost/preprocessor/iteration/iterate.hpp +82 -0
- data/ext/boost/preprocessor/list/adt.hpp +73 -0
- data/ext/boost/preprocessor/list/append.hpp +40 -0
- data/ext/boost/preprocessor/list/detail/fold_left.hpp +279 -0
- data/ext/boost/preprocessor/list/detail/fold_right.hpp +277 -0
- data/ext/boost/preprocessor/list/fold_left.hpp +303 -0
- data/ext/boost/preprocessor/list/fold_right.hpp +40 -0
- data/ext/boost/preprocessor/list/for_each_i.hpp +65 -0
- data/ext/boost/preprocessor/list/reverse.hpp +40 -0
- data/ext/boost/preprocessor/list/transform.hpp +49 -0
- data/ext/boost/preprocessor/logical/and.hpp +30 -0
- data/ext/boost/preprocessor/logical/bitand.hpp +38 -0
- data/ext/boost/preprocessor/logical/bool.hpp +288 -0
- data/ext/boost/preprocessor/logical/compl.hpp +36 -0
- data/ext/boost/preprocessor/punctuation/comma.hpp +21 -0
- data/ext/boost/preprocessor/punctuation/comma_if.hpp +31 -0
- data/ext/boost/preprocessor/repeat.hpp +17 -0
- data/ext/boost/preprocessor/repetition/detail/for.hpp +536 -0
- data/ext/boost/preprocessor/repetition/enum.hpp +66 -0
- data/ext/boost/preprocessor/repetition/enum_binary_params.hpp +54 -0
- data/ext/boost/preprocessor/repetition/enum_params.hpp +41 -0
- data/ext/boost/preprocessor/repetition/for.hpp +306 -0
- data/ext/boost/preprocessor/repetition/repeat.hpp +825 -0
- data/ext/boost/preprocessor/repetition/repeat_from_to.hpp +87 -0
- data/ext/boost/preprocessor/seq/elem.hpp +304 -0
- data/ext/boost/preprocessor/seq/enum.hpp +288 -0
- data/ext/boost/preprocessor/seq/for_each_i.hpp +61 -0
- data/ext/boost/preprocessor/seq/seq.hpp +44 -0
- data/ext/boost/preprocessor/seq/size.hpp +548 -0
- data/ext/boost/preprocessor/slot/detail/def.hpp +49 -0
- data/ext/boost/preprocessor/slot/detail/shared.hpp +247 -0
- data/ext/boost/preprocessor/slot/slot.hpp +32 -0
- data/ext/boost/preprocessor/stringize.hpp +33 -0
- data/ext/boost/preprocessor/tuple/eat.hpp +57 -0
- data/ext/boost/preprocessor/tuple/elem.hpp +385 -0
- data/ext/boost/preprocessor/tuple/rem.hpp +72 -0
- data/ext/boost/preprocessor/tuple/to_list.hpp +62 -0
- data/ext/boost/range/as_literal.hpp +131 -0
- data/ext/boost/range/begin.hpp +132 -0
- data/ext/boost/range/config.hpp +54 -0
- data/ext/boost/range/const_iterator.hpp +64 -0
- data/ext/boost/range/detail/common.hpp +117 -0
- data/ext/boost/range/detail/implementation_help.hpp +99 -0
- data/ext/boost/range/detail/sfinae.hpp +77 -0
- data/ext/boost/range/detail/str_types.hpp +38 -0
- data/ext/boost/range/difference_type.hpp +29 -0
- data/ext/boost/range/distance.hpp +34 -0
- data/ext/boost/range/empty.hpp +34 -0
- data/ext/boost/range/end.hpp +131 -0
- data/ext/boost/range/functions.hpp +27 -0
- data/ext/boost/range/iterator.hpp +72 -0
- data/ext/boost/range/iterator_range.hpp +643 -0
- data/ext/boost/range/mutable_iterator.hpp +64 -0
- data/ext/boost/range/rbegin.hpp +65 -0
- data/ext/boost/range/rend.hpp +65 -0
- data/ext/boost/range/reverse_iterator.hpp +40 -0
- data/ext/boost/range/size.hpp +36 -0
- data/ext/boost/range/size_type.hpp +78 -0
- data/ext/boost/range/value_type.hpp +34 -0
- data/ext/boost/ref.hpp +178 -0
- data/ext/boost/shared_ptr.hpp +619 -0
- data/ext/boost/src/pthread/exceptions.cpp +146 -0
- data/ext/boost/src/pthread/once.cpp +51 -0
- data/ext/boost/src/pthread/thread.cpp +709 -0
- data/ext/boost/src/pthread/timeconv.inl +130 -0
- data/ext/boost/src/tss_null.cpp +34 -0
- data/ext/boost/src/win32/exceptions.cpp +124 -0
- data/ext/boost/src/win32/thread.cpp +629 -0
- data/ext/boost/src/win32/timeconv.inl +130 -0
- data/ext/boost/src/win32/tss_dll.cpp +72 -0
- data/ext/boost/src/win32/tss_pe.cpp +269 -0
- data/ext/boost/static_assert.hpp +122 -0
- data/ext/boost/thread.hpp +21 -0
- data/ext/boost/thread/condition.hpp +16 -0
- data/ext/boost/thread/condition_variable.hpp +21 -0
- data/ext/boost/thread/detail/config.hpp +94 -0
- data/ext/boost/thread/detail/move.hpp +33 -0
- data/ext/boost/thread/detail/platform.hpp +71 -0
- data/ext/boost/thread/exceptions.hpp +109 -0
- data/ext/boost/thread/locks.hpp +589 -0
- data/ext/boost/thread/mutex.hpp +21 -0
- data/ext/boost/thread/once.hpp +29 -0
- data/ext/boost/thread/pthread/condition_variable.hpp +184 -0
- data/ext/boost/thread/pthread/condition_variable_fwd.hpp +66 -0
- data/ext/boost/thread/pthread/mutex.hpp +211 -0
- data/ext/boost/thread/pthread/once.hpp +85 -0
- data/ext/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +50 -0
- data/ext/boost/thread/pthread/recursive_mutex.hpp +249 -0
- data/ext/boost/thread/pthread/thread.hpp +339 -0
- data/ext/boost/thread/pthread/thread_data.hpp +102 -0
- data/ext/boost/thread/pthread/timespec.hpp +28 -0
- data/ext/boost/thread/pthread/tss.hpp +103 -0
- data/ext/boost/thread/recursive_mutex.hpp +21 -0
- data/ext/boost/thread/thread.hpp +22 -0
- data/ext/boost/thread/thread_time.hpp +46 -0
- data/ext/boost/thread/tss.hpp +18 -0
- data/ext/boost/thread/xtime.hpp +88 -0
- data/ext/boost/throw_exception.hpp +46 -0
- data/ext/boost/token_functions.hpp +621 -0
- data/ext/boost/token_iterator.hpp +128 -0
- data/ext/boost/tokenizer.hpp +98 -0
- data/ext/boost/type.hpp +18 -0
- data/ext/boost/type_traits/add_const.hpp +47 -0
- data/ext/boost/type_traits/add_pointer.hpp +72 -0
- data/ext/boost/type_traits/add_reference.hpp +89 -0
- data/ext/boost/type_traits/alignment_of.hpp +100 -0
- data/ext/boost/type_traits/broken_compiler_spec.hpp +117 -0
- data/ext/boost/type_traits/composite_traits.hpp +29 -0
- data/ext/boost/type_traits/config.hpp +76 -0
- data/ext/boost/type_traits/conversion_traits.hpp +17 -0
- data/ext/boost/type_traits/detail/bool_trait_def.hpp +173 -0
- data/ext/boost/type_traits/detail/bool_trait_undef.hpp +27 -0
- data/ext/boost/type_traits/detail/cv_traits_impl.hpp +97 -0
- data/ext/boost/type_traits/detail/false_result.hpp +28 -0
- data/ext/boost/type_traits/detail/ice_and.hpp +35 -0
- data/ext/boost/type_traits/detail/ice_eq.hpp +36 -0
- data/ext/boost/type_traits/detail/ice_not.hpp +31 -0
- data/ext/boost/type_traits/detail/ice_or.hpp +34 -0
- data/ext/boost/type_traits/detail/is_function_ptr_helper.hpp +220 -0
- data/ext/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +817 -0
- data/ext/boost/type_traits/detail/size_t_trait_def.hpp +58 -0
- data/ext/boost/type_traits/detail/size_t_trait_undef.hpp +16 -0
- data/ext/boost/type_traits/detail/template_arity_spec.hpp +31 -0
- data/ext/boost/type_traits/detail/type_trait_def.hpp +61 -0
- data/ext/boost/type_traits/detail/type_trait_undef.hpp +19 -0
- data/ext/boost/type_traits/detail/yes_no_type.hpp +26 -0
- data/ext/boost/type_traits/function_traits.hpp +236 -0
- data/ext/boost/type_traits/has_nothrow_copy.hpp +39 -0
- data/ext/boost/type_traits/has_trivial_copy.hpp +49 -0
- data/ext/boost/type_traits/ice.hpp +20 -0
- data/ext/boost/type_traits/integral_constant.hpp +53 -0
- data/ext/boost/type_traits/intrinsics.hpp +153 -0
- data/ext/boost/type_traits/is_abstract.hpp +144 -0
- data/ext/boost/type_traits/is_arithmetic.hpp +43 -0
- data/ext/boost/type_traits/is_array.hpp +90 -0
- data/ext/boost/type_traits/is_class.hpp +128 -0
- data/ext/boost/type_traits/is_const.hpp +142 -0
- data/ext/boost/type_traits/is_convertible.hpp +418 -0
- data/ext/boost/type_traits/is_enum.hpp +180 -0
- data/ext/boost/type_traits/is_float.hpp +27 -0
- data/ext/boost/type_traits/is_function.hpp +95 -0
- data/ext/boost/type_traits/is_integral.hpp +73 -0
- data/ext/boost/type_traits/is_member_function_pointer.hpp +134 -0
- data/ext/boost/type_traits/is_member_pointer.hpp +114 -0
- data/ext/boost/type_traits/is_pod.hpp +135 -0
- data/ext/boost/type_traits/is_pointer.hpp +160 -0
- data/ext/boost/type_traits/is_reference.hpp +116 -0
- data/ext/boost/type_traits/is_same.hpp +103 -0
- data/ext/boost/type_traits/is_scalar.hpp +55 -0
- data/ext/boost/type_traits/is_union.hpp +49 -0
- data/ext/boost/type_traits/is_void.hpp +33 -0
- data/ext/boost/type_traits/is_volatile.hpp +131 -0
- data/ext/boost/type_traits/remove_const.hpp +78 -0
- data/ext/boost/type_traits/remove_cv.hpp +61 -0
- data/ext/boost/type_traits/remove_pointer.hpp +43 -0
- data/ext/boost/type_traits/remove_reference.hpp +50 -0
- data/ext/boost/type_traits/type_with_alignment.hpp +288 -0
- data/ext/boost/utility.hpp +19 -0
- data/ext/boost/utility/addressof.hpp +58 -0
- data/ext/boost/utility/base_from_member.hpp +87 -0
- data/ext/boost/utility/compare_pointees.hpp +68 -0
- data/ext/boost/utility/enable_if.hpp +119 -0
- data/ext/boost/visit_each.hpp +29 -0
- data/ext/boost/weak_ptr.hpp +188 -0
- data/ext/common/Application.h +511 -0
- data/ext/common/ApplicationPool.h +205 -0
- data/ext/common/ApplicationPoolServer.h +794 -0
- data/ext/common/ApplicationPoolServerExecutable.cpp +743 -0
- data/ext/common/ApplicationPoolStatusReporter.h +336 -0
- data/ext/common/Base64.cpp +143 -0
- data/ext/common/Base64.h +57 -0
- data/ext/common/CachedFileStat.cpp +62 -0
- data/ext/common/CachedFileStat.h +51 -0
- data/ext/common/CachedFileStat.hpp +243 -0
- data/ext/common/DummySpawnManager.h +108 -0
- data/ext/common/Exceptions.h +258 -0
- data/ext/common/FileChangeChecker.h +209 -0
- data/ext/common/Logging.cpp +65 -0
- data/ext/common/Logging.h +123 -0
- data/ext/common/MessageChannel.h +615 -0
- data/ext/common/PoolOptions.h +355 -0
- data/ext/common/SpawnManager.h +561 -0
- data/ext/common/StandardApplicationPool.h +821 -0
- data/ext/common/StaticString.h +148 -0
- data/ext/common/StringListCreator.h +83 -0
- data/ext/common/SystemTime.cpp +33 -0
- data/ext/common/SystemTime.h +88 -0
- data/ext/common/Timer.h +90 -0
- data/ext/common/Utils.cpp +681 -0
- data/ext/common/Utils.h +497 -0
- data/ext/common/Version.h +31 -0
- data/ext/nginx/Configuration.c +1098 -0
- data/ext/nginx/Configuration.h +71 -0
- data/ext/nginx/ContentHandler.c +1225 -0
- data/ext/nginx/ContentHandler.h +64 -0
- data/ext/nginx/HelperServer.cpp +850 -0
- data/ext/nginx/HttpStatusExtractor.h +350 -0
- data/ext/nginx/ScgiRequestParser.h +317 -0
- data/ext/nginx/StaticContentHandler.c +257 -0
- data/ext/nginx/StaticContentHandler.h +37 -0
- data/ext/nginx/config +45 -0
- data/ext/nginx/ngx_http_passenger_module.c +653 -0
- data/ext/nginx/ngx_http_passenger_module.h +72 -0
- data/ext/oxt/backtrace.cpp +177 -0
- data/ext/oxt/backtrace.hpp +135 -0
- data/ext/oxt/detail/backtrace_disabled.hpp +39 -0
- data/ext/oxt/detail/backtrace_enabled.hpp +155 -0
- data/ext/oxt/detail/spin_lock_gcc_x86.hpp +82 -0
- data/ext/oxt/detail/spin_lock_portable.hpp +38 -0
- data/ext/oxt/detail/spin_lock_pthreads.hpp +97 -0
- data/ext/oxt/detail/tracable_exception_disabled.hpp +46 -0
- data/ext/oxt/detail/tracable_exception_enabled.hpp +48 -0
- data/ext/oxt/macros.hpp +58 -0
- data/ext/oxt/spin_lock.hpp +55 -0
- data/ext/oxt/system_calls.cpp +351 -0
- data/ext/oxt/system_calls.hpp +244 -0
- data/ext/oxt/thread.cpp +32 -0
- data/ext/oxt/thread.hpp +335 -0
- data/ext/oxt/tracable_exception.cpp +87 -0
- data/ext/oxt/tracable_exception.hpp +35 -0
- data/ext/phusion_passenger/extconf.rb +36 -0
- data/ext/phusion_passenger/native_support.c +308 -0
- data/lib/jeweler_spec.rb +86 -0
- data/lib/phusion_passenger/abstract_installer.rb +196 -0
- data/lib/phusion_passenger/abstract_request_handler.rb +475 -0
- data/lib/phusion_passenger/abstract_server.rb +369 -0
- data/lib/phusion_passenger/abstract_server_collection.rb +306 -0
- data/lib/phusion_passenger/admin_tools.rb +48 -0
- data/lib/phusion_passenger/admin_tools/control_process.rb +150 -0
- data/lib/phusion_passenger/application.rb +113 -0
- data/lib/phusion_passenger/console_text_template.rb +66 -0
- data/lib/phusion_passenger/constants.rb +31 -0
- data/lib/phusion_passenger/dependencies.rb +425 -0
- data/lib/phusion_passenger/events.rb +50 -0
- data/lib/phusion_passenger/exceptions.rb +103 -0
- data/lib/phusion_passenger/html_template.rb +109 -0
- data/lib/phusion_passenger/message_channel.rb +229 -0
- data/lib/phusion_passenger/packaging.rb +39 -0
- data/lib/phusion_passenger/platform_info.rb +550 -0
- data/lib/phusion_passenger/rack/application_spawner.rb +146 -0
- data/lib/phusion_passenger/rack/request_handler.rb +122 -0
- data/lib/phusion_passenger/railz/application_spawner.rb +412 -0
- data/lib/phusion_passenger/railz/cgi_fixed.rb +68 -0
- data/lib/phusion_passenger/railz/framework_spawner.rb +334 -0
- data/lib/phusion_passenger/railz/request_handler.rb +73 -0
- data/lib/phusion_passenger/simple_benchmarking.rb +52 -0
- data/lib/phusion_passenger/spawn_manager.rb +372 -0
- data/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb +9 -0
- data/lib/phusion_passenger/templates/apache2/config_snippets.txt.erb +13 -0
- data/lib/phusion_passenger/templates/apache2/deployment_example.txt.erb +23 -0
- data/lib/phusion_passenger/templates/apache2/no_write_permission_to_passenger_root.txt.erb +9 -0
- data/lib/phusion_passenger/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/apache2/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/apache2/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/templates/app_exited_during_initialization.html.erb +14 -0
- data/lib/phusion_passenger/templates/app_init_error.html.erb +46 -0
- data/lib/phusion_passenger/templates/database_error.html.erb +24 -0
- data/lib/phusion_passenger/templates/error_layout.css +97 -0
- data/lib/phusion_passenger/templates/error_layout.html.erb +39 -0
- data/lib/phusion_passenger/templates/framework_init_error.html.erb +10 -0
- data/lib/phusion_passenger/templates/general_error.html.erb +8 -0
- data/lib/phusion_passenger/templates/invalid_app_root.html.erb +9 -0
- data/lib/phusion_passenger/templates/load_error.html.erb +6 -0
- data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
- data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
- data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/templates/version_not_found.html.erb +6 -0
- data/lib/phusion_passenger/utils.rb +611 -0
- data/lib/phusion_passenger/utils/rewindable_input.rb +116 -0
- data/lib/phusion_passenger/wsgi/application_spawner.rb +104 -0
- data/lib/phusion_passenger/wsgi/request_handler.py +199 -0
- data/man/passenger-config.1 +29 -0
- data/man/passenger-make-enterprisey.8 +23 -0
- data/man/passenger-memory-stats.8 +33 -0
- data/man/passenger-status.8 +43 -0
- data/man/passenger-stress-test.1 +43 -0
- data/misc/copy_boost_headers.rb +125 -0
- data/misc/find_owner_pipe_leaks.rb +128 -0
- data/misc/rake/cplusplus.rb +57 -0
- data/misc/rake/extensions.rb +182 -0
- data/misc/rake/gempackagetask.rb +99 -0
- data/misc/rake/packagetask.rb +186 -0
- data/misc/rake/rdoctask.rb +209 -0
- data/misc/render_error_pages.rb +116 -0
- data/test/ApplicationPoolServerTest.cpp +114 -0
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +33 -0
- data/test/ApplicationPoolTest.cpp +599 -0
- data/test/Base64Test.cpp +48 -0
- data/test/CachedFileStatTest.cpp +402 -0
- data/test/CxxTestMain.cpp +143 -0
- data/test/FileChangeCheckerTest.cpp +331 -0
- data/test/HttpStatusExtractorTest.cpp +198 -0
- data/test/MessageChannelTest.cpp +312 -0
- data/test/PoolOptionsTest.cpp +117 -0
- data/test/ScgiRequestParserTest.cpp +337 -0
- data/test/SpawnManagerTest.cpp +64 -0
- data/test/StandardApplicationPoolTest.cpp +27 -0
- data/test/StaticStringTest.cpp +51 -0
- data/test/SystemTimeTest.cpp +37 -0
- data/test/UtilsTest.cpp +257 -0
- data/test/config.yml.example +30 -0
- data/test/integration_tests/apache2_tests.rb +595 -0
- data/test/integration_tests/hello_world_rack_spec.rb +36 -0
- data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
- data/test/integration_tests/mycook_spec.rb +192 -0
- data/test/integration_tests/nginx_tests.rb +151 -0
- data/test/oxt/backtrace_test.cpp +128 -0
- data/test/oxt/oxt_test_main.cpp +25 -0
- data/test/oxt/syscall_interruption_test.cpp +38 -0
- data/test/ruby/abstract_request_handler_spec.rb +85 -0
- data/test/ruby/abstract_server_collection_spec.rb +246 -0
- data/test/ruby/abstract_server_spec.rb +51 -0
- data/test/ruby/application_spec.rb +43 -0
- data/test/ruby/message_channel_spec.rb +170 -0
- data/test/ruby/rack/application_spawner_spec.rb +99 -0
- data/test/ruby/rails/application_spawner_spec.rb +159 -0
- data/test/ruby/rails/framework_spawner_spec.rb +133 -0
- data/test/ruby/rails/minimal_spawner_spec.rb +93 -0
- data/test/ruby/rails/spawner_error_handling_spec.rb +107 -0
- data/test/ruby/rails/spawner_privilege_lowering_spec.rb +97 -0
- data/test/ruby/spawn_manager_spec.rb +205 -0
- data/test/ruby/spawn_server_spec.rb +26 -0
- data/test/ruby/utils_spec.rb +335 -0
- data/test/ruby/wsgi/application_spawner_spec.rb +54 -0
- data/test/stub/apache2/httpd.conf.erb +81 -0
- data/test/stub/apache2/mime.types +748 -0
- data/test/stub/garbage1.dat +0 -0
- data/test/stub/garbage2.dat +0 -0
- data/test/stub/garbage3.dat +0 -0
- data/test/stub/http_request.yml +23 -0
- data/test/stub/message_channel.rb +9 -0
- data/test/stub/message_channel_2.rb +10 -0
- data/test/stub/message_channel_3.rb +17 -0
- data/test/stub/nginx/koi-utf +109 -0
- data/test/stub/nginx/koi-win +103 -0
- data/test/stub/nginx/mime.types +70 -0
- data/test/stub/nginx/nginx.conf.erb +57 -0
- data/test/stub/nginx/win-utf +126 -0
- data/test/stub/rack/config.ru +4 -0
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/foobar/app/controllers/application.rb +12 -0
- data/test/stub/rails_apps/foobar/app/controllers/bar_controller_1.rb +5 -0
- data/test/stub/rails_apps/foobar/app/controllers/bar_controller_2.rb +5 -0
- data/test/stub/rails_apps/foobar/app/controllers/foo_controller.rb +21 -0
- data/test/stub/rails_apps/foobar/app/helpers/application_helper.rb +3 -0
- data/test/stub/rails_apps/foobar/config/boot.rb +108 -0
- data/test/stub/rails_apps/foobar/config/database.yml +19 -0
- data/test/stub/rails_apps/foobar/config/environment.rb +59 -0
- data/test/stub/rails_apps/foobar/config/environments/development.rb +17 -0
- data/test/stub/rails_apps/foobar/config/environments/production.rb +18 -0
- data/test/stub/rails_apps/foobar/config/initializers/inflections.rb +10 -0
- data/test/stub/rails_apps/foobar/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails_apps/foobar/config/routes.rb +35 -0
- data/test/stub/rails_apps/mycook/app/controllers/application.rb +12 -0
- data/test/stub/rails_apps/mycook/app/controllers/recipes_controller.rb +5 -0
- data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +15 -0
- data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +71 -0
- data/test/stub/rails_apps/mycook/app/helpers/application_helper.rb +3 -0
- data/test/stub/rails_apps/mycook/app/views/layouts/default.rhtml +26 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/create.rhtml +13 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/index.rhtml +3 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/new.rhtml +8 -0
- data/test/stub/rails_apps/mycook/app/views/uploads/index.rhtml +1 -0
- data/test/stub/rails_apps/mycook/app/views/uploads/new.html.erb +8 -0
- data/test/stub/rails_apps/mycook/app/views/welcome/cached.rhtml +1 -0
- data/test/stub/rails_apps/mycook/app/views/welcome/index.rhtml +20 -0
- data/test/stub/rails_apps/mycook/config/boot.rb +108 -0
- data/test/stub/rails_apps/mycook/config/database.yml +19 -0
- data/test/stub/rails_apps/mycook/config/environment.rb +61 -0
- data/test/stub/rails_apps/mycook/config/environments/development.rb +18 -0
- data/test/stub/rails_apps/mycook/config/environments/production.rb +19 -0
- data/test/stub/rails_apps/mycook/config/initializers/inflections.rb +10 -0
- data/test/stub/rails_apps/mycook/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails_apps/mycook/config/routes.rb +38 -0
- data/test/stub/rails_apps/mycook/log/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/public/404.html +30 -0
- data/test/stub/rails_apps/mycook/public/422.html +30 -0
- data/test/stub/rails_apps/mycook/public/500.html +30 -0
- data/test/stub/rails_apps/mycook/public/dispatch.cgi +10 -0
- data/test/stub/rails_apps/mycook/public/dispatch.fcgi +24 -0
- data/test/stub/rails_apps/mycook/public/dispatch.rb +10 -0
- data/test/stub/rails_apps/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/mycook/public/images/angrywizard.gif +0 -0
- data/test/stub/rails_apps/mycook/public/images/cookbook.gif +0 -0
- data/test/stub/rails_apps/mycook/public/images/header.png +0 -0
- data/test/stub/rails_apps/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/mycook/public/javascripts/application.js +2 -0
- data/test/stub/rails_apps/mycook/public/javascripts/controls.js +963 -0
- data/test/stub/rails_apps/mycook/public/javascripts/dragdrop.js +972 -0
- data/test/stub/rails_apps/mycook/public/javascripts/effects.js +1120 -0
- data/test/stub/rails_apps/mycook/public/javascripts/prototype.js +4225 -0
- data/test/stub/rails_apps/mycook/public/robots.txt +5 -0
- data/test/stub/rails_apps/mycook/public/uploads.html +26 -0
- data/test/stub/rails_apps/mycook/public/welcome/cached.html +26 -0
- data/test/stub/rails_apps/mycook/sites/some.site/public/uploads.html +26 -0
- data/test/stub/rails_apps/mycook/sites/some.site/public/welcome/cached.html +26 -0
- data/test/stub/rails_apps/mycook/tmp/cache/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/pids/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/sessions/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/sockets/useless.txt +1 -0
- data/test/stub/spawn_server.rb +20 -0
- data/test/stub/upload_data.txt +494 -0
- data/test/stub/vendor_rails/minimal/README +1 -0
- data/test/stub/vendor_rails/minimal/actionmailer/lib/action_mailer.rb +0 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_controller.rb +19 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_pack.rb +0 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_view.rb +0 -0
- data/test/stub/vendor_rails/minimal/activerecord/lib/active_record.rb +7 -0
- data/test/stub/vendor_rails/minimal/activeresource/lib/active_resource.rb +0 -0
- data/test/stub/vendor_rails/minimal/activesupport/lib/active_support.rb +17 -0
- data/test/stub/vendor_rails/minimal/activesupport/lib/active_support/whiny_nil.rb +0 -0
- data/test/stub/vendor_rails/minimal/railties/lib/dispatcher.rb +0 -0
- data/test/stub/vendor_rails/minimal/railties/lib/initializer.rb +52 -0
- data/test/stub/vendor_rails/minimal/railties/lib/ruby_version_check.rb +1 -0
- data/test/stub/wsgi/passenger_wsgi.py +3 -0
- data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
- data/test/stub/zsfa/header.png +0 -0
- data/test/stub/zsfa/index.html +14 -0
- data/test/stub/zsfa/zsfa.png +0 -0
- data/test/support/Support.cpp +84 -0
- data/test/support/Support.h +118 -0
- data/test/support/apache2_controller.rb +250 -0
- data/test/support/config.rb +38 -0
- data/test/support/multipart.rb +62 -0
- data/test/support/nginx_controller.rb +98 -0
- data/test/support/run_rspec_tests.rb +10 -0
- data/test/support/test_helper.rb +207 -0
- data/test/support/tut.h +1234 -0
- data/test/support/tut_reporter.h +256 -0
- data/test/support/valgrind.h +2539 -0
- metadata +1078 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
// Copyright David Abrahams 2003.
|
2
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
3
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
4
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
5
|
+
#ifndef ITERATOR_TRAITS_DWA200347_HPP
|
6
|
+
# define ITERATOR_TRAITS_DWA200347_HPP
|
7
|
+
|
8
|
+
# include <boost/detail/iterator.hpp>
|
9
|
+
# include <boost/detail/workaround.hpp>
|
10
|
+
|
11
|
+
namespace boost {
|
12
|
+
|
13
|
+
// Unfortunately, g++ 2.95.x chokes when we define a class template
|
14
|
+
// iterator_category which has the same name as its
|
15
|
+
// std::iterator_category() function, probably due in part to the
|
16
|
+
// "std:: is visible globally" hack it uses. Use
|
17
|
+
// BOOST_ITERATOR_CATEGORY to write code that's portable to older
|
18
|
+
// GCCs.
|
19
|
+
|
20
|
+
# if BOOST_WORKAROUND(__GNUC__, <= 2)
|
21
|
+
# define BOOST_ITERATOR_CATEGORY iterator_category_
|
22
|
+
# else
|
23
|
+
# define BOOST_ITERATOR_CATEGORY iterator_category
|
24
|
+
# endif
|
25
|
+
|
26
|
+
|
27
|
+
template <class Iterator>
|
28
|
+
struct iterator_value
|
29
|
+
{
|
30
|
+
typedef typename boost::detail::iterator_traits<Iterator>::value_type type;
|
31
|
+
};
|
32
|
+
|
33
|
+
template <class Iterator>
|
34
|
+
struct iterator_reference
|
35
|
+
{
|
36
|
+
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
|
37
|
+
};
|
38
|
+
|
39
|
+
|
40
|
+
template <class Iterator>
|
41
|
+
struct iterator_pointer
|
42
|
+
{
|
43
|
+
typedef typename boost::detail::iterator_traits<Iterator>::pointer type;
|
44
|
+
};
|
45
|
+
|
46
|
+
template <class Iterator>
|
47
|
+
struct iterator_difference
|
48
|
+
{
|
49
|
+
typedef typename boost::detail::iterator_traits<Iterator>::difference_type type;
|
50
|
+
};
|
51
|
+
|
52
|
+
template <class Iterator>
|
53
|
+
struct BOOST_ITERATOR_CATEGORY
|
54
|
+
{
|
55
|
+
typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type;
|
56
|
+
};
|
57
|
+
|
58
|
+
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
59
|
+
template <>
|
60
|
+
struct iterator_value<int>
|
61
|
+
{
|
62
|
+
typedef void type;
|
63
|
+
};
|
64
|
+
|
65
|
+
template <>
|
66
|
+
struct iterator_reference<int>
|
67
|
+
{
|
68
|
+
typedef void type;
|
69
|
+
};
|
70
|
+
|
71
|
+
template <>
|
72
|
+
struct iterator_pointer<int>
|
73
|
+
{
|
74
|
+
typedef void type;
|
75
|
+
};
|
76
|
+
|
77
|
+
template <>
|
78
|
+
struct iterator_difference<int>
|
79
|
+
{
|
80
|
+
typedef void type;
|
81
|
+
};
|
82
|
+
|
83
|
+
template <>
|
84
|
+
struct BOOST_ITERATOR_CATEGORY<int>
|
85
|
+
{
|
86
|
+
typedef void type;
|
87
|
+
};
|
88
|
+
# endif
|
89
|
+
|
90
|
+
} // namespace boost::iterator
|
91
|
+
|
92
|
+
#endif // ITERATOR_TRAITS_DWA200347_HPP
|
@@ -0,0 +1,69 @@
|
|
1
|
+
// (C) Copyright David Abrahams 2002.
|
2
|
+
// (C) Copyright Jeremy Siek 2002.
|
3
|
+
// (C) Copyright Thomas Witt 2002.
|
4
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
5
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
6
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
7
|
+
#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
8
|
+
#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
9
|
+
|
10
|
+
#include <boost/iterator.hpp>
|
11
|
+
#include <boost/utility.hpp>
|
12
|
+
#include <boost/iterator/iterator_adaptor.hpp>
|
13
|
+
|
14
|
+
namespace boost
|
15
|
+
{
|
16
|
+
|
17
|
+
//
|
18
|
+
//
|
19
|
+
//
|
20
|
+
template <class Iterator>
|
21
|
+
class reverse_iterator
|
22
|
+
: public iterator_adaptor< reverse_iterator<Iterator>, Iterator >
|
23
|
+
{
|
24
|
+
typedef iterator_adaptor< reverse_iterator<Iterator>, Iterator > super_t;
|
25
|
+
|
26
|
+
friend class iterator_core_access;
|
27
|
+
|
28
|
+
public:
|
29
|
+
reverse_iterator() {}
|
30
|
+
|
31
|
+
explicit reverse_iterator(Iterator x)
|
32
|
+
: super_t(x) {}
|
33
|
+
|
34
|
+
template<class OtherIterator>
|
35
|
+
reverse_iterator(
|
36
|
+
reverse_iterator<OtherIterator> const& r
|
37
|
+
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
38
|
+
)
|
39
|
+
: super_t(r.base())
|
40
|
+
{}
|
41
|
+
|
42
|
+
private:
|
43
|
+
typename super_t::reference dereference() const { return *boost::prior(this->base()); }
|
44
|
+
|
45
|
+
void increment() { --this->base_reference(); }
|
46
|
+
void decrement() { ++this->base_reference(); }
|
47
|
+
|
48
|
+
void advance(typename super_t::difference_type n)
|
49
|
+
{
|
50
|
+
this->base_reference() += -n;
|
51
|
+
}
|
52
|
+
|
53
|
+
template <class OtherIterator>
|
54
|
+
typename super_t::difference_type
|
55
|
+
distance_to(reverse_iterator<OtherIterator> const& y) const
|
56
|
+
{
|
57
|
+
return this->base_reference() - y.base();
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
template <class BidirectionalIterator>
|
62
|
+
reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
|
63
|
+
{
|
64
|
+
return reverse_iterator<BidirectionalIterator>(x);
|
65
|
+
}
|
66
|
+
|
67
|
+
} // namespace boost
|
68
|
+
|
69
|
+
#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
@@ -0,0 +1,188 @@
|
|
1
|
+
// (C) Copyright David Abrahams 2002.
|
2
|
+
// (C) Copyright Jeremy Siek 2002.
|
3
|
+
// (C) Copyright Thomas Witt 2002.
|
4
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
5
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
6
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
7
|
+
#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
8
|
+
#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
9
|
+
|
10
|
+
#include <boost/function.hpp>
|
11
|
+
#include <boost/iterator.hpp>
|
12
|
+
#include <boost/iterator/detail/enable_if.hpp>
|
13
|
+
#include <boost/iterator/iterator_adaptor.hpp>
|
14
|
+
#include <boost/iterator/iterator_categories.hpp>
|
15
|
+
#include <boost/mpl/not.hpp>
|
16
|
+
#include <boost/mpl/bool.hpp>
|
17
|
+
#include <boost/type_traits/function_traits.hpp>
|
18
|
+
#include <boost/type_traits/is_const.hpp>
|
19
|
+
#include <boost/type_traits/is_class.hpp>
|
20
|
+
#include <boost/type_traits/is_function.hpp>
|
21
|
+
#include <boost/type_traits/is_reference.hpp>
|
22
|
+
#include <boost/type_traits/remove_const.hpp>
|
23
|
+
#include <boost/type_traits/remove_reference.hpp>
|
24
|
+
|
25
|
+
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
26
|
+
# include <boost/type_traits/is_base_and_derived.hpp>
|
27
|
+
|
28
|
+
#endif
|
29
|
+
#include <boost/iterator/detail/config_def.hpp>
|
30
|
+
|
31
|
+
|
32
|
+
namespace boost
|
33
|
+
{
|
34
|
+
template <class UnaryFunction, class Iterator, class Reference = use_default, class Value = use_default>
|
35
|
+
class transform_iterator;
|
36
|
+
|
37
|
+
namespace detail
|
38
|
+
{
|
39
|
+
|
40
|
+
template <class UnaryFunc>
|
41
|
+
struct function_object_result
|
42
|
+
{
|
43
|
+
typedef typename UnaryFunc::result_type type;
|
44
|
+
};
|
45
|
+
|
46
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
47
|
+
template <class Return, class Argument>
|
48
|
+
struct function_object_result<Return(*)(Argument)>
|
49
|
+
{
|
50
|
+
typedef Return type;
|
51
|
+
};
|
52
|
+
#endif
|
53
|
+
|
54
|
+
// Compute the iterator_adaptor instantiation to be used for transform_iterator
|
55
|
+
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
56
|
+
struct transform_iterator_base
|
57
|
+
{
|
58
|
+
private:
|
59
|
+
// By default, dereferencing the iterator yields the same as
|
60
|
+
// the function. Do we need to adjust the way
|
61
|
+
// function_object_result is computed for the standard
|
62
|
+
// proposal (e.g. using Doug's result_of)?
|
63
|
+
typedef typename ia_dflt_help<
|
64
|
+
Reference
|
65
|
+
, function_object_result<UnaryFunc>
|
66
|
+
>::type reference;
|
67
|
+
|
68
|
+
// To get the default for Value: remove any reference on the
|
69
|
+
// result type, but retain any constness to signal
|
70
|
+
// non-writability. Note that if we adopt Thomas' suggestion
|
71
|
+
// to key non-writability *only* on the Reference argument,
|
72
|
+
// we'd need to strip constness here as well.
|
73
|
+
typedef typename ia_dflt_help<
|
74
|
+
Value
|
75
|
+
, remove_reference<reference>
|
76
|
+
>::type cv_value_type;
|
77
|
+
|
78
|
+
public:
|
79
|
+
typedef iterator_adaptor<
|
80
|
+
transform_iterator<UnaryFunc, Iterator, Reference, Value>
|
81
|
+
, Iterator
|
82
|
+
, cv_value_type
|
83
|
+
, use_default // Leave the traversal category alone
|
84
|
+
, reference
|
85
|
+
> type;
|
86
|
+
};
|
87
|
+
}
|
88
|
+
|
89
|
+
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
90
|
+
class transform_iterator
|
91
|
+
: public boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
92
|
+
{
|
93
|
+
typedef typename
|
94
|
+
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
95
|
+
super_t;
|
96
|
+
|
97
|
+
friend class iterator_core_access;
|
98
|
+
|
99
|
+
public:
|
100
|
+
transform_iterator() { }
|
101
|
+
|
102
|
+
transform_iterator(Iterator const& x, UnaryFunc f)
|
103
|
+
: super_t(x), m_f(f) { }
|
104
|
+
|
105
|
+
explicit transform_iterator(Iterator const& x)
|
106
|
+
: super_t(x)
|
107
|
+
{
|
108
|
+
// Pro8 is a little too aggressive about instantiating the
|
109
|
+
// body of this function.
|
110
|
+
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
111
|
+
// don't provide this constructor if UnaryFunc is a
|
112
|
+
// function pointer type, since it will be 0. Too dangerous.
|
113
|
+
BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
|
114
|
+
#endif
|
115
|
+
}
|
116
|
+
|
117
|
+
template<
|
118
|
+
class OtherUnaryFunction
|
119
|
+
, class OtherIterator
|
120
|
+
, class OtherReference
|
121
|
+
, class OtherValue>
|
122
|
+
transform_iterator(
|
123
|
+
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
|
124
|
+
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
125
|
+
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
126
|
+
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
|
127
|
+
#endif
|
128
|
+
)
|
129
|
+
: super_t(t.base()), m_f(t.functor())
|
130
|
+
{}
|
131
|
+
|
132
|
+
UnaryFunc functor() const
|
133
|
+
{ return m_f; }
|
134
|
+
|
135
|
+
private:
|
136
|
+
typename super_t::reference dereference() const
|
137
|
+
{ return m_f(*this->base()); }
|
138
|
+
|
139
|
+
// Probably should be the initial base class so it can be
|
140
|
+
// optimized away via EBO if it is an empty class.
|
141
|
+
UnaryFunc m_f;
|
142
|
+
};
|
143
|
+
|
144
|
+
template <class UnaryFunc, class Iterator>
|
145
|
+
transform_iterator<UnaryFunc, Iterator>
|
146
|
+
make_transform_iterator(Iterator it, UnaryFunc fun)
|
147
|
+
{
|
148
|
+
return transform_iterator<UnaryFunc, Iterator>(it, fun);
|
149
|
+
}
|
150
|
+
|
151
|
+
// Version which allows explicit specification of the UnaryFunc
|
152
|
+
// type.
|
153
|
+
//
|
154
|
+
// This generator is not provided if UnaryFunc is a function
|
155
|
+
// pointer type, because it's too dangerous: the default-constructed
|
156
|
+
// function pointer in the iterator be 0, leading to a runtime
|
157
|
+
// crash.
|
158
|
+
template <class UnaryFunc, class Iterator>
|
159
|
+
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
160
|
+
typename mpl::if_<
|
161
|
+
#else
|
162
|
+
typename iterators::enable_if<
|
163
|
+
#endif
|
164
|
+
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
|
165
|
+
, transform_iterator<UnaryFunc, Iterator>
|
166
|
+
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
167
|
+
, int[3]
|
168
|
+
#endif
|
169
|
+
>::type
|
170
|
+
make_transform_iterator(Iterator it)
|
171
|
+
{
|
172
|
+
return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc());
|
173
|
+
}
|
174
|
+
|
175
|
+
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
176
|
+
template <class Return, class Argument, class Iterator>
|
177
|
+
transform_iterator< Return (*)(Argument), Iterator, Return>
|
178
|
+
make_transform_iterator(Iterator it, Return (*fun)(Argument))
|
179
|
+
{
|
180
|
+
return transform_iterator<Return (*)(Argument), Iterator, Return>(it, fun);
|
181
|
+
}
|
182
|
+
#endif
|
183
|
+
|
184
|
+
} // namespace boost
|
185
|
+
|
186
|
+
#include <boost/iterator/detail/config_undef.hpp>
|
187
|
+
|
188
|
+
#endif // BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
@@ -0,0 +1,1205 @@
|
|
1
|
+
#ifndef BOOST_LEXICAL_CAST_INCLUDED
|
2
|
+
#define BOOST_LEXICAL_CAST_INCLUDED
|
3
|
+
|
4
|
+
// Boost lexical_cast.hpp header -------------------------------------------//
|
5
|
+
//
|
6
|
+
// See http://www.boost.org/libs/conversion for documentation.
|
7
|
+
// See end of this header for rights and permissions.
|
8
|
+
//
|
9
|
+
// what: lexical_cast custom keyword cast
|
10
|
+
// who: contributed by Kevlin Henney,
|
11
|
+
// enhanced with contributions from Terje Slettebo,
|
12
|
+
// with additional fixes and suggestions from Gennaro Prota,
|
13
|
+
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
14
|
+
// Alexander Nasonov and other Boosters
|
15
|
+
// when: November 2000, March 2003, June 2005, June 2006
|
16
|
+
|
17
|
+
#include <climits>
|
18
|
+
#include <cstddef>
|
19
|
+
#include <istream>
|
20
|
+
#include <locale>
|
21
|
+
#include <string>
|
22
|
+
#include <typeinfo>
|
23
|
+
#include <boost/config.hpp>
|
24
|
+
#include <boost/limits.hpp>
|
25
|
+
#include <boost/mpl/if.hpp>
|
26
|
+
#include <boost/throw_exception.hpp>
|
27
|
+
#include <boost/type_traits/is_pointer.hpp>
|
28
|
+
#include <boost/call_traits.hpp>
|
29
|
+
#include <boost/static_assert.hpp>
|
30
|
+
#include <boost/detail/lcast_precision.hpp>
|
31
|
+
|
32
|
+
#ifdef BOOST_NO_STRINGSTREAM
|
33
|
+
#include <strstream>
|
34
|
+
#else
|
35
|
+
#include <sstream>
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#if defined(BOOST_NO_STRINGSTREAM) || \
|
39
|
+
defined(BOOST_NO_STD_WSTRING) || \
|
40
|
+
defined(BOOST_NO_STD_LOCALE)
|
41
|
+
#define DISABLE_WIDE_CHAR_SUPPORT
|
42
|
+
#endif
|
43
|
+
|
44
|
+
namespace boost
|
45
|
+
{
|
46
|
+
// exception used to indicate runtime lexical_cast failure
|
47
|
+
class bad_lexical_cast : public std::bad_cast
|
48
|
+
{
|
49
|
+
public:
|
50
|
+
bad_lexical_cast() :
|
51
|
+
source(&typeid(void)), target(&typeid(void))
|
52
|
+
{
|
53
|
+
}
|
54
|
+
bad_lexical_cast(
|
55
|
+
const std::type_info &source_type_arg,
|
56
|
+
const std::type_info &target_type_arg) :
|
57
|
+
source(&source_type_arg), target(&target_type_arg)
|
58
|
+
{
|
59
|
+
}
|
60
|
+
const std::type_info &source_type() const
|
61
|
+
{
|
62
|
+
return *source;
|
63
|
+
}
|
64
|
+
const std::type_info &target_type() const
|
65
|
+
{
|
66
|
+
return *target;
|
67
|
+
}
|
68
|
+
virtual const char *what() const throw()
|
69
|
+
{
|
70
|
+
return "bad lexical cast: "
|
71
|
+
"source type value could not be interpreted as target";
|
72
|
+
}
|
73
|
+
virtual ~bad_lexical_cast() throw()
|
74
|
+
{
|
75
|
+
}
|
76
|
+
private:
|
77
|
+
const std::type_info *source;
|
78
|
+
const std::type_info *target;
|
79
|
+
};
|
80
|
+
|
81
|
+
namespace detail // selectors for choosing stream character type
|
82
|
+
{
|
83
|
+
template<typename Type>
|
84
|
+
struct stream_char
|
85
|
+
{
|
86
|
+
typedef char type;
|
87
|
+
};
|
88
|
+
|
89
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
90
|
+
template<class CharT, class Traits, class Alloc>
|
91
|
+
struct stream_char< std::basic_string<CharT,Traits,Alloc> >
|
92
|
+
{
|
93
|
+
typedef CharT type;
|
94
|
+
};
|
95
|
+
#endif
|
96
|
+
|
97
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
98
|
+
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
99
|
+
template<>
|
100
|
+
struct stream_char<wchar_t>
|
101
|
+
{
|
102
|
+
typedef wchar_t type;
|
103
|
+
};
|
104
|
+
#endif
|
105
|
+
|
106
|
+
template<>
|
107
|
+
struct stream_char<wchar_t *>
|
108
|
+
{
|
109
|
+
typedef wchar_t type;
|
110
|
+
};
|
111
|
+
|
112
|
+
template<>
|
113
|
+
struct stream_char<const wchar_t *>
|
114
|
+
{
|
115
|
+
typedef wchar_t type;
|
116
|
+
};
|
117
|
+
|
118
|
+
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
119
|
+
template<>
|
120
|
+
struct stream_char<std::wstring>
|
121
|
+
{
|
122
|
+
typedef wchar_t type;
|
123
|
+
};
|
124
|
+
#endif
|
125
|
+
#endif
|
126
|
+
|
127
|
+
template<typename TargetChar, typename SourceChar>
|
128
|
+
struct widest_char
|
129
|
+
{
|
130
|
+
typedef TargetChar type;
|
131
|
+
};
|
132
|
+
|
133
|
+
template<>
|
134
|
+
struct widest_char<char, wchar_t>
|
135
|
+
{
|
136
|
+
typedef wchar_t type;
|
137
|
+
};
|
138
|
+
}
|
139
|
+
|
140
|
+
namespace detail // deduce_char_traits template
|
141
|
+
{
|
142
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
143
|
+
template<class CharT, class Target, class Source>
|
144
|
+
struct deduce_char_traits
|
145
|
+
{
|
146
|
+
typedef std::char_traits<CharT> type;
|
147
|
+
};
|
148
|
+
|
149
|
+
template<class CharT, class Traits, class Alloc, class Source>
|
150
|
+
struct deduce_char_traits< CharT
|
151
|
+
, std::basic_string<CharT,Traits,Alloc>
|
152
|
+
, Source
|
153
|
+
>
|
154
|
+
{
|
155
|
+
typedef Traits type;
|
156
|
+
};
|
157
|
+
|
158
|
+
template<class CharT, class Target, class Traits, class Alloc>
|
159
|
+
struct deduce_char_traits< CharT
|
160
|
+
, Target
|
161
|
+
, std::basic_string<CharT,Traits,Alloc>
|
162
|
+
>
|
163
|
+
{
|
164
|
+
typedef Traits type;
|
165
|
+
};
|
166
|
+
|
167
|
+
template<class CharT, class Traits, class Alloc1, class Alloc2>
|
168
|
+
struct deduce_char_traits< CharT
|
169
|
+
, std::basic_string<CharT,Traits,Alloc1>
|
170
|
+
, std::basic_string<CharT,Traits,Alloc2>
|
171
|
+
>
|
172
|
+
{
|
173
|
+
typedef Traits type;
|
174
|
+
};
|
175
|
+
#endif
|
176
|
+
}
|
177
|
+
|
178
|
+
namespace detail // lcast_src_length
|
179
|
+
{
|
180
|
+
// Return max. length of string representation of Source;
|
181
|
+
// 0 if unlimited (with exceptions for some types, see below).
|
182
|
+
// Values with limited string representation are placed to
|
183
|
+
// the buffer locally defined in lexical_cast function.
|
184
|
+
// 1 is returned for few types such as CharT const* or
|
185
|
+
// std::basic_string<CharT> that already have an internal
|
186
|
+
// buffer ready to be reused by lexical_stream_limited_src.
|
187
|
+
// Each specialization should have a correspondent operator<<
|
188
|
+
// defined in lexical_stream_limited_src.
|
189
|
+
template< class CharT // A result of widest_char transformation.
|
190
|
+
, class Source // Source type of lexical_cast.
|
191
|
+
>
|
192
|
+
struct lcast_src_length
|
193
|
+
{
|
194
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 0);
|
195
|
+
// To check coverage, build the test with
|
196
|
+
// bjam --v2 profile optimization=off
|
197
|
+
static void check_coverage() {}
|
198
|
+
};
|
199
|
+
|
200
|
+
template<>
|
201
|
+
struct lcast_src_length<char, bool>
|
202
|
+
{
|
203
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
204
|
+
static void check_coverage() {}
|
205
|
+
};
|
206
|
+
|
207
|
+
template<>
|
208
|
+
struct lcast_src_length<char, char>
|
209
|
+
{
|
210
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
211
|
+
static void check_coverage() {}
|
212
|
+
};
|
213
|
+
|
214
|
+
// No specializations for:
|
215
|
+
// lcast_src_length<char, signed char>
|
216
|
+
// lcast_src_length<char, unsigned char>
|
217
|
+
// lcast_src_length<char, signed char*>
|
218
|
+
// lcast_src_length<char, unsigned char*>
|
219
|
+
// lcast_src_length<char, signed char const*>
|
220
|
+
// lcast_src_length<char, unsigned char const*>
|
221
|
+
|
222
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
223
|
+
template<>
|
224
|
+
struct lcast_src_length<wchar_t, bool>
|
225
|
+
{
|
226
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
227
|
+
static void check_coverage() {}
|
228
|
+
};
|
229
|
+
|
230
|
+
template<>
|
231
|
+
struct lcast_src_length<wchar_t, char>
|
232
|
+
{
|
233
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
234
|
+
static void check_coverage() {}
|
235
|
+
};
|
236
|
+
|
237
|
+
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
238
|
+
template<>
|
239
|
+
struct lcast_src_length<wchar_t, wchar_t>
|
240
|
+
{
|
241
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
242
|
+
static void check_coverage() {}
|
243
|
+
};
|
244
|
+
#endif
|
245
|
+
#endif
|
246
|
+
|
247
|
+
template<>
|
248
|
+
struct lcast_src_length<char, char const*>
|
249
|
+
{
|
250
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
251
|
+
static void check_coverage() {}
|
252
|
+
};
|
253
|
+
|
254
|
+
template<>
|
255
|
+
struct lcast_src_length<char, char*>
|
256
|
+
{
|
257
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
258
|
+
static void check_coverage() {}
|
259
|
+
};
|
260
|
+
|
261
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
262
|
+
template<>
|
263
|
+
struct lcast_src_length<wchar_t, wchar_t const*>
|
264
|
+
{
|
265
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
266
|
+
static void check_coverage() {}
|
267
|
+
};
|
268
|
+
|
269
|
+
template<>
|
270
|
+
struct lcast_src_length<wchar_t, wchar_t*>
|
271
|
+
{
|
272
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
273
|
+
static void check_coverage() {}
|
274
|
+
};
|
275
|
+
#endif
|
276
|
+
|
277
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
278
|
+
template<class CharT, class Traits, class Alloc>
|
279
|
+
struct lcast_src_length< CharT, std::basic_string<CharT,Traits,Alloc> >
|
280
|
+
{
|
281
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
282
|
+
static void check_coverage() {}
|
283
|
+
};
|
284
|
+
#else
|
285
|
+
template<>
|
286
|
+
struct lcast_src_length< char, std::basic_string<char> >
|
287
|
+
{
|
288
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
289
|
+
static void check_coverage() {}
|
290
|
+
};
|
291
|
+
|
292
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
293
|
+
template<>
|
294
|
+
struct lcast_src_length< wchar_t, std::basic_string<wchar_t> >
|
295
|
+
{
|
296
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
297
|
+
static void check_coverage() {}
|
298
|
+
};
|
299
|
+
#endif
|
300
|
+
#endif
|
301
|
+
|
302
|
+
// Helper for integral types.
|
303
|
+
// Notes on length calculation:
|
304
|
+
// Max length for 32bit int with grouping "\1" and thousands_sep ',':
|
305
|
+
// "-2,1,4,7,4,8,3,6,4,7"
|
306
|
+
// ^ - is_signed
|
307
|
+
// ^ - 1 digit not counted by digits10
|
308
|
+
// ^^^^^^^^^^^^^^^^^^ - digits10 * 2
|
309
|
+
//
|
310
|
+
// Constant is_specialized is used instead of constant 1
|
311
|
+
// to prevent buffer overflow in a rare case when
|
312
|
+
// <boost/limits.hpp> doesn't add missing specialization for
|
313
|
+
// numeric_limits<T> for some integral type T.
|
314
|
+
// When is_specialized is false, the whole expression is 0.
|
315
|
+
template<class Source>
|
316
|
+
struct lcast_src_length_integral
|
317
|
+
{
|
318
|
+
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
319
|
+
BOOST_STATIC_CONSTANT(std::size_t, value =
|
320
|
+
std::numeric_limits<Source>::is_signed +
|
321
|
+
std::numeric_limits<Source>::is_specialized + // == 1
|
322
|
+
std::numeric_limits<Source>::digits10 * 2
|
323
|
+
);
|
324
|
+
#else
|
325
|
+
BOOST_STATIC_CONSTANT(std::size_t, value = 156);
|
326
|
+
BOOST_STATIC_ASSERT(sizeof(Source) * CHAR_BIT <= 256);
|
327
|
+
#endif
|
328
|
+
};
|
329
|
+
|
330
|
+
#define BOOST_AUX_LEXICAL_CAST_DEF1(CharT, T) template<> \
|
331
|
+
struct lcast_src_length<CharT, T> : lcast_src_length_integral<T> \
|
332
|
+
{ static void check_coverage() {} };
|
333
|
+
|
334
|
+
#ifdef DISABLE_WIDE_CHAR_SUPPORT
|
335
|
+
#define BOOST_AUX_LEXICAL_CAST_DEF(T) BOOST_AUX_LEXICAL_CAST_DEF1(char, T)
|
336
|
+
#else
|
337
|
+
#define BOOST_AUX_LEXICAL_CAST_DEF(T) \
|
338
|
+
BOOST_AUX_LEXICAL_CAST_DEF1(char, T) \
|
339
|
+
BOOST_AUX_LEXICAL_CAST_DEF1(wchar_t, T)
|
340
|
+
#endif
|
341
|
+
|
342
|
+
BOOST_AUX_LEXICAL_CAST_DEF(short)
|
343
|
+
BOOST_AUX_LEXICAL_CAST_DEF(unsigned short)
|
344
|
+
BOOST_AUX_LEXICAL_CAST_DEF(int)
|
345
|
+
BOOST_AUX_LEXICAL_CAST_DEF(unsigned int)
|
346
|
+
BOOST_AUX_LEXICAL_CAST_DEF(long)
|
347
|
+
BOOST_AUX_LEXICAL_CAST_DEF(unsigned long)
|
348
|
+
#if defined(BOOST_HAS_LONG_LONG)
|
349
|
+
BOOST_AUX_LEXICAL_CAST_DEF(boost::ulong_long_type)
|
350
|
+
BOOST_AUX_LEXICAL_CAST_DEF(boost::long_long_type )
|
351
|
+
#elif defined(BOOST_HAS_MS_INT64)
|
352
|
+
BOOST_AUX_LEXICAL_CAST_DEF(unsigned __int64)
|
353
|
+
BOOST_AUX_LEXICAL_CAST_DEF( __int64)
|
354
|
+
#endif
|
355
|
+
|
356
|
+
#undef BOOST_AUX_LEXICAL_CAST_DEF
|
357
|
+
#undef BOOST_AUX_LEXICAL_CAST_DEF1
|
358
|
+
|
359
|
+
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
360
|
+
// Helper for floating point types.
|
361
|
+
// -1.23456789e-123456
|
362
|
+
// ^ sign
|
363
|
+
// ^ leading digit
|
364
|
+
// ^ decimal point
|
365
|
+
// ^^^^^^^^ lcast_precision<Source>::value
|
366
|
+
// ^ "e"
|
367
|
+
// ^ exponent sign
|
368
|
+
// ^^^^^^ exponent (assumed 6 or less digits)
|
369
|
+
// sign + leading digit + decimal point + "e" + exponent sign == 5
|
370
|
+
template<class Source>
|
371
|
+
struct lcast_src_length_floating
|
372
|
+
{
|
373
|
+
BOOST_STATIC_ASSERT(
|
374
|
+
std::numeric_limits<Source>::max_exponent10 <= 999999L &&
|
375
|
+
std::numeric_limits<Source>::min_exponent10 >= -999999L
|
376
|
+
);
|
377
|
+
BOOST_STATIC_CONSTANT(std::size_t, value =
|
378
|
+
5 + lcast_precision<Source>::value + 6
|
379
|
+
);
|
380
|
+
};
|
381
|
+
|
382
|
+
template<>
|
383
|
+
struct lcast_src_length<char,float>
|
384
|
+
: lcast_src_length_floating<float>
|
385
|
+
{
|
386
|
+
static void check_coverage() {}
|
387
|
+
};
|
388
|
+
|
389
|
+
template<>
|
390
|
+
struct lcast_src_length<char,double>
|
391
|
+
: lcast_src_length_floating<double>
|
392
|
+
{
|
393
|
+
static void check_coverage() {}
|
394
|
+
};
|
395
|
+
|
396
|
+
template<>
|
397
|
+
struct lcast_src_length<char,long double>
|
398
|
+
: lcast_src_length_floating<long double>
|
399
|
+
{
|
400
|
+
static void check_coverage() {}
|
401
|
+
};
|
402
|
+
|
403
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
404
|
+
template<>
|
405
|
+
struct lcast_src_length<wchar_t,float>
|
406
|
+
: lcast_src_length_floating<float>
|
407
|
+
{
|
408
|
+
static void check_coverage() {}
|
409
|
+
};
|
410
|
+
|
411
|
+
template<>
|
412
|
+
struct lcast_src_length<wchar_t,double>
|
413
|
+
: lcast_src_length_floating<double>
|
414
|
+
{
|
415
|
+
static void check_coverage() {}
|
416
|
+
};
|
417
|
+
|
418
|
+
template<>
|
419
|
+
struct lcast_src_length<wchar_t,long double>
|
420
|
+
: lcast_src_length_floating<long double>
|
421
|
+
{
|
422
|
+
static void check_coverage() {}
|
423
|
+
};
|
424
|
+
|
425
|
+
#endif // #ifndef DISABLE_WIDE_CHAR_SUPPORT
|
426
|
+
#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
427
|
+
}
|
428
|
+
|
429
|
+
namespace detail // '0' and '-' constants
|
430
|
+
{
|
431
|
+
template<typename CharT> struct lcast_char_constants;
|
432
|
+
|
433
|
+
template<>
|
434
|
+
struct lcast_char_constants<char>
|
435
|
+
{
|
436
|
+
BOOST_STATIC_CONSTANT(char, zero = '0');
|
437
|
+
BOOST_STATIC_CONSTANT(char, minus = '-');
|
438
|
+
};
|
439
|
+
|
440
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
441
|
+
template<>
|
442
|
+
struct lcast_char_constants<wchar_t>
|
443
|
+
{
|
444
|
+
BOOST_STATIC_CONSTANT(wchar_t, zero = L'0');
|
445
|
+
BOOST_STATIC_CONSTANT(wchar_t, minus = L'-');
|
446
|
+
};
|
447
|
+
#endif
|
448
|
+
}
|
449
|
+
|
450
|
+
namespace detail // lexical_streambuf_fake
|
451
|
+
{
|
452
|
+
struct lexical_streambuf_fake
|
453
|
+
{
|
454
|
+
};
|
455
|
+
}
|
456
|
+
|
457
|
+
namespace detail // lcast_to_unsigned
|
458
|
+
{
|
459
|
+
#if (defined _MSC_VER)
|
460
|
+
# pragma warning( push )
|
461
|
+
// C4146: unary minus operator applied to unsigned type, result still unsigned
|
462
|
+
# pragma warning( disable : 4146 )
|
463
|
+
#endif
|
464
|
+
|
465
|
+
inline unsigned int lcast_to_unsigned(int value)
|
466
|
+
{
|
467
|
+
unsigned int uval = value;
|
468
|
+
return value < 0 ? -uval : uval;
|
469
|
+
}
|
470
|
+
|
471
|
+
inline unsigned long lcast_to_unsigned(long value)
|
472
|
+
{
|
473
|
+
unsigned long uval = value;
|
474
|
+
return value < 0 ? -uval : uval;
|
475
|
+
}
|
476
|
+
|
477
|
+
#if defined(BOOST_HAS_LONG_LONG)
|
478
|
+
inline boost::ulong_long_type lcast_to_unsigned(boost::long_long_type v)
|
479
|
+
{
|
480
|
+
boost::ulong_long_type uval = v;
|
481
|
+
return v < 0 ? -uval : uval;
|
482
|
+
}
|
483
|
+
#elif defined(BOOST_HAS_MS_INT64)
|
484
|
+
inline unsigned __int64 lcast_to_unsigned(__int64 value)
|
485
|
+
{
|
486
|
+
unsigned __int64 uval = value;
|
487
|
+
return value < 0 ? -uval : uval;
|
488
|
+
}
|
489
|
+
#endif
|
490
|
+
|
491
|
+
#if (defined _MSC_VER)
|
492
|
+
# pragma warning( pop ) // C4146: unary minus operator applied to unsigned type,
|
493
|
+
// result still unsigned
|
494
|
+
#endif
|
495
|
+
}
|
496
|
+
|
497
|
+
namespace detail // lcast_put_unsigned
|
498
|
+
{
|
499
|
+
template<class Traits, class T, class CharT>
|
500
|
+
CharT* lcast_put_unsigned(T n, CharT* finish)
|
501
|
+
{
|
502
|
+
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
503
|
+
BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
|
504
|
+
#endif
|
505
|
+
CharT thousands_sep = 0;
|
506
|
+
|
507
|
+
#ifdef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
508
|
+
char const* grouping = "";
|
509
|
+
std::size_t const grouping_size = 0;
|
510
|
+
#else
|
511
|
+
std::locale loc;
|
512
|
+
typedef std::numpunct<CharT> numpunct;
|
513
|
+
numpunct const& np = BOOST_USE_FACET(numpunct, loc);
|
514
|
+
std::string const& grouping = np.grouping();
|
515
|
+
std::string::size_type const grouping_size = grouping.size();
|
516
|
+
|
517
|
+
if(grouping_size)
|
518
|
+
thousands_sep = np.thousands_sep();
|
519
|
+
#endif
|
520
|
+
|
521
|
+
std::string::size_type group = 0; // current group number
|
522
|
+
char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0];
|
523
|
+
// a) Since grouping is const, grouping[grouping.size()] returns 0.
|
524
|
+
// b) It's safe to assume here and below that CHAR_MAX
|
525
|
+
// is equivalent to unlimited grouping:
|
526
|
+
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
527
|
+
BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
|
528
|
+
#endif
|
529
|
+
typedef typename Traits::int_type int_type;
|
530
|
+
CharT const czero = lcast_char_constants<CharT>::zero;
|
531
|
+
int_type const zero = Traits::to_int_type(czero);
|
532
|
+
|
533
|
+
char left = last_grp_size;
|
534
|
+
|
535
|
+
do
|
536
|
+
{
|
537
|
+
if(left == 0)
|
538
|
+
{
|
539
|
+
++group;
|
540
|
+
if(group < grouping_size)
|
541
|
+
{
|
542
|
+
char const grp_size = grouping[group];
|
543
|
+
last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size;
|
544
|
+
}
|
545
|
+
|
546
|
+
left = last_grp_size;
|
547
|
+
--finish;
|
548
|
+
Traits::assign(*finish, thousands_sep);
|
549
|
+
}
|
550
|
+
|
551
|
+
--left;
|
552
|
+
--finish;
|
553
|
+
int_type const digit = static_cast<int_type>(n % 10U);
|
554
|
+
Traits::assign(*finish, Traits::to_char_type(zero + digit));
|
555
|
+
n /= 10;
|
556
|
+
} while(n);
|
557
|
+
|
558
|
+
return finish;
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
namespace detail // stream wrapper for handling lexical conversions
|
563
|
+
{
|
564
|
+
template<typename Target, typename Source, typename Traits>
|
565
|
+
class lexical_stream
|
566
|
+
{
|
567
|
+
private:
|
568
|
+
typedef typename widest_char<
|
569
|
+
typename stream_char<Target>::type,
|
570
|
+
typename stream_char<Source>::type>::type char_type;
|
571
|
+
|
572
|
+
typedef Traits traits_type;
|
573
|
+
|
574
|
+
public:
|
575
|
+
lexical_stream(char_type* = 0, char_type* = 0)
|
576
|
+
{
|
577
|
+
stream.unsetf(std::ios::skipws);
|
578
|
+
lcast_set_precision(stream, (Source*)0, (Target*)0);
|
579
|
+
}
|
580
|
+
~lexical_stream()
|
581
|
+
{
|
582
|
+
#if defined(BOOST_NO_STRINGSTREAM)
|
583
|
+
stream.freeze(false);
|
584
|
+
#endif
|
585
|
+
}
|
586
|
+
bool operator<<(const Source &input)
|
587
|
+
{
|
588
|
+
return !(stream << input).fail();
|
589
|
+
}
|
590
|
+
template<typename InputStreamable>
|
591
|
+
bool operator>>(InputStreamable &output)
|
592
|
+
{
|
593
|
+
return !is_pointer<InputStreamable>::value &&
|
594
|
+
stream >> output &&
|
595
|
+
stream.get() ==
|
596
|
+
#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING)
|
597
|
+
// GCC 2.9x lacks std::char_traits<>::eof().
|
598
|
+
// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3
|
599
|
+
// configurations, which do provide std::char_traits<>::eof().
|
600
|
+
|
601
|
+
EOF;
|
602
|
+
#else
|
603
|
+
traits_type::eof();
|
604
|
+
#endif
|
605
|
+
}
|
606
|
+
|
607
|
+
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
608
|
+
|
609
|
+
bool operator>>(std::string &output)
|
610
|
+
{
|
611
|
+
#if defined(BOOST_NO_STRINGSTREAM)
|
612
|
+
stream << '\0';
|
613
|
+
#endif
|
614
|
+
stream.str().swap(output);
|
615
|
+
return true;
|
616
|
+
}
|
617
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
618
|
+
bool operator>>(std::wstring &output)
|
619
|
+
{
|
620
|
+
stream.str().swap(output);
|
621
|
+
return true;
|
622
|
+
}
|
623
|
+
#endif
|
624
|
+
|
625
|
+
#else
|
626
|
+
bool operator>>(std::basic_string<char_type,traits_type>& output)
|
627
|
+
{
|
628
|
+
stream.str().swap(output);
|
629
|
+
return true;
|
630
|
+
}
|
631
|
+
|
632
|
+
template<class Alloc>
|
633
|
+
bool operator>>(std::basic_string<char_type,traits_type,Alloc>& out)
|
634
|
+
{
|
635
|
+
std::basic_string<char_type,traits_type> str(stream.str());
|
636
|
+
out.assign(str.begin(), str.end());
|
637
|
+
return true;
|
638
|
+
}
|
639
|
+
#endif
|
640
|
+
private:
|
641
|
+
#if defined(BOOST_NO_STRINGSTREAM)
|
642
|
+
std::strstream stream;
|
643
|
+
#elif defined(BOOST_NO_STD_LOCALE)
|
644
|
+
std::stringstream stream;
|
645
|
+
#else
|
646
|
+
std::basic_stringstream<char_type,traits_type> stream;
|
647
|
+
#endif
|
648
|
+
};
|
649
|
+
}
|
650
|
+
|
651
|
+
namespace detail // optimized stream wrapper
|
652
|
+
{
|
653
|
+
// String representation of Source has an upper limit.
|
654
|
+
template< class CharT // a result of widest_char transformation
|
655
|
+
, class Base // lexical_streambuf_fake or basic_streambuf<CharT>
|
656
|
+
, class Traits // usually char_traits<CharT>
|
657
|
+
>
|
658
|
+
class lexical_stream_limited_src : public Base
|
659
|
+
{
|
660
|
+
// A string representation of Source is written to [start, finish).
|
661
|
+
// Currently, it is assumed that [start, finish) is big enough
|
662
|
+
// to hold a string representation of any Source value.
|
663
|
+
CharT* start;
|
664
|
+
CharT* finish;
|
665
|
+
|
666
|
+
private:
|
667
|
+
|
668
|
+
static void widen_and_assign(char*p, char ch)
|
669
|
+
{
|
670
|
+
Traits::assign(*p, ch);
|
671
|
+
}
|
672
|
+
|
673
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
674
|
+
static void widen_and_assign(wchar_t* p, char ch)
|
675
|
+
{
|
676
|
+
std::locale loc;
|
677
|
+
wchar_t w = BOOST_USE_FACET(std::ctype<wchar_t>, loc).widen(ch);
|
678
|
+
Traits::assign(*p, w);
|
679
|
+
}
|
680
|
+
|
681
|
+
static void widen_and_assign(wchar_t* p, wchar_t ch)
|
682
|
+
{
|
683
|
+
Traits::assign(*p, ch);
|
684
|
+
}
|
685
|
+
|
686
|
+
static void widen_and_assign(char*, wchar_t ch); // undefined
|
687
|
+
#endif
|
688
|
+
|
689
|
+
template<class OutputStreamable>
|
690
|
+
bool lcast_put(const OutputStreamable& input)
|
691
|
+
{
|
692
|
+
this->setp(start, finish);
|
693
|
+
std::basic_ostream<CharT> stream(static_cast<Base*>(this));
|
694
|
+
lcast_set_precision(stream, (OutputStreamable*)0);
|
695
|
+
bool const result = !(stream << input).fail();
|
696
|
+
finish = this->pptr();
|
697
|
+
return result;
|
698
|
+
}
|
699
|
+
|
700
|
+
// Undefined:
|
701
|
+
lexical_stream_limited_src(lexical_stream_limited_src const&);
|
702
|
+
void operator=(lexical_stream_limited_src const&);
|
703
|
+
|
704
|
+
public:
|
705
|
+
|
706
|
+
lexical_stream_limited_src(CharT* start, CharT* finish)
|
707
|
+
: start(start)
|
708
|
+
, finish(finish)
|
709
|
+
{}
|
710
|
+
|
711
|
+
public: // output
|
712
|
+
|
713
|
+
template<class Alloc>
|
714
|
+
bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str)
|
715
|
+
{
|
716
|
+
start = const_cast<CharT*>(str.data());
|
717
|
+
finish = start + str.length();
|
718
|
+
return true;
|
719
|
+
}
|
720
|
+
|
721
|
+
bool operator<<(bool);
|
722
|
+
bool operator<<(char);
|
723
|
+
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
724
|
+
bool operator<<(wchar_t);
|
725
|
+
#endif
|
726
|
+
bool operator<<(CharT const*);
|
727
|
+
bool operator<<(short);
|
728
|
+
bool operator<<(int);
|
729
|
+
bool operator<<(long);
|
730
|
+
bool operator<<(unsigned short);
|
731
|
+
bool operator<<(unsigned int);
|
732
|
+
bool operator<<(unsigned long);
|
733
|
+
#if defined(BOOST_HAS_LONG_LONG)
|
734
|
+
bool operator<<(boost::ulong_long_type);
|
735
|
+
bool operator<<(boost::long_long_type );
|
736
|
+
#elif defined(BOOST_HAS_MS_INT64)
|
737
|
+
bool operator<<(unsigned __int64);
|
738
|
+
bool operator<<( __int64);
|
739
|
+
#endif
|
740
|
+
// These three operators use ostream and streambuf.
|
741
|
+
// lcast_streambuf_for_source<T>::value is true.
|
742
|
+
bool operator<<(float);
|
743
|
+
bool operator<<(double);
|
744
|
+
bool operator<<(long double);
|
745
|
+
|
746
|
+
public: // input
|
747
|
+
|
748
|
+
// Generic istream-based algorithm.
|
749
|
+
// lcast_streambuf_for_target<InputStreamable>::value is true.
|
750
|
+
template<typename InputStreamable>
|
751
|
+
bool operator>>(InputStreamable& output)
|
752
|
+
{
|
753
|
+
#if (defined _MSC_VER)
|
754
|
+
# pragma warning( push )
|
755
|
+
// conditional expression is constant
|
756
|
+
# pragma warning( disable : 4127 )
|
757
|
+
#endif
|
758
|
+
if(is_pointer<InputStreamable>::value)
|
759
|
+
return false;
|
760
|
+
|
761
|
+
this->setg(start, start, finish);
|
762
|
+
std::basic_istream<CharT> stream(static_cast<Base*>(this));
|
763
|
+
stream.unsetf(std::ios::skipws);
|
764
|
+
lcast_set_precision(stream, (InputStreamable*)0);
|
765
|
+
#if (defined _MSC_VER)
|
766
|
+
# pragma warning( pop )
|
767
|
+
#endif
|
768
|
+
return stream >> output &&
|
769
|
+
stream.get() ==
|
770
|
+
#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING)
|
771
|
+
// GCC 2.9x lacks std::char_traits<>::eof().
|
772
|
+
// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3
|
773
|
+
// configurations, which do provide std::char_traits<>::eof().
|
774
|
+
|
775
|
+
EOF;
|
776
|
+
#else
|
777
|
+
Traits::eof();
|
778
|
+
#endif
|
779
|
+
}
|
780
|
+
|
781
|
+
bool operator>>(CharT&);
|
782
|
+
|
783
|
+
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
784
|
+
// This #if is in sync with lcast_streambuf_for_target
|
785
|
+
|
786
|
+
bool operator>>(std::string&);
|
787
|
+
|
788
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
789
|
+
bool operator>>(std::wstring&);
|
790
|
+
#endif
|
791
|
+
|
792
|
+
#else
|
793
|
+
template<class Alloc>
|
794
|
+
bool operator>>(std::basic_string<CharT,Traits,Alloc>& str)
|
795
|
+
{
|
796
|
+
str.assign(start, finish);
|
797
|
+
return true;
|
798
|
+
}
|
799
|
+
#endif
|
800
|
+
};
|
801
|
+
|
802
|
+
template<typename CharT, class Base, class Traits>
|
803
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
804
|
+
bool value)
|
805
|
+
{
|
806
|
+
typedef typename Traits::int_type int_type;
|
807
|
+
CharT const czero = lcast_char_constants<CharT>::zero;
|
808
|
+
int_type const zero = Traits::to_int_type(czero);
|
809
|
+
Traits::assign(*start, Traits::to_char_type(zero + value));
|
810
|
+
finish = start + 1;
|
811
|
+
return true;
|
812
|
+
}
|
813
|
+
|
814
|
+
template<typename CharT, class Base, class Traits>
|
815
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
816
|
+
char ch)
|
817
|
+
{
|
818
|
+
widen_and_assign(start, ch);
|
819
|
+
finish = start + 1;
|
820
|
+
return true;
|
821
|
+
}
|
822
|
+
|
823
|
+
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
824
|
+
template<typename CharT, class Base, class Traits>
|
825
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
826
|
+
wchar_t ch)
|
827
|
+
{
|
828
|
+
widen_and_assign(start, ch);
|
829
|
+
finish = start + 1;
|
830
|
+
return true;
|
831
|
+
}
|
832
|
+
#endif
|
833
|
+
|
834
|
+
template<typename CharT, class Base, class Traits>
|
835
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
836
|
+
short n)
|
837
|
+
{
|
838
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
839
|
+
if(n < 0)
|
840
|
+
{
|
841
|
+
--start;
|
842
|
+
CharT const minus = lcast_char_constants<CharT>::minus;
|
843
|
+
Traits::assign(*start, minus);
|
844
|
+
}
|
845
|
+
return true;
|
846
|
+
}
|
847
|
+
|
848
|
+
template<typename CharT, class Base, class Traits>
|
849
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
850
|
+
int n)
|
851
|
+
{
|
852
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
853
|
+
if(n < 0)
|
854
|
+
{
|
855
|
+
--start;
|
856
|
+
CharT const minus = lcast_char_constants<CharT>::minus;
|
857
|
+
Traits::assign(*start, minus);
|
858
|
+
}
|
859
|
+
return true;
|
860
|
+
}
|
861
|
+
|
862
|
+
template<typename CharT, class Base, class Traits>
|
863
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
864
|
+
long n)
|
865
|
+
{
|
866
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
867
|
+
if(n < 0)
|
868
|
+
{
|
869
|
+
--start;
|
870
|
+
CharT const minus = lcast_char_constants<CharT>::minus;
|
871
|
+
Traits::assign(*start, minus);
|
872
|
+
}
|
873
|
+
return true;
|
874
|
+
}
|
875
|
+
|
876
|
+
#if defined(BOOST_HAS_LONG_LONG)
|
877
|
+
template<typename CharT, class Base, class Traits>
|
878
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
879
|
+
boost::long_long_type n)
|
880
|
+
{
|
881
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
882
|
+
if(n < 0)
|
883
|
+
{
|
884
|
+
--start;
|
885
|
+
CharT const minus = lcast_char_constants<CharT>::minus;
|
886
|
+
Traits::assign(*start, minus);
|
887
|
+
}
|
888
|
+
return true;
|
889
|
+
}
|
890
|
+
#elif defined(BOOST_HAS_MS_INT64)
|
891
|
+
template<typename CharT, class Base, class Traits>
|
892
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
893
|
+
__int64 n)
|
894
|
+
{
|
895
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
896
|
+
if(n < 0)
|
897
|
+
{
|
898
|
+
--start;
|
899
|
+
CharT const minus = lcast_char_constants<CharT>::minus;
|
900
|
+
Traits::assign(*start, minus);
|
901
|
+
}
|
902
|
+
return true;
|
903
|
+
}
|
904
|
+
#endif
|
905
|
+
|
906
|
+
template<typename CharT, class Base, class Traits>
|
907
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
908
|
+
unsigned short n)
|
909
|
+
{
|
910
|
+
start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish);
|
911
|
+
return true;
|
912
|
+
}
|
913
|
+
|
914
|
+
template<typename CharT, class Base, class Traits>
|
915
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
916
|
+
unsigned int n)
|
917
|
+
{
|
918
|
+
start = lcast_put_unsigned<Traits>(n, finish);
|
919
|
+
return true;
|
920
|
+
}
|
921
|
+
|
922
|
+
template<typename CharT, class Base, class Traits>
|
923
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
924
|
+
unsigned long n)
|
925
|
+
{
|
926
|
+
start = lcast_put_unsigned<Traits>(n, finish);
|
927
|
+
return true;
|
928
|
+
}
|
929
|
+
|
930
|
+
#if defined(BOOST_HAS_LONG_LONG)
|
931
|
+
template<typename CharT, class Base, class Traits>
|
932
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
933
|
+
boost::ulong_long_type n)
|
934
|
+
{
|
935
|
+
start = lcast_put_unsigned<Traits>(n, finish);
|
936
|
+
return true;
|
937
|
+
}
|
938
|
+
#elif defined(BOOST_HAS_MS_INT64)
|
939
|
+
template<typename CharT, class Base, class Traits>
|
940
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
941
|
+
unsigned __int64 n)
|
942
|
+
{
|
943
|
+
start = lcast_put_unsigned<Traits>(n, finish);
|
944
|
+
return true;
|
945
|
+
}
|
946
|
+
#endif
|
947
|
+
|
948
|
+
template<typename CharT, class Base, class Traits>
|
949
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
950
|
+
float val)
|
951
|
+
{
|
952
|
+
return this->lcast_put(val);
|
953
|
+
}
|
954
|
+
|
955
|
+
template<typename CharT, class Base, class Traits>
|
956
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
957
|
+
double val)
|
958
|
+
{
|
959
|
+
return this->lcast_put(val);
|
960
|
+
}
|
961
|
+
|
962
|
+
template<typename CharT, class Base, class Traits>
|
963
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
964
|
+
long double val)
|
965
|
+
{
|
966
|
+
return this->lcast_put(val);
|
967
|
+
}
|
968
|
+
|
969
|
+
template<typename CharT, class Base, class Traits>
|
970
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
971
|
+
CharT const* str)
|
972
|
+
{
|
973
|
+
start = const_cast<CharT*>(str);
|
974
|
+
finish = start + Traits::length(str);
|
975
|
+
return true;
|
976
|
+
}
|
977
|
+
|
978
|
+
template<typename CharT, class Base, class Traits>
|
979
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
980
|
+
CharT& output)
|
981
|
+
{
|
982
|
+
bool const ok = (finish - start == 1);
|
983
|
+
if(ok)
|
984
|
+
Traits::assign(output, *start);
|
985
|
+
return ok;
|
986
|
+
}
|
987
|
+
|
988
|
+
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
989
|
+
template<typename CharT, class Base, class Traits>
|
990
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
991
|
+
std::string& str)
|
992
|
+
{
|
993
|
+
str.assign(start, finish);
|
994
|
+
return true;
|
995
|
+
}
|
996
|
+
|
997
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
998
|
+
template<typename CharT, class Base, class Traits>
|
999
|
+
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
1000
|
+
std::wstring& str)
|
1001
|
+
{
|
1002
|
+
str.assign(start, finish);
|
1003
|
+
return true;
|
1004
|
+
}
|
1005
|
+
#endif
|
1006
|
+
#endif
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
namespace detail // lcast_streambuf_for_source
|
1010
|
+
{
|
1011
|
+
// Returns true if optimized stream wrapper needs ostream for writing.
|
1012
|
+
template<class Source>
|
1013
|
+
struct lcast_streambuf_for_source
|
1014
|
+
{
|
1015
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1016
|
+
};
|
1017
|
+
|
1018
|
+
template<>
|
1019
|
+
struct lcast_streambuf_for_source<float>
|
1020
|
+
{
|
1021
|
+
BOOST_STATIC_CONSTANT(bool, value = true);
|
1022
|
+
};
|
1023
|
+
|
1024
|
+
template<>
|
1025
|
+
struct lcast_streambuf_for_source<double>
|
1026
|
+
{
|
1027
|
+
BOOST_STATIC_CONSTANT(bool, value = true);
|
1028
|
+
};
|
1029
|
+
|
1030
|
+
template<>
|
1031
|
+
struct lcast_streambuf_for_source<long double>
|
1032
|
+
{
|
1033
|
+
BOOST_STATIC_CONSTANT(bool, value = true);
|
1034
|
+
};
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
namespace detail // lcast_streambuf_for_target
|
1038
|
+
{
|
1039
|
+
// Returns true if optimized stream wrapper needs istream for reading.
|
1040
|
+
template<class Target>
|
1041
|
+
struct lcast_streambuf_for_target
|
1042
|
+
{
|
1043
|
+
BOOST_STATIC_CONSTANT(bool, value = true);
|
1044
|
+
};
|
1045
|
+
|
1046
|
+
template<>
|
1047
|
+
struct lcast_streambuf_for_target<char>
|
1048
|
+
{
|
1049
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
1053
|
+
template<>
|
1054
|
+
struct lcast_streambuf_for_target<wchar_t>
|
1055
|
+
{
|
1056
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1057
|
+
};
|
1058
|
+
#endif
|
1059
|
+
|
1060
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
1061
|
+
template<class Traits, class Alloc>
|
1062
|
+
struct lcast_streambuf_for_target<
|
1063
|
+
std::basic_string<char,Traits,Alloc> >
|
1064
|
+
{
|
1065
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
1069
|
+
template<class Traits, class Alloc>
|
1070
|
+
struct lcast_streambuf_for_target<
|
1071
|
+
std::basic_string<wchar_t,Traits,Alloc> >
|
1072
|
+
{
|
1073
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1074
|
+
};
|
1075
|
+
#endif
|
1076
|
+
#else
|
1077
|
+
template<>
|
1078
|
+
struct lcast_streambuf_for_target<std::string>
|
1079
|
+
{
|
1080
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1081
|
+
};
|
1082
|
+
|
1083
|
+
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
1084
|
+
template<>
|
1085
|
+
struct lcast_streambuf_for_target<std::wstring>
|
1086
|
+
{
|
1087
|
+
BOOST_STATIC_CONSTANT(bool, value = false);
|
1088
|
+
};
|
1089
|
+
#endif
|
1090
|
+
#endif
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
1094
|
+
|
1095
|
+
// call-by-const reference version
|
1096
|
+
|
1097
|
+
namespace detail
|
1098
|
+
{
|
1099
|
+
template<class T>
|
1100
|
+
struct array_to_pointer_decay
|
1101
|
+
{
|
1102
|
+
typedef T type;
|
1103
|
+
};
|
1104
|
+
|
1105
|
+
template<class T, std::size_t N>
|
1106
|
+
struct array_to_pointer_decay<T[N]>
|
1107
|
+
{
|
1108
|
+
typedef const T * type;
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
template< typename Target
|
1112
|
+
, typename Source
|
1113
|
+
, bool Unlimited // string representation of Source is unlimited
|
1114
|
+
, typename CharT
|
1115
|
+
>
|
1116
|
+
Target lexical_cast(
|
1117
|
+
BOOST_DEDUCED_TYPENAME boost::call_traits<Source>::param_type arg,
|
1118
|
+
CharT* buf, std::size_t src_len)
|
1119
|
+
{
|
1120
|
+
typedef BOOST_DEDUCED_TYPENAME
|
1121
|
+
deduce_char_traits<CharT,Target,Source>::type traits;
|
1122
|
+
|
1123
|
+
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
1124
|
+
lcast_streambuf_for_target<Target>::value ||
|
1125
|
+
lcast_streambuf_for_source<Source>::value
|
1126
|
+
, std::basic_streambuf<CharT>
|
1127
|
+
, lexical_streambuf_fake
|
1128
|
+
>::type base;
|
1129
|
+
|
1130
|
+
BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
1131
|
+
Unlimited
|
1132
|
+
, detail::lexical_stream<Target,Source,traits>
|
1133
|
+
, detail::lexical_stream_limited_src<CharT,base,traits>
|
1134
|
+
>::type interpreter(buf, buf + src_len);
|
1135
|
+
|
1136
|
+
// The original form, reproduced below, is more elegant
|
1137
|
+
// but yields a spurious C4701 warning ("possible use of
|
1138
|
+
// "result" before initialization") with VC7.1 (/W4).
|
1139
|
+
//
|
1140
|
+
// Target result;
|
1141
|
+
//
|
1142
|
+
// if(!(interpreter << arg && interpreter >> result))
|
1143
|
+
// throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
1144
|
+
// return result;
|
1145
|
+
|
1146
|
+
if(interpreter << arg) {
|
1147
|
+
Target result;
|
1148
|
+
if (interpreter >> result)
|
1149
|
+
return result;
|
1150
|
+
}
|
1151
|
+
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
1152
|
+
return Target(); // normally never reached (throw_exception)
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
template<typename Target, typename Source>
|
1157
|
+
inline Target lexical_cast(const Source &arg)
|
1158
|
+
{
|
1159
|
+
typedef typename detail::array_to_pointer_decay<Source>::type src;
|
1160
|
+
|
1161
|
+
typedef typename detail::widest_char<
|
1162
|
+
typename detail::stream_char<Target>::type
|
1163
|
+
, typename detail::stream_char<src>::type
|
1164
|
+
>::type char_type;
|
1165
|
+
|
1166
|
+
typedef detail::lcast_src_length<char_type, src> lcast_src_length;
|
1167
|
+
std::size_t const src_len = lcast_src_length::value;
|
1168
|
+
char_type buf[src_len + 1];
|
1169
|
+
lcast_src_length::check_coverage();
|
1170
|
+
return detail::lexical_cast<Target, src, !src_len>(arg, buf, src_len);
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
#else
|
1174
|
+
|
1175
|
+
// call-by-value fallback version (deprecated)
|
1176
|
+
|
1177
|
+
template<typename Target, typename Source>
|
1178
|
+
Target lexical_cast(Source arg)
|
1179
|
+
{
|
1180
|
+
typedef typename detail::widest_char<
|
1181
|
+
BOOST_DEDUCED_TYPENAME detail::stream_char<Target>::type
|
1182
|
+
, BOOST_DEDUCED_TYPENAME detail::stream_char<Source>::type
|
1183
|
+
>::type char_type;
|
1184
|
+
|
1185
|
+
typedef std::char_traits<char_type> traits;
|
1186
|
+
detail::lexical_stream<Target, Source, traits> interpreter;
|
1187
|
+
Target result;
|
1188
|
+
|
1189
|
+
if(!(interpreter << arg && interpreter >> result))
|
1190
|
+
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
1191
|
+
return result;
|
1192
|
+
}
|
1193
|
+
|
1194
|
+
#endif
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
// Copyright Kevlin Henney, 2000-2005.
|
1198
|
+
// Copyright Alexander Nasonov, 2006-2007.
|
1199
|
+
//
|
1200
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
1201
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
1202
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
1203
|
+
|
1204
|
+
#undef DISABLE_WIDE_CHAR_SUPPORT
|
1205
|
+
#endif
|