couchbase 1.3.15 → 3.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +17 -12
- data/.gitmodules +15 -0
- data/.idea/.gitignore +5 -0
- data/.idea/dictionaries/gem_terms.xml +13 -0
- data/.idea/inspectionProfiles/Project_Default.xml +7 -0
- data/.idea/vcs.xml +11 -0
- data/.travis.yml +6 -21
- data/Gemfile +21 -2
- data/LICENSE.txt +202 -0
- data/README.md +7 -0
- data/Rakefile +24 -15
- data/bin/console +21 -0
- data/bin/setup +23 -0
- data/couchbase.gemspec +36 -41
- data/examples/crud.rb +21 -0
- data/examples/query.rb +17 -0
- data/examples/subdocument.rb +29 -0
- data/ext/.clang-format +15 -0
- data/ext/.clang-tidy +20 -0
- data/ext/.cmake-format.yaml +8 -0
- data/ext/.gitignore +2 -0
- data/ext/.idea/.name +1 -0
- data/ext/.idea/dictionaries/couchbase_terms.xml +12 -0
- data/ext/.idea/ext.iml +2 -0
- data/ext/.idea/misc.xml +4 -0
- data/ext/.idea/modules.xml +8 -0
- data/ext/.idea/vcs.xml +11 -0
- data/ext/CMakeLists.txt +145 -0
- data/ext/LICENSE.txt +202 -0
- data/ext/couchbase/bucket.hxx +75 -0
- data/ext/couchbase/cbcrypto/cbcrypto.cc +888 -0
- data/ext/couchbase/cbcrypto/cbcrypto.h +89 -0
- data/ext/couchbase/cbsasl/client.cc +48 -0
- data/ext/couchbase/cbsasl/client.h +127 -0
- data/ext/couchbase/cbsasl/context.cc +33 -0
- data/ext/couchbase/cbsasl/context.h +52 -0
- data/ext/couchbase/cbsasl/error.h +72 -0
- data/ext/couchbase/cbsasl/mechanism.cc +48 -0
- data/ext/couchbase/cbsasl/mechanism.h +55 -0
- data/ext/couchbase/cbsasl/plain/plain.cc +36 -0
- data/ext/couchbase/cbsasl/plain/plain.h +53 -0
- data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +390 -0
- data/ext/couchbase/cbsasl/scram-sha/scram-sha.h +185 -0
- data/ext/couchbase/cbsasl/scram-sha/stringutils.cc +81 -0
- data/ext/couchbase/cbsasl/scram-sha/stringutils.h +48 -0
- data/ext/couchbase/cluster.hxx +159 -0
- data/ext/couchbase/collections_manifest.hxx +88 -0
- data/ext/couchbase/configuration.hxx +242 -0
- data/ext/couchbase/configuration_monitor.hxx +93 -0
- data/ext/couchbase/couchbase.cxx +1099 -0
- data/ext/couchbase/error_map.hxx +61 -0
- data/ext/couchbase/errors.hxx +691 -0
- data/ext/couchbase/io/binary_message.hxx +38 -0
- data/ext/couchbase/io/binary_parser.hxx +64 -0
- data/ext/couchbase/io/http_message.hxx +34 -0
- data/ext/couchbase/io/http_parser.hxx +173 -0
- data/ext/couchbase/io/http_session.hxx +281 -0
- data/ext/couchbase/io/key_value_session.hxx +754 -0
- data/ext/couchbase/io/session_manager.hxx +107 -0
- data/ext/couchbase/mutation_token.hxx +37 -0
- data/ext/couchbase/operations.hxx +29 -0
- data/ext/couchbase/operations/command.hxx +77 -0
- data/ext/couchbase/operations/document_id.hxx +37 -0
- data/ext/couchbase/operations/get.hxx +60 -0
- data/ext/couchbase/operations/lookup_in.hxx +85 -0
- data/ext/couchbase/operations/mutate_in.hxx +87 -0
- data/ext/couchbase/operations/query.hxx +230 -0
- data/ext/couchbase/operations/remove.hxx +58 -0
- data/ext/couchbase/operations/upsert.hxx +60 -0
- data/ext/couchbase/platform/base64.cc +234 -0
- data/ext/couchbase/platform/base64.h +47 -0
- data/ext/couchbase/platform/random.cc +119 -0
- data/ext/couchbase/platform/random.h +39 -0
- data/ext/couchbase/platform/string_hex.cc +99 -0
- data/ext/couchbase/platform/string_hex.h +50 -0
- data/ext/couchbase/platform/uuid.cc +96 -0
- data/ext/couchbase/platform/uuid.h +56 -0
- data/ext/couchbase/protocol/client_opcode.hxx +215 -0
- data/ext/couchbase/protocol/client_request.hxx +113 -0
- data/ext/couchbase/protocol/client_response.hxx +181 -0
- data/ext/couchbase/protocol/cmd_get.hxx +99 -0
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +111 -0
- data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +86 -0
- data/ext/couchbase/protocol/cmd_get_error_map.hxx +113 -0
- data/ext/couchbase/protocol/cmd_hello.hxx +130 -0
- data/ext/couchbase/protocol/cmd_info.hxx +35 -0
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +203 -0
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +265 -0
- data/ext/couchbase/protocol/cmd_remove.hxx +79 -0
- data/ext/couchbase/protocol/cmd_sasl_auth.hxx +94 -0
- data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +88 -0
- data/ext/couchbase/protocol/cmd_sasl_step.hxx +92 -0
- data/ext/couchbase/protocol/cmd_select_bucket.hxx +73 -0
- data/ext/couchbase/protocol/cmd_upsert.hxx +136 -0
- data/ext/couchbase/protocol/datatype.hxx +48 -0
- data/ext/couchbase/protocol/hello_feature.hxx +118 -0
- data/ext/couchbase/protocol/magic.hxx +83 -0
- data/ext/couchbase/protocol/status.hxx +333 -0
- data/ext/couchbase/protocol/unsigned_leb128.h +195 -0
- data/ext/couchbase/service_type.hxx +23 -0
- data/ext/couchbase/utils/byteswap.hxx +34 -0
- data/ext/couchbase/utils/crc32.hxx +48 -0
- data/ext/couchbase/version.hxx +22 -0
- data/ext/extconf.rb +44 -0
- data/ext/test/main.cxx +143 -0
- data/ext/third_party/asio/.appveyor.yml +107 -0
- data/ext/third_party/asio/.cirrus.yml +16 -0
- data/ext/third_party/asio/.gitignore +3 -0
- data/ext/third_party/asio/.travis.yml +323 -0
- data/ext/third_party/asio/asio/.gitignore +23 -0
- data/ext/third_party/asio/asio/COPYING +4 -0
- data/ext/third_party/asio/asio/INSTALL +5 -0
- data/ext/third_party/asio/asio/LICENSE_1_0.txt +23 -0
- data/ext/third_party/asio/asio/Makefile.am +19 -0
- data/ext/third_party/asio/asio/README +4 -0
- data/ext/third_party/asio/asio/asio.manifest +4865 -0
- data/ext/third_party/asio/asio/autogen.sh +55 -0
- data/ext/third_party/asio/asio/boost_asio.manifest +5193 -0
- data/ext/third_party/asio/asio/boostify.pl +603 -0
- data/ext/third_party/asio/asio/configure.ac +182 -0
- data/ext/third_party/asio/asio/include/.gitignore +2 -0
- data/ext/third_party/asio/asio/include/Makefile.am +484 -0
- data/ext/third_party/asio/asio/include/asio.hpp +147 -0
- data/ext/third_party/asio/asio/include/asio/associated_allocator.hpp +131 -0
- data/ext/third_party/asio/asio/include/asio/associated_executor.hpp +149 -0
- data/ext/third_party/asio/asio/include/asio/async_result.hpp +589 -0
- data/ext/third_party/asio/asio/include/asio/awaitable.hpp +123 -0
- data/ext/third_party/asio/asio/include/asio/basic_datagram_socket.hpp +1210 -0
- data/ext/third_party/asio/asio/include/asio/basic_deadline_timer.hpp +693 -0
- data/ext/third_party/asio/asio/include/asio/basic_io_object.hpp +290 -0
- data/ext/third_party/asio/asio/include/asio/basic_raw_socket.hpp +1202 -0
- data/ext/third_party/asio/asio/include/asio/basic_seq_packet_socket.hpp +756 -0
- data/ext/third_party/asio/asio/include/asio/basic_serial_port.hpp +907 -0
- data/ext/third_party/asio/asio/include/asio/basic_signal_set.hpp +568 -0
- data/ext/third_party/asio/asio/include/asio/basic_socket.hpp +1894 -0
- data/ext/third_party/asio/asio/include/asio/basic_socket_acceptor.hpp +2495 -0
- data/ext/third_party/asio/asio/include/asio/basic_socket_iostream.hpp +407 -0
- data/ext/third_party/asio/asio/include/asio/basic_socket_streambuf.hpp +687 -0
- data/ext/third_party/asio/asio/include/asio/basic_stream_socket.hpp +1049 -0
- data/ext/third_party/asio/asio/include/asio/basic_streambuf.hpp +452 -0
- data/ext/third_party/asio/asio/include/asio/basic_streambuf_fwd.hpp +36 -0
- data/ext/third_party/asio/asio/include/asio/basic_waitable_timer.hpp +763 -0
- data/ext/third_party/asio/asio/include/asio/bind_executor.hpp +580 -0
- data/ext/third_party/asio/asio/include/asio/buffer.hpp +2494 -0
- data/ext/third_party/asio/asio/include/asio/buffered_read_stream.hpp +253 -0
- data/ext/third_party/asio/asio/include/asio/buffered_read_stream_fwd.hpp +25 -0
- data/ext/third_party/asio/asio/include/asio/buffered_stream.hpp +279 -0
- data/ext/third_party/asio/asio/include/asio/buffered_stream_fwd.hpp +25 -0
- data/ext/third_party/asio/asio/include/asio/buffered_write_stream.hpp +245 -0
- data/ext/third_party/asio/asio/include/asio/buffered_write_stream_fwd.hpp +25 -0
- data/ext/third_party/asio/asio/include/asio/buffers_iterator.hpp +521 -0
- data/ext/third_party/asio/asio/include/asio/co_spawn.hpp +100 -0
- data/ext/third_party/asio/asio/include/asio/completion_condition.hpp +218 -0
- data/ext/third_party/asio/asio/include/asio/compose.hpp +136 -0
- data/ext/third_party/asio/asio/include/asio/connect.hpp +1076 -0
- data/ext/third_party/asio/asio/include/asio/coroutine.hpp +328 -0
- data/ext/third_party/asio/asio/include/asio/deadline_timer.hpp +38 -0
- data/ext/third_party/asio/asio/include/asio/defer.hpp +127 -0
- data/ext/third_party/asio/asio/include/asio/detached.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/detail/array.hpp +38 -0
- data/ext/third_party/asio/asio/include/asio/detail/array_fwd.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/detail/assert.hpp +32 -0
- data/ext/third_party/asio/asio/include/asio/detail/atomic_count.hpp +45 -0
- data/ext/third_party/asio/asio/include/asio/detail/base_from_completion_cond.hpp +69 -0
- data/ext/third_party/asio/asio/include/asio/detail/bind_handler.hpp +816 -0
- data/ext/third_party/asio/asio/include/asio/detail/buffer_resize_guard.hpp +66 -0
- data/ext/third_party/asio/asio/include/asio/detail/buffer_sequence_adapter.hpp +544 -0
- data/ext/third_party/asio/asio/include/asio/detail/buffered_stream_storage.hpp +126 -0
- data/ext/third_party/asio/asio/include/asio/detail/call_stack.hpp +125 -0
- data/ext/third_party/asio/asio/include/asio/detail/chrono.hpp +66 -0
- data/ext/third_party/asio/asio/include/asio/detail/chrono_time_traits.hpp +190 -0
- data/ext/third_party/asio/asio/include/asio/detail/completion_handler.hpp +83 -0
- data/ext/third_party/asio/asio/include/asio/detail/concurrency_hint.hpp +94 -0
- data/ext/third_party/asio/asio/include/asio/detail/conditionally_enabled_event.hpp +112 -0
- data/ext/third_party/asio/asio/include/asio/detail/conditionally_enabled_mutex.hpp +149 -0
- data/ext/third_party/asio/asio/include/asio/detail/config.hpp +1499 -0
- data/ext/third_party/asio/asio/include/asio/detail/consuming_buffers.hpp +414 -0
- data/ext/third_party/asio/asio/include/asio/detail/cstddef.hpp +31 -0
- data/ext/third_party/asio/asio/include/asio/detail/cstdint.hpp +60 -0
- data/ext/third_party/asio/asio/include/asio/detail/date_time_fwd.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/detail/deadline_timer_service.hpp +280 -0
- data/ext/third_party/asio/asio/include/asio/detail/dependent_type.hpp +36 -0
- data/ext/third_party/asio/asio/include/asio/detail/descriptor_ops.hpp +121 -0
- data/ext/third_party/asio/asio/include/asio/detail/descriptor_read_op.hpp +130 -0
- data/ext/third_party/asio/asio/include/asio/detail/descriptor_write_op.hpp +130 -0
- data/ext/third_party/asio/asio/include/asio/detail/dev_poll_reactor.hpp +218 -0
- data/ext/third_party/asio/asio/include/asio/detail/epoll_reactor.hpp +266 -0
- data/ext/third_party/asio/asio/include/asio/detail/event.hpp +48 -0
- data/ext/third_party/asio/asio/include/asio/detail/eventfd_select_interrupter.hpp +83 -0
- data/ext/third_party/asio/asio/include/asio/detail/executor_function.hpp +104 -0
- data/ext/third_party/asio/asio/include/asio/detail/executor_op.hpp +84 -0
- data/ext/third_party/asio/asio/include/asio/detail/fd_set_adapter.hpp +39 -0
- data/ext/third_party/asio/asio/include/asio/detail/fenced_block.hpp +80 -0
- data/ext/third_party/asio/asio/include/asio/detail/functional.hpp +38 -0
- data/ext/third_party/asio/asio/include/asio/detail/future.hpp +33 -0
- data/ext/third_party/asio/asio/include/asio/detail/gcc_arm_fenced_block.hpp +91 -0
- data/ext/third_party/asio/asio/include/asio/detail/gcc_hppa_fenced_block.hpp +68 -0
- data/ext/third_party/asio/asio/include/asio/detail/gcc_sync_fenced_block.hpp +65 -0
- data/ext/third_party/asio/asio/include/asio/detail/gcc_x86_fenced_block.hpp +99 -0
- data/ext/third_party/asio/asio/include/asio/detail/global.hpp +52 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_alloc_helpers.hpp +242 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_cont_helpers.hpp +45 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_invoke_helpers.hpp +57 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_tracking.hpp +238 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_type_requirements.hpp +556 -0
- data/ext/third_party/asio/asio/include/asio/detail/handler_work.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/detail/hash_map.hpp +331 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/buffer_sequence_adapter.ipp +118 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/descriptor_ops.ipp +474 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/dev_poll_reactor.hpp +91 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/dev_poll_reactor.ipp +446 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/epoll_reactor.hpp +89 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/epoll_reactor.ipp +787 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp +169 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/handler_tracking.ipp +358 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/kqueue_reactor.hpp +93 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/kqueue_reactor.ipp +570 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/null_event.ipp +74 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/pipe_select_interrupter.ipp +129 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/posix_event.ipp +59 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/posix_mutex.ipp +46 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/posix_thread.ipp +84 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/posix_tss_ptr.ipp +46 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_descriptor_service.ipp +223 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_serial_port_service.ipp +152 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_socket_service_base.ipp +300 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/resolver_service_base.ipp +158 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/scheduler.ipp +617 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/select_reactor.hpp +100 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/select_reactor.ipp +338 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/service_registry.hpp +94 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/service_registry.ipp +197 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/signal_set_service.ipp +667 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/socket_ops.ipp +3575 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/socket_select_interrupter.ipp +185 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/strand_executor_service.hpp +179 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/strand_executor_service.ipp +134 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.hpp +118 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.ipp +177 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/throw_error.ipp +60 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/timer_queue_ptime.ipp +91 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/timer_queue_set.ipp +101 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_event.ipp +76 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_handle_service.ipp +525 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_io_context.hpp +103 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_io_context.ipp +594 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp +192 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp +801 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_mutex.ipp +84 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_object_handle_service.ipp +448 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_static_mutex.ipp +136 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_thread.ipp +150 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/win_tss_ptr.ipp +57 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp +626 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp +92 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp +121 -0
- data/ext/third_party/asio/asio/include/asio/detail/impl/winsock_init.ipp +82 -0
- data/ext/third_party/asio/asio/include/asio/detail/io_control.hpp +84 -0
- data/ext/third_party/asio/asio/include/asio/detail/io_object_executor.hpp +167 -0
- data/ext/third_party/asio/asio/include/asio/detail/io_object_impl.hpp +193 -0
- data/ext/third_party/asio/asio/include/asio/detail/is_buffer_sequence.hpp +312 -0
- data/ext/third_party/asio/asio/include/asio/detail/is_executor.hpp +126 -0
- data/ext/third_party/asio/asio/include/asio/detail/keyword_tss_ptr.hpp +70 -0
- data/ext/third_party/asio/asio/include/asio/detail/kqueue_reactor.hpp +242 -0
- data/ext/third_party/asio/asio/include/asio/detail/limits.hpp +26 -0
- data/ext/third_party/asio/asio/include/asio/detail/local_free_on_block_exit.hpp +59 -0
- data/ext/third_party/asio/asio/include/asio/detail/macos_fenced_block.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/detail/memory.hpp +70 -0
- data/ext/third_party/asio/asio/include/asio/detail/mutex.hpp +48 -0
- data/ext/third_party/asio/asio/include/asio/detail/non_const_lvalue.hpp +54 -0
- data/ext/third_party/asio/asio/include/asio/detail/noncopyable.hpp +43 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_event.hpp +100 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_fenced_block.hpp +47 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_global.hpp +59 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_mutex.hpp +64 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_reactor.hpp +68 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_signal_blocker.hpp +69 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_socket_service.hpp +519 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_static_mutex.hpp +60 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_thread.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/detail/null_tss_ptr.hpp +68 -0
- data/ext/third_party/asio/asio/include/asio/detail/object_pool.hpp +171 -0
- data/ext/third_party/asio/asio/include/asio/detail/old_win_sdk_compat.hpp +214 -0
- data/ext/third_party/asio/asio/include/asio/detail/op_queue.hpp +162 -0
- data/ext/third_party/asio/asio/include/asio/detail/operation.hpp +38 -0
- data/ext/third_party/asio/asio/include/asio/detail/pipe_select_interrupter.hpp +89 -0
- data/ext/third_party/asio/asio/include/asio/detail/pop_options.hpp +141 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_event.hpp +162 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_fd_set_adapter.hpp +118 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_global.hpp +80 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_mutex.hpp +76 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_signal_blocker.hpp +85 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_static_mutex.hpp +64 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_thread.hpp +109 -0
- data/ext/third_party/asio/asio/include/asio/detail/posix_tss_ptr.hpp +79 -0
- data/ext/third_party/asio/asio/include/asio/detail/push_options.hpp +185 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_descriptor_service.hpp +391 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_null_buffers_op.hpp +92 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_serial_port_service.hpp +238 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp +230 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_connect_op.hpp +116 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recv_op.hpp +137 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvfrom_op.hpp +142 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvmsg_op.hpp +135 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_send_op.hpp +136 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_sendto_op.hpp +134 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service.hpp +505 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service_base.hpp +518 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactive_wait_op.hpp +92 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactor.hpp +32 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactor_fwd.hpp +40 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactor_op.hpp +65 -0
- data/ext/third_party/asio/asio/include/asio/detail/reactor_op_queue.hpp +168 -0
- data/ext/third_party/asio/asio/include/asio/detail/recycling_allocator.hpp +106 -0
- data/ext/third_party/asio/asio/include/asio/detail/regex_fwd.hpp +35 -0
- data/ext/third_party/asio/asio/include/asio/detail/resolve_endpoint_op.hpp +138 -0
- data/ext/third_party/asio/asio/include/asio/detail/resolve_op.hpp +45 -0
- data/ext/third_party/asio/asio/include/asio/detail/resolve_query_op.hpp +148 -0
- data/ext/third_party/asio/asio/include/asio/detail/resolver_service.hpp +145 -0
- data/ext/third_party/asio/asio/include/asio/detail/resolver_service_base.hpp +143 -0
- data/ext/third_party/asio/asio/include/asio/detail/scheduler.hpp +224 -0
- data/ext/third_party/asio/asio/include/asio/detail/scheduler_operation.hpp +78 -0
- data/ext/third_party/asio/asio/include/asio/detail/scheduler_thread_info.hpp +40 -0
- data/ext/third_party/asio/asio/include/asio/detail/scoped_lock.hpp +101 -0
- data/ext/third_party/asio/asio/include/asio/detail/scoped_ptr.hpp +87 -0
- data/ext/third_party/asio/asio/include/asio/detail/select_interrupter.hpp +46 -0
- data/ext/third_party/asio/asio/include/asio/detail/select_reactor.hpp +238 -0
- data/ext/third_party/asio/asio/include/asio/detail/service_registry.hpp +164 -0
- data/ext/third_party/asio/asio/include/asio/detail/signal_blocker.hpp +44 -0
- data/ext/third_party/asio/asio/include/asio/detail/signal_handler.hpp +88 -0
- data/ext/third_party/asio/asio/include/asio/detail/signal_init.hpp +47 -0
- data/ext/third_party/asio/asio/include/asio/detail/signal_op.hpp +49 -0
- data/ext/third_party/asio/asio/include/asio/detail/signal_set_service.hpp +229 -0
- data/ext/third_party/asio/asio/include/asio/detail/socket_holder.hpp +98 -0
- data/ext/third_party/asio/asio/include/asio/detail/socket_ops.hpp +337 -0
- data/ext/third_party/asio/asio/include/asio/detail/socket_option.hpp +316 -0
- data/ext/third_party/asio/asio/include/asio/detail/socket_select_interrupter.hpp +91 -0
- data/ext/third_party/asio/asio/include/asio/detail/socket_types.hpp +416 -0
- data/ext/third_party/asio/asio/include/asio/detail/solaris_fenced_block.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/detail/static_mutex.hpp +52 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_event.hpp +176 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_fenced_block.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_global.hpp +70 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_mutex.hpp +73 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_static_mutex.hpp +81 -0
- data/ext/third_party/asio/asio/include/asio/detail/std_thread.hpp +71 -0
- data/ext/third_party/asio/asio/include/asio/detail/strand_executor_service.hpp +142 -0
- data/ext/third_party/asio/asio/include/asio/detail/strand_service.hpp +142 -0
- data/ext/third_party/asio/asio/include/asio/detail/string_view.hpp +47 -0
- data/ext/third_party/asio/asio/include/asio/detail/thread.hpp +60 -0
- data/ext/third_party/asio/asio/include/asio/detail/thread_context.hpp +42 -0
- data/ext/third_party/asio/asio/include/asio/detail/thread_group.hpp +95 -0
- data/ext/third_party/asio/asio/include/asio/detail/thread_info_base.hpp +125 -0
- data/ext/third_party/asio/asio/include/asio/detail/throw_error.hpp +53 -0
- data/ext/third_party/asio/asio/include/asio/detail/throw_exception.hpp +51 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_queue.hpp +360 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_queue_base.hpp +68 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_queue_ptime.hpp +99 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_queue_set.hpp +66 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_scheduler.hpp +35 -0
- data/ext/third_party/asio/asio/include/asio/detail/timer_scheduler_fwd.hpp +40 -0
- data/ext/third_party/asio/asio/include/asio/detail/tss_ptr.hpp +69 -0
- data/ext/third_party/asio/asio/include/asio/detail/type_traits.hpp +89 -0
- data/ext/third_party/asio/asio/include/asio/detail/variadic_templates.hpp +151 -0
- data/ext/third_party/asio/asio/include/asio/detail/wait_handler.hpp +87 -0
- data/ext/third_party/asio/asio/include/asio/detail/wait_op.hpp +45 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_event.hpp +151 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_fd_set_adapter.hpp +149 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_fenced_block.hpp +90 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_global.hpp +71 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_read_op.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_service.hpp +335 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_write_op.hpp +106 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_io_context.hpp +338 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_null_buffers_op.hpp +123 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_operation.hpp +96 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_op.hpp +92 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp +159 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_serial_port_service.hpp +232 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp +308 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_connect_op.hpp +130 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recv_op.hpp +120 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvfrom_op.hpp +129 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvmsg_op.hpp +121 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_send_op.hpp +114 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_service.hpp +581 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_service_base.hpp +600 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_thread_info.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_iocp_wait_op.hpp +123 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_mutex.hpp +78 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_object_handle_service.hpp +195 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_static_mutex.hpp +74 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_thread.hpp +147 -0
- data/ext/third_party/asio/asio/include/asio/detail/win_tss_ptr.hpp +79 -0
- data/ext/third_party/asio/asio/include/asio/detail/winapp_thread.hpp +124 -0
- data/ext/third_party/asio/asio/include/asio/detail/wince_thread.hpp +124 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_async_manager.hpp +305 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_async_op.hpp +65 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_resolve_op.hpp +121 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_resolver_service.hpp +212 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_connect_op.hpp +94 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_recv_op.hpp +115 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_send_op.hpp +106 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_ssocket_service.hpp +250 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_ssocket_service_base.hpp +362 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_timer_scheduler.hpp +147 -0
- data/ext/third_party/asio/asio/include/asio/detail/winrt_utils.hpp +106 -0
- data/ext/third_party/asio/asio/include/asio/detail/winsock_init.hpp +128 -0
- data/ext/third_party/asio/asio/include/asio/detail/work_dispatcher.hpp +73 -0
- data/ext/third_party/asio/asio/include/asio/detail/wrapped_handler.hpp +291 -0
- data/ext/third_party/asio/asio/include/asio/dispatch.hpp +118 -0
- data/ext/third_party/asio/asio/include/asio/error.hpp +356 -0
- data/ext/third_party/asio/asio/include/asio/error_code.hpp +202 -0
- data/ext/third_party/asio/asio/include/asio/execution_context.hpp +412 -0
- data/ext/third_party/asio/asio/include/asio/executor.hpp +341 -0
- data/ext/third_party/asio/asio/include/asio/executor_work_guard.hpp +170 -0
- data/ext/third_party/asio/asio/include/asio/generic/basic_endpoint.hpp +193 -0
- data/ext/third_party/asio/asio/include/asio/generic/datagram_protocol.hpp +123 -0
- data/ext/third_party/asio/asio/include/asio/generic/detail/endpoint.hpp +133 -0
- data/ext/third_party/asio/asio/include/asio/generic/detail/impl/endpoint.ipp +110 -0
- data/ext/third_party/asio/asio/include/asio/generic/raw_protocol.hpp +121 -0
- data/ext/third_party/asio/asio/include/asio/generic/seq_packet_protocol.hpp +122 -0
- data/ext/third_party/asio/asio/include/asio/generic/stream_protocol.hpp +127 -0
- data/ext/third_party/asio/asio/include/asio/handler_alloc_hook.hpp +81 -0
- data/ext/third_party/asio/asio/include/asio/handler_continuation_hook.hpp +54 -0
- data/ext/third_party/asio/asio/include/asio/handler_invoke_hook.hpp +85 -0
- data/ext/third_party/asio/asio/include/asio/high_resolution_timer.hpp +44 -0
- data/ext/third_party/asio/asio/include/asio/impl/awaitable.hpp +422 -0
- data/ext/third_party/asio/asio/include/asio/impl/buffered_read_stream.hpp +491 -0
- data/ext/third_party/asio/asio/include/asio/impl/buffered_write_stream.hpp +471 -0
- data/ext/third_party/asio/asio/include/asio/impl/co_spawn.hpp +160 -0
- data/ext/third_party/asio/asio/include/asio/impl/compose.hpp +533 -0
- data/ext/third_party/asio/asio/include/asio/impl/connect.hpp +872 -0
- data/ext/third_party/asio/asio/include/asio/impl/defer.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/impl/detached.hpp +130 -0
- data/ext/third_party/asio/asio/include/asio/impl/dispatch.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/impl/error.ipp +128 -0
- data/ext/third_party/asio/asio/include/asio/impl/error_code.ipp +206 -0
- data/ext/third_party/asio/asio/include/asio/impl/execution_context.hpp +109 -0
- data/ext/third_party/asio/asio/include/asio/impl/execution_context.ipp +82 -0
- data/ext/third_party/asio/asio/include/asio/impl/executor.hpp +387 -0
- data/ext/third_party/asio/asio/include/asio/impl/executor.ipp +38 -0
- data/ext/third_party/asio/asio/include/asio/impl/handler_alloc_hook.ipp +52 -0
- data/ext/third_party/asio/asio/include/asio/impl/io_context.hpp +353 -0
- data/ext/third_party/asio/asio/include/asio/impl/io_context.ipp +175 -0
- data/ext/third_party/asio/asio/include/asio/impl/post.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/impl/read.hpp +1135 -0
- data/ext/third_party/asio/asio/include/asio/impl/read_at.hpp +699 -0
- data/ext/third_party/asio/asio/include/asio/impl/read_until.hpp +3150 -0
- data/ext/third_party/asio/asio/include/asio/impl/redirect_error.hpp +372 -0
- data/ext/third_party/asio/asio/include/asio/impl/serial_port_base.hpp +59 -0
- data/ext/third_party/asio/asio/include/asio/impl/serial_port_base.ipp +554 -0
- data/ext/third_party/asio/asio/include/asio/impl/spawn.hpp +490 -0
- data/ext/third_party/asio/asio/include/asio/impl/src.cpp +25 -0
- data/ext/third_party/asio/asio/include/asio/impl/src.hpp +82 -0
- data/ext/third_party/asio/asio/include/asio/impl/system_context.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/impl/system_context.ipp +80 -0
- data/ext/third_party/asio/asio/include/asio/impl/system_executor.hpp +85 -0
- data/ext/third_party/asio/asio/include/asio/impl/thread_pool.hpp +127 -0
- data/ext/third_party/asio/asio/include/asio/impl/thread_pool.ipp +87 -0
- data/ext/third_party/asio/asio/include/asio/impl/use_awaitable.hpp +276 -0
- data/ext/third_party/asio/asio/include/asio/impl/use_future.hpp +887 -0
- data/ext/third_party/asio/asio/include/asio/impl/write.hpp +1043 -0
- data/ext/third_party/asio/asio/include/asio/impl/write_at.hpp +624 -0
- data/ext/third_party/asio/asio/include/asio/io_context.hpp +872 -0
- data/ext/third_party/asio/asio/include/asio/io_context_strand.hpp +374 -0
- data/ext/third_party/asio/asio/include/asio/io_service.hpp +33 -0
- data/ext/third_party/asio/asio/include/asio/io_service_strand.hpp +20 -0
- data/ext/third_party/asio/asio/include/asio/ip/address.hpp +268 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v4.hpp +335 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v4_iterator.hpp +162 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v4_range.hpp +134 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v6.hpp +341 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v6_iterator.hpp +183 -0
- data/ext/third_party/asio/asio/include/asio/ip/address_v6_range.hpp +129 -0
- data/ext/third_party/asio/asio/include/asio/ip/bad_address_cast.hpp +53 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_endpoint.hpp +264 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_resolver.hpp +1030 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_entry.hpp +113 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_iterator.hpp +192 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_query.hpp +244 -0
- data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_results.hpp +311 -0
- data/ext/third_party/asio/asio/include/asio/ip/detail/endpoint.hpp +141 -0
- data/ext/third_party/asio/asio/include/asio/ip/detail/impl/endpoint.ipp +199 -0
- data/ext/third_party/asio/asio/include/asio/ip/detail/socket_option.hpp +566 -0
- data/ext/third_party/asio/asio/include/asio/ip/host_name.hpp +42 -0
- data/ext/third_party/asio/asio/include/asio/ip/icmp.hpp +115 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address.ipp +239 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address_v4.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address_v4.ipp +210 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address_v6.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/address_v6.ipp +350 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/basic_endpoint.hpp +43 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/host_name.ipp +54 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/network_v4.hpp +54 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/network_v4.ipp +216 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/network_v6.hpp +53 -0
- data/ext/third_party/asio/asio/include/asio/ip/impl/network_v6.ipp +185 -0
- data/ext/third_party/asio/asio/include/asio/ip/multicast.hpp +191 -0
- data/ext/third_party/asio/asio/include/asio/ip/network_v4.hpp +261 -0
- data/ext/third_party/asio/asio/include/asio/ip/network_v6.hpp +235 -0
- data/ext/third_party/asio/asio/include/asio/ip/resolver_base.hpp +129 -0
- data/ext/third_party/asio/asio/include/asio/ip/resolver_query_base.hpp +43 -0
- data/ext/third_party/asio/asio/include/asio/ip/tcp.hpp +155 -0
- data/ext/third_party/asio/asio/include/asio/ip/udp.hpp +111 -0
- data/ext/third_party/asio/asio/include/asio/ip/unicast.hpp +70 -0
- data/ext/third_party/asio/asio/include/asio/ip/v6_only.hpp +69 -0
- data/ext/third_party/asio/asio/include/asio/is_executor.hpp +46 -0
- data/ext/third_party/asio/asio/include/asio/is_read_buffered.hpp +59 -0
- data/ext/third_party/asio/asio/include/asio/is_write_buffered.hpp +59 -0
- data/ext/third_party/asio/asio/include/asio/local/basic_endpoint.hpp +247 -0
- data/ext/third_party/asio/asio/include/asio/local/connect_pair.hpp +101 -0
- data/ext/third_party/asio/asio/include/asio/local/datagram_protocol.hpp +80 -0
- data/ext/third_party/asio/asio/include/asio/local/detail/endpoint.hpp +139 -0
- data/ext/third_party/asio/asio/include/asio/local/detail/impl/endpoint.ipp +136 -0
- data/ext/third_party/asio/asio/include/asio/local/stream_protocol.hpp +90 -0
- data/ext/third_party/asio/asio/include/asio/packaged_task.hpp +126 -0
- data/ext/third_party/asio/asio/include/asio/placeholders.hpp +151 -0
- data/ext/third_party/asio/asio/include/asio/posix/basic_descriptor.hpp +697 -0
- data/ext/third_party/asio/asio/include/asio/posix/basic_stream_descriptor.hpp +470 -0
- data/ext/third_party/asio/asio/include/asio/posix/descriptor.hpp +37 -0
- data/ext/third_party/asio/asio/include/asio/posix/descriptor_base.hpp +90 -0
- data/ext/third_party/asio/asio/include/asio/posix/stream_descriptor.hpp +37 -0
- data/ext/third_party/asio/asio/include/asio/post.hpp +123 -0
- data/ext/third_party/asio/asio/include/asio/read.hpp +1288 -0
- data/ext/third_party/asio/asio/include/asio/read_at.hpp +694 -0
- data/ext/third_party/asio/asio/include/asio/read_until.hpp +2863 -0
- data/ext/third_party/asio/asio/include/asio/redirect_error.hpp +66 -0
- data/ext/third_party/asio/asio/include/asio/serial_port.hpp +36 -0
- data/ext/third_party/asio/asio/include/asio/serial_port_base.hpp +167 -0
- data/ext/third_party/asio/asio/include/asio/signal_set.hpp +28 -0
- data/ext/third_party/asio/asio/include/asio/socket_base.hpp +559 -0
- data/ext/third_party/asio/asio/include/asio/spawn.hpp +336 -0
- data/ext/third_party/asio/asio/include/asio/ssl.hpp +28 -0
- data/ext/third_party/asio/asio/include/asio/ssl/context.hpp +761 -0
- data/ext/third_party/asio/asio/include/asio/ssl/context_base.hpp +209 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/buffered_handshake_op.hpp +114 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/engine.hpp +160 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/handshake_op.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/impl/engine.ipp +336 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp +165 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/io.hpp +381 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/openssl_init.hpp +101 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/openssl_types.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/password_callback.hpp +66 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/read_op.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/shutdown_op.hpp +64 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/stream_core.hpp +135 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/verify_callback.hpp +62 -0
- data/ext/third_party/asio/asio/include/asio/ssl/detail/write_op.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ssl/error.hpp +125 -0
- data/ext/third_party/asio/asio/include/asio/ssl/host_name_verification.hpp +90 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/context.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/context.ipp +1238 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/error.ipp +102 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/host_name_verification.ipp +73 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/rfc2818_verification.ipp +164 -0
- data/ext/third_party/asio/asio/include/asio/ssl/impl/src.hpp +29 -0
- data/ext/third_party/asio/asio/include/asio/ssl/rfc2818_verification.hpp +98 -0
- data/ext/third_party/asio/asio/include/asio/ssl/stream.hpp +885 -0
- data/ext/third_party/asio/asio/include/asio/ssl/stream_base.hpp +52 -0
- data/ext/third_party/asio/asio/include/asio/ssl/verify_context.hpp +67 -0
- data/ext/third_party/asio/asio/include/asio/ssl/verify_mode.hpp +63 -0
- data/ext/third_party/asio/asio/include/asio/steady_timer.hpp +42 -0
- data/ext/third_party/asio/asio/include/asio/strand.hpp +314 -0
- data/ext/third_party/asio/asio/include/asio/streambuf.hpp +33 -0
- data/ext/third_party/asio/asio/include/asio/system_context.hpp +81 -0
- data/ext/third_party/asio/asio/include/asio/system_error.hpp +131 -0
- data/ext/third_party/asio/asio/include/asio/system_executor.hpp +129 -0
- data/ext/third_party/asio/asio/include/asio/system_timer.hpp +42 -0
- data/ext/third_party/asio/asio/include/asio/this_coro.hpp +45 -0
- data/ext/third_party/asio/asio/include/asio/thread.hpp +92 -0
- data/ext/third_party/asio/asio/include/asio/thread_pool.hpp +235 -0
- data/ext/third_party/asio/asio/include/asio/time_traits.hpp +86 -0
- data/ext/third_party/asio/asio/include/asio/ts/buffer.hpp +24 -0
- data/ext/third_party/asio/asio/include/asio/ts/executor.hpp +34 -0
- data/ext/third_party/asio/asio/include/asio/ts/internet.hpp +40 -0
- data/ext/third_party/asio/asio/include/asio/ts/io_context.hpp +20 -0
- data/ext/third_party/asio/asio/include/asio/ts/net.hpp +26 -0
- data/ext/third_party/asio/asio/include/asio/ts/netfwd.hpp +203 -0
- data/ext/third_party/asio/asio/include/asio/ts/socket.hpp +27 -0
- data/ext/third_party/asio/asio/include/asio/ts/timer.hpp +26 -0
- data/ext/third_party/asio/asio/include/asio/unyield.hpp +21 -0
- data/ext/third_party/asio/asio/include/asio/use_awaitable.hpp +110 -0
- data/ext/third_party/asio/asio/include/asio/use_future.hpp +160 -0
- data/ext/third_party/asio/asio/include/asio/uses_executor.hpp +71 -0
- data/ext/third_party/asio/asio/include/asio/version.hpp +23 -0
- data/ext/third_party/asio/asio/include/asio/wait_traits.hpp +56 -0
- data/ext/third_party/asio/asio/include/asio/windows/basic_object_handle.hpp +435 -0
- data/ext/third_party/asio/asio/include/asio/windows/basic_overlapped_handle.hpp +361 -0
- data/ext/third_party/asio/asio/include/asio/windows/basic_random_access_handle.hpp +490 -0
- data/ext/third_party/asio/asio/include/asio/windows/basic_stream_handle.hpp +474 -0
- data/ext/third_party/asio/asio/include/asio/windows/object_handle.hpp +38 -0
- data/ext/third_party/asio/asio/include/asio/windows/overlapped_handle.hpp +39 -0
- data/ext/third_party/asio/asio/include/asio/windows/overlapped_ptr.hpp +143 -0
- data/ext/third_party/asio/asio/include/asio/windows/random_access_handle.hpp +37 -0
- data/ext/third_party/asio/asio/include/asio/windows/stream_handle.hpp +37 -0
- data/ext/third_party/asio/asio/include/asio/write.hpp +1246 -0
- data/ext/third_party/asio/asio/include/asio/write_at.hpp +702 -0
- data/ext/third_party/asio/asio/include/asio/yield.hpp +23 -0
- data/ext/third_party/asio/asio/release.pl +440 -0
- data/ext/third_party/asio/asio/src/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/Makefile.am +23 -0
- data/ext/third_party/asio/asio/src/Makefile.mgw +204 -0
- data/ext/third_party/asio/asio/src/Makefile.msc +497 -0
- data/ext/third_party/asio/asio/src/asio.cpp +11 -0
- data/ext/third_party/asio/asio/src/asio_ssl.cpp +11 -0
- data/ext/third_party/asio/asio/src/doc/.gitignore +5 -0
- data/ext/third_party/asio/asio/src/doc/Jamfile.v2 +62 -0
- data/ext/third_party/asio/asio/src/doc/asio.png +0 -0
- data/ext/third_party/asio/asio/src/doc/asio.qbk +127 -0
- data/ext/third_party/asio/asio/src/doc/asioref.sty +90 -0
- data/ext/third_party/asio/asio/src/doc/asioref.xsl +94 -0
- data/ext/third_party/asio/asio/src/doc/boost_bind_dox.txt +5 -0
- data/ext/third_party/asio/asio/src/doc/doxy2qbk.pl +22 -0
- data/ext/third_party/asio/asio/src/doc/examples.qbk +564 -0
- data/ext/third_party/asio/asio/src/doc/history.qbk +1794 -0
- data/ext/third_party/asio/asio/src/doc/index.xml +13 -0
- data/ext/third_party/asio/asio/src/doc/makepdf.pl +26 -0
- data/ext/third_party/asio/asio/src/doc/net_ts.qbk +479 -0
- data/ext/third_party/asio/asio/src/doc/noncopyable_dox.txt +3 -0
- data/ext/third_party/asio/asio/src/doc/overview.qbk +103 -0
- data/ext/third_party/asio/asio/src/doc/overview/allocation.qbk +89 -0
- data/ext/third_party/asio/asio/src/doc/overview/async.qbk +185 -0
- data/ext/third_party/asio/asio/src/doc/overview/async_op1.dot +78 -0
- data/ext/third_party/asio/asio/src/doc/overview/async_op1.png +0 -0
- data/ext/third_party/asio/asio/src/doc/overview/async_op2.dot +78 -0
- data/ext/third_party/asio/asio/src/doc/overview/async_op2.png +0 -0
- data/ext/third_party/asio/asio/src/doc/overview/basics.qbk +106 -0
- data/ext/third_party/asio/asio/src/doc/overview/bsd_sockets.qbk +270 -0
- data/ext/third_party/asio/asio/src/doc/overview/buffers.qbk +163 -0
- data/ext/third_party/asio/asio/src/doc/overview/concurrency_hint.qbk +88 -0
- data/ext/third_party/asio/asio/src/doc/overview/coroutine.qbk +51 -0
- data/ext/third_party/asio/asio/src/doc/overview/coroutines_ts.qbk +97 -0
- data/ext/third_party/asio/asio/src/doc/overview/cpp2011.qbk +271 -0
- data/ext/third_party/asio/asio/src/doc/overview/handler_tracking.qbk +220 -0
- data/ext/third_party/asio/asio/src/doc/overview/implementation.qbk +305 -0
- data/ext/third_party/asio/asio/src/doc/overview/iostreams.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/overview/line_based.qbk +118 -0
- data/ext/third_party/asio/asio/src/doc/overview/other_protocols.qbk +94 -0
- data/ext/third_party/asio/asio/src/doc/overview/posix.qbk +152 -0
- data/ext/third_party/asio/asio/src/doc/overview/proactor.dot +100 -0
- data/ext/third_party/asio/asio/src/doc/overview/proactor.png +0 -0
- data/ext/third_party/asio/asio/src/doc/overview/protocols.qbk +149 -0
- data/ext/third_party/asio/asio/src/doc/overview/rationale.qbk +54 -0
- data/ext/third_party/asio/asio/src/doc/overview/reactor.qbk +44 -0
- data/ext/third_party/asio/asio/src/doc/overview/serial_ports.qbk +45 -0
- data/ext/third_party/asio/asio/src/doc/overview/signals.qbk +44 -0
- data/ext/third_party/asio/asio/src/doc/overview/spawn.qbk +102 -0
- data/ext/third_party/asio/asio/src/doc/overview/ssl.qbk +124 -0
- data/ext/third_party/asio/asio/src/doc/overview/strands.qbk +114 -0
- data/ext/third_party/asio/asio/src/doc/overview/streams.qbk +62 -0
- data/ext/third_party/asio/asio/src/doc/overview/sync_op.dot +67 -0
- data/ext/third_party/asio/asio/src/doc/overview/sync_op.png +0 -0
- data/ext/third_party/asio/asio/src/doc/overview/threads.qbk +67 -0
- data/ext/third_party/asio/asio/src/doc/overview/timers.qbk +52 -0
- data/ext/third_party/asio/asio/src/doc/overview/windows.qbk +126 -0
- data/ext/third_party/asio/asio/src/doc/project-root.jam +1 -0
- data/ext/third_party/asio/asio/src/doc/quickref.xml +561 -0
- data/ext/third_party/asio/asio/src/doc/reference.dox +264 -0
- data/ext/third_party/asio/asio/src/doc/reference.qbk +125973 -0
- data/ext/third_party/asio/asio/src/doc/reference.xsl +1831 -0
- data/ext/third_party/asio/asio/src/doc/release_checklist.htm +68 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AcceptHandler.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AcceptableProtocol.qbk +25 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessReadDevice.qbk +56 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessWriteDevice.qbk +57 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AsyncReadStream.qbk +50 -0
- data/ext/third_party/asio/asio/src/doc/requirements/AsyncWriteStream.qbk +48 -0
- data/ext/third_party/asio/asio/src/doc/requirements/BufferedHandshakeHandler.qbk +55 -0
- data/ext/third_party/asio/asio/src/doc/requirements/CompletionCondition.qbk +42 -0
- data/ext/third_party/asio/asio/src/doc/requirements/CompletionHandler.qbk +63 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ConnectCondition.qbk +34 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ConnectHandler.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ConstBufferSequence.qbk +53 -0
- data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer.qbk +16 -0
- data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v1.qbk +93 -0
- data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v2.qbk +94 -0
- data/ext/third_party/asio/asio/src/doc/requirements/Endpoint.qbk +97 -0
- data/ext/third_party/asio/asio/src/doc/requirements/EndpointSequence.qbk +30 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ExecutionContext.qbk +36 -0
- data/ext/third_party/asio/asio/src/doc/requirements/Executor.qbk +141 -0
- data/ext/third_party/asio/asio/src/doc/requirements/GettableSerialPortOption.qbk +33 -0
- data/ext/third_party/asio/asio/src/doc/requirements/GettableSocketOption.qbk +67 -0
- data/ext/third_party/asio/asio/src/doc/requirements/Handler.qbk +64 -0
- data/ext/third_party/asio/asio/src/doc/requirements/HandshakeHandler.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/InternetProtocol.qbk +47 -0
- data/ext/third_party/asio/asio/src/doc/requirements/IoControlCommand.qbk +34 -0
- data/ext/third_party/asio/asio/src/doc/requirements/IoObjectService.qbk +62 -0
- data/ext/third_party/asio/asio/src/doc/requirements/IteratorConnectHandler.qbk +81 -0
- data/ext/third_party/asio/asio/src/doc/requirements/LegacyCompletionHandler.qbk +65 -0
- data/ext/third_party/asio/asio/src/doc/requirements/MoveAcceptHandler.qbk +61 -0
- data/ext/third_party/asio/asio/src/doc/requirements/MutableBufferSequence.qbk +54 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ProtoAllocator.qbk +19 -0
- data/ext/third_party/asio/asio/src/doc/requirements/Protocol.qbk +56 -0
- data/ext/third_party/asio/asio/src/doc/requirements/RangeConnectHandler.qbk +82 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ReadHandler.qbk +79 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ResolveHandler.qbk +82 -0
- data/ext/third_party/asio/asio/src/doc/requirements/Service.qbk +40 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SettableSerialPortOption.qbk +33 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SettableSocketOption.qbk +54 -0
- data/ext/third_party/asio/asio/src/doc/requirements/ShutdownHandler.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SignalHandler.qbk +79 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessReadDevice.qbk +49 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessWriteDevice.qbk +49 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SyncReadStream.qbk +41 -0
- data/ext/third_party/asio/asio/src/doc/requirements/SyncWriteStream.qbk +39 -0
- data/ext/third_party/asio/asio/src/doc/requirements/TimeTraits.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/WaitHandler.qbk +72 -0
- data/ext/third_party/asio/asio/src/doc/requirements/WaitTraits.qbk +52 -0
- data/ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk +79 -0
- data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_operations.qbk +300 -0
- data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_socket_operations.qbk +39 -0
- data/ext/third_party/asio/asio/src/doc/requirements/read_write_operations.qbk +34 -0
- data/ext/third_party/asio/asio/src/doc/requirements/synchronous_socket_operations.qbk +37 -0
- data/ext/third_party/asio/asio/src/doc/std_exception_dox.txt +7 -0
- data/ext/third_party/asio/asio/src/doc/tutorial.dox +226 -0
- data/ext/third_party/asio/asio/src/doc/tutorial.qbk +2387 -0
- data/ext/third_party/asio/asio/src/doc/tutorial.xsl +437 -0
- data/ext/third_party/asio/asio/src/doc/using.qbk +309 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/Makefile.am +251 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/allocation/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/allocation/server.cpp +285 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/buffers/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/buffers/reference_counted.cpp +131 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/chat/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_client.cpp +177 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_message.hpp +93 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_server.cpp +249 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/chat/posix_chat_client.cpp +204 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp +137 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp +92 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp +59 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp +79 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp +59 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp +53 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/fork/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/fork/daemon.cpp +190 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/fork/process_per_connection.cpp +161 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/client/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/client/async_client.cpp +204 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/client/sync_client.cpp +106 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_1K.html +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_2K.html +49 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_4K.html +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_8K.html +175 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection.cpp +99 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection.hpp +83 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection_manager.cpp +38 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection_manager.hpp +44 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/header.hpp +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/main.cpp +44 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/mime_types.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/mime_types.hpp +27 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/reply.cpp +256 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/reply.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request.hpp +34 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_handler.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_handler.hpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_parser.cpp +315 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_parser.hpp +95 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/server.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server/server.hpp +69 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/connection.cpp +93 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/connection.hpp +75 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/header.hpp +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/io_context_pool.cpp +69 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/io_context_pool.hpp +58 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/main.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/mime_types.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/mime_types.hpp +27 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/reply.cpp +256 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/reply.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request.hpp +34 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_handler.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_handler.hpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_parser.cpp +315 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_parser.hpp +95 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/server.cpp +77 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/server.hpp +68 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/connection.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/connection.hpp +78 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/header.hpp +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/main.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/mime_types.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/mime_types.hpp +27 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/reply.cpp +256 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/reply.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request.hpp +34 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_handler.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_handler.hpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_parser.cpp +315 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_parser.hpp +95 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/server.cpp +89 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/server.hpp +70 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/file_handler.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/file_handler.hpp +44 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/header.hpp +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/main.cpp +58 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/mime_types.cpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/mime_types.hpp +27 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/reply.cpp +256 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/reply.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request.hpp +46 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request_parser.cpp +226 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request_parser.hpp +78 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/server.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/server.hpp +73 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/icmp/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/icmp/icmp_header.hpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/icmp/ipv4_header.hpp +102 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/icmp/ping.cpp +163 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/invocation/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp +171 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/daytime_client.cpp +44 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/daytime_server.cpp +51 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/http_client.cpp +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/local/.gitignore +13 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/local/connect_pair.cpp +141 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/local/iostream_client.cpp +62 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/local/stream_client.cpp +61 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/local/stream_server.cpp +141 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/multicast/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/multicast/receiver.cpp +93 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/multicast/sender.cpp +98 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/nonblocking/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp +240 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/client.cpp +192 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/protocol.hpp +156 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/server.cpp +187 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/serialization/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/serialization/client.cpp +125 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/serialization/connection.hpp +188 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/serialization/server.cpp +123 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/serialization/stock.hpp +50 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/basic_logger.hpp +83 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/daytime_client.cpp +97 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/logger.hpp +24 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/logger_service.cpp +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/services/logger_service.hpp +145 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/socks4/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/socks4/socks4.hpp +144 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/socks4/sync_client.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/spawn/.gitignore +12 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/spawn/echo_server.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/spawn/parallel_grep.cpp +89 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/README +8 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/ca.pem +49 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/client.cpp +157 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/dh2048.pem +8 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/server.cpp +170 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/ssl/server.pem +71 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp +311 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp +191 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_token_tcp_client.cpp +200 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp +154 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/server.cpp +433 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timers/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/timers/time_t_timer.cpp +106 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime1/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime1/client.cpp +57 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime2/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime2/server.cpp +50 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime3/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime3/server.cpp +119 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime4/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime4/client.cpp +52 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime5/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime5/server.cpp +53 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime6/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime6/server.cpp +89 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime7/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime7/server.cpp +160 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime_dox.txt +500 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/index_dox.txt +48 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer1/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer1/timer.cpp +24 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer2/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer2/timer.cpp +29 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer3/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer3/timer.cpp +43 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer4/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer4/timer.cpp +54 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer5/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer5/timer.cpp +80 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer_dox.txt +378 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/windows/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp03/windows/transmit_file.cpp +177 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/Makefile.am +161 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/allocation/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/allocation/server.cpp +255 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/buffers/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/buffers/reference_counted.cpp +122 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/chat/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_client.cpp +167 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_message.hpp +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_server.cpp +227 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp +114 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp +82 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp +55 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp +74 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp +58 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp +52 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/.gitignore +5 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/actor.cpp +286 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/bank_account_1.cpp +54 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/bank_account_2.cpp +54 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/fork_join.cpp +328 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/pipeline.cpp +299 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/executors/priority_scheduler.cpp +174 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/fork/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/fork/daemon.cpp +189 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/fork/process_per_connection.cpp +162 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/futures/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/futures/daytime_client.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/handler_tracking/custom_tracking.hpp +201 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection.hpp +79 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection_manager.cpp +40 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection_manager.hpp +48 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/header.hpp +28 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/main.cpp +43 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/mime_types.cpp +45 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/mime_types.hpp +27 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/reply.cpp +255 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/reply.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request.hpp +34 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_handler.cpp +121 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_handler.hpp +47 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_parser.cpp +315 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_parser.hpp +96 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/server.cpp +94 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/http/server/server.hpp +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/invocation/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/invocation/prioritised_handlers.cpp +202 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/iostreams/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/iostreams/http_client.cpp +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/local/.gitignore +13 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/local/connect_pair.cpp +129 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/local/iostream_client.cpp +61 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/local/stream_client.cpp +60 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/local/stream_server.cpp +121 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/multicast/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/multicast/receiver.cpp +88 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/multicast/sender.cpp +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/nonblocking/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/nonblocking/third_party_lib.cpp +212 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_1.cpp +113 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_2.cpp +131 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_3.cpp +192 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_4.cpp +207 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_5.cpp +243 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_6.cpp +302 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_7.cpp +222 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_8.cpp +217 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/socks4/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/socks4/socks4.hpp +143 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/socks4/sync_client.cpp +93 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/spawn/.gitignore +12 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/spawn/echo_server.cpp +111 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/spawn/parallel_grep.cpp +84 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/README +8 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/ca.pem +49 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/client.cpp +165 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/dh2048.pem +8 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/server.cpp +143 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/ssl/server.pem +71 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp +311 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp +192 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp +197 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp +155 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/server.cpp +433 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timers/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp11/timers/time_t_timer.cpp +106 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/Makefile.am +64 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp +117 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp +83 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp +55 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp +77 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp +59 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp +53 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/.gitignore +6 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/actor.cpp +281 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/async_1.cpp +47 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/async_2.cpp +68 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/bank_account_1.cpp +54 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/bank_account_2.cpp +53 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/fork_join.cpp +327 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/pipeline.cpp +294 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/executors/priority_scheduler.cpp +173 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/iostreams/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/iostreams/http_client.cpp +91 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/.gitignore +10 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_1.cpp +113 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_2.cpp +131 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_3.cpp +186 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_4.cpp +201 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_5.cpp +238 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_6.cpp +298 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_7.cpp +219 -0
- data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_8.cpp +212 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/Makefile.am +8 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/chat_server.cpp +225 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/echo_server.cpp +76 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/echo_server_with_default.cpp +78 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/range_based_for.cpp +107 -0
- data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/refactored_echo_server.cpp +85 -0
- data/ext/third_party/asio/asio/src/tests/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/tests/Makefile.am +432 -0
- data/ext/third_party/asio/asio/src/tests/latency/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/tests/latency/allocator.hpp +52 -0
- data/ext/third_party/asio/asio/src/tests/latency/high_res_clock.hpp +53 -0
- data/ext/third_party/asio/asio/src/tests/latency/tcp_client.cpp +124 -0
- data/ext/third_party/asio/asio/src/tests/latency/tcp_server.cpp +114 -0
- data/ext/third_party/asio/asio/src/tests/latency/udp_client.cpp +104 -0
- data/ext/third_party/asio/asio/src/tests/latency/udp_server.cpp +125 -0
- data/ext/third_party/asio/asio/src/tests/performance/.gitignore +11 -0
- data/ext/third_party/asio/asio/src/tests/performance/client.cpp +286 -0
- data/ext/third_party/asio/asio/src/tests/performance/handler_allocator.hpp +112 -0
- data/ext/third_party/asio/asio/src/tests/performance/server.cpp +233 -0
- data/ext/third_party/asio/asio/src/tests/unit/.gitignore +75 -0
- data/ext/third_party/asio/asio/src/tests/unit/archetypes/async_ops.hpp +415 -0
- data/ext/third_party/asio/asio/src/tests/unit/archetypes/async_result.hpp +94 -0
- data/ext/third_party/asio/asio/src/tests/unit/archetypes/gettable_socket_option.hpp +54 -0
- data/ext/third_party/asio/asio/src/tests/unit/archetypes/io_control_command.hpp +32 -0
- data/ext/third_party/asio/asio/src/tests/unit/archetypes/settable_socket_option.hpp +49 -0
- data/ext/third_party/asio/asio/src/tests/unit/associated_allocator.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/associated_executor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/async_result.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/awaitable.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_datagram_socket.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_deadline_timer.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_raw_socket.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_seq_packet_socket.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_serial_port.cpp +26 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_signal_set.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_socket.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_socket_acceptor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_stream_socket.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_streambuf.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/basic_waitable_timer.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/bind_executor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/buffer.cpp +830 -0
- data/ext/third_party/asio/asio/src/tests/unit/buffered_read_stream.cpp +338 -0
- data/ext/third_party/asio/asio/src/tests/unit/buffered_stream.cpp +364 -0
- data/ext/third_party/asio/asio/src/tests/unit/buffered_write_stream.cpp +353 -0
- data/ext/third_party/asio/asio/src/tests/unit/buffers_iterator.cpp +292 -0
- data/ext/third_party/asio/asio/src/tests/unit/co_spawn.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/completion_condition.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/compose.cpp +185 -0
- data/ext/third_party/asio/asio/src/tests/unit/connect.cpp +1190 -0
- data/ext/third_party/asio/asio/src/tests/unit/coroutine.cpp +112 -0
- data/ext/third_party/asio/asio/src/tests/unit/deadline_timer.cpp +392 -0
- data/ext/third_party/asio/asio/src/tests/unit/defer.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/detached.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/dispatch.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/error.cpp +89 -0
- data/ext/third_party/asio/asio/src/tests/unit/execution_context.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/executor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/executor_work_guard.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/.gitignore +14 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/basic_endpoint.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/datagram_protocol.cpp +263 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/raw_protocol.cpp +263 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/seq_packet_protocol.cpp +205 -0
- data/ext/third_party/asio/asio/src/tests/unit/generic/stream_protocol.cpp +248 -0
- data/ext/third_party/asio/asio/src/tests/unit/high_resolution_timer.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/io_context.cpp +362 -0
- data/ext/third_party/asio/asio/src/tests/unit/io_context_strand.cpp +325 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/.gitignore +27 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/address.cpp +144 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/basic_endpoint.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_entry.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_iterator.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_query.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/host_name.cpp +55 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/icmp.cpp +577 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/multicast.cpp +363 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/network_v4.cpp +314 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/network_v6.cpp +238 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/resolver_query_base.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/tcp.cpp +1346 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/udp.cpp +673 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/unicast.cpp +171 -0
- data/ext/third_party/asio/asio/src/tests/unit/ip/v6_only.cpp +135 -0
- data/ext/third_party/asio/asio/src/tests/unit/is_read_buffered.cpp +129 -0
- data/ext/third_party/asio/asio/src/tests/unit/is_write_buffered.cpp +129 -0
- data/ext/third_party/asio/asio/src/tests/unit/local/.gitignore +13 -0
- data/ext/third_party/asio/asio/src/tests/unit/local/basic_endpoint.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/local/connect_pair.cpp +76 -0
- data/ext/third_party/asio/asio/src/tests/unit/local/datagram_protocol.cpp +242 -0
- data/ext/third_party/asio/asio/src/tests/unit/local/stream_protocol.cpp +219 -0
- data/ext/third_party/asio/asio/src/tests/unit/packaged_task.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/placeholders.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/.gitignore +14 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/basic_descriptor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/basic_stream_descriptor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/descriptor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/descriptor_base.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/posix/stream_descriptor.cpp +183 -0
- data/ext/third_party/asio/asio/src/tests/unit/post.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/read.cpp +4997 -0
- data/ext/third_party/asio/asio/src/tests/unit/read_at.cpp +7502 -0
- data/ext/third_party/asio/asio/src/tests/unit/read_until.cpp +1658 -0
- data/ext/third_party/asio/asio/src/tests/unit/redirect_error.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/serial_port.cpp +173 -0
- data/ext/third_party/asio/asio/src/tests/unit/serial_port_base.cpp +99 -0
- data/ext/third_party/asio/asio/src/tests/unit/signal_set.cpp +95 -0
- data/ext/third_party/asio/asio/src/tests/unit/socket_base.cpp +650 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/.gitignore +15 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/context.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/context_base.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/error.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/host_name_verification.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/rfc2818_verification.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/stream.cpp +191 -0
- data/ext/third_party/asio/asio/src/tests/unit/ssl/stream_base.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/steady_timer.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/strand.cpp +263 -0
- data/ext/third_party/asio/asio/src/tests/unit/streambuf.cpp +62 -0
- data/ext/third_party/asio/asio/src/tests/unit/system_context.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/system_executor.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/system_timer.cpp +399 -0
- data/ext/third_party/asio/asio/src/tests/unit/this_coro.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/thread.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/time_traits.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/.gitignore +17 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/buffer.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/executor.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/internet.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/io_context.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/net.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/netfwd.cpp +33 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/socket.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/ts/timer.cpp +30 -0
- data/ext/third_party/asio/asio/src/tests/unit/unit_test.hpp +175 -0
- data/ext/third_party/asio/asio/src/tests/unit/use_awaitable.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/use_future.cpp +670 -0
- data/ext/third_party/asio/asio/src/tests/unit/uses_executor.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/wait_traits.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/.gitignore +18 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/basic_object_handle.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/basic_overlapped_handle.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/basic_random_access_handle.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/basic_stream_handle.cpp +25 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/object_handle.cpp +130 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/overlapped_handle.cpp +26 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/overlapped_ptr.cpp +107 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/random_access_handle.cpp +155 -0
- data/ext/third_party/asio/asio/src/tests/unit/windows/stream_handle.cpp +148 -0
- data/ext/third_party/asio/asio/src/tests/unit/write.cpp +4904 -0
- data/ext/third_party/asio/asio/src/tests/unit/write_at.cpp +7563 -0
- data/ext/third_party/asio/asio/src/tools/handlerviz.pl +299 -0
- data/ext/third_party/asio/asio/tsify.pl +574 -0
- data/ext/third_party/gsl/.clang-format +34 -0
- data/ext/third_party/gsl/.github/workflows/main.yml +94 -0
- data/ext/third_party/gsl/.gitignore +16 -0
- data/ext/third_party/gsl/.travis.yml +551 -0
- data/ext/third_party/gsl/CMakeLists.txt +119 -0
- data/ext/third_party/gsl/CMakeSettings.json +18 -0
- data/ext/third_party/gsl/CONTRIBUTING.md +29 -0
- data/ext/third_party/gsl/GSL.natvis +98 -0
- data/ext/third_party/gsl/LICENSE +21 -0
- data/ext/third_party/gsl/README.md +124 -0
- data/ext/third_party/gsl/ThirdPartyNotices.txt +41 -0
- data/ext/third_party/gsl/appveyor.yml +128 -0
- data/ext/third_party/gsl/include/gsl/gsl +29 -0
- data/ext/third_party/gsl/include/gsl/gsl_algorithm +61 -0
- data/ext/third_party/gsl/include/gsl/gsl_assert +133 -0
- data/ext/third_party/gsl/include/gsl/gsl_byte +209 -0
- data/ext/third_party/gsl/include/gsl/gsl_util +171 -0
- data/ext/third_party/gsl/include/gsl/multi_span +2273 -0
- data/ext/third_party/gsl/include/gsl/pointers +301 -0
- data/ext/third_party/gsl/include/gsl/span +764 -0
- data/ext/third_party/gsl/include/gsl/span_ext +198 -0
- data/ext/third_party/gsl/include/gsl/string_span +716 -0
- data/ext/third_party/gsl/tests/CMakeLists.txt +267 -0
- data/ext/third_party/gsl/tests/CMakeLists.txt.in +14 -0
- data/ext/third_party/gsl/tests/algorithm_tests.cpp +227 -0
- data/ext/third_party/gsl/tests/assertion_tests.cpp +61 -0
- data/ext/third_party/gsl/tests/at_tests.cpp +135 -0
- data/ext/third_party/gsl/tests/bounds_tests.cpp +102 -0
- data/ext/third_party/gsl/tests/byte_tests.cpp +129 -0
- data/ext/third_party/gsl/tests/multi_span_tests.cpp +1866 -0
- data/ext/third_party/gsl/tests/no_exception_ensure_tests.cpp +48 -0
- data/ext/third_party/gsl/tests/notnull_tests.cpp +535 -0
- data/ext/third_party/gsl/tests/owner_tests.cpp +43 -0
- data/ext/third_party/gsl/tests/span_compatibility_tests.cpp +1021 -0
- data/ext/third_party/gsl/tests/span_ext_tests.cpp +360 -0
- data/ext/third_party/gsl/tests/span_tests.cpp +1244 -0
- data/ext/third_party/gsl/tests/strict_notnull_tests.cpp +190 -0
- data/ext/third_party/gsl/tests/strided_span_tests.cpp +790 -0
- data/ext/third_party/gsl/tests/string_span_tests.cpp +1217 -0
- data/ext/third_party/gsl/tests/utils_tests.cpp +129 -0
- data/ext/third_party/http_parser/.gitignore +30 -0
- data/ext/third_party/http_parser/.mailmap +8 -0
- data/ext/third_party/http_parser/.travis.yml +13 -0
- data/ext/third_party/http_parser/AUTHORS +68 -0
- data/ext/third_party/http_parser/LICENSE-MIT +19 -0
- data/ext/third_party/http_parser/README.md +246 -0
- data/ext/third_party/http_parser/bench.c +128 -0
- data/ext/third_party/http_parser/contrib/parsertrace.c +157 -0
- data/ext/third_party/http_parser/contrib/url_parser.c +47 -0
- data/ext/third_party/http_parser/fuzzers/fuzz_parser.c +26 -0
- data/ext/third_party/http_parser/fuzzers/fuzz_url.c +14 -0
- data/ext/third_party/http_parser/http_parser.c +2568 -0
- data/ext/third_party/http_parser/http_parser.gyp +111 -0
- data/ext/third_party/http_parser/http_parser.h +447 -0
- data/ext/third_party/http_parser/test.c +4600 -0
- data/ext/third_party/json/.appveyor.yml +44 -0
- data/ext/third_party/json/.clang-format +84 -0
- data/ext/third_party/json/.conan/build.py +80 -0
- data/ext/third_party/json/.conan/test_package/CMakeLists.txt +12 -0
- data/ext/third_party/json/.conan/test_package/conanfile.py +24 -0
- data/ext/third_party/json/.conan/test_package/test_package.cpp +16 -0
- data/ext/third_party/json/.gitignore +3 -0
- data/ext/third_party/json/.travis.yml +173 -0
- data/ext/third_party/json/CMakeLists.txt +44 -0
- data/ext/third_party/json/LICENSE +21 -0
- data/ext/third_party/json/LICENSE.double-conversion +32 -0
- data/ext/third_party/json/LICENSE.itoa +19 -0
- data/ext/third_party/json/LICENSE.ryu +201 -0
- data/ext/third_party/json/README.md +149 -0
- data/ext/third_party/json/conanfile.py +28 -0
- data/ext/third_party/json/contrib/nlohmann.cpp +48 -0
- data/ext/third_party/json/contrib/nlohmann/from_value.hpp +62 -0
- data/ext/third_party/json/contrib/nlohmann/json.hpp +18928 -0
- data/ext/third_party/json/contrib/nlohmann/to_value.hpp +109 -0
- data/ext/third_party/json/doc/Advanced-Use-Cases.md +83 -0
- data/ext/third_party/json/doc/Batteries-Included.md +212 -0
- data/ext/third_party/json/doc/Binding-Traits.md +319 -0
- data/ext/third_party/json/doc/Changelog.md +31 -0
- data/ext/third_party/json/doc/Common-Use-Cases.md +148 -0
- data/ext/third_party/json/doc/Design-Decisions.md +36 -0
- data/ext/third_party/json/doc/Events-Interface.md +140 -0
- data/ext/third_party/json/doc/Getting-Started.md +19 -0
- data/ext/third_party/json/doc/Instance-Sharing.md +163 -0
- data/ext/third_party/json/doc/Interoperability.md +75 -0
- data/ext/third_party/json/doc/Overview.md +24 -0
- data/ext/third_party/json/doc/Overview.png +0 -0
- data/ext/third_party/json/doc/Parser-Interface.md +84 -0
- data/ext/third_party/json/doc/README.md +78 -0
- data/ext/third_party/json/doc/Scratchpad.md +25 -0
- data/ext/third_party/json/doc/Type-Traits.md +364 -0
- data/ext/third_party/json/doc/Types.png +0 -0
- data/ext/third_party/json/doc/Value-Class.md +525 -0
- data/ext/third_party/json/include/tao/json.hpp +45 -0
- data/ext/third_party/json/include/tao/json/basic_value.hpp +941 -0
- data/ext/third_party/json/include/tao/json/binary.hpp +103 -0
- data/ext/third_party/json/include/tao/json/binary_view.hpp +31 -0
- data/ext/third_party/json/include/tao/json/binding.hpp +71 -0
- data/ext/third_party/json/include/tao/json/binding/constant.hpp +232 -0
- data/ext/third_party/json/include/tao/json/binding/element.hpp +182 -0
- data/ext/third_party/json/include/tao/json/binding/factory.hpp +250 -0
- data/ext/third_party/json/include/tao/json/binding/for_nothing_value.hpp +17 -0
- data/ext/third_party/json/include/tao/json/binding/for_unknown_key.hpp +17 -0
- data/ext/third_party/json/include/tao/json/binding/inherit.hpp +14 -0
- data/ext/third_party/json/include/tao/json/binding/internal/array.hpp +103 -0
- data/ext/third_party/json/include/tao/json/binding/internal/inherit.hpp +45 -0
- data/ext/third_party/json/include/tao/json/binding/internal/object.hpp +267 -0
- data/ext/third_party/json/include/tao/json/binding/internal/type_key.hpp +54 -0
- data/ext/third_party/json/include/tao/json/binding/member.hpp +32 -0
- data/ext/third_party/json/include/tao/json/binding/member_kind.hpp +17 -0
- data/ext/third_party/json/include/tao/json/binding/versions.hpp +127 -0
- data/ext/third_party/json/include/tao/json/cbor.hpp +18 -0
- data/ext/third_party/json/include/tao/json/cbor/consume_file.hpp +34 -0
- data/ext/third_party/json/include/tao/json/cbor/consume_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/cbor/events/from_file.hpp +27 -0
- data/ext/third_party/json/include/tao/json/cbor/events/from_input.hpp +43 -0
- data/ext/third_party/json/include/tao/json/cbor/events/from_string.hpp +37 -0
- data/ext/third_party/json/include/tao/json/cbor/events/to_stream.hpp +161 -0
- data/ext/third_party/json/include/tao/json/cbor/events/to_string.hpp +31 -0
- data/ext/third_party/json/include/tao/json/cbor/from_file.hpp +33 -0
- data/ext/third_party/json/include/tao/json/cbor/from_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/cbor/from_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/cbor/internal/grammar.hpp +417 -0
- data/ext/third_party/json/include/tao/json/cbor/internal/major.hpp +28 -0
- data/ext/third_party/json/include/tao/json/cbor/parts_parser.hpp +392 -0
- data/ext/third_party/json/include/tao/json/cbor/to_stream.hpp +27 -0
- data/ext/third_party/json/include/tao/json/cbor/to_string.hpp +28 -0
- data/ext/third_party/json/include/tao/json/consume.hpp +43 -0
- data/ext/third_party/json/include/tao/json/consume_file.hpp +33 -0
- data/ext/third_party/json/include/tao/json/consume_string.hpp +31 -0
- data/ext/third_party/json/include/tao/json/contrib/array_traits.hpp +43 -0
- data/ext/third_party/json/include/tao/json/contrib/deque_traits.hpp +41 -0
- data/ext/third_party/json/include/tao/json/contrib/diff.hpp +106 -0
- data/ext/third_party/json/include/tao/json/contrib/get.hpp +152 -0
- data/ext/third_party/json/include/tao/json/contrib/internal/array_traits.hpp +92 -0
- data/ext/third_party/json/include/tao/json/contrib/internal/indirect_traits.hpp +69 -0
- data/ext/third_party/json/include/tao/json/contrib/internal/object_traits.hpp +105 -0
- data/ext/third_party/json/include/tao/json/contrib/internal/type_traits.hpp +36 -0
- data/ext/third_party/json/include/tao/json/contrib/list_traits.hpp +41 -0
- data/ext/third_party/json/include/tao/json/contrib/map_traits.hpp +43 -0
- data/ext/third_party/json/include/tao/json/contrib/multimap_traits.hpp +43 -0
- data/ext/third_party/json/include/tao/json/contrib/multiset_traits.hpp +41 -0
- data/ext/third_party/json/include/tao/json/contrib/pair_traits.hpp +21 -0
- data/ext/third_party/json/include/tao/json/contrib/patch.hpp +105 -0
- data/ext/third_party/json/include/tao/json/contrib/pointer_traits.hpp +59 -0
- data/ext/third_party/json/include/tao/json/contrib/position.hpp +166 -0
- data/ext/third_party/json/include/tao/json/contrib/reference.hpp +115 -0
- data/ext/third_party/json/include/tao/json/contrib/schema.hpp +1851 -0
- data/ext/third_party/json/include/tao/json/contrib/set_traits.hpp +41 -0
- data/ext/third_party/json/include/tao/json/contrib/shared_ptr_traits.hpp +90 -0
- data/ext/third_party/json/include/tao/json/contrib/traits.hpp +121 -0
- data/ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp +51 -0
- data/ext/third_party/json/include/tao/json/contrib/unique_ptr_traits.hpp +89 -0
- data/ext/third_party/json/include/tao/json/contrib/unordered_map_traits.hpp +43 -0
- data/ext/third_party/json/include/tao/json/contrib/unordered_set_traits.hpp +41 -0
- data/ext/third_party/json/include/tao/json/contrib/vector_bool_traits.hpp +45 -0
- data/ext/third_party/json/include/tao/json/contrib/vector_traits.hpp +51 -0
- data/ext/third_party/json/include/tao/json/events.hpp +47 -0
- data/ext/third_party/json/include/tao/json/events/apply.hpp +20 -0
- data/ext/third_party/json/include/tao/json/events/binary_to_base64.hpp +26 -0
- data/ext/third_party/json/include/tao/json/events/binary_to_base64url.hpp +28 -0
- data/ext/third_party/json/include/tao/json/events/binary_to_exception.hpp +27 -0
- data/ext/third_party/json/include/tao/json/events/binary_to_hex.hpp +26 -0
- data/ext/third_party/json/include/tao/json/events/compare.hpp +265 -0
- data/ext/third_party/json/include/tao/json/events/debug.hpp +145 -0
- data/ext/third_party/json/include/tao/json/events/discard.hpp +43 -0
- data/ext/third_party/json/include/tao/json/events/from_file.hpp +28 -0
- data/ext/third_party/json/include/tao/json/events/from_input.hpp +45 -0
- data/ext/third_party/json/include/tao/json/events/from_stream.hpp +33 -0
- data/ext/third_party/json/include/tao/json/events/from_string.hpp +38 -0
- data/ext/third_party/json/include/tao/json/events/from_value.hpp +202 -0
- data/ext/third_party/json/include/tao/json/events/hash.hpp +174 -0
- data/ext/third_party/json/include/tao/json/events/invalid_string_to_binary.hpp +50 -0
- data/ext/third_party/json/include/tao/json/events/invalid_string_to_exception.hpp +49 -0
- data/ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp +48 -0
- data/ext/third_party/json/include/tao/json/events/key_camel_case_to_snake_case.hpp +62 -0
- data/ext/third_party/json/include/tao/json/events/key_snake_case_to_camel_case.hpp +57 -0
- data/ext/third_party/json/include/tao/json/events/limit_nesting_depth.hpp +82 -0
- data/ext/third_party/json/include/tao/json/events/limit_value_count.hpp +46 -0
- data/ext/third_party/json/include/tao/json/events/non_finite_to_exception.hpp +31 -0
- data/ext/third_party/json/include/tao/json/events/non_finite_to_null.hpp +32 -0
- data/ext/third_party/json/include/tao/json/events/non_finite_to_string.hpp +40 -0
- data/ext/third_party/json/include/tao/json/events/prefer_signed.hpp +32 -0
- data/ext/third_party/json/include/tao/json/events/prefer_unsigned.hpp +32 -0
- data/ext/third_party/json/include/tao/json/events/produce.hpp +22 -0
- data/ext/third_party/json/include/tao/json/events/ref.hpp +111 -0
- data/ext/third_party/json/include/tao/json/events/statistics.hpp +112 -0
- data/ext/third_party/json/include/tao/json/events/tee.hpp +386 -0
- data/ext/third_party/json/include/tao/json/events/to_pretty_stream.hpp +172 -0
- data/ext/third_party/json/include/tao/json/events/to_stream.hpp +142 -0
- data/ext/third_party/json/include/tao/json/events/to_string.hpp +33 -0
- data/ext/third_party/json/include/tao/json/events/to_value.hpp +137 -0
- data/ext/third_party/json/include/tao/json/events/transformer.hpp +70 -0
- data/ext/third_party/json/include/tao/json/events/validate_event_order.hpp +411 -0
- data/ext/third_party/json/include/tao/json/events/validate_keys.hpp +51 -0
- data/ext/third_party/json/include/tao/json/events/virtual_base.hpp +192 -0
- data/ext/third_party/json/include/tao/json/events/virtual_ref.hpp +170 -0
- data/ext/third_party/json/include/tao/json/external/double.hpp +1313 -0
- data/ext/third_party/json/include/tao/json/external/itoa.hpp +149 -0
- data/ext/third_party/json/include/tao/json/external/pegtl.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/analyze_cycles.hpp +127 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/counted.hpp +23 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/generic.hpp +31 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/grammar_info.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_guard.hpp +51 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_rules.hpp +25 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_info.hpp +29 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_type.hpp +21 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/analyze.hpp +21 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/apply_mode.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/argv_input.hpp +51 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/ascii.hpp +67 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/buffer_input.hpp +212 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_action.hpp +38 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_state.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_states.hpp +62 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_control.hpp +36 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_state.hpp +50 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp +61 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/config.hpp +11 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/abnf.hpp +35 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/alphabet.hpp +67 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/counter.hpp +54 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/http.hpp +253 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp +68 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf16.hpp +200 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf32.hpp +200 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf8.hpp +105 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/if_then.hpp +55 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/integer.hpp +446 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/json.hpp +88 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/json_pointer.hpp +33 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree.hpp +561 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree_to_dot.hpp +104 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/raw_string.hpp +225 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/remove_first_state.hpp +86 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_one_min_max.hpp +62 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_string.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/to_string.hpp +38 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/tracer.hpp +158 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/unescape.hpp +199 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/contrib/uri.hpp +106 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/cstream_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/disable_action.hpp +35 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/discard_input.hpp +37 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_failure.hpp +39 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_success.hpp +39 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/enable_action.hpp +35 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/eol.hpp +37 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/eol_pair.hpp +18 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/file_input.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/action.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/action_input.hpp +107 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/alnum.hpp +18 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/alpha.hpp +18 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/always_false.hpp +21 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/any.hpp +58 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply0.hpp +50 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply0_single.hpp +34 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply_single.hpp +34 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/at.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/bof.hpp +31 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/bol.hpp +31 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump.hpp +45 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump_help.hpp +29 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/bytes.hpp +36 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/control.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_crlf_eol.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_eol.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/crlf_eol.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/cstream_reader.hpp +49 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp +40 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/demangle.hpp +140 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/disable.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/discard.hpp +33 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/dusel_mode.hpp +23 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/duseltronik.hpp +187 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/enable.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp +62 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian_gcc.hpp +206 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian_win.hpp +106 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/eof.hpp +31 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/eol.hpp +31 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/eolf.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_posix.hpp +83 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_win32.hpp +219 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_opener.hpp +72 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_reader.hpp +114 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply.hpp +25 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply0.hpp +25 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_match.hpp +56 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/identifier.hpp +22 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_apply.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must.hpp +48 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must_else.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_then_else.hpp +51 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/input_pair.hpp +29 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/istream_reader.hpp +40 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/istring.hpp +72 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/iterator.hpp +52 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_crlf_eol.hpp +37 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_eol.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/list.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_must.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail_pad.hpp +22 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/marker.hpp +82 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply.hpp +25 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply0.hpp +23 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/must.hpp +72 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/not_at.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/one.hpp +44 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/opt.hpp +57 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/pad.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/pad_opt.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_char.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_mask_uint.hpp +54 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_mask_uint8.hpp +34 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_uint.hpp +45 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_uint8.hpp +33 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf16.hpp +54 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf32.hpp +43 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf8.hpp +90 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/pegtl_string.hpp +90 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/plus.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/raise.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/range.hpp +51 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/ranges.hpp +93 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/read_uint.hpp +77 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rematch.hpp +69 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep.hpp +66 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_min.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_min_max.hpp +79 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_opt.hpp +46 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/require.hpp +42 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/result_on_found.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/rules.hpp +61 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/seq.hpp +73 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/skip_control.hpp +25 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/sor.hpp +60 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/star.hpp +47 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/star_must.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/state.hpp +49 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/string.hpp +58 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/trivial.hpp +32 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/try_catch_type.hpp +64 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/internal/until.hpp +84 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/istream_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/match.hpp +73 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/memory_input.hpp +381 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/mmap_input.hpp +79 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/normal.hpp +87 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/nothing.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/parse.hpp +53 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/parse_error.hpp +69 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/position.hpp +75 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/read_input.hpp +74 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/require_apply.hpp +16 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/require_apply0.hpp +16 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/rewind_mode.hpp +20 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/rules.hpp +67 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/string_input.hpp +66 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/tracking_mode.hpp +19 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/uint16.hpp +62 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/uint32.hpp +62 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/uint64.hpp +63 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/uint8.hpp +36 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/utf16.hpp +49 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/utf32.hpp +49 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/utf8.hpp +28 -0
- data/ext/third_party/json/include/tao/json/external/pegtl/version.hpp +13 -0
- data/ext/third_party/json/include/tao/json/external/ryu.hpp +1216 -0
- data/ext/third_party/json/include/tao/json/forward.hpp +44 -0
- data/ext/third_party/json/include/tao/json/from_file.hpp +32 -0
- data/ext/third_party/json/include/tao/json/from_input.hpp +32 -0
- data/ext/third_party/json/include/tao/json/from_stream.hpp +45 -0
- data/ext/third_party/json/include/tao/json/from_string.hpp +41 -0
- data/ext/third_party/json/include/tao/json/internal/action.hpp +268 -0
- data/ext/third_party/json/include/tao/json/internal/base64.hpp +55 -0
- data/ext/third_party/json/include/tao/json/internal/base64url.hpp +53 -0
- data/ext/third_party/json/include/tao/json/internal/endian.hpp +60 -0
- data/ext/third_party/json/include/tao/json/internal/endian_gcc.hpp +198 -0
- data/ext/third_party/json/include/tao/json/internal/endian_win.hpp +103 -0
- data/ext/third_party/json/include/tao/json/internal/errors.hpp +85 -0
- data/ext/third_party/json/include/tao/json/internal/escape.hpp +77 -0
- data/ext/third_party/json/include/tao/json/internal/format.hpp +59 -0
- data/ext/third_party/json/include/tao/json/internal/grammar.hpp +229 -0
- data/ext/third_party/json/include/tao/json/internal/hexdump.hpp +31 -0
- data/ext/third_party/json/include/tao/json/internal/identity.hpp +22 -0
- data/ext/third_party/json/include/tao/json/internal/number_state.hpp +80 -0
- data/ext/third_party/json/include/tao/json/internal/number_traits.hpp +267 -0
- data/ext/third_party/json/include/tao/json/internal/pair.hpp +42 -0
- data/ext/third_party/json/include/tao/json/internal/parse_util.hpp +112 -0
- data/ext/third_party/json/include/tao/json/internal/sha256.hpp +218 -0
- data/ext/third_party/json/include/tao/json/internal/single.hpp +40 -0
- data/ext/third_party/json/include/tao/json/internal/string_t.hpp +35 -0
- data/ext/third_party/json/include/tao/json/internal/type_traits.hpp +113 -0
- data/ext/third_party/json/include/tao/json/internal/unescape_action.hpp +24 -0
- data/ext/third_party/json/include/tao/json/internal/uri_fragment.hpp +182 -0
- data/ext/third_party/json/include/tao/json/jaxn.hpp +19 -0
- data/ext/third_party/json/include/tao/json/jaxn/consume_file.hpp +34 -0
- data/ext/third_party/json/include/tao/json/jaxn/consume_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/from_file.hpp +28 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/from_input.hpp +45 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/from_stream.hpp +33 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/from_string.hpp +39 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/to_pretty_stream.hpp +69 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/to_stream.hpp +67 -0
- data/ext/third_party/json/include/tao/json/jaxn/events/to_string.hpp +33 -0
- data/ext/third_party/json/include/tao/json/jaxn/from_file.hpp +33 -0
- data/ext/third_party/json/include/tao/json/jaxn/from_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/jaxn/from_stream.hpp +48 -0
- data/ext/third_party/json/include/tao/json/jaxn/from_string.hpp +42 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/action.hpp +355 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/bunescape_action.hpp +114 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/errors.hpp +108 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/grammar.hpp +375 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/integer.hpp +256 -0
- data/ext/third_party/json/include/tao/json/jaxn/internal/unescape_action.hpp +28 -0
- data/ext/third_party/json/include/tao/json/jaxn/is_identifier.hpp +27 -0
- data/ext/third_party/json/include/tao/json/jaxn/parts_parser.hpp +263 -0
- data/ext/third_party/json/include/tao/json/jaxn/to_stream.hpp +36 -0
- data/ext/third_party/json/include/tao/json/jaxn/to_string.hpp +33 -0
- data/ext/third_party/json/include/tao/json/message_extension.hpp +49 -0
- data/ext/third_party/json/include/tao/json/msgpack.hpp +18 -0
- data/ext/third_party/json/include/tao/json/msgpack/consume_file.hpp +34 -0
- data/ext/third_party/json/include/tao/json/msgpack/consume_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/msgpack/events/from_file.hpp +27 -0
- data/ext/third_party/json/include/tao/json/msgpack/events/from_input.hpp +43 -0
- data/ext/third_party/json/include/tao/json/msgpack/events/from_string.hpp +37 -0
- data/ext/third_party/json/include/tao/json/msgpack/events/to_stream.hpp +214 -0
- data/ext/third_party/json/include/tao/json/msgpack/events/to_string.hpp +31 -0
- data/ext/third_party/json/include/tao/json/msgpack/from_file.hpp +33 -0
- data/ext/third_party/json/include/tao/json/msgpack/from_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/msgpack/from_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/msgpack/internal/format.hpp +57 -0
- data/ext/third_party/json/include/tao/json/msgpack/internal/grammar.hpp +249 -0
- data/ext/third_party/json/include/tao/json/msgpack/parts_parser.hpp +311 -0
- data/ext/third_party/json/include/tao/json/msgpack/to_stream.hpp +27 -0
- data/ext/third_party/json/include/tao/json/msgpack/to_string.hpp +28 -0
- data/ext/third_party/json/include/tao/json/operators.hpp +494 -0
- data/ext/third_party/json/include/tao/json/parts_parser.hpp +306 -0
- data/ext/third_party/json/include/tao/json/pointer.hpp +432 -0
- data/ext/third_party/json/include/tao/json/produce.hpp +61 -0
- data/ext/third_party/json/include/tao/json/self_contained.hpp +143 -0
- data/ext/third_party/json/include/tao/json/span.hpp +568 -0
- data/ext/third_party/json/include/tao/json/stream.hpp +38 -0
- data/ext/third_party/json/include/tao/json/to_stream.hpp +42 -0
- data/ext/third_party/json/include/tao/json/to_string.hpp +23 -0
- data/ext/third_party/json/include/tao/json/traits.hpp +971 -0
- data/ext/third_party/json/include/tao/json/type.hpp +112 -0
- data/ext/third_party/json/include/tao/json/ubjson.hpp +18 -0
- data/ext/third_party/json/include/tao/json/ubjson/consume_file.hpp +34 -0
- data/ext/third_party/json/include/tao/json/ubjson/consume_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/ubjson/events/from_file.hpp +27 -0
- data/ext/third_party/json/include/tao/json/ubjson/events/from_input.hpp +43 -0
- data/ext/third_party/json/include/tao/json/ubjson/events/from_string.hpp +37 -0
- data/ext/third_party/json/include/tao/json/ubjson/events/to_stream.hpp +174 -0
- data/ext/third_party/json/include/tao/json/ubjson/events/to_string.hpp +31 -0
- data/ext/third_party/json/include/tao/json/ubjson/from_file.hpp +33 -0
- data/ext/third_party/json/include/tao/json/ubjson/from_input.hpp +33 -0
- data/ext/third_party/json/include/tao/json/ubjson/from_string.hpp +32 -0
- data/ext/third_party/json/include/tao/json/ubjson/internal/grammar.hpp +413 -0
- data/ext/third_party/json/include/tao/json/ubjson/internal/marker.hpp +46 -0
- data/ext/third_party/json/include/tao/json/ubjson/parts_parser.hpp +393 -0
- data/ext/third_party/json/include/tao/json/ubjson/to_stream.hpp +28 -0
- data/ext/third_party/json/include/tao/json/ubjson/to_string.hpp +29 -0
- data/ext/third_party/json/include/tao/json/utf8.hpp +57 -0
- data/ext/third_party/json/include/tao/json/value.hpp +12 -0
- data/ext/third_party/json/src/example/json/CMakeLists.txt +67 -0
- data/ext/third_party/json/src/example/json/cbor_to_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/cbor_to_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/cbor_to_msgpack.cpp +18 -0
- data/ext/third_party/json/src/example/json/cbor_to_pretty_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/cbor_to_pretty_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/cbor_to_ubjson.cpp +18 -0
- data/ext/third_party/json/src/example/json/jaxn_to_cbor.cpp +18 -0
- data/ext/third_party/json/src/example/json/jaxn_to_cplusplus.cpp +249 -0
- data/ext/third_party/json/src/example/json/jaxn_to_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/jaxn_to_msgpack.cpp +18 -0
- data/ext/third_party/json/src/example/json/jaxn_to_pretty_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/jaxn_to_ubjson.cpp +18 -0
- data/ext/third_party/json/src/example/json/json_to_cbor.cpp +18 -0
- data/ext/third_party/json/src/example/json/json_to_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/json_to_msgpack.cpp +18 -0
- data/ext/third_party/json/src/example/json/json_to_pretty_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/json_to_ubjson.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_cbor.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_pretty_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_pretty_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/msgpack_to_ubjson.cpp +18 -0
- data/ext/third_party/json/src/example/json/printf_doubles.cpp +51 -0
- data/ext/third_party/json/src/example/json/ubjson_to_cbor.cpp +18 -0
- data/ext/third_party/json/src/example/json/ubjson_to_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/ubjson_to_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/ubjson_to_msgpack.cpp +18 -0
- data/ext/third_party/json/src/example/json/ubjson_to_pretty_jaxn.cpp +18 -0
- data/ext/third_party/json/src/example/json/ubjson_to_pretty_json.cpp +18 -0
- data/ext/third_party/json/src/example/json/validate_event_order.cpp +27 -0
- data/ext/third_party/json/src/example/json/validate_integer.cpp +56 -0
- data/ext/third_party/json/src/perf/json/bench_mark.hpp +43 -0
- data/ext/third_party/json/src/perf/json/benchmark.cpp +34 -0
- data/ext/third_party/json/src/perf/json/parse_file.cpp +17 -0
- data/ext/third_party/json/src/perf/json/pretty_print_file.cpp +19 -0
- data/ext/third_party/json/src/perf/json/print_double.cpp +34 -0
- data/ext/third_party/json/src/perf/json/print_file.cpp +19 -0
- data/ext/third_party/json/src/perf/json/sizes.cpp +24 -0
- data/ext/third_party/json/src/perf/json/syntax_only.cpp +27 -0
- data/ext/third_party/json/src/test/json/CMakeLists.txt +97 -0
- data/ext/third_party/json/src/test/json/big_list_of_naughty_strings.cpp +43 -0
- data/ext/third_party/json/src/test/json/binding_array.cpp +549 -0
- data/ext/third_party/json/src/test/json/binding_factory.cpp +265 -0
- data/ext/third_party/json/src/test/json/binding_object.cpp +208 -0
- data/ext/third_party/json/src/test/json/binding_versions.cpp +95 -0
- data/ext/third_party/json/src/test/json/cbor.cpp +149 -0
- data/ext/third_party/json/src/test/json/cbor_parts_parser.cpp +36 -0
- data/ext/third_party/json/src/test/json/contrib_diff.cpp +43 -0
- data/ext/third_party/json/src/test/json/contrib_get.cpp +42 -0
- data/ext/third_party/json/src/test/json/contrib_patch_add.cpp +75 -0
- data/ext/third_party/json/src/test/json/contrib_patch_copy.cpp +113 -0
- data/ext/third_party/json/src/test/json/contrib_patch_move.cpp +97 -0
- data/ext/third_party/json/src/test/json/contrib_patch_remove.cpp +85 -0
- data/ext/third_party/json/src/test/json/contrib_patch_replace.cpp +79 -0
- data/ext/third_party/json/src/test/json/contrib_patch_test.cpp +69 -0
- data/ext/third_party/json/src/test/json/contrib_position.cpp +48 -0
- data/ext/third_party/json/src/test/json/contrib_reference.cpp +44 -0
- data/ext/third_party/json/src/test/json/contrib_schema.cpp +132 -0
- data/ext/third_party/json/src/test/json/contrib_traits.cpp +258 -0
- data/ext/third_party/json/src/test/json/double.cpp +182 -0
- data/ext/third_party/json/src/test/json/enable_implicit_constructor.cpp +54 -0
- data/ext/third_party/json/src/test/json/escape.cpp +42 -0
- data/ext/third_party/json/src/test/json/events_binary_to.cpp +56 -0
- data/ext/third_party/json/src/test/json/events_compare.cpp +433 -0
- data/ext/third_party/json/src/test/json/events_debug.cpp +24 -0
- data/ext/third_party/json/src/test/json/events_hash.cpp +65 -0
- data/ext/third_party/json/src/test/json/events_to_stream.cpp +28 -0
- data/ext/third_party/json/src/test/json/events_to_string.cpp +25 -0
- data/ext/third_party/json/src/test/json/include_json.cpp +14 -0
- data/ext/third_party/json/src/test/json/integer.cpp +118 -0
- data/ext/third_party/json/src/test/json/jaxn_ostream.cpp +76 -0
- data/ext/third_party/json/src/test/json/jaxn_parse.cpp +239 -0
- data/ext/third_party/json/src/test/json/jaxn_parts_parser.cpp +220 -0
- data/ext/third_party/json/src/test/json/json_ostream.cpp +102 -0
- data/ext/third_party/json/src/test/json/json_parse.cpp +153 -0
- data/ext/third_party/json/src/test/json/json_parts_parser.cpp +124 -0
- data/ext/third_party/json/src/test/json/json_pointer.cpp +176 -0
- data/ext/third_party/json/src/test/json/key_camel_case_to_snake_case.cpp +38 -0
- data/ext/third_party/json/src/test/json/key_snake_case_to_camel_case.cpp +33 -0
- data/ext/third_party/json/src/test/json/literal.cpp +18 -0
- data/ext/third_party/json/src/test/json/main.hpp +20 -0
- data/ext/third_party/json/src/test/json/make_events.hpp +362 -0
- data/ext/third_party/json/src/test/json/msgpack.cpp +136 -0
- data/ext/third_party/json/src/test/json/object_construction.cpp +167 -0
- data/ext/third_party/json/src/test/json/opaque_pointer.cpp +192 -0
- data/ext/third_party/json/src/test/json/operators.cpp +494 -0
- data/ext/third_party/json/src/test/json/optional.cpp +79 -0
- data/ext/third_party/json/src/test/json/public_base.cpp +142 -0
- data/ext/third_party/json/src/test/json/self_contained.cpp +106 -0
- data/ext/third_party/json/src/test/json/sha256.cpp +38 -0
- data/ext/third_party/json/src/test/json/string_view.cpp +70 -0
- data/ext/third_party/json/src/test/json/temporary_parsing.cpp +339 -0
- data/ext/third_party/json/src/test/json/test.hpp +74 -0
- data/ext/third_party/json/src/test/json/test_events.hpp +250 -0
- data/ext/third_party/json/src/test/json/test_types.hpp +557 -0
- data/ext/third_party/json/src/test/json/test_unhex.hpp +42 -0
- data/ext/third_party/json/src/test/json/type.cpp +35 -0
- data/ext/third_party/json/src/test/json/ubjson.cpp +119 -0
- data/ext/third_party/json/src/test/json/uri_fragment.cpp +52 -0
- data/ext/third_party/json/src/test/json/validate_event_interfaces.cpp +177 -0
- data/ext/third_party/json/src/test/json/validate_utf8.cpp +37 -0
- data/ext/third_party/json/src/test/json/value_access.cpp +144 -0
- data/ext/third_party/json/src/test/json/value_basics.cpp +241 -0
- data/ext/third_party/json/src/test/json/value_create.cpp +372 -0
- data/ext/third_party/json/src/test/json/value_ptr.cpp +33 -0
- data/ext/third_party/json/src/test/json/value_subscript.cpp +89 -0
- data/ext/third_party/json/src/test/json/with_arguments.cpp +98 -0
- data/ext/third_party/json/tests/blns.json +496 -0
- data/ext/third_party/json/tests/canada.json +9 -0
- data/ext/third_party/json/tests/citm_catalog.json +50469 -0
- data/ext/third_party/json/tests/draft4/additionalItems.json +82 -0
- data/ext/third_party/json/tests/draft4/additionalProperties.json +88 -0
- data/ext/third_party/json/tests/draft4/allOf.json +112 -0
- data/ext/third_party/json/tests/draft4/anyOf.json +68 -0
- data/ext/third_party/json/tests/draft4/default.json +49 -0
- data/ext/third_party/json/tests/draft4/definitions.json +32 -0
- data/ext/third_party/json/tests/draft4/dependencies.json +113 -0
- data/ext/third_party/json/tests/draft4/enum.json +72 -0
- data/ext/third_party/json/tests/draft4/items.json +46 -0
- data/ext/third_party/json/tests/draft4/maxItems.json +28 -0
- data/ext/third_party/json/tests/draft4/maxLength.json +33 -0
- data/ext/third_party/json/tests/draft4/maxProperties.json +28 -0
- data/ext/third_party/json/tests/draft4/maximum.json +42 -0
- data/ext/third_party/json/tests/draft4/minItems.json +28 -0
- data/ext/third_party/json/tests/draft4/minLength.json +33 -0
- data/ext/third_party/json/tests/draft4/minProperties.json +28 -0
- data/ext/third_party/json/tests/draft4/minimum.json +42 -0
- data/ext/third_party/json/tests/draft4/multipleOf.json +60 -0
- data/ext/third_party/json/tests/draft4/not.json +96 -0
- data/ext/third_party/json/tests/draft4/oneOf.json +68 -0
- data/ext/third_party/json/tests/draft4/optional/bignum.json +107 -0
- data/ext/third_party/json/tests/draft4/optional/format.json +148 -0
- data/ext/third_party/json/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
- data/ext/third_party/json/tests/draft4/pattern.json +34 -0
- data/ext/third_party/json/tests/draft4/patternProperties.json +110 -0
- data/ext/third_party/json/tests/draft4/properties.json +92 -0
- data/ext/third_party/json/tests/draft4/ref.json +179 -0
- data/ext/third_party/json/tests/draft4/refRemote.json +74 -0
- data/ext/third_party/json/tests/draft4/required.json +44 -0
- data/ext/third_party/json/tests/draft4/type.json +345 -0
- data/ext/third_party/json/tests/draft4/uniqueItems.json +79 -0
- data/ext/third_party/json/tests/taocpp/binary.jaxn +4 -0
- data/ext/third_party/json/tests/taocpp/dateTime.json +108 -0
- data/ext/third_party/json/tests/taocpp/make_events.cbor +0 -0
- data/ext/third_party/json/tests/taocpp/number.json +682 -0
- data/ext/third_party/json/tests/taocpp/position.json +8 -0
- data/ext/third_party/json/tests/taocpp/schema.json +378 -0
- data/ext/third_party/json/tests/twitter.json +15482 -0
- data/ext/third_party/spdlog/.clang-format +108 -0
- data/ext/third_party/spdlog/.clang-tidy +54 -0
- data/ext/third_party/spdlog/.gitattributes +1 -0
- data/ext/third_party/spdlog/.gitignore +83 -0
- data/ext/third_party/spdlog/.travis.yml +112 -0
- data/ext/third_party/spdlog/CMakeLists.txt +324 -0
- data/ext/third_party/spdlog/INSTALL +24 -0
- data/ext/third_party/spdlog/LICENSE +26 -0
- data/ext/third_party/spdlog/README.md +423 -0
- data/ext/third_party/spdlog/appveyor.yml +51 -0
- data/ext/third_party/spdlog/bench/CMakeLists.txt +25 -0
- data/ext/third_party/spdlog/bench/async_bench.cpp +179 -0
- data/ext/third_party/spdlog/bench/bench.cpp +238 -0
- data/ext/third_party/spdlog/bench/formatter-bench.cpp +80 -0
- data/ext/third_party/spdlog/bench/latency.cpp +166 -0
- data/ext/third_party/spdlog/bench/utils.h +34 -0
- data/ext/third_party/spdlog/cmake/ide.cmake +18 -0
- data/ext/third_party/spdlog/cmake/pch.h.in +258 -0
- data/ext/third_party/spdlog/cmake/spdlog.pc.in +13 -0
- data/ext/third_party/spdlog/cmake/spdlogCPack.cmake +46 -0
- data/ext/third_party/spdlog/cmake/spdlogConfig.cmake.in +15 -0
- data/ext/third_party/spdlog/cmake/utils.cmake +61 -0
- data/ext/third_party/spdlog/cmake/version.rc.in +42 -0
- data/ext/third_party/spdlog/example/CMakeLists.txt +23 -0
- data/ext/third_party/spdlog/example/example.cpp +282 -0
- data/ext/third_party/spdlog/include/spdlog/async.h +93 -0
- data/ext/third_party/spdlog/include/spdlog/async_logger-inl.h +92 -0
- data/ext/third_party/spdlog/include/spdlog/async_logger.h +68 -0
- data/ext/third_party/spdlog/include/spdlog/cfg/argv.h +45 -0
- data/ext/third_party/spdlog/include/spdlog/cfg/env.h +36 -0
- data/ext/third_party/spdlog/include/spdlog/cfg/helpers-inl.h +103 -0
- data/ext/third_party/spdlog/include/spdlog/cfg/helpers.h +28 -0
- data/ext/third_party/spdlog/include/spdlog/cfg/log_levels.h +47 -0
- data/ext/third_party/spdlog/include/spdlog/common-inl.h +76 -0
- data/ext/third_party/spdlog/include/spdlog/common.h +246 -0
- data/ext/third_party/spdlog/include/spdlog/details/backtracer-inl.h +69 -0
- data/ext/third_party/spdlog/include/spdlog/details/backtracer.h +45 -0
- data/ext/third_party/spdlog/include/spdlog/details/circular_q.h +141 -0
- data/ext/third_party/spdlog/include/spdlog/details/console_globals.h +32 -0
- data/ext/third_party/spdlog/include/spdlog/details/file_helper-inl.h +132 -0
- data/ext/third_party/spdlog/include/spdlog/details/file_helper.h +59 -0
- data/ext/third_party/spdlog/include/spdlog/details/fmt_helper.h +108 -0
- data/ext/third_party/spdlog/include/spdlog/details/log_msg-inl.h +37 -0
- data/ext/third_party/spdlog/include/spdlog/details/log_msg.h +36 -0
- data/ext/third_party/spdlog/include/spdlog/details/log_msg_buffer-inl.h +58 -0
- data/ext/third_party/spdlog/include/spdlog/details/log_msg_buffer.h +33 -0
- data/ext/third_party/spdlog/include/spdlog/details/mpmc_blocking_q.h +120 -0
- data/ext/third_party/spdlog/include/spdlog/details/null_mutex.h +49 -0
- data/ext/third_party/spdlog/include/spdlog/details/os-inl.h +554 -0
- data/ext/third_party/spdlog/include/spdlog/details/os.h +111 -0
- data/ext/third_party/spdlog/include/spdlog/details/periodic_worker-inl.h +49 -0
- data/ext/third_party/spdlog/include/spdlog/details/periodic_worker.h +40 -0
- data/ext/third_party/spdlog/include/spdlog/details/registry-inl.h +299 -0
- data/ext/third_party/spdlog/include/spdlog/details/registry.h +112 -0
- data/ext/third_party/spdlog/include/spdlog/details/synchronous_factory.h +24 -0
- data/ext/third_party/spdlog/include/spdlog/details/tcp_client-windows.h +175 -0
- data/ext/third_party/spdlog/include/spdlog/details/tcp_client.h +145 -0
- data/ext/third_party/spdlog/include/spdlog/details/thread_pool-inl.h +124 -0
- data/ext/third_party/spdlog/include/spdlog/details/thread_pool.h +120 -0
- data/ext/third_party/spdlog/include/spdlog/details/windows_include.h +11 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bin_to_hex.h +216 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/LICENSE.rst +27 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/chrono.h +1119 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/color.h +568 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/compile.h +595 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/core.h +1789 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format-inl.h +1403 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format.h +3648 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/locale.h +78 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ostream.h +143 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/posix.h +2 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/printf.h +721 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ranges.h +387 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/fmt.h +25 -0
- data/ext/third_party/spdlog/include/spdlog/fmt/ostr.h +20 -0
- data/ext/third_party/spdlog/include/spdlog/formatter.h +18 -0
- data/ext/third_party/spdlog/include/spdlog/fwd.h +14 -0
- data/ext/third_party/spdlog/include/spdlog/logger-inl.h +253 -0
- data/ext/third_party/spdlog/include/spdlog/logger.h +392 -0
- data/ext/third_party/spdlog/include/spdlog/pattern_formatter-inl.h +1358 -0
- data/ext/third_party/spdlog/include/spdlog/pattern_formatter.h +126 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/android_sink.h +119 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h +143 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/ansicolor_sink.h +118 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/base_sink-inl.h +63 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/base_sink.h +52 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/basic_file_sink-inl.h +43 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/basic_file_sink.h +58 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/daily_file_sink.h +204 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/dist_sink.h +97 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/dup_filter_sink.h +90 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/msvc_sink.h +49 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/null_sink.h +44 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/ostream_sink.h +50 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/ringbuffer_sink.h +72 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h +131 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/rotating_file_sink.h +78 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/sink-inl.h +25 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/sink.h +35 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/stdout_color_sinks.h +45 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks-inl.h +94 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks.h +80 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/syslog_sink.h +109 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/systemd_sink.h +103 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/tcp_sink.h +81 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/win_eventlog_sink.h +266 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/wincolor_sink-inl.h +180 -0
- data/ext/third_party/spdlog/include/spdlog/sinks/wincolor_sink.h +94 -0
- data/ext/third_party/spdlog/include/spdlog/spdlog-inl.h +115 -0
- data/ext/third_party/spdlog/include/spdlog/spdlog.h +340 -0
- data/ext/third_party/spdlog/include/spdlog/tweakme.h +116 -0
- data/ext/third_party/spdlog/include/spdlog/version.h +10 -0
- data/ext/third_party/spdlog/logos/jetbrains-variant-4.svg +43 -0
- data/ext/third_party/spdlog/scripts/extract_version.py +17 -0
- data/ext/third_party/spdlog/scripts/format.sh +16 -0
- data/ext/third_party/spdlog/src/async.cpp +13 -0
- data/ext/third_party/spdlog/src/cfg.cpp +8 -0
- data/ext/third_party/spdlog/src/color_sinks.cpp +51 -0
- data/ext/third_party/spdlog/src/file_sinks.cpp +20 -0
- data/ext/third_party/spdlog/src/fmt.cpp +189 -0
- data/ext/third_party/spdlog/src/spdlog.cpp +26 -0
- data/ext/third_party/spdlog/src/stdout_sinks.cpp +29 -0
- data/ext/third_party/spdlog/tests/CMakeLists.txt +70 -0
- data/ext/third_party/spdlog/tests/catch.hpp +15372 -0
- data/ext/third_party/spdlog/tests/catch.license +23 -0
- data/ext/third_party/spdlog/tests/includes.h +26 -0
- data/ext/third_party/spdlog/tests/main.cpp +2 -0
- data/ext/third_party/spdlog/tests/test_async.cpp +188 -0
- data/ext/third_party/spdlog/tests/test_backtrace.cpp +65 -0
- data/ext/third_party/spdlog/tests/test_cfg.cpp +93 -0
- data/ext/third_party/spdlog/tests/test_create_dir.cpp +80 -0
- data/ext/third_party/spdlog/tests/test_daily_logger.cpp +149 -0
- data/ext/third_party/spdlog/tests/test_dup_filter.cpp +88 -0
- data/ext/third_party/spdlog/tests/test_errors.cpp +118 -0
- data/ext/third_party/spdlog/tests/test_eventlog.cpp +71 -0
- data/ext/third_party/spdlog/tests/test_file_helper.cpp +102 -0
- data/ext/third_party/spdlog/tests/test_file_logging.cpp +98 -0
- data/ext/third_party/spdlog/tests/test_fmt_helper.cpp +86 -0
- data/ext/third_party/spdlog/tests/test_macros.cpp +60 -0
- data/ext/third_party/spdlog/tests/test_misc.cpp +271 -0
- data/ext/third_party/spdlog/tests/test_mpmc_q.cpp +106 -0
- data/ext/third_party/spdlog/tests/test_pattern_formatter.cpp +443 -0
- data/ext/third_party/spdlog/tests/test_registry.cpp +116 -0
- data/ext/third_party/spdlog/tests/test_sink.h +79 -0
- data/ext/third_party/spdlog/tests/test_stdout_api.cpp +98 -0
- data/ext/third_party/spdlog/tests/test_systemd.cpp +15 -0
- data/ext/third_party/spdlog/tests/test_time_point.cpp +36 -0
- data/ext/third_party/spdlog/tests/utils.cpp +125 -0
- data/ext/third_party/spdlog/tests/utils.h +18 -0
- data/lib/couchbase.rb +13 -150
- data/lib/couchbase/authenticator.rb +25 -0
- data/lib/couchbase/binary_collection.rb +128 -0
- data/lib/couchbase/bucket.rb +50 -426
- data/lib/couchbase/cluster.rb +236 -99
- data/lib/couchbase/collection.rb +378 -0
- data/lib/couchbase/common_options.rb +29 -0
- data/lib/couchbase/errors.rb +222 -0
- data/lib/couchbase/management/analytics_index_manager.rb +143 -0
- data/lib/couchbase/management/bucket_manager.rb +187 -0
- data/lib/couchbase/management/collection_manager.rb +28 -0
- data/lib/couchbase/management/query_index_manager.rb +26 -0
- data/lib/couchbase/management/search_index_manager.rb +26 -0
- data/lib/couchbase/management/user_manager.rb +321 -0
- data/lib/couchbase/management/view_index_manager.rb +28 -0
- data/lib/couchbase/mutation_state.rb +40 -0
- data/lib/couchbase/results.rb +307 -0
- data/lib/couchbase/scope.rb +49 -0
- data/lib/couchbase/subdoc.rb +226 -0
- data/lib/couchbase/version.rb +12 -15
- data/rbi/couchbase.rbi +79 -0
- metadata +1991 -243
- data/.yardopts +0 -5
- data/CONTRIBUTING.markdown +0 -75
- data/LICENSE +0 -201
- data/Makefile +0 -3
- data/README.markdown +0 -592
- data/RELEASE_NOTES.markdown +0 -909
- data/examples/chat-em/Gemfile +0 -7
- data/examples/chat-em/README.markdown +0 -45
- data/examples/chat-em/server.rb +0 -82
- data/examples/chat-goliath-grape/Gemfile +0 -5
- data/examples/chat-goliath-grape/README.markdown +0 -50
- data/examples/chat-goliath-grape/app.rb +0 -67
- data/examples/chat-goliath-grape/config/app.rb +0 -20
- data/examples/transcoders/Gemfile +0 -3
- data/examples/transcoders/README.markdown +0 -59
- data/examples/transcoders/cb-zcat +0 -40
- data/examples/transcoders/cb-zcp +0 -45
- data/examples/transcoders/gzip_transcoder.rb +0 -49
- data/examples/transcoders/options.rb +0 -54
- data/ext/couchbase_ext/.gitignore +0 -4
- data/ext/couchbase_ext/arguments.c +0 -979
- data/ext/couchbase_ext/arithmetic.c +0 -316
- data/ext/couchbase_ext/bucket.c +0 -1436
- data/ext/couchbase_ext/context.c +0 -65
- data/ext/couchbase_ext/couchbase_ext.c +0 -1480
- data/ext/couchbase_ext/couchbase_ext.h +0 -678
- data/ext/couchbase_ext/delete.c +0 -163
- data/ext/couchbase_ext/eventmachine_plugin.c +0 -466
- data/ext/couchbase_ext/extconf.rb +0 -194
- data/ext/couchbase_ext/get.c +0 -316
- data/ext/couchbase_ext/gethrtime.c +0 -129
- data/ext/couchbase_ext/http.c +0 -432
- data/ext/couchbase_ext/multithread_plugin.c +0 -1085
- data/ext/couchbase_ext/n1ql.c +0 -117
- data/ext/couchbase_ext/observe.c +0 -171
- data/ext/couchbase_ext/result.c +0 -129
- data/ext/couchbase_ext/stats.c +0 -163
- data/ext/couchbase_ext/store.c +0 -542
- data/ext/couchbase_ext/timer.c +0 -192
- data/ext/couchbase_ext/touch.c +0 -186
- data/ext/couchbase_ext/unlock.c +0 -176
- data/ext/couchbase_ext/utils.c +0 -558
- data/ext/couchbase_ext/version.c +0 -142
- data/lib/action_dispatch/middleware/session/couchbase_store.rb +0 -38
- data/lib/active_support/cache/couchbase_store.rb +0 -430
- data/lib/couchbase/connection_pool.rb +0 -58
- data/lib/couchbase/constants.rb +0 -12
- data/lib/couchbase/dns.rb +0 -76
- data/lib/couchbase/result.rb +0 -26
- data/lib/couchbase/transcoder.rb +0 -120
- data/lib/couchbase/utils.rb +0 -62
- data/lib/couchbase/view.rb +0 -506
- data/lib/couchbase/view_row.rb +0 -272
- data/lib/ext/multi_json_fix.rb +0 -56
- data/lib/rack/session/couchbase.rb +0 -108
- data/tasks/benchmark.rake +0 -6
- data/tasks/compile.rake +0 -153
- data/tasks/test.rake +0 -100
- data/tasks/util.rake +0 -21
- data/test/profile/.gitignore +0 -1
- data/test/profile/Gemfile +0 -6
- data/test/profile/benchmark.rb +0 -195
- data/test/setup.rb +0 -178
- data/test/test_arithmetic.rb +0 -185
- data/test/test_async.rb +0 -316
- data/test/test_bucket.rb +0 -299
- data/test/test_cas.rb +0 -235
- data/test/test_couchbase.rb +0 -77
- data/test/test_couchbase_connection_pool.rb +0 -77
- data/test/test_couchbase_rails_cache_store.rb +0 -358
- data/test/test_delete.rb +0 -120
- data/test/test_errors.rb +0 -82
- data/test/test_eventmachine.rb +0 -78
- data/test/test_format.rb +0 -164
- data/test/test_get.rb +0 -407
- data/test/test_stats.rb +0 -57
- data/test/test_store.rb +0 -224
- data/test/test_timer.rb +0 -42
- data/test/test_touch.rb +0 -97
- data/test/test_unlock.rb +0 -119
- data/test/test_utils.rb +0 -58
- data/test/test_version.rb +0 -52
@@ -0,0 +1,3648 @@
|
|
1
|
+
/*
|
2
|
+
Formatting library for C++
|
3
|
+
|
4
|
+
Copyright (c) 2012 - present, Victor Zverovich
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
--- Optional exception to the license ---
|
26
|
+
|
27
|
+
As an exception, if, as a result of your compiling your source code, portions
|
28
|
+
of this Software are embedded into a machine-executable object form of such
|
29
|
+
source code, you may redistribute such embedded portions in such object form
|
30
|
+
without including the above copyright and permission notices.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifndef FMT_FORMAT_H_
|
34
|
+
#define FMT_FORMAT_H_
|
35
|
+
|
36
|
+
#include <algorithm>
|
37
|
+
#include <cerrno>
|
38
|
+
#include <cmath>
|
39
|
+
#include <cstdint>
|
40
|
+
#include <limits>
|
41
|
+
#include <memory>
|
42
|
+
#include <stdexcept>
|
43
|
+
|
44
|
+
#include "core.h"
|
45
|
+
|
46
|
+
#ifdef FMT_DEPRECATED_INCLUDE_OS
|
47
|
+
# include "os.h"
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#ifdef __INTEL_COMPILER
|
51
|
+
# define FMT_ICC_VERSION __INTEL_COMPILER
|
52
|
+
#elif defined(__ICL)
|
53
|
+
# define FMT_ICC_VERSION __ICL
|
54
|
+
#else
|
55
|
+
# define FMT_ICC_VERSION 0
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#ifdef __NVCC__
|
59
|
+
# define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
|
60
|
+
#else
|
61
|
+
# define FMT_CUDA_VERSION 0
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#ifdef __has_builtin
|
65
|
+
# define FMT_HAS_BUILTIN(x) __has_builtin(x)
|
66
|
+
#else
|
67
|
+
# define FMT_HAS_BUILTIN(x) 0
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if FMT_GCC_VERSION || FMT_CLANG_VERSION
|
71
|
+
# define FMT_NOINLINE __attribute__((noinline))
|
72
|
+
#else
|
73
|
+
# define FMT_NOINLINE
|
74
|
+
#endif
|
75
|
+
|
76
|
+
#if __cplusplus == 201103L || __cplusplus == 201402L
|
77
|
+
# if defined(__clang__)
|
78
|
+
# define FMT_FALLTHROUGH [[clang::fallthrough]]
|
79
|
+
# elif FMT_GCC_VERSION >= 700 && !defined(__PGI)
|
80
|
+
# define FMT_FALLTHROUGH [[gnu::fallthrough]]
|
81
|
+
# else
|
82
|
+
# define FMT_FALLTHROUGH
|
83
|
+
# endif
|
84
|
+
#elif FMT_HAS_CPP17_ATTRIBUTE(fallthrough) || \
|
85
|
+
(defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
|
86
|
+
# define FMT_FALLTHROUGH [[fallthrough]]
|
87
|
+
#else
|
88
|
+
# define FMT_FALLTHROUGH
|
89
|
+
#endif
|
90
|
+
|
91
|
+
#ifndef FMT_THROW
|
92
|
+
# if FMT_EXCEPTIONS
|
93
|
+
# if FMT_MSC_VER || FMT_NVCC
|
94
|
+
FMT_BEGIN_NAMESPACE
|
95
|
+
namespace internal {
|
96
|
+
template <typename Exception> inline void do_throw(const Exception& x) {
|
97
|
+
// Silence unreachable code warnings in MSVC and NVCC because these
|
98
|
+
// are nearly impossible to fix in a generic code.
|
99
|
+
volatile bool b = true;
|
100
|
+
if (b) throw x;
|
101
|
+
}
|
102
|
+
} // namespace internal
|
103
|
+
FMT_END_NAMESPACE
|
104
|
+
# define FMT_THROW(x) internal::do_throw(x)
|
105
|
+
# else
|
106
|
+
# define FMT_THROW(x) throw x
|
107
|
+
# endif
|
108
|
+
# else
|
109
|
+
# define FMT_THROW(x) \
|
110
|
+
do { \
|
111
|
+
static_cast<void>(sizeof(x)); \
|
112
|
+
FMT_ASSERT(false, ""); \
|
113
|
+
} while (false)
|
114
|
+
# endif
|
115
|
+
#endif
|
116
|
+
|
117
|
+
#if FMT_EXCEPTIONS
|
118
|
+
# define FMT_TRY try
|
119
|
+
# define FMT_CATCH(x) catch (x)
|
120
|
+
#else
|
121
|
+
# define FMT_TRY if (true)
|
122
|
+
# define FMT_CATCH(x) if (false)
|
123
|
+
#endif
|
124
|
+
|
125
|
+
#ifndef FMT_USE_USER_DEFINED_LITERALS
|
126
|
+
// For Intel and NVIDIA compilers both they and the system gcc/msc support UDLs.
|
127
|
+
# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \
|
128
|
+
FMT_MSC_VER >= 1900) && \
|
129
|
+
(!(FMT_ICC_VERSION || FMT_CUDA_VERSION) || FMT_ICC_VERSION >= 1500 || \
|
130
|
+
FMT_CUDA_VERSION >= 700)
|
131
|
+
# define FMT_USE_USER_DEFINED_LITERALS 1
|
132
|
+
# else
|
133
|
+
# define FMT_USE_USER_DEFINED_LITERALS 0
|
134
|
+
# endif
|
135
|
+
#endif
|
136
|
+
|
137
|
+
#ifndef FMT_USE_UDL_TEMPLATE
|
138
|
+
// EDG front end based compilers (icc, nvcc) and GCC < 6.4 do not propertly
|
139
|
+
// support UDL templates and GCC >= 9 warns about them.
|
140
|
+
# if FMT_USE_USER_DEFINED_LITERALS && FMT_ICC_VERSION == 0 && \
|
141
|
+
FMT_CUDA_VERSION == 0 && \
|
142
|
+
((FMT_GCC_VERSION >= 604 && FMT_GCC_VERSION <= 900 && \
|
143
|
+
__cplusplus >= 201402L) || \
|
144
|
+
FMT_CLANG_VERSION >= 304)
|
145
|
+
# define FMT_USE_UDL_TEMPLATE 1
|
146
|
+
# else
|
147
|
+
# define FMT_USE_UDL_TEMPLATE 0
|
148
|
+
# endif
|
149
|
+
#endif
|
150
|
+
|
151
|
+
#ifndef FMT_USE_FLOAT
|
152
|
+
# define FMT_USE_FLOAT 1
|
153
|
+
#endif
|
154
|
+
|
155
|
+
#ifndef FMT_USE_DOUBLE
|
156
|
+
# define FMT_USE_DOUBLE 1
|
157
|
+
#endif
|
158
|
+
|
159
|
+
#ifndef FMT_USE_LONG_DOUBLE
|
160
|
+
# define FMT_USE_LONG_DOUBLE 1
|
161
|
+
#endif
|
162
|
+
|
163
|
+
// __builtin_clz is broken in clang with Microsoft CodeGen:
|
164
|
+
// https://github.com/fmtlib/fmt/issues/519
|
165
|
+
#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clz)) && !FMT_MSC_VER
|
166
|
+
# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
|
167
|
+
#endif
|
168
|
+
#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clzll)) && !FMT_MSC_VER
|
169
|
+
# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
|
170
|
+
#endif
|
171
|
+
|
172
|
+
// Some compilers masquerade as both MSVC and GCC-likes or otherwise support
|
173
|
+
// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the
|
174
|
+
// MSVC intrinsics if the clz and clzll builtins are not available.
|
175
|
+
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
|
176
|
+
# include <intrin.h> // _BitScanReverse, _BitScanReverse64
|
177
|
+
|
178
|
+
FMT_BEGIN_NAMESPACE
|
179
|
+
namespace internal {
|
180
|
+
// Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.
|
181
|
+
# ifndef __clang__
|
182
|
+
# pragma intrinsic(_BitScanReverse)
|
183
|
+
# endif
|
184
|
+
inline uint32_t clz(uint32_t x) {
|
185
|
+
unsigned long r = 0;
|
186
|
+
_BitScanReverse(&r, x);
|
187
|
+
|
188
|
+
FMT_ASSERT(x != 0, "");
|
189
|
+
// Static analysis complains about using uninitialized data
|
190
|
+
// "r", but the only way that can happen is if "x" is 0,
|
191
|
+
// which the callers guarantee to not happen.
|
192
|
+
# pragma warning(suppress : 6102)
|
193
|
+
return 31 - r;
|
194
|
+
}
|
195
|
+
# define FMT_BUILTIN_CLZ(n) internal::clz(n)
|
196
|
+
|
197
|
+
# if defined(_WIN64) && !defined(__clang__)
|
198
|
+
# pragma intrinsic(_BitScanReverse64)
|
199
|
+
# endif
|
200
|
+
|
201
|
+
inline uint32_t clzll(uint64_t x) {
|
202
|
+
unsigned long r = 0;
|
203
|
+
# ifdef _WIN64
|
204
|
+
_BitScanReverse64(&r, x);
|
205
|
+
# else
|
206
|
+
// Scan the high 32 bits.
|
207
|
+
if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32))) return 63 - (r + 32);
|
208
|
+
|
209
|
+
// Scan the low 32 bits.
|
210
|
+
_BitScanReverse(&r, static_cast<uint32_t>(x));
|
211
|
+
# endif
|
212
|
+
|
213
|
+
FMT_ASSERT(x != 0, "");
|
214
|
+
// Static analysis complains about using uninitialized data
|
215
|
+
// "r", but the only way that can happen is if "x" is 0,
|
216
|
+
// which the callers guarantee to not happen.
|
217
|
+
# pragma warning(suppress : 6102)
|
218
|
+
return 63 - r;
|
219
|
+
}
|
220
|
+
# define FMT_BUILTIN_CLZLL(n) internal::clzll(n)
|
221
|
+
} // namespace internal
|
222
|
+
FMT_END_NAMESPACE
|
223
|
+
#endif
|
224
|
+
|
225
|
+
// Enable the deprecated numeric alignment.
|
226
|
+
#ifndef FMT_NUMERIC_ALIGN
|
227
|
+
# define FMT_NUMERIC_ALIGN 1
|
228
|
+
#endif
|
229
|
+
|
230
|
+
// Enable the deprecated percent specifier.
|
231
|
+
#ifndef FMT_DEPRECATED_PERCENT
|
232
|
+
# define FMT_DEPRECATED_PERCENT 0
|
233
|
+
#endif
|
234
|
+
|
235
|
+
FMT_BEGIN_NAMESPACE
|
236
|
+
namespace internal {
|
237
|
+
|
238
|
+
// An equivalent of `*reinterpret_cast<Dest*>(&source)` that doesn't have
|
239
|
+
// undefined behavior (e.g. due to type aliasing).
|
240
|
+
// Example: uint64_t d = bit_cast<uint64_t>(2.718);
|
241
|
+
template <typename Dest, typename Source>
|
242
|
+
inline Dest bit_cast(const Source& source) {
|
243
|
+
static_assert(sizeof(Dest) == sizeof(Source), "size mismatch");
|
244
|
+
Dest dest;
|
245
|
+
std::memcpy(&dest, &source, sizeof(dest));
|
246
|
+
return dest;
|
247
|
+
}
|
248
|
+
|
249
|
+
inline bool is_big_endian() {
|
250
|
+
const auto u = 1u;
|
251
|
+
struct bytes {
|
252
|
+
char data[sizeof(u)];
|
253
|
+
};
|
254
|
+
return bit_cast<bytes>(u).data[0] == 0;
|
255
|
+
}
|
256
|
+
|
257
|
+
// A fallback implementation of uintptr_t for systems that lack it.
|
258
|
+
struct fallback_uintptr {
|
259
|
+
unsigned char value[sizeof(void*)];
|
260
|
+
|
261
|
+
fallback_uintptr() = default;
|
262
|
+
explicit fallback_uintptr(const void* p) {
|
263
|
+
*this = bit_cast<fallback_uintptr>(p);
|
264
|
+
if (is_big_endian()) {
|
265
|
+
for (size_t i = 0, j = sizeof(void*) - 1; i < j; ++i, --j)
|
266
|
+
std::swap(value[i], value[j]);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
};
|
270
|
+
#ifdef UINTPTR_MAX
|
271
|
+
using uintptr_t = ::uintptr_t;
|
272
|
+
inline uintptr_t to_uintptr(const void* p) { return bit_cast<uintptr_t>(p); }
|
273
|
+
#else
|
274
|
+
using uintptr_t = fallback_uintptr;
|
275
|
+
inline fallback_uintptr to_uintptr(const void* p) {
|
276
|
+
return fallback_uintptr(p);
|
277
|
+
}
|
278
|
+
#endif
|
279
|
+
|
280
|
+
// Returns the largest possible value for type T. Same as
|
281
|
+
// std::numeric_limits<T>::max() but shorter and not affected by the max macro.
|
282
|
+
template <typename T> constexpr T max_value() {
|
283
|
+
return (std::numeric_limits<T>::max)();
|
284
|
+
}
|
285
|
+
template <typename T> constexpr int num_bits() {
|
286
|
+
return std::numeric_limits<T>::digits;
|
287
|
+
}
|
288
|
+
template <> constexpr int num_bits<fallback_uintptr>() {
|
289
|
+
return static_cast<int>(sizeof(void*) *
|
290
|
+
std::numeric_limits<unsigned char>::digits);
|
291
|
+
}
|
292
|
+
|
293
|
+
// An approximation of iterator_t for pre-C++20 systems.
|
294
|
+
template <typename T>
|
295
|
+
using iterator_t = decltype(std::begin(std::declval<T&>()));
|
296
|
+
|
297
|
+
// Detect the iterator category of *any* given type in a SFINAE-friendly way.
|
298
|
+
// Unfortunately, older implementations of std::iterator_traits are not safe
|
299
|
+
// for use in a SFINAE-context.
|
300
|
+
template <typename It, typename Enable = void>
|
301
|
+
struct iterator_category : std::false_type {};
|
302
|
+
|
303
|
+
template <typename T> struct iterator_category<T*> {
|
304
|
+
using type = std::random_access_iterator_tag;
|
305
|
+
};
|
306
|
+
|
307
|
+
template <typename It>
|
308
|
+
struct iterator_category<It, void_t<typename It::iterator_category>> {
|
309
|
+
using type = typename It::iterator_category;
|
310
|
+
};
|
311
|
+
|
312
|
+
// Detect if *any* given type models the OutputIterator concept.
|
313
|
+
template <typename It> class is_output_iterator {
|
314
|
+
// Check for mutability because all iterator categories derived from
|
315
|
+
// std::input_iterator_tag *may* also meet the requirements of an
|
316
|
+
// OutputIterator, thereby falling into the category of 'mutable iterators'
|
317
|
+
// [iterator.requirements.general] clause 4. The compiler reveals this
|
318
|
+
// property only at the point of *actually dereferencing* the iterator!
|
319
|
+
template <typename U>
|
320
|
+
static decltype(*(std::declval<U>())) test(std::input_iterator_tag);
|
321
|
+
template <typename U> static char& test(std::output_iterator_tag);
|
322
|
+
template <typename U> static const char& test(...);
|
323
|
+
|
324
|
+
using type = decltype(test<It>(typename iterator_category<It>::type{}));
|
325
|
+
|
326
|
+
public:
|
327
|
+
enum { value = !std::is_const<remove_reference_t<type>>::value };
|
328
|
+
};
|
329
|
+
|
330
|
+
// A workaround for std::string not having mutable data() until C++17.
|
331
|
+
template <typename Char> inline Char* get_data(std::basic_string<Char>& s) {
|
332
|
+
return &s[0];
|
333
|
+
}
|
334
|
+
template <typename Container>
|
335
|
+
inline typename Container::value_type* get_data(Container& c) {
|
336
|
+
return c.data();
|
337
|
+
}
|
338
|
+
|
339
|
+
#if defined(_SECURE_SCL) && _SECURE_SCL
|
340
|
+
// Make a checked iterator to avoid MSVC warnings.
|
341
|
+
template <typename T> using checked_ptr = stdext::checked_array_iterator<T*>;
|
342
|
+
template <typename T> checked_ptr<T> make_checked(T* p, std::size_t size) {
|
343
|
+
return {p, size};
|
344
|
+
}
|
345
|
+
#else
|
346
|
+
template <typename T> using checked_ptr = T*;
|
347
|
+
template <typename T> inline T* make_checked(T* p, std::size_t) { return p; }
|
348
|
+
#endif
|
349
|
+
|
350
|
+
template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)>
|
351
|
+
inline checked_ptr<typename Container::value_type> reserve(
|
352
|
+
std::back_insert_iterator<Container>& it, std::size_t n) {
|
353
|
+
Container& c = get_container(it);
|
354
|
+
std::size_t size = c.size();
|
355
|
+
c.resize(size + n);
|
356
|
+
return make_checked(get_data(c) + size, n);
|
357
|
+
}
|
358
|
+
|
359
|
+
template <typename Iterator>
|
360
|
+
inline Iterator& reserve(Iterator& it, std::size_t) {
|
361
|
+
return it;
|
362
|
+
}
|
363
|
+
|
364
|
+
// An output iterator that counts the number of objects written to it and
|
365
|
+
// discards them.
|
366
|
+
class counting_iterator {
|
367
|
+
private:
|
368
|
+
std::size_t count_;
|
369
|
+
|
370
|
+
public:
|
371
|
+
using iterator_category = std::output_iterator_tag;
|
372
|
+
using difference_type = std::ptrdiff_t;
|
373
|
+
using pointer = void;
|
374
|
+
using reference = void;
|
375
|
+
using _Unchecked_type = counting_iterator; // Mark iterator as checked.
|
376
|
+
|
377
|
+
struct value_type {
|
378
|
+
template <typename T> void operator=(const T&) {}
|
379
|
+
};
|
380
|
+
|
381
|
+
counting_iterator() : count_(0) {}
|
382
|
+
|
383
|
+
std::size_t count() const { return count_; }
|
384
|
+
|
385
|
+
counting_iterator& operator++() {
|
386
|
+
++count_;
|
387
|
+
return *this;
|
388
|
+
}
|
389
|
+
|
390
|
+
counting_iterator operator++(int) {
|
391
|
+
auto it = *this;
|
392
|
+
++*this;
|
393
|
+
return it;
|
394
|
+
}
|
395
|
+
|
396
|
+
value_type operator*() const { return {}; }
|
397
|
+
};
|
398
|
+
|
399
|
+
template <typename OutputIt> class truncating_iterator_base {
|
400
|
+
protected:
|
401
|
+
OutputIt out_;
|
402
|
+
std::size_t limit_;
|
403
|
+
std::size_t count_;
|
404
|
+
|
405
|
+
truncating_iterator_base(OutputIt out, std::size_t limit)
|
406
|
+
: out_(out), limit_(limit), count_(0) {}
|
407
|
+
|
408
|
+
public:
|
409
|
+
using iterator_category = std::output_iterator_tag;
|
410
|
+
using value_type = typename std::iterator_traits<OutputIt>::value_type;
|
411
|
+
using difference_type = void;
|
412
|
+
using pointer = void;
|
413
|
+
using reference = void;
|
414
|
+
using _Unchecked_type =
|
415
|
+
truncating_iterator_base; // Mark iterator as checked.
|
416
|
+
|
417
|
+
OutputIt base() const { return out_; }
|
418
|
+
std::size_t count() const { return count_; }
|
419
|
+
};
|
420
|
+
|
421
|
+
// An output iterator that truncates the output and counts the number of objects
|
422
|
+
// written to it.
|
423
|
+
template <typename OutputIt,
|
424
|
+
typename Enable = typename std::is_void<
|
425
|
+
typename std::iterator_traits<OutputIt>::value_type>::type>
|
426
|
+
class truncating_iterator;
|
427
|
+
|
428
|
+
template <typename OutputIt>
|
429
|
+
class truncating_iterator<OutputIt, std::false_type>
|
430
|
+
: public truncating_iterator_base<OutputIt> {
|
431
|
+
mutable typename truncating_iterator_base<OutputIt>::value_type blackhole_;
|
432
|
+
|
433
|
+
public:
|
434
|
+
using value_type = typename truncating_iterator_base<OutputIt>::value_type;
|
435
|
+
|
436
|
+
truncating_iterator(OutputIt out, std::size_t limit)
|
437
|
+
: truncating_iterator_base<OutputIt>(out, limit) {}
|
438
|
+
|
439
|
+
truncating_iterator& operator++() {
|
440
|
+
if (this->count_++ < this->limit_) ++this->out_;
|
441
|
+
return *this;
|
442
|
+
}
|
443
|
+
|
444
|
+
truncating_iterator operator++(int) {
|
445
|
+
auto it = *this;
|
446
|
+
++*this;
|
447
|
+
return it;
|
448
|
+
}
|
449
|
+
|
450
|
+
value_type& operator*() const {
|
451
|
+
return this->count_ < this->limit_ ? *this->out_ : blackhole_;
|
452
|
+
}
|
453
|
+
};
|
454
|
+
|
455
|
+
template <typename OutputIt>
|
456
|
+
class truncating_iterator<OutputIt, std::true_type>
|
457
|
+
: public truncating_iterator_base<OutputIt> {
|
458
|
+
public:
|
459
|
+
truncating_iterator(OutputIt out, std::size_t limit)
|
460
|
+
: truncating_iterator_base<OutputIt>(out, limit) {}
|
461
|
+
|
462
|
+
template <typename T> truncating_iterator& operator=(T val) {
|
463
|
+
if (this->count_++ < this->limit_) *this->out_++ = val;
|
464
|
+
return *this;
|
465
|
+
}
|
466
|
+
|
467
|
+
truncating_iterator& operator++() { return *this; }
|
468
|
+
truncating_iterator& operator++(int) { return *this; }
|
469
|
+
truncating_iterator& operator*() { return *this; }
|
470
|
+
};
|
471
|
+
|
472
|
+
// A range with the specified output iterator and value type.
|
473
|
+
template <typename OutputIt, typename T = typename OutputIt::value_type>
|
474
|
+
class output_range {
|
475
|
+
private:
|
476
|
+
OutputIt it_;
|
477
|
+
|
478
|
+
public:
|
479
|
+
using value_type = T;
|
480
|
+
using iterator = OutputIt;
|
481
|
+
struct sentinel {};
|
482
|
+
|
483
|
+
explicit output_range(OutputIt it) : it_(it) {}
|
484
|
+
OutputIt begin() const { return it_; }
|
485
|
+
sentinel end() const { return {}; } // Sentinel is not used yet.
|
486
|
+
};
|
487
|
+
|
488
|
+
template <typename Char>
|
489
|
+
inline size_t count_code_points(basic_string_view<Char> s) {
|
490
|
+
return s.size();
|
491
|
+
}
|
492
|
+
|
493
|
+
// Counts the number of code points in a UTF-8 string.
|
494
|
+
inline size_t count_code_points(basic_string_view<char> s) {
|
495
|
+
const char* data = s.data();
|
496
|
+
size_t num_code_points = 0;
|
497
|
+
for (size_t i = 0, size = s.size(); i != size; ++i) {
|
498
|
+
if ((data[i] & 0xc0) != 0x80) ++num_code_points;
|
499
|
+
}
|
500
|
+
return num_code_points;
|
501
|
+
}
|
502
|
+
|
503
|
+
inline size_t count_code_points(basic_string_view<char8_type> s) {
|
504
|
+
return count_code_points(basic_string_view<char>(
|
505
|
+
reinterpret_cast<const char*>(s.data()), s.size()));
|
506
|
+
}
|
507
|
+
|
508
|
+
template <typename Char>
|
509
|
+
inline size_t code_point_index(basic_string_view<Char> s, size_t n) {
|
510
|
+
size_t size = s.size();
|
511
|
+
return n < size ? n : size;
|
512
|
+
}
|
513
|
+
|
514
|
+
// Calculates the index of the nth code point in a UTF-8 string.
|
515
|
+
inline size_t code_point_index(basic_string_view<char8_type> s, size_t n) {
|
516
|
+
const char8_type* data = s.data();
|
517
|
+
size_t num_code_points = 0;
|
518
|
+
for (size_t i = 0, size = s.size(); i != size; ++i) {
|
519
|
+
if ((data[i] & 0xc0) != 0x80 && ++num_code_points > n) {
|
520
|
+
return i;
|
521
|
+
}
|
522
|
+
}
|
523
|
+
return s.size();
|
524
|
+
}
|
525
|
+
|
526
|
+
inline char8_type to_char8_t(char c) { return static_cast<char8_type>(c); }
|
527
|
+
|
528
|
+
template <typename InputIt, typename OutChar>
|
529
|
+
using needs_conversion = bool_constant<
|
530
|
+
std::is_same<typename std::iterator_traits<InputIt>::value_type,
|
531
|
+
char>::value &&
|
532
|
+
std::is_same<OutChar, char8_type>::value>;
|
533
|
+
|
534
|
+
template <typename OutChar, typename InputIt, typename OutputIt,
|
535
|
+
FMT_ENABLE_IF(!needs_conversion<InputIt, OutChar>::value)>
|
536
|
+
OutputIt copy_str(InputIt begin, InputIt end, OutputIt it) {
|
537
|
+
return std::copy(begin, end, it);
|
538
|
+
}
|
539
|
+
|
540
|
+
template <typename OutChar, typename InputIt, typename OutputIt,
|
541
|
+
FMT_ENABLE_IF(needs_conversion<InputIt, OutChar>::value)>
|
542
|
+
OutputIt copy_str(InputIt begin, InputIt end, OutputIt it) {
|
543
|
+
return std::transform(begin, end, it, to_char8_t);
|
544
|
+
}
|
545
|
+
|
546
|
+
#ifndef FMT_USE_GRISU
|
547
|
+
# define FMT_USE_GRISU 1
|
548
|
+
#endif
|
549
|
+
|
550
|
+
template <typename T> constexpr bool use_grisu() {
|
551
|
+
return FMT_USE_GRISU && std::numeric_limits<double>::is_iec559 &&
|
552
|
+
sizeof(T) <= sizeof(double);
|
553
|
+
}
|
554
|
+
|
555
|
+
template <typename T>
|
556
|
+
template <typename U>
|
557
|
+
void buffer<T>::append(const U* begin, const U* end) {
|
558
|
+
std::size_t new_size = size_ + to_unsigned(end - begin);
|
559
|
+
reserve(new_size);
|
560
|
+
std::uninitialized_copy(begin, end, make_checked(ptr_, capacity_) + size_);
|
561
|
+
size_ = new_size;
|
562
|
+
}
|
563
|
+
} // namespace internal
|
564
|
+
|
565
|
+
// A range with an iterator appending to a buffer.
|
566
|
+
template <typename T>
|
567
|
+
class buffer_range : public internal::output_range<
|
568
|
+
std::back_insert_iterator<internal::buffer<T>>, T> {
|
569
|
+
public:
|
570
|
+
using iterator = std::back_insert_iterator<internal::buffer<T>>;
|
571
|
+
using internal::output_range<iterator, T>::output_range;
|
572
|
+
buffer_range(internal::buffer<T>& buf)
|
573
|
+
: internal::output_range<iterator, T>(std::back_inserter(buf)) {}
|
574
|
+
};
|
575
|
+
|
576
|
+
class FMT_DEPRECATED u8string_view
|
577
|
+
: public basic_string_view<internal::char8_type> {
|
578
|
+
public:
|
579
|
+
u8string_view(const char* s)
|
580
|
+
: basic_string_view<internal::char8_type>(
|
581
|
+
reinterpret_cast<const internal::char8_type*>(s)) {}
|
582
|
+
u8string_view(const char* s, size_t count) FMT_NOEXCEPT
|
583
|
+
: basic_string_view<internal::char8_type>(
|
584
|
+
reinterpret_cast<const internal::char8_type*>(s), count) {}
|
585
|
+
};
|
586
|
+
|
587
|
+
#if FMT_USE_USER_DEFINED_LITERALS
|
588
|
+
inline namespace literals {
|
589
|
+
FMT_DEPRECATED inline basic_string_view<internal::char8_type> operator"" _u(
|
590
|
+
const char* s, std::size_t n) {
|
591
|
+
return {reinterpret_cast<const internal::char8_type*>(s), n};
|
592
|
+
}
|
593
|
+
} // namespace literals
|
594
|
+
#endif
|
595
|
+
|
596
|
+
// The number of characters to store in the basic_memory_buffer object itself
|
597
|
+
// to avoid dynamic memory allocation.
|
598
|
+
enum { inline_buffer_size = 500 };
|
599
|
+
|
600
|
+
/**
|
601
|
+
\rst
|
602
|
+
A dynamically growing memory buffer for trivially copyable/constructible types
|
603
|
+
with the first ``SIZE`` elements stored in the object itself.
|
604
|
+
|
605
|
+
You can use one of the following type aliases for common character types:
|
606
|
+
|
607
|
+
+----------------+------------------------------+
|
608
|
+
| Type | Definition |
|
609
|
+
+================+==============================+
|
610
|
+
| memory_buffer | basic_memory_buffer<char> |
|
611
|
+
+----------------+------------------------------+
|
612
|
+
| wmemory_buffer | basic_memory_buffer<wchar_t> |
|
613
|
+
+----------------+------------------------------+
|
614
|
+
|
615
|
+
**Example**::
|
616
|
+
|
617
|
+
fmt::memory_buffer out;
|
618
|
+
format_to(out, "The answer is {}.", 42);
|
619
|
+
|
620
|
+
This will append the following output to the ``out`` object:
|
621
|
+
|
622
|
+
.. code-block:: none
|
623
|
+
|
624
|
+
The answer is 42.
|
625
|
+
|
626
|
+
The output can be converted to an ``std::string`` with ``to_string(out)``.
|
627
|
+
\endrst
|
628
|
+
*/
|
629
|
+
template <typename T, std::size_t SIZE = inline_buffer_size,
|
630
|
+
typename Allocator = std::allocator<T>>
|
631
|
+
class basic_memory_buffer : private Allocator, public internal::buffer<T> {
|
632
|
+
private:
|
633
|
+
T store_[SIZE];
|
634
|
+
|
635
|
+
// Deallocate memory allocated by the buffer.
|
636
|
+
void deallocate() {
|
637
|
+
T* data = this->data();
|
638
|
+
if (data != store_) Allocator::deallocate(data, this->capacity());
|
639
|
+
}
|
640
|
+
|
641
|
+
protected:
|
642
|
+
void grow(std::size_t size) FMT_OVERRIDE;
|
643
|
+
|
644
|
+
public:
|
645
|
+
using value_type = T;
|
646
|
+
using const_reference = const T&;
|
647
|
+
|
648
|
+
explicit basic_memory_buffer(const Allocator& alloc = Allocator())
|
649
|
+
: Allocator(alloc) {
|
650
|
+
this->set(store_, SIZE);
|
651
|
+
}
|
652
|
+
~basic_memory_buffer() FMT_OVERRIDE { deallocate(); }
|
653
|
+
|
654
|
+
private:
|
655
|
+
// Move data from other to this buffer.
|
656
|
+
void move(basic_memory_buffer& other) {
|
657
|
+
Allocator &this_alloc = *this, &other_alloc = other;
|
658
|
+
this_alloc = std::move(other_alloc);
|
659
|
+
T* data = other.data();
|
660
|
+
std::size_t size = other.size(), capacity = other.capacity();
|
661
|
+
if (data == other.store_) {
|
662
|
+
this->set(store_, capacity);
|
663
|
+
std::uninitialized_copy(other.store_, other.store_ + size,
|
664
|
+
internal::make_checked(store_, capacity));
|
665
|
+
} else {
|
666
|
+
this->set(data, capacity);
|
667
|
+
// Set pointer to the inline array so that delete is not called
|
668
|
+
// when deallocating.
|
669
|
+
other.set(other.store_, 0);
|
670
|
+
}
|
671
|
+
this->resize(size);
|
672
|
+
}
|
673
|
+
|
674
|
+
public:
|
675
|
+
/**
|
676
|
+
\rst
|
677
|
+
Constructs a :class:`fmt::basic_memory_buffer` object moving the content
|
678
|
+
of the other object to it.
|
679
|
+
\endrst
|
680
|
+
*/
|
681
|
+
basic_memory_buffer(basic_memory_buffer&& other) FMT_NOEXCEPT { move(other); }
|
682
|
+
|
683
|
+
/**
|
684
|
+
\rst
|
685
|
+
Moves the content of the other ``basic_memory_buffer`` object to this one.
|
686
|
+
\endrst
|
687
|
+
*/
|
688
|
+
basic_memory_buffer& operator=(basic_memory_buffer&& other) FMT_NOEXCEPT {
|
689
|
+
FMT_ASSERT(this != &other, "");
|
690
|
+
deallocate();
|
691
|
+
move(other);
|
692
|
+
return *this;
|
693
|
+
}
|
694
|
+
|
695
|
+
// Returns a copy of the allocator associated with this buffer.
|
696
|
+
Allocator get_allocator() const { return *this; }
|
697
|
+
};
|
698
|
+
|
699
|
+
template <typename T, std::size_t SIZE, typename Allocator>
|
700
|
+
void basic_memory_buffer<T, SIZE, Allocator>::grow(std::size_t size) {
|
701
|
+
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
702
|
+
if (size > 1000) throw std::runtime_error("fuzz mode - won't grow that much");
|
703
|
+
#endif
|
704
|
+
std::size_t old_capacity = this->capacity();
|
705
|
+
std::size_t new_capacity = old_capacity + old_capacity / 2;
|
706
|
+
if (size > new_capacity) new_capacity = size;
|
707
|
+
T* old_data = this->data();
|
708
|
+
T* new_data = std::allocator_traits<Allocator>::allocate(*this, new_capacity);
|
709
|
+
// The following code doesn't throw, so the raw pointer above doesn't leak.
|
710
|
+
std::uninitialized_copy(old_data, old_data + this->size(),
|
711
|
+
internal::make_checked(new_data, new_capacity));
|
712
|
+
this->set(new_data, new_capacity);
|
713
|
+
// deallocate must not throw according to the standard, but even if it does,
|
714
|
+
// the buffer already uses the new storage and will deallocate it in
|
715
|
+
// destructor.
|
716
|
+
if (old_data != store_) Allocator::deallocate(old_data, old_capacity);
|
717
|
+
}
|
718
|
+
|
719
|
+
using memory_buffer = basic_memory_buffer<char>;
|
720
|
+
using wmemory_buffer = basic_memory_buffer<wchar_t>;
|
721
|
+
|
722
|
+
/** A formatting error such as invalid format string. */
|
723
|
+
FMT_CLASS_API
|
724
|
+
class FMT_API format_error : public std::runtime_error {
|
725
|
+
public:
|
726
|
+
explicit format_error(const char* message) : std::runtime_error(message) {}
|
727
|
+
explicit format_error(const std::string& message)
|
728
|
+
: std::runtime_error(message) {}
|
729
|
+
format_error(const format_error&) = default;
|
730
|
+
format_error& operator=(const format_error&) = default;
|
731
|
+
format_error(format_error&&) = default;
|
732
|
+
format_error& operator=(format_error&&) = default;
|
733
|
+
~format_error() FMT_NOEXCEPT FMT_OVERRIDE;
|
734
|
+
};
|
735
|
+
|
736
|
+
namespace internal {
|
737
|
+
|
738
|
+
// Returns true if value is negative, false otherwise.
|
739
|
+
// Same as `value < 0` but doesn't produce warnings if T is an unsigned type.
|
740
|
+
template <typename T, FMT_ENABLE_IF(std::numeric_limits<T>::is_signed)>
|
741
|
+
FMT_CONSTEXPR bool is_negative(T value) {
|
742
|
+
return value < 0;
|
743
|
+
}
|
744
|
+
template <typename T, FMT_ENABLE_IF(!std::numeric_limits<T>::is_signed)>
|
745
|
+
FMT_CONSTEXPR bool is_negative(T) {
|
746
|
+
return false;
|
747
|
+
}
|
748
|
+
|
749
|
+
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
750
|
+
FMT_CONSTEXPR bool is_supported_floating_point(T) {
|
751
|
+
return (std::is_same<T, float>::value && FMT_USE_FLOAT) ||
|
752
|
+
(std::is_same<T, double>::value && FMT_USE_DOUBLE) ||
|
753
|
+
(std::is_same<T, long double>::value && FMT_USE_LONG_DOUBLE);
|
754
|
+
}
|
755
|
+
|
756
|
+
// Smallest of uint32_t, uint64_t, uint128_t that is large enough to
|
757
|
+
// represent all values of T.
|
758
|
+
template <typename T>
|
759
|
+
using uint32_or_64_or_128_t = conditional_t<
|
760
|
+
std::numeric_limits<T>::digits <= 32, uint32_t,
|
761
|
+
conditional_t<std::numeric_limits<T>::digits <= 64, uint64_t, uint128_t>>;
|
762
|
+
|
763
|
+
// Static data is placed in this class template for the header-only config.
|
764
|
+
template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
|
765
|
+
static const uint64_t powers_of_10_64[];
|
766
|
+
static const uint32_t zero_or_powers_of_10_32[];
|
767
|
+
static const uint64_t zero_or_powers_of_10_64[];
|
768
|
+
static const uint64_t pow10_significands[];
|
769
|
+
static const int16_t pow10_exponents[];
|
770
|
+
static const char digits[];
|
771
|
+
static const char hex_digits[];
|
772
|
+
static const char foreground_color[];
|
773
|
+
static const char background_color[];
|
774
|
+
static const char reset_color[5];
|
775
|
+
static const wchar_t wreset_color[5];
|
776
|
+
static const char signs[];
|
777
|
+
};
|
778
|
+
|
779
|
+
FMT_EXTERN template struct basic_data<void>;
|
780
|
+
|
781
|
+
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
|
782
|
+
struct data : basic_data<> {};
|
783
|
+
|
784
|
+
#ifdef FMT_BUILTIN_CLZLL
|
785
|
+
// Returns the number of decimal digits in n. Leading zeros are not counted
|
786
|
+
// except for n == 0 in which case count_digits returns 1.
|
787
|
+
inline int count_digits(uint64_t n) {
|
788
|
+
// Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
|
789
|
+
// and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits.
|
790
|
+
int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12;
|
791
|
+
return t - (n < data::zero_or_powers_of_10_64[t]) + 1;
|
792
|
+
}
|
793
|
+
#else
|
794
|
+
// Fallback version of count_digits used when __builtin_clz is not available.
|
795
|
+
inline int count_digits(uint64_t n) {
|
796
|
+
int count = 1;
|
797
|
+
for (;;) {
|
798
|
+
// Integer division is slow so do it for a group of four digits instead
|
799
|
+
// of for every digit. The idea comes from the talk by Alexandrescu
|
800
|
+
// "Three Optimization Tips for C++". See speed-test for a comparison.
|
801
|
+
if (n < 10) return count;
|
802
|
+
if (n < 100) return count + 1;
|
803
|
+
if (n < 1000) return count + 2;
|
804
|
+
if (n < 10000) return count + 3;
|
805
|
+
n /= 10000u;
|
806
|
+
count += 4;
|
807
|
+
}
|
808
|
+
}
|
809
|
+
#endif
|
810
|
+
|
811
|
+
#if FMT_USE_INT128
|
812
|
+
inline int count_digits(uint128_t n) {
|
813
|
+
int count = 1;
|
814
|
+
for (;;) {
|
815
|
+
// Integer division is slow so do it for a group of four digits instead
|
816
|
+
// of for every digit. The idea comes from the talk by Alexandrescu
|
817
|
+
// "Three Optimization Tips for C++". See speed-test for a comparison.
|
818
|
+
if (n < 10) return count;
|
819
|
+
if (n < 100) return count + 1;
|
820
|
+
if (n < 1000) return count + 2;
|
821
|
+
if (n < 10000) return count + 3;
|
822
|
+
n /= 10000U;
|
823
|
+
count += 4;
|
824
|
+
}
|
825
|
+
}
|
826
|
+
#endif
|
827
|
+
|
828
|
+
// Counts the number of digits in n. BITS = log2(radix).
|
829
|
+
template <unsigned BITS, typename UInt> inline int count_digits(UInt n) {
|
830
|
+
int num_digits = 0;
|
831
|
+
do {
|
832
|
+
++num_digits;
|
833
|
+
} while ((n >>= BITS) != 0);
|
834
|
+
return num_digits;
|
835
|
+
}
|
836
|
+
|
837
|
+
template <> int count_digits<4>(internal::fallback_uintptr n);
|
838
|
+
|
839
|
+
#if FMT_GCC_VERSION || FMT_CLANG_VERSION
|
840
|
+
# define FMT_ALWAYS_INLINE inline __attribute__((always_inline))
|
841
|
+
#else
|
842
|
+
# define FMT_ALWAYS_INLINE
|
843
|
+
#endif
|
844
|
+
|
845
|
+
#ifdef FMT_BUILTIN_CLZ
|
846
|
+
// Optional version of count_digits for better performance on 32-bit platforms.
|
847
|
+
inline int count_digits(uint32_t n) {
|
848
|
+
int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12;
|
849
|
+
return t - (n < data::zero_or_powers_of_10_32[t]) + 1;
|
850
|
+
}
|
851
|
+
#endif
|
852
|
+
|
853
|
+
template <typename Char> FMT_API std::string grouping_impl(locale_ref loc);
|
854
|
+
template <typename Char> inline std::string grouping(locale_ref loc) {
|
855
|
+
return grouping_impl<char>(loc);
|
856
|
+
}
|
857
|
+
template <> inline std::string grouping<wchar_t>(locale_ref loc) {
|
858
|
+
return grouping_impl<wchar_t>(loc);
|
859
|
+
}
|
860
|
+
|
861
|
+
template <typename Char> FMT_API Char thousands_sep_impl(locale_ref loc);
|
862
|
+
template <typename Char> inline Char thousands_sep(locale_ref loc) {
|
863
|
+
return Char(thousands_sep_impl<char>(loc));
|
864
|
+
}
|
865
|
+
template <> inline wchar_t thousands_sep(locale_ref loc) {
|
866
|
+
return thousands_sep_impl<wchar_t>(loc);
|
867
|
+
}
|
868
|
+
|
869
|
+
template <typename Char> FMT_API Char decimal_point_impl(locale_ref loc);
|
870
|
+
template <typename Char> inline Char decimal_point(locale_ref loc) {
|
871
|
+
return Char(decimal_point_impl<char>(loc));
|
872
|
+
}
|
873
|
+
template <> inline wchar_t decimal_point(locale_ref loc) {
|
874
|
+
return decimal_point_impl<wchar_t>(loc);
|
875
|
+
}
|
876
|
+
|
877
|
+
// Formats a decimal unsigned integer value writing into buffer.
|
878
|
+
// add_thousands_sep is called after writing each char to add a thousands
|
879
|
+
// separator if necessary.
|
880
|
+
template <typename UInt, typename Char, typename F>
|
881
|
+
inline Char* format_decimal(Char* buffer, UInt value, int num_digits,
|
882
|
+
F add_thousands_sep) {
|
883
|
+
FMT_ASSERT(num_digits >= 0, "invalid digit count");
|
884
|
+
buffer += num_digits;
|
885
|
+
Char* end = buffer;
|
886
|
+
while (value >= 100) {
|
887
|
+
// Integer division is slow so do it for a group of two digits instead
|
888
|
+
// of for every digit. The idea comes from the talk by Alexandrescu
|
889
|
+
// "Three Optimization Tips for C++". See speed-test for a comparison.
|
890
|
+
auto index = static_cast<unsigned>((value % 100) * 2);
|
891
|
+
value /= 100;
|
892
|
+
*--buffer = static_cast<Char>(data::digits[index + 1]);
|
893
|
+
add_thousands_sep(buffer);
|
894
|
+
*--buffer = static_cast<Char>(data::digits[index]);
|
895
|
+
add_thousands_sep(buffer);
|
896
|
+
}
|
897
|
+
if (value < 10) {
|
898
|
+
*--buffer = static_cast<Char>('0' + value);
|
899
|
+
return end;
|
900
|
+
}
|
901
|
+
auto index = static_cast<unsigned>(value * 2);
|
902
|
+
*--buffer = static_cast<Char>(data::digits[index + 1]);
|
903
|
+
add_thousands_sep(buffer);
|
904
|
+
*--buffer = static_cast<Char>(data::digits[index]);
|
905
|
+
return end;
|
906
|
+
}
|
907
|
+
|
908
|
+
template <typename Int> constexpr int digits10() FMT_NOEXCEPT {
|
909
|
+
return std::numeric_limits<Int>::digits10;
|
910
|
+
}
|
911
|
+
template <> constexpr int digits10<int128_t>() FMT_NOEXCEPT { return 38; }
|
912
|
+
template <> constexpr int digits10<uint128_t>() FMT_NOEXCEPT { return 38; }
|
913
|
+
|
914
|
+
template <typename Char, typename UInt, typename Iterator, typename F>
|
915
|
+
inline Iterator format_decimal(Iterator out, UInt value, int num_digits,
|
916
|
+
F add_thousands_sep) {
|
917
|
+
FMT_ASSERT(num_digits >= 0, "invalid digit count");
|
918
|
+
// Buffer should be large enough to hold all digits (<= digits10 + 1).
|
919
|
+
enum { max_size = digits10<UInt>() + 1 };
|
920
|
+
Char buffer[2 * max_size];
|
921
|
+
auto end = format_decimal(buffer, value, num_digits, add_thousands_sep);
|
922
|
+
return internal::copy_str<Char>(buffer, end, out);
|
923
|
+
}
|
924
|
+
|
925
|
+
template <typename Char, typename It, typename UInt>
|
926
|
+
inline It format_decimal(It out, UInt value, int num_digits) {
|
927
|
+
return format_decimal<Char>(out, value, num_digits, [](Char*) {});
|
928
|
+
}
|
929
|
+
|
930
|
+
template <unsigned BASE_BITS, typename Char, typename UInt>
|
931
|
+
inline Char* format_uint(Char* buffer, UInt value, int num_digits,
|
932
|
+
bool upper = false) {
|
933
|
+
buffer += num_digits;
|
934
|
+
Char* end = buffer;
|
935
|
+
do {
|
936
|
+
const char* digits = upper ? "0123456789ABCDEF" : data::hex_digits;
|
937
|
+
unsigned digit = (value & ((1 << BASE_BITS) - 1));
|
938
|
+
*--buffer = static_cast<Char>(BASE_BITS < 4 ? static_cast<char>('0' + digit)
|
939
|
+
: digits[digit]);
|
940
|
+
} while ((value >>= BASE_BITS) != 0);
|
941
|
+
return end;
|
942
|
+
}
|
943
|
+
|
944
|
+
template <unsigned BASE_BITS, typename Char>
|
945
|
+
Char* format_uint(Char* buffer, internal::fallback_uintptr n, int num_digits,
|
946
|
+
bool = false) {
|
947
|
+
auto char_digits = std::numeric_limits<unsigned char>::digits / 4;
|
948
|
+
int start = (num_digits + char_digits - 1) / char_digits - 1;
|
949
|
+
if (int start_digits = num_digits % char_digits) {
|
950
|
+
unsigned value = n.value[start--];
|
951
|
+
buffer = format_uint<BASE_BITS>(buffer, value, start_digits);
|
952
|
+
}
|
953
|
+
for (; start >= 0; --start) {
|
954
|
+
unsigned value = n.value[start];
|
955
|
+
buffer += char_digits;
|
956
|
+
auto p = buffer;
|
957
|
+
for (int i = 0; i < char_digits; ++i) {
|
958
|
+
unsigned digit = (value & ((1 << BASE_BITS) - 1));
|
959
|
+
*--p = static_cast<Char>(data::hex_digits[digit]);
|
960
|
+
value >>= BASE_BITS;
|
961
|
+
}
|
962
|
+
}
|
963
|
+
return buffer;
|
964
|
+
}
|
965
|
+
|
966
|
+
template <unsigned BASE_BITS, typename Char, typename It, typename UInt>
|
967
|
+
inline It format_uint(It out, UInt value, int num_digits, bool upper = false) {
|
968
|
+
// Buffer should be large enough to hold all digits (digits / BASE_BITS + 1).
|
969
|
+
char buffer[num_bits<UInt>() / BASE_BITS + 1];
|
970
|
+
format_uint<BASE_BITS>(buffer, value, num_digits, upper);
|
971
|
+
return internal::copy_str<Char>(buffer, buffer + num_digits, out);
|
972
|
+
}
|
973
|
+
|
974
|
+
// A converter from UTF-8 to UTF-16.
|
975
|
+
class utf8_to_utf16 {
|
976
|
+
private:
|
977
|
+
wmemory_buffer buffer_;
|
978
|
+
|
979
|
+
public:
|
980
|
+
FMT_API explicit utf8_to_utf16(string_view s);
|
981
|
+
operator wstring_view() const { return {&buffer_[0], size()}; }
|
982
|
+
size_t size() const { return buffer_.size() - 1; }
|
983
|
+
const wchar_t* c_str() const { return &buffer_[0]; }
|
984
|
+
std::wstring str() const { return {&buffer_[0], size()}; }
|
985
|
+
};
|
986
|
+
|
987
|
+
template <typename T = void> struct null {};
|
988
|
+
|
989
|
+
// Workaround an array initialization issue in gcc 4.8.
|
990
|
+
template <typename Char> struct fill_t {
|
991
|
+
private:
|
992
|
+
enum { max_size = 4 };
|
993
|
+
Char data_[max_size];
|
994
|
+
unsigned char size_;
|
995
|
+
|
996
|
+
public:
|
997
|
+
FMT_CONSTEXPR void operator=(basic_string_view<Char> s) {
|
998
|
+
auto size = s.size();
|
999
|
+
if (size > max_size) {
|
1000
|
+
FMT_THROW(format_error("invalid fill"));
|
1001
|
+
return;
|
1002
|
+
}
|
1003
|
+
for (size_t i = 0; i < size; ++i) data_[i] = s[i];
|
1004
|
+
size_ = static_cast<unsigned char>(size);
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
size_t size() const { return size_; }
|
1008
|
+
const Char* data() const { return data_; }
|
1009
|
+
|
1010
|
+
FMT_CONSTEXPR Char& operator[](size_t index) { return data_[index]; }
|
1011
|
+
FMT_CONSTEXPR const Char& operator[](size_t index) const {
|
1012
|
+
return data_[index];
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
static FMT_CONSTEXPR fill_t<Char> make() {
|
1016
|
+
auto fill = fill_t<Char>();
|
1017
|
+
fill[0] = Char(' ');
|
1018
|
+
fill.size_ = 1;
|
1019
|
+
return fill;
|
1020
|
+
}
|
1021
|
+
};
|
1022
|
+
} // namespace internal
|
1023
|
+
|
1024
|
+
// We cannot use enum classes as bit fields because of a gcc bug
|
1025
|
+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414.
|
1026
|
+
namespace align {
|
1027
|
+
enum type { none, left, right, center, numeric };
|
1028
|
+
}
|
1029
|
+
using align_t = align::type;
|
1030
|
+
|
1031
|
+
namespace sign {
|
1032
|
+
enum type { none, minus, plus, space };
|
1033
|
+
}
|
1034
|
+
using sign_t = sign::type;
|
1035
|
+
|
1036
|
+
// Format specifiers for built-in and string types.
|
1037
|
+
template <typename Char> struct basic_format_specs {
|
1038
|
+
int width;
|
1039
|
+
int precision;
|
1040
|
+
char type;
|
1041
|
+
align_t align : 4;
|
1042
|
+
sign_t sign : 3;
|
1043
|
+
bool alt : 1; // Alternate form ('#').
|
1044
|
+
internal::fill_t<Char> fill;
|
1045
|
+
|
1046
|
+
constexpr basic_format_specs()
|
1047
|
+
: width(0),
|
1048
|
+
precision(-1),
|
1049
|
+
type(0),
|
1050
|
+
align(align::none),
|
1051
|
+
sign(sign::none),
|
1052
|
+
alt(false),
|
1053
|
+
fill(internal::fill_t<Char>::make()) {}
|
1054
|
+
};
|
1055
|
+
|
1056
|
+
using format_specs = basic_format_specs<char>;
|
1057
|
+
|
1058
|
+
namespace internal {
|
1059
|
+
|
1060
|
+
// A floating-point presentation format.
|
1061
|
+
enum class float_format : unsigned char {
|
1062
|
+
general, // General: exponent notation or fixed point based on magnitude.
|
1063
|
+
exp, // Exponent notation with the default precision of 6, e.g. 1.2e-3.
|
1064
|
+
fixed, // Fixed point with the default precision of 6, e.g. 0.0012.
|
1065
|
+
hex
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
struct float_specs {
|
1069
|
+
int precision;
|
1070
|
+
float_format format : 8;
|
1071
|
+
sign_t sign : 8;
|
1072
|
+
bool upper : 1;
|
1073
|
+
bool locale : 1;
|
1074
|
+
bool percent : 1;
|
1075
|
+
bool binary32 : 1;
|
1076
|
+
bool use_grisu : 1;
|
1077
|
+
bool showpoint : 1;
|
1078
|
+
};
|
1079
|
+
|
1080
|
+
// Writes the exponent exp in the form "[+-]d{2,3}" to buffer.
|
1081
|
+
template <typename Char, typename It> It write_exponent(int exp, It it) {
|
1082
|
+
FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range");
|
1083
|
+
if (exp < 0) {
|
1084
|
+
*it++ = static_cast<Char>('-');
|
1085
|
+
exp = -exp;
|
1086
|
+
} else {
|
1087
|
+
*it++ = static_cast<Char>('+');
|
1088
|
+
}
|
1089
|
+
if (exp >= 100) {
|
1090
|
+
const char* top = data::digits + (exp / 100) * 2;
|
1091
|
+
if (exp >= 1000) *it++ = static_cast<Char>(top[0]);
|
1092
|
+
*it++ = static_cast<Char>(top[1]);
|
1093
|
+
exp %= 100;
|
1094
|
+
}
|
1095
|
+
const char* d = data::digits + exp * 2;
|
1096
|
+
*it++ = static_cast<Char>(d[0]);
|
1097
|
+
*it++ = static_cast<Char>(d[1]);
|
1098
|
+
return it;
|
1099
|
+
}
|
1100
|
+
|
1101
|
+
template <typename Char> class float_writer {
|
1102
|
+
private:
|
1103
|
+
// The number is given as v = digits_ * pow(10, exp_).
|
1104
|
+
const char* digits_;
|
1105
|
+
int num_digits_;
|
1106
|
+
int exp_;
|
1107
|
+
size_t size_;
|
1108
|
+
float_specs specs_;
|
1109
|
+
Char decimal_point_;
|
1110
|
+
|
1111
|
+
template <typename It> It prettify(It it) const {
|
1112
|
+
// pow(10, full_exp - 1) <= v <= pow(10, full_exp).
|
1113
|
+
int full_exp = num_digits_ + exp_;
|
1114
|
+
if (specs_.format == float_format::exp) {
|
1115
|
+
// Insert a decimal point after the first digit and add an exponent.
|
1116
|
+
*it++ = static_cast<Char>(*digits_);
|
1117
|
+
int num_zeros = specs_.precision - num_digits_;
|
1118
|
+
if (num_digits_ > 1 || specs_.showpoint) *it++ = decimal_point_;
|
1119
|
+
it = copy_str<Char>(digits_ + 1, digits_ + num_digits_, it);
|
1120
|
+
if (num_zeros > 0 && specs_.showpoint)
|
1121
|
+
it = std::fill_n(it, num_zeros, static_cast<Char>('0'));
|
1122
|
+
*it++ = static_cast<Char>(specs_.upper ? 'E' : 'e');
|
1123
|
+
return write_exponent<Char>(full_exp - 1, it);
|
1124
|
+
}
|
1125
|
+
if (num_digits_ <= full_exp) {
|
1126
|
+
// 1234e7 -> 12340000000[.0+]
|
1127
|
+
it = copy_str<Char>(digits_, digits_ + num_digits_, it);
|
1128
|
+
it = std::fill_n(it, full_exp - num_digits_, static_cast<Char>('0'));
|
1129
|
+
if (specs_.showpoint || specs_.precision < 0) {
|
1130
|
+
*it++ = decimal_point_;
|
1131
|
+
int num_zeros = specs_.precision - full_exp;
|
1132
|
+
if (num_zeros <= 0) {
|
1133
|
+
if (specs_.format != float_format::fixed)
|
1134
|
+
*it++ = static_cast<Char>('0');
|
1135
|
+
return it;
|
1136
|
+
}
|
1137
|
+
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
1138
|
+
if (num_zeros > 1000)
|
1139
|
+
throw std::runtime_error("fuzz mode - avoiding excessive cpu use");
|
1140
|
+
#endif
|
1141
|
+
it = std::fill_n(it, num_zeros, static_cast<Char>('0'));
|
1142
|
+
}
|
1143
|
+
} else if (full_exp > 0) {
|
1144
|
+
// 1234e-2 -> 12.34[0+]
|
1145
|
+
it = copy_str<Char>(digits_, digits_ + full_exp, it);
|
1146
|
+
if (!specs_.showpoint) {
|
1147
|
+
// Remove trailing zeros.
|
1148
|
+
int num_digits = num_digits_;
|
1149
|
+
while (num_digits > full_exp && digits_[num_digits - 1] == '0')
|
1150
|
+
--num_digits;
|
1151
|
+
if (num_digits != full_exp) *it++ = decimal_point_;
|
1152
|
+
return copy_str<Char>(digits_ + full_exp, digits_ + num_digits, it);
|
1153
|
+
}
|
1154
|
+
*it++ = decimal_point_;
|
1155
|
+
it = copy_str<Char>(digits_ + full_exp, digits_ + num_digits_, it);
|
1156
|
+
if (specs_.precision > num_digits_) {
|
1157
|
+
// Add trailing zeros.
|
1158
|
+
int num_zeros = specs_.precision - num_digits_;
|
1159
|
+
it = std::fill_n(it, num_zeros, static_cast<Char>('0'));
|
1160
|
+
}
|
1161
|
+
} else {
|
1162
|
+
// 1234e-6 -> 0.001234
|
1163
|
+
*it++ = static_cast<Char>('0');
|
1164
|
+
int num_zeros = -full_exp;
|
1165
|
+
int num_digits = num_digits_;
|
1166
|
+
if (num_digits == 0 && specs_.precision >= 0 &&
|
1167
|
+
specs_.precision < num_zeros) {
|
1168
|
+
num_zeros = specs_.precision;
|
1169
|
+
}
|
1170
|
+
// Remove trailing zeros.
|
1171
|
+
if (!specs_.showpoint)
|
1172
|
+
while (num_digits > 0 && digits_[num_digits - 1] == '0') --num_digits;
|
1173
|
+
if (num_zeros != 0 || num_digits != 0 || specs_.showpoint) {
|
1174
|
+
*it++ = decimal_point_;
|
1175
|
+
it = std::fill_n(it, num_zeros, static_cast<Char>('0'));
|
1176
|
+
it = copy_str<Char>(digits_, digits_ + num_digits, it);
|
1177
|
+
}
|
1178
|
+
}
|
1179
|
+
return it;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
public:
|
1183
|
+
float_writer(const char* digits, int num_digits, int exp, float_specs specs,
|
1184
|
+
Char decimal_point)
|
1185
|
+
: digits_(digits),
|
1186
|
+
num_digits_(num_digits),
|
1187
|
+
exp_(exp),
|
1188
|
+
specs_(specs),
|
1189
|
+
decimal_point_(decimal_point) {
|
1190
|
+
int full_exp = num_digits + exp - 1;
|
1191
|
+
int precision = specs.precision > 0 ? specs.precision : 16;
|
1192
|
+
if (specs_.format == float_format::general &&
|
1193
|
+
!(full_exp >= -4 && full_exp < precision)) {
|
1194
|
+
specs_.format = float_format::exp;
|
1195
|
+
}
|
1196
|
+
size_ = prettify(counting_iterator()).count();
|
1197
|
+
size_ += specs.sign ? 1 : 0;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
size_t size() const { return size_; }
|
1201
|
+
size_t width() const { return size(); }
|
1202
|
+
|
1203
|
+
template <typename It> void operator()(It&& it) {
|
1204
|
+
if (specs_.sign) *it++ = static_cast<Char>(data::signs[specs_.sign]);
|
1205
|
+
it = prettify(it);
|
1206
|
+
}
|
1207
|
+
};
|
1208
|
+
|
1209
|
+
template <typename T>
|
1210
|
+
int format_float(T value, int precision, float_specs specs, buffer<char>& buf);
|
1211
|
+
|
1212
|
+
// Formats a floating-point number with snprintf.
|
1213
|
+
template <typename T>
|
1214
|
+
int snprintf_float(T value, int precision, float_specs specs,
|
1215
|
+
buffer<char>& buf);
|
1216
|
+
|
1217
|
+
template <typename T> T promote_float(T value) { return value; }
|
1218
|
+
inline double promote_float(float value) { return static_cast<double>(value); }
|
1219
|
+
|
1220
|
+
template <typename Handler>
|
1221
|
+
FMT_CONSTEXPR void handle_int_type_spec(char spec, Handler&& handler) {
|
1222
|
+
switch (spec) {
|
1223
|
+
case 0:
|
1224
|
+
case 'd':
|
1225
|
+
handler.on_dec();
|
1226
|
+
break;
|
1227
|
+
case 'x':
|
1228
|
+
case 'X':
|
1229
|
+
handler.on_hex();
|
1230
|
+
break;
|
1231
|
+
case 'b':
|
1232
|
+
case 'B':
|
1233
|
+
handler.on_bin();
|
1234
|
+
break;
|
1235
|
+
case 'o':
|
1236
|
+
handler.on_oct();
|
1237
|
+
break;
|
1238
|
+
case 'n':
|
1239
|
+
case 'L':
|
1240
|
+
handler.on_num();
|
1241
|
+
break;
|
1242
|
+
default:
|
1243
|
+
handler.on_error();
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
template <typename ErrorHandler = error_handler, typename Char>
|
1248
|
+
FMT_CONSTEXPR float_specs parse_float_type_spec(
|
1249
|
+
const basic_format_specs<Char>& specs, ErrorHandler&& eh = {}) {
|
1250
|
+
auto result = float_specs();
|
1251
|
+
result.showpoint = specs.alt;
|
1252
|
+
switch (specs.type) {
|
1253
|
+
case 0:
|
1254
|
+
result.format = float_format::general;
|
1255
|
+
result.showpoint |= specs.precision > 0;
|
1256
|
+
break;
|
1257
|
+
case 'G':
|
1258
|
+
result.upper = true;
|
1259
|
+
FMT_FALLTHROUGH;
|
1260
|
+
case 'g':
|
1261
|
+
result.format = float_format::general;
|
1262
|
+
break;
|
1263
|
+
case 'E':
|
1264
|
+
result.upper = true;
|
1265
|
+
FMT_FALLTHROUGH;
|
1266
|
+
case 'e':
|
1267
|
+
result.format = float_format::exp;
|
1268
|
+
result.showpoint |= specs.precision != 0;
|
1269
|
+
break;
|
1270
|
+
case 'F':
|
1271
|
+
result.upper = true;
|
1272
|
+
FMT_FALLTHROUGH;
|
1273
|
+
case 'f':
|
1274
|
+
result.format = float_format::fixed;
|
1275
|
+
result.showpoint |= specs.precision != 0;
|
1276
|
+
break;
|
1277
|
+
#if FMT_DEPRECATED_PERCENT
|
1278
|
+
case '%':
|
1279
|
+
result.format = float_format::fixed;
|
1280
|
+
result.percent = true;
|
1281
|
+
break;
|
1282
|
+
#endif
|
1283
|
+
case 'A':
|
1284
|
+
result.upper = true;
|
1285
|
+
FMT_FALLTHROUGH;
|
1286
|
+
case 'a':
|
1287
|
+
result.format = float_format::hex;
|
1288
|
+
break;
|
1289
|
+
case 'n':
|
1290
|
+
result.locale = true;
|
1291
|
+
break;
|
1292
|
+
default:
|
1293
|
+
eh.on_error("invalid type specifier");
|
1294
|
+
break;
|
1295
|
+
}
|
1296
|
+
return result;
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
template <typename Char, typename Handler>
|
1300
|
+
FMT_CONSTEXPR void handle_char_specs(const basic_format_specs<Char>* specs,
|
1301
|
+
Handler&& handler) {
|
1302
|
+
if (!specs) return handler.on_char();
|
1303
|
+
if (specs->type && specs->type != 'c') return handler.on_int();
|
1304
|
+
if (specs->align == align::numeric || specs->sign != sign::none || specs->alt)
|
1305
|
+
handler.on_error("invalid format specifier for char");
|
1306
|
+
handler.on_char();
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
template <typename Char, typename Handler>
|
1310
|
+
FMT_CONSTEXPR void handle_cstring_type_spec(Char spec, Handler&& handler) {
|
1311
|
+
if (spec == 0 || spec == 's')
|
1312
|
+
handler.on_string();
|
1313
|
+
else if (spec == 'p')
|
1314
|
+
handler.on_pointer();
|
1315
|
+
else
|
1316
|
+
handler.on_error("invalid type specifier");
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
template <typename Char, typename ErrorHandler>
|
1320
|
+
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler&& eh) {
|
1321
|
+
if (spec != 0 && spec != 's') eh.on_error("invalid type specifier");
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
template <typename Char, typename ErrorHandler>
|
1325
|
+
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler&& eh) {
|
1326
|
+
if (spec != 0 && spec != 'p') eh.on_error("invalid type specifier");
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
template <typename ErrorHandler> class int_type_checker : private ErrorHandler {
|
1330
|
+
public:
|
1331
|
+
FMT_CONSTEXPR explicit int_type_checker(ErrorHandler eh) : ErrorHandler(eh) {}
|
1332
|
+
|
1333
|
+
FMT_CONSTEXPR void on_dec() {}
|
1334
|
+
FMT_CONSTEXPR void on_hex() {}
|
1335
|
+
FMT_CONSTEXPR void on_bin() {}
|
1336
|
+
FMT_CONSTEXPR void on_oct() {}
|
1337
|
+
FMT_CONSTEXPR void on_num() {}
|
1338
|
+
|
1339
|
+
FMT_CONSTEXPR void on_error() {
|
1340
|
+
ErrorHandler::on_error("invalid type specifier");
|
1341
|
+
}
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
template <typename ErrorHandler>
|
1345
|
+
class char_specs_checker : public ErrorHandler {
|
1346
|
+
private:
|
1347
|
+
char type_;
|
1348
|
+
|
1349
|
+
public:
|
1350
|
+
FMT_CONSTEXPR char_specs_checker(char type, ErrorHandler eh)
|
1351
|
+
: ErrorHandler(eh), type_(type) {}
|
1352
|
+
|
1353
|
+
FMT_CONSTEXPR void on_int() {
|
1354
|
+
handle_int_type_spec(type_, int_type_checker<ErrorHandler>(*this));
|
1355
|
+
}
|
1356
|
+
FMT_CONSTEXPR void on_char() {}
|
1357
|
+
};
|
1358
|
+
|
1359
|
+
template <typename ErrorHandler>
|
1360
|
+
class cstring_type_checker : public ErrorHandler {
|
1361
|
+
public:
|
1362
|
+
FMT_CONSTEXPR explicit cstring_type_checker(ErrorHandler eh)
|
1363
|
+
: ErrorHandler(eh) {}
|
1364
|
+
|
1365
|
+
FMT_CONSTEXPR void on_string() {}
|
1366
|
+
FMT_CONSTEXPR void on_pointer() {}
|
1367
|
+
};
|
1368
|
+
|
1369
|
+
template <typename Context>
|
1370
|
+
void arg_map<Context>::init(const basic_format_args<Context>& args) {
|
1371
|
+
if (map_) return;
|
1372
|
+
map_ = new entry[internal::to_unsigned(args.max_size())];
|
1373
|
+
if (args.is_packed()) {
|
1374
|
+
for (int i = 0;; ++i) {
|
1375
|
+
internal::type arg_type = args.type(i);
|
1376
|
+
if (arg_type == internal::type::none_type) return;
|
1377
|
+
if (arg_type == internal::type::named_arg_type)
|
1378
|
+
push_back(args.values_[i]);
|
1379
|
+
}
|
1380
|
+
}
|
1381
|
+
for (int i = 0, n = args.max_size(); i < n; ++i) {
|
1382
|
+
auto type = args.args_[i].type_;
|
1383
|
+
if (type == internal::type::named_arg_type) push_back(args.args_[i].value_);
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
template <typename Char> struct nonfinite_writer {
|
1388
|
+
sign_t sign;
|
1389
|
+
const char* str;
|
1390
|
+
static constexpr size_t str_size = 3;
|
1391
|
+
|
1392
|
+
size_t size() const { return str_size + (sign ? 1 : 0); }
|
1393
|
+
size_t width() const { return size(); }
|
1394
|
+
|
1395
|
+
template <typename It> void operator()(It&& it) const {
|
1396
|
+
if (sign) *it++ = static_cast<Char>(data::signs[sign]);
|
1397
|
+
it = copy_str<Char>(str, str + str_size, it);
|
1398
|
+
}
|
1399
|
+
};
|
1400
|
+
|
1401
|
+
template <typename OutputIt, typename Char>
|
1402
|
+
FMT_NOINLINE OutputIt fill(OutputIt it, size_t n, const fill_t<Char>& fill) {
|
1403
|
+
auto fill_size = fill.size();
|
1404
|
+
if (fill_size == 1) return std::fill_n(it, n, fill[0]);
|
1405
|
+
for (size_t i = 0; i < n; ++i) it = std::copy_n(fill.data(), fill_size, it);
|
1406
|
+
return it;
|
1407
|
+
}
|
1408
|
+
|
1409
|
+
// This template provides operations for formatting and writing data into a
|
1410
|
+
// character range.
|
1411
|
+
template <typename Range> class basic_writer {
|
1412
|
+
public:
|
1413
|
+
using char_type = typename Range::value_type;
|
1414
|
+
using iterator = typename Range::iterator;
|
1415
|
+
using format_specs = basic_format_specs<char_type>;
|
1416
|
+
|
1417
|
+
private:
|
1418
|
+
iterator out_; // Output iterator.
|
1419
|
+
locale_ref locale_;
|
1420
|
+
|
1421
|
+
// Attempts to reserve space for n extra characters in the output range.
|
1422
|
+
// Returns a pointer to the reserved range or a reference to out_.
|
1423
|
+
auto reserve(std::size_t n) -> decltype(internal::reserve(out_, n)) {
|
1424
|
+
return internal::reserve(out_, n);
|
1425
|
+
}
|
1426
|
+
|
1427
|
+
template <typename F> struct padded_int_writer {
|
1428
|
+
size_t size_;
|
1429
|
+
string_view prefix;
|
1430
|
+
char_type fill;
|
1431
|
+
std::size_t padding;
|
1432
|
+
F f;
|
1433
|
+
|
1434
|
+
size_t size() const { return size_; }
|
1435
|
+
size_t width() const { return size_; }
|
1436
|
+
|
1437
|
+
template <typename It> void operator()(It&& it) const {
|
1438
|
+
if (prefix.size() != 0)
|
1439
|
+
it = copy_str<char_type>(prefix.begin(), prefix.end(), it);
|
1440
|
+
it = std::fill_n(it, padding, fill);
|
1441
|
+
f(it);
|
1442
|
+
}
|
1443
|
+
};
|
1444
|
+
|
1445
|
+
// Writes an integer in the format
|
1446
|
+
// <left-padding><prefix><numeric-padding><digits><right-padding>
|
1447
|
+
// where <digits> are written by f(it).
|
1448
|
+
template <typename F>
|
1449
|
+
void write_int(int num_digits, string_view prefix, format_specs specs, F f) {
|
1450
|
+
std::size_t size = prefix.size() + to_unsigned(num_digits);
|
1451
|
+
char_type fill = specs.fill[0];
|
1452
|
+
std::size_t padding = 0;
|
1453
|
+
if (specs.align == align::numeric) {
|
1454
|
+
auto unsiged_width = to_unsigned(specs.width);
|
1455
|
+
if (unsiged_width > size) {
|
1456
|
+
padding = unsiged_width - size;
|
1457
|
+
size = unsiged_width;
|
1458
|
+
}
|
1459
|
+
} else if (specs.precision > num_digits) {
|
1460
|
+
size = prefix.size() + to_unsigned(specs.precision);
|
1461
|
+
padding = to_unsigned(specs.precision - num_digits);
|
1462
|
+
fill = static_cast<char_type>('0');
|
1463
|
+
}
|
1464
|
+
if (specs.align == align::none) specs.align = align::right;
|
1465
|
+
write_padded(specs, padded_int_writer<F>{size, prefix, fill, padding, f});
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
// Writes a decimal integer.
|
1469
|
+
template <typename Int> void write_decimal(Int value) {
|
1470
|
+
auto abs_value = static_cast<uint32_or_64_or_128_t<Int>>(value);
|
1471
|
+
bool negative = is_negative(value);
|
1472
|
+
// Don't do -abs_value since it trips unsigned-integer-overflow sanitizer.
|
1473
|
+
if (negative) abs_value = ~abs_value + 1;
|
1474
|
+
int num_digits = count_digits(abs_value);
|
1475
|
+
auto&& it = reserve((negative ? 1 : 0) + static_cast<size_t>(num_digits));
|
1476
|
+
if (negative) *it++ = static_cast<char_type>('-');
|
1477
|
+
it = format_decimal<char_type>(it, abs_value, num_digits);
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
// The handle_int_type_spec handler that writes an integer.
|
1481
|
+
template <typename Int, typename Specs> struct int_writer {
|
1482
|
+
using unsigned_type = uint32_or_64_or_128_t<Int>;
|
1483
|
+
|
1484
|
+
basic_writer<Range>& writer;
|
1485
|
+
const Specs& specs;
|
1486
|
+
unsigned_type abs_value;
|
1487
|
+
char prefix[4];
|
1488
|
+
unsigned prefix_size;
|
1489
|
+
|
1490
|
+
string_view get_prefix() const { return string_view(prefix, prefix_size); }
|
1491
|
+
|
1492
|
+
int_writer(basic_writer<Range>& w, Int value, const Specs& s)
|
1493
|
+
: writer(w),
|
1494
|
+
specs(s),
|
1495
|
+
abs_value(static_cast<unsigned_type>(value)),
|
1496
|
+
prefix_size(0) {
|
1497
|
+
if (is_negative(value)) {
|
1498
|
+
prefix[0] = '-';
|
1499
|
+
++prefix_size;
|
1500
|
+
abs_value = 0 - abs_value;
|
1501
|
+
} else if (specs.sign != sign::none && specs.sign != sign::minus) {
|
1502
|
+
prefix[0] = specs.sign == sign::plus ? '+' : ' ';
|
1503
|
+
++prefix_size;
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
|
1507
|
+
struct dec_writer {
|
1508
|
+
unsigned_type abs_value;
|
1509
|
+
int num_digits;
|
1510
|
+
|
1511
|
+
template <typename It> void operator()(It&& it) const {
|
1512
|
+
it = internal::format_decimal<char_type>(it, abs_value, num_digits);
|
1513
|
+
}
|
1514
|
+
};
|
1515
|
+
|
1516
|
+
void on_dec() {
|
1517
|
+
int num_digits = count_digits(abs_value);
|
1518
|
+
writer.write_int(num_digits, get_prefix(), specs,
|
1519
|
+
dec_writer{abs_value, num_digits});
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
struct hex_writer {
|
1523
|
+
int_writer& self;
|
1524
|
+
int num_digits;
|
1525
|
+
|
1526
|
+
template <typename It> void operator()(It&& it) const {
|
1527
|
+
it = format_uint<4, char_type>(it, self.abs_value, num_digits,
|
1528
|
+
self.specs.type != 'x');
|
1529
|
+
}
|
1530
|
+
};
|
1531
|
+
|
1532
|
+
void on_hex() {
|
1533
|
+
if (specs.alt) {
|
1534
|
+
prefix[prefix_size++] = '0';
|
1535
|
+
prefix[prefix_size++] = specs.type;
|
1536
|
+
}
|
1537
|
+
int num_digits = count_digits<4>(abs_value);
|
1538
|
+
writer.write_int(num_digits, get_prefix(), specs,
|
1539
|
+
hex_writer{*this, num_digits});
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
template <int BITS> struct bin_writer {
|
1543
|
+
unsigned_type abs_value;
|
1544
|
+
int num_digits;
|
1545
|
+
|
1546
|
+
template <typename It> void operator()(It&& it) const {
|
1547
|
+
it = format_uint<BITS, char_type>(it, abs_value, num_digits);
|
1548
|
+
}
|
1549
|
+
};
|
1550
|
+
|
1551
|
+
void on_bin() {
|
1552
|
+
if (specs.alt) {
|
1553
|
+
prefix[prefix_size++] = '0';
|
1554
|
+
prefix[prefix_size++] = static_cast<char>(specs.type);
|
1555
|
+
}
|
1556
|
+
int num_digits = count_digits<1>(abs_value);
|
1557
|
+
writer.write_int(num_digits, get_prefix(), specs,
|
1558
|
+
bin_writer<1>{abs_value, num_digits});
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
void on_oct() {
|
1562
|
+
int num_digits = count_digits<3>(abs_value);
|
1563
|
+
if (specs.alt && specs.precision <= num_digits && abs_value != 0) {
|
1564
|
+
// Octal prefix '0' is counted as a digit, so only add it if precision
|
1565
|
+
// is not greater than the number of digits.
|
1566
|
+
prefix[prefix_size++] = '0';
|
1567
|
+
}
|
1568
|
+
writer.write_int(num_digits, get_prefix(), specs,
|
1569
|
+
bin_writer<3>{abs_value, num_digits});
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
enum { sep_size = 1 };
|
1573
|
+
|
1574
|
+
struct num_writer {
|
1575
|
+
unsigned_type abs_value;
|
1576
|
+
int size;
|
1577
|
+
const std::string& groups;
|
1578
|
+
char_type sep;
|
1579
|
+
|
1580
|
+
template <typename It> void operator()(It&& it) const {
|
1581
|
+
basic_string_view<char_type> s(&sep, sep_size);
|
1582
|
+
// Index of a decimal digit with the least significant digit having
|
1583
|
+
// index 0.
|
1584
|
+
int digit_index = 0;
|
1585
|
+
std::string::const_iterator group = groups.cbegin();
|
1586
|
+
it = format_decimal<char_type>(
|
1587
|
+
it, abs_value, size,
|
1588
|
+
[this, s, &group, &digit_index](char_type*& buffer) {
|
1589
|
+
if (*group <= 0 || ++digit_index % *group != 0 ||
|
1590
|
+
*group == max_value<char>())
|
1591
|
+
return;
|
1592
|
+
if (group + 1 != groups.cend()) {
|
1593
|
+
digit_index = 0;
|
1594
|
+
++group;
|
1595
|
+
}
|
1596
|
+
buffer -= s.size();
|
1597
|
+
std::uninitialized_copy(s.data(), s.data() + s.size(),
|
1598
|
+
make_checked(buffer, s.size()));
|
1599
|
+
});
|
1600
|
+
}
|
1601
|
+
};
|
1602
|
+
|
1603
|
+
void on_num() {
|
1604
|
+
std::string groups = grouping<char_type>(writer.locale_);
|
1605
|
+
if (groups.empty()) return on_dec();
|
1606
|
+
auto sep = thousands_sep<char_type>(writer.locale_);
|
1607
|
+
if (!sep) return on_dec();
|
1608
|
+
int num_digits = count_digits(abs_value);
|
1609
|
+
int size = num_digits;
|
1610
|
+
std::string::const_iterator group = groups.cbegin();
|
1611
|
+
while (group != groups.cend() && num_digits > *group && *group > 0 &&
|
1612
|
+
*group != max_value<char>()) {
|
1613
|
+
size += sep_size;
|
1614
|
+
num_digits -= *group;
|
1615
|
+
++group;
|
1616
|
+
}
|
1617
|
+
if (group == groups.cend())
|
1618
|
+
size += sep_size * ((num_digits - 1) / groups.back());
|
1619
|
+
writer.write_int(size, get_prefix(), specs,
|
1620
|
+
num_writer{abs_value, size, groups, sep});
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
FMT_NORETURN void on_error() {
|
1624
|
+
FMT_THROW(format_error("invalid type specifier"));
|
1625
|
+
}
|
1626
|
+
};
|
1627
|
+
|
1628
|
+
template <typename Char> struct str_writer {
|
1629
|
+
const Char* s;
|
1630
|
+
size_t size_;
|
1631
|
+
|
1632
|
+
size_t size() const { return size_; }
|
1633
|
+
size_t width() const {
|
1634
|
+
return count_code_points(basic_string_view<Char>(s, size_));
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
template <typename It> void operator()(It&& it) const {
|
1638
|
+
it = copy_str<char_type>(s, s + size_, it);
|
1639
|
+
}
|
1640
|
+
};
|
1641
|
+
|
1642
|
+
struct bytes_writer {
|
1643
|
+
string_view bytes;
|
1644
|
+
|
1645
|
+
size_t size() const { return bytes.size(); }
|
1646
|
+
size_t width() const { return bytes.size(); }
|
1647
|
+
|
1648
|
+
template <typename It> void operator()(It&& it) const {
|
1649
|
+
const char* data = bytes.data();
|
1650
|
+
it = copy_str<char>(data, data + size(), it);
|
1651
|
+
}
|
1652
|
+
};
|
1653
|
+
|
1654
|
+
template <typename UIntPtr> struct pointer_writer {
|
1655
|
+
UIntPtr value;
|
1656
|
+
int num_digits;
|
1657
|
+
|
1658
|
+
size_t size() const { return to_unsigned(num_digits) + 2; }
|
1659
|
+
size_t width() const { return size(); }
|
1660
|
+
|
1661
|
+
template <typename It> void operator()(It&& it) const {
|
1662
|
+
*it++ = static_cast<char_type>('0');
|
1663
|
+
*it++ = static_cast<char_type>('x');
|
1664
|
+
it = format_uint<4, char_type>(it, value, num_digits);
|
1665
|
+
}
|
1666
|
+
};
|
1667
|
+
|
1668
|
+
public:
|
1669
|
+
explicit basic_writer(Range out, locale_ref loc = locale_ref())
|
1670
|
+
: out_(out.begin()), locale_(loc) {}
|
1671
|
+
|
1672
|
+
iterator out() const { return out_; }
|
1673
|
+
|
1674
|
+
// Writes a value in the format
|
1675
|
+
// <left-padding><value><right-padding>
|
1676
|
+
// where <value> is written by f(it).
|
1677
|
+
template <typename F> void write_padded(const format_specs& specs, F&& f) {
|
1678
|
+
// User-perceived width (in code points).
|
1679
|
+
unsigned width = to_unsigned(specs.width);
|
1680
|
+
size_t size = f.size(); // The number of code units.
|
1681
|
+
size_t num_code_points = width != 0 ? f.width() : size;
|
1682
|
+
if (width <= num_code_points) return f(reserve(size));
|
1683
|
+
size_t padding = width - num_code_points;
|
1684
|
+
size_t fill_size = specs.fill.size();
|
1685
|
+
auto&& it = reserve(size + padding * fill_size);
|
1686
|
+
if (specs.align == align::right) {
|
1687
|
+
it = fill(it, padding, specs.fill);
|
1688
|
+
f(it);
|
1689
|
+
} else if (specs.align == align::center) {
|
1690
|
+
std::size_t left_padding = padding / 2;
|
1691
|
+
it = fill(it, left_padding, specs.fill);
|
1692
|
+
f(it);
|
1693
|
+
it = fill(it, padding - left_padding, specs.fill);
|
1694
|
+
} else {
|
1695
|
+
f(it);
|
1696
|
+
it = fill(it, padding, specs.fill);
|
1697
|
+
}
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
void write(int value) { write_decimal(value); }
|
1701
|
+
void write(long value) { write_decimal(value); }
|
1702
|
+
void write(long long value) { write_decimal(value); }
|
1703
|
+
|
1704
|
+
void write(unsigned value) { write_decimal(value); }
|
1705
|
+
void write(unsigned long value) { write_decimal(value); }
|
1706
|
+
void write(unsigned long long value) { write_decimal(value); }
|
1707
|
+
|
1708
|
+
#if FMT_USE_INT128
|
1709
|
+
void write(int128_t value) { write_decimal(value); }
|
1710
|
+
void write(uint128_t value) { write_decimal(value); }
|
1711
|
+
#endif
|
1712
|
+
|
1713
|
+
template <typename T, typename Spec>
|
1714
|
+
void write_int(T value, const Spec& spec) {
|
1715
|
+
handle_int_type_spec(spec.type, int_writer<T, Spec>(*this, value, spec));
|
1716
|
+
}
|
1717
|
+
|
1718
|
+
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
1719
|
+
void write(T value, format_specs specs = {}) {
|
1720
|
+
if (const_check(!is_supported_floating_point(value))) {
|
1721
|
+
return;
|
1722
|
+
}
|
1723
|
+
float_specs fspecs = parse_float_type_spec(specs);
|
1724
|
+
fspecs.sign = specs.sign;
|
1725
|
+
if (std::signbit(value)) { // value < 0 is false for NaN so use signbit.
|
1726
|
+
fspecs.sign = sign::minus;
|
1727
|
+
value = -value;
|
1728
|
+
} else if (fspecs.sign == sign::minus) {
|
1729
|
+
fspecs.sign = sign::none;
|
1730
|
+
}
|
1731
|
+
|
1732
|
+
if (!std::isfinite(value)) {
|
1733
|
+
auto str = std::isinf(value) ? (fspecs.upper ? "INF" : "inf")
|
1734
|
+
: (fspecs.upper ? "NAN" : "nan");
|
1735
|
+
return write_padded(specs, nonfinite_writer<char_type>{fspecs.sign, str});
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
if (specs.align == align::none) {
|
1739
|
+
specs.align = align::right;
|
1740
|
+
} else if (specs.align == align::numeric) {
|
1741
|
+
if (fspecs.sign) {
|
1742
|
+
auto&& it = reserve(1);
|
1743
|
+
*it++ = static_cast<char_type>(data::signs[fspecs.sign]);
|
1744
|
+
fspecs.sign = sign::none;
|
1745
|
+
if (specs.width != 0) --specs.width;
|
1746
|
+
}
|
1747
|
+
specs.align = align::right;
|
1748
|
+
}
|
1749
|
+
|
1750
|
+
memory_buffer buffer;
|
1751
|
+
if (fspecs.format == float_format::hex) {
|
1752
|
+
if (fspecs.sign) buffer.push_back(data::signs[fspecs.sign]);
|
1753
|
+
snprintf_float(promote_float(value), specs.precision, fspecs, buffer);
|
1754
|
+
write_padded(specs, str_writer<char>{buffer.data(), buffer.size()});
|
1755
|
+
return;
|
1756
|
+
}
|
1757
|
+
int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6;
|
1758
|
+
if (fspecs.format == float_format::exp) {
|
1759
|
+
if (precision == max_value<int>())
|
1760
|
+
FMT_THROW(format_error("number is too big"));
|
1761
|
+
else
|
1762
|
+
++precision;
|
1763
|
+
}
|
1764
|
+
if (const_check(std::is_same<T, float>())) fspecs.binary32 = true;
|
1765
|
+
fspecs.use_grisu = use_grisu<T>();
|
1766
|
+
if (const_check(FMT_DEPRECATED_PERCENT) && fspecs.percent) value *= 100;
|
1767
|
+
int exp = format_float(promote_float(value), precision, fspecs, buffer);
|
1768
|
+
if (const_check(FMT_DEPRECATED_PERCENT) && fspecs.percent) {
|
1769
|
+
buffer.push_back('%');
|
1770
|
+
--exp; // Adjust decimal place position.
|
1771
|
+
}
|
1772
|
+
fspecs.precision = precision;
|
1773
|
+
char_type point = fspecs.locale ? decimal_point<char_type>(locale_)
|
1774
|
+
: static_cast<char_type>('.');
|
1775
|
+
write_padded(specs, float_writer<char_type>(buffer.data(),
|
1776
|
+
static_cast<int>(buffer.size()),
|
1777
|
+
exp, fspecs, point));
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
void write(char value) {
|
1781
|
+
auto&& it = reserve(1);
|
1782
|
+
*it++ = value;
|
1783
|
+
}
|
1784
|
+
|
1785
|
+
template <typename Char, FMT_ENABLE_IF(std::is_same<Char, char_type>::value)>
|
1786
|
+
void write(Char value) {
|
1787
|
+
auto&& it = reserve(1);
|
1788
|
+
*it++ = value;
|
1789
|
+
}
|
1790
|
+
|
1791
|
+
void write(string_view value) {
|
1792
|
+
auto&& it = reserve(value.size());
|
1793
|
+
it = copy_str<char_type>(value.begin(), value.end(), it);
|
1794
|
+
}
|
1795
|
+
void write(wstring_view value) {
|
1796
|
+
static_assert(std::is_same<char_type, wchar_t>::value, "");
|
1797
|
+
auto&& it = reserve(value.size());
|
1798
|
+
it = std::copy(value.begin(), value.end(), it);
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
template <typename Char>
|
1802
|
+
void write(const Char* s, std::size_t size, const format_specs& specs) {
|
1803
|
+
write_padded(specs, str_writer<Char>{s, size});
|
1804
|
+
}
|
1805
|
+
|
1806
|
+
template <typename Char>
|
1807
|
+
void write(basic_string_view<Char> s, const format_specs& specs = {}) {
|
1808
|
+
const Char* data = s.data();
|
1809
|
+
std::size_t size = s.size();
|
1810
|
+
if (specs.precision >= 0 && to_unsigned(specs.precision) < size)
|
1811
|
+
size = code_point_index(s, to_unsigned(specs.precision));
|
1812
|
+
write(data, size, specs);
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
void write_bytes(string_view bytes, const format_specs& specs) {
|
1816
|
+
write_padded(specs, bytes_writer{bytes});
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
template <typename UIntPtr>
|
1820
|
+
void write_pointer(UIntPtr value, const format_specs* specs) {
|
1821
|
+
int num_digits = count_digits<4>(value);
|
1822
|
+
auto pw = pointer_writer<UIntPtr>{value, num_digits};
|
1823
|
+
if (!specs) return pw(reserve(to_unsigned(num_digits) + 2));
|
1824
|
+
format_specs specs_copy = *specs;
|
1825
|
+
if (specs_copy.align == align::none) specs_copy.align = align::right;
|
1826
|
+
write_padded(specs_copy, pw);
|
1827
|
+
}
|
1828
|
+
};
|
1829
|
+
|
1830
|
+
using writer = basic_writer<buffer_range<char>>;
|
1831
|
+
|
1832
|
+
template <typename T> struct is_integral : std::is_integral<T> {};
|
1833
|
+
template <> struct is_integral<int128_t> : std::true_type {};
|
1834
|
+
template <> struct is_integral<uint128_t> : std::true_type {};
|
1835
|
+
|
1836
|
+
template <typename Range, typename ErrorHandler = internal::error_handler>
|
1837
|
+
class arg_formatter_base {
|
1838
|
+
public:
|
1839
|
+
using char_type = typename Range::value_type;
|
1840
|
+
using iterator = typename Range::iterator;
|
1841
|
+
using format_specs = basic_format_specs<char_type>;
|
1842
|
+
|
1843
|
+
private:
|
1844
|
+
using writer_type = basic_writer<Range>;
|
1845
|
+
writer_type writer_;
|
1846
|
+
format_specs* specs_;
|
1847
|
+
|
1848
|
+
struct char_writer {
|
1849
|
+
char_type value;
|
1850
|
+
|
1851
|
+
size_t size() const { return 1; }
|
1852
|
+
size_t width() const { return 1; }
|
1853
|
+
|
1854
|
+
template <typename It> void operator()(It&& it) const { *it++ = value; }
|
1855
|
+
};
|
1856
|
+
|
1857
|
+
void write_char(char_type value) {
|
1858
|
+
if (specs_)
|
1859
|
+
writer_.write_padded(*specs_, char_writer{value});
|
1860
|
+
else
|
1861
|
+
writer_.write(value);
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
void write_pointer(const void* p) {
|
1865
|
+
writer_.write_pointer(internal::to_uintptr(p), specs_);
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
protected:
|
1869
|
+
writer_type& writer() { return writer_; }
|
1870
|
+
FMT_DEPRECATED format_specs* spec() { return specs_; }
|
1871
|
+
format_specs* specs() { return specs_; }
|
1872
|
+
iterator out() { return writer_.out(); }
|
1873
|
+
|
1874
|
+
void write(bool value) {
|
1875
|
+
string_view sv(value ? "true" : "false");
|
1876
|
+
specs_ ? writer_.write(sv, *specs_) : writer_.write(sv);
|
1877
|
+
}
|
1878
|
+
|
1879
|
+
void write(const char_type* value) {
|
1880
|
+
if (!value) {
|
1881
|
+
FMT_THROW(format_error("string pointer is null"));
|
1882
|
+
} else {
|
1883
|
+
auto length = std::char_traits<char_type>::length(value);
|
1884
|
+
basic_string_view<char_type> sv(value, length);
|
1885
|
+
specs_ ? writer_.write(sv, *specs_) : writer_.write(sv);
|
1886
|
+
}
|
1887
|
+
}
|
1888
|
+
|
1889
|
+
public:
|
1890
|
+
arg_formatter_base(Range r, format_specs* s, locale_ref loc)
|
1891
|
+
: writer_(r, loc), specs_(s) {}
|
1892
|
+
|
1893
|
+
iterator operator()(monostate) {
|
1894
|
+
FMT_ASSERT(false, "invalid argument type");
|
1895
|
+
return out();
|
1896
|
+
}
|
1897
|
+
|
1898
|
+
template <typename T, FMT_ENABLE_IF(is_integral<T>::value)>
|
1899
|
+
iterator operator()(T value) {
|
1900
|
+
if (specs_)
|
1901
|
+
writer_.write_int(value, *specs_);
|
1902
|
+
else
|
1903
|
+
writer_.write(value);
|
1904
|
+
return out();
|
1905
|
+
}
|
1906
|
+
|
1907
|
+
iterator operator()(char_type value) {
|
1908
|
+
internal::handle_char_specs(
|
1909
|
+
specs_, char_spec_handler(*this, static_cast<char_type>(value)));
|
1910
|
+
return out();
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
iterator operator()(bool value) {
|
1914
|
+
if (specs_ && specs_->type) return (*this)(value ? 1 : 0);
|
1915
|
+
write(value != 0);
|
1916
|
+
return out();
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
1920
|
+
iterator operator()(T value) {
|
1921
|
+
if (const_check(is_supported_floating_point(value)))
|
1922
|
+
writer_.write(value, specs_ ? *specs_ : format_specs());
|
1923
|
+
else
|
1924
|
+
FMT_ASSERT(false, "unsupported float argument type");
|
1925
|
+
return out();
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
struct char_spec_handler : ErrorHandler {
|
1929
|
+
arg_formatter_base& formatter;
|
1930
|
+
char_type value;
|
1931
|
+
|
1932
|
+
char_spec_handler(arg_formatter_base& f, char_type val)
|
1933
|
+
: formatter(f), value(val) {}
|
1934
|
+
|
1935
|
+
void on_int() {
|
1936
|
+
if (formatter.specs_)
|
1937
|
+
formatter.writer_.write_int(value, *formatter.specs_);
|
1938
|
+
else
|
1939
|
+
formatter.writer_.write(value);
|
1940
|
+
}
|
1941
|
+
void on_char() { formatter.write_char(value); }
|
1942
|
+
};
|
1943
|
+
|
1944
|
+
struct cstring_spec_handler : internal::error_handler {
|
1945
|
+
arg_formatter_base& formatter;
|
1946
|
+
const char_type* value;
|
1947
|
+
|
1948
|
+
cstring_spec_handler(arg_formatter_base& f, const char_type* val)
|
1949
|
+
: formatter(f), value(val) {}
|
1950
|
+
|
1951
|
+
void on_string() { formatter.write(value); }
|
1952
|
+
void on_pointer() { formatter.write_pointer(value); }
|
1953
|
+
};
|
1954
|
+
|
1955
|
+
iterator operator()(const char_type* value) {
|
1956
|
+
if (!specs_) return write(value), out();
|
1957
|
+
internal::handle_cstring_type_spec(specs_->type,
|
1958
|
+
cstring_spec_handler(*this, value));
|
1959
|
+
return out();
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
iterator operator()(basic_string_view<char_type> value) {
|
1963
|
+
if (specs_) {
|
1964
|
+
internal::check_string_type_spec(specs_->type, internal::error_handler());
|
1965
|
+
writer_.write(value, *specs_);
|
1966
|
+
} else {
|
1967
|
+
writer_.write(value);
|
1968
|
+
}
|
1969
|
+
return out();
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
iterator operator()(const void* value) {
|
1973
|
+
if (specs_)
|
1974
|
+
check_pointer_type_spec(specs_->type, internal::error_handler());
|
1975
|
+
write_pointer(value);
|
1976
|
+
return out();
|
1977
|
+
}
|
1978
|
+
};
|
1979
|
+
|
1980
|
+
template <typename Char> FMT_CONSTEXPR bool is_name_start(Char c) {
|
1981
|
+
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || '_' == c;
|
1982
|
+
}
|
1983
|
+
|
1984
|
+
// Parses the range [begin, end) as an unsigned integer. This function assumes
|
1985
|
+
// that the range is non-empty and the first character is a digit.
|
1986
|
+
template <typename Char, typename ErrorHandler>
|
1987
|
+
FMT_CONSTEXPR int parse_nonnegative_int(const Char*& begin, const Char* end,
|
1988
|
+
ErrorHandler&& eh) {
|
1989
|
+
FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', "");
|
1990
|
+
unsigned value = 0;
|
1991
|
+
// Convert to unsigned to prevent a warning.
|
1992
|
+
constexpr unsigned max_int = max_value<int>();
|
1993
|
+
unsigned big = max_int / 10;
|
1994
|
+
do {
|
1995
|
+
// Check for overflow.
|
1996
|
+
if (value > big) {
|
1997
|
+
value = max_int + 1;
|
1998
|
+
break;
|
1999
|
+
}
|
2000
|
+
value = value * 10 + unsigned(*begin - '0');
|
2001
|
+
++begin;
|
2002
|
+
} while (begin != end && '0' <= *begin && *begin <= '9');
|
2003
|
+
if (value > max_int) eh.on_error("number is too big");
|
2004
|
+
return static_cast<int>(value);
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
template <typename Context> class custom_formatter {
|
2008
|
+
private:
|
2009
|
+
using char_type = typename Context::char_type;
|
2010
|
+
|
2011
|
+
basic_format_parse_context<char_type>& parse_ctx_;
|
2012
|
+
Context& ctx_;
|
2013
|
+
|
2014
|
+
public:
|
2015
|
+
explicit custom_formatter(basic_format_parse_context<char_type>& parse_ctx,
|
2016
|
+
Context& ctx)
|
2017
|
+
: parse_ctx_(parse_ctx), ctx_(ctx) {}
|
2018
|
+
|
2019
|
+
bool operator()(typename basic_format_arg<Context>::handle h) const {
|
2020
|
+
h.format(parse_ctx_, ctx_);
|
2021
|
+
return true;
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
template <typename T> bool operator()(T) const { return false; }
|
2025
|
+
};
|
2026
|
+
|
2027
|
+
template <typename T>
|
2028
|
+
using is_integer =
|
2029
|
+
bool_constant<is_integral<T>::value && !std::is_same<T, bool>::value &&
|
2030
|
+
!std::is_same<T, char>::value &&
|
2031
|
+
!std::is_same<T, wchar_t>::value>;
|
2032
|
+
|
2033
|
+
template <typename ErrorHandler> class width_checker {
|
2034
|
+
public:
|
2035
|
+
explicit FMT_CONSTEXPR width_checker(ErrorHandler& eh) : handler_(eh) {}
|
2036
|
+
|
2037
|
+
template <typename T, FMT_ENABLE_IF(is_integer<T>::value)>
|
2038
|
+
FMT_CONSTEXPR unsigned long long operator()(T value) {
|
2039
|
+
if (is_negative(value)) handler_.on_error("negative width");
|
2040
|
+
return static_cast<unsigned long long>(value);
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)>
|
2044
|
+
FMT_CONSTEXPR unsigned long long operator()(T) {
|
2045
|
+
handler_.on_error("width is not integer");
|
2046
|
+
return 0;
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
private:
|
2050
|
+
ErrorHandler& handler_;
|
2051
|
+
};
|
2052
|
+
|
2053
|
+
template <typename ErrorHandler> class precision_checker {
|
2054
|
+
public:
|
2055
|
+
explicit FMT_CONSTEXPR precision_checker(ErrorHandler& eh) : handler_(eh) {}
|
2056
|
+
|
2057
|
+
template <typename T, FMT_ENABLE_IF(is_integer<T>::value)>
|
2058
|
+
FMT_CONSTEXPR unsigned long long operator()(T value) {
|
2059
|
+
if (is_negative(value)) handler_.on_error("negative precision");
|
2060
|
+
return static_cast<unsigned long long>(value);
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)>
|
2064
|
+
FMT_CONSTEXPR unsigned long long operator()(T) {
|
2065
|
+
handler_.on_error("precision is not integer");
|
2066
|
+
return 0;
|
2067
|
+
}
|
2068
|
+
|
2069
|
+
private:
|
2070
|
+
ErrorHandler& handler_;
|
2071
|
+
};
|
2072
|
+
|
2073
|
+
// A format specifier handler that sets fields in basic_format_specs.
|
2074
|
+
template <typename Char> class specs_setter {
|
2075
|
+
public:
|
2076
|
+
explicit FMT_CONSTEXPR specs_setter(basic_format_specs<Char>& specs)
|
2077
|
+
: specs_(specs) {}
|
2078
|
+
|
2079
|
+
FMT_CONSTEXPR specs_setter(const specs_setter& other)
|
2080
|
+
: specs_(other.specs_) {}
|
2081
|
+
|
2082
|
+
FMT_CONSTEXPR void on_align(align_t align) { specs_.align = align; }
|
2083
|
+
FMT_CONSTEXPR void on_fill(basic_string_view<Char> fill) {
|
2084
|
+
specs_.fill = fill;
|
2085
|
+
}
|
2086
|
+
FMT_CONSTEXPR void on_plus() { specs_.sign = sign::plus; }
|
2087
|
+
FMT_CONSTEXPR void on_minus() { specs_.sign = sign::minus; }
|
2088
|
+
FMT_CONSTEXPR void on_space() { specs_.sign = sign::space; }
|
2089
|
+
FMT_CONSTEXPR void on_hash() { specs_.alt = true; }
|
2090
|
+
|
2091
|
+
FMT_CONSTEXPR void on_zero() {
|
2092
|
+
specs_.align = align::numeric;
|
2093
|
+
specs_.fill[0] = Char('0');
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
FMT_CONSTEXPR void on_width(int width) { specs_.width = width; }
|
2097
|
+
FMT_CONSTEXPR void on_precision(int precision) {
|
2098
|
+
specs_.precision = precision;
|
2099
|
+
}
|
2100
|
+
FMT_CONSTEXPR void end_precision() {}
|
2101
|
+
|
2102
|
+
FMT_CONSTEXPR void on_type(Char type) {
|
2103
|
+
specs_.type = static_cast<char>(type);
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
protected:
|
2107
|
+
basic_format_specs<Char>& specs_;
|
2108
|
+
};
|
2109
|
+
|
2110
|
+
template <typename ErrorHandler> class numeric_specs_checker {
|
2111
|
+
public:
|
2112
|
+
FMT_CONSTEXPR numeric_specs_checker(ErrorHandler& eh, internal::type arg_type)
|
2113
|
+
: error_handler_(eh), arg_type_(arg_type) {}
|
2114
|
+
|
2115
|
+
FMT_CONSTEXPR void require_numeric_argument() {
|
2116
|
+
if (!is_arithmetic_type(arg_type_))
|
2117
|
+
error_handler_.on_error("format specifier requires numeric argument");
|
2118
|
+
}
|
2119
|
+
|
2120
|
+
FMT_CONSTEXPR void check_sign() {
|
2121
|
+
require_numeric_argument();
|
2122
|
+
if (is_integral_type(arg_type_) && arg_type_ != type::int_type &&
|
2123
|
+
arg_type_ != type::long_long_type && arg_type_ != type::char_type) {
|
2124
|
+
error_handler_.on_error("format specifier requires signed argument");
|
2125
|
+
}
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
FMT_CONSTEXPR void check_precision() {
|
2129
|
+
if (is_integral_type(arg_type_) || arg_type_ == type::pointer_type)
|
2130
|
+
error_handler_.on_error("precision not allowed for this argument type");
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
private:
|
2134
|
+
ErrorHandler& error_handler_;
|
2135
|
+
internal::type arg_type_;
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
// A format specifier handler that checks if specifiers are consistent with the
|
2139
|
+
// argument type.
|
2140
|
+
template <typename Handler> class specs_checker : public Handler {
|
2141
|
+
public:
|
2142
|
+
FMT_CONSTEXPR specs_checker(const Handler& handler, internal::type arg_type)
|
2143
|
+
: Handler(handler), checker_(*this, arg_type) {}
|
2144
|
+
|
2145
|
+
FMT_CONSTEXPR specs_checker(const specs_checker& other)
|
2146
|
+
: Handler(other), checker_(*this, other.arg_type_) {}
|
2147
|
+
|
2148
|
+
FMT_CONSTEXPR void on_align(align_t align) {
|
2149
|
+
if (align == align::numeric) checker_.require_numeric_argument();
|
2150
|
+
Handler::on_align(align);
|
2151
|
+
}
|
2152
|
+
|
2153
|
+
FMT_CONSTEXPR void on_plus() {
|
2154
|
+
checker_.check_sign();
|
2155
|
+
Handler::on_plus();
|
2156
|
+
}
|
2157
|
+
|
2158
|
+
FMT_CONSTEXPR void on_minus() {
|
2159
|
+
checker_.check_sign();
|
2160
|
+
Handler::on_minus();
|
2161
|
+
}
|
2162
|
+
|
2163
|
+
FMT_CONSTEXPR void on_space() {
|
2164
|
+
checker_.check_sign();
|
2165
|
+
Handler::on_space();
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
FMT_CONSTEXPR void on_hash() {
|
2169
|
+
checker_.require_numeric_argument();
|
2170
|
+
Handler::on_hash();
|
2171
|
+
}
|
2172
|
+
|
2173
|
+
FMT_CONSTEXPR void on_zero() {
|
2174
|
+
checker_.require_numeric_argument();
|
2175
|
+
Handler::on_zero();
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
FMT_CONSTEXPR void end_precision() { checker_.check_precision(); }
|
2179
|
+
|
2180
|
+
private:
|
2181
|
+
numeric_specs_checker<Handler> checker_;
|
2182
|
+
};
|
2183
|
+
|
2184
|
+
template <template <typename> class Handler, typename FormatArg,
|
2185
|
+
typename ErrorHandler>
|
2186
|
+
FMT_CONSTEXPR int get_dynamic_spec(FormatArg arg, ErrorHandler eh) {
|
2187
|
+
unsigned long long value = visit_format_arg(Handler<ErrorHandler>(eh), arg);
|
2188
|
+
if (value > to_unsigned(max_value<int>())) eh.on_error("number is too big");
|
2189
|
+
return static_cast<int>(value);
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
struct auto_id {};
|
2193
|
+
|
2194
|
+
template <typename Context>
|
2195
|
+
FMT_CONSTEXPR typename Context::format_arg get_arg(Context& ctx, int id) {
|
2196
|
+
auto arg = ctx.arg(id);
|
2197
|
+
if (!arg) ctx.on_error("argument index out of range");
|
2198
|
+
return arg;
|
2199
|
+
}
|
2200
|
+
|
2201
|
+
// The standard format specifier handler with checking.
|
2202
|
+
template <typename ParseContext, typename Context>
|
2203
|
+
class specs_handler : public specs_setter<typename Context::char_type> {
|
2204
|
+
public:
|
2205
|
+
using char_type = typename Context::char_type;
|
2206
|
+
|
2207
|
+
FMT_CONSTEXPR specs_handler(basic_format_specs<char_type>& specs,
|
2208
|
+
ParseContext& parse_ctx, Context& ctx)
|
2209
|
+
: specs_setter<char_type>(specs),
|
2210
|
+
parse_context_(parse_ctx),
|
2211
|
+
context_(ctx) {}
|
2212
|
+
|
2213
|
+
template <typename Id> FMT_CONSTEXPR void on_dynamic_width(Id arg_id) {
|
2214
|
+
this->specs_.width = get_dynamic_spec<width_checker>(
|
2215
|
+
get_arg(arg_id), context_.error_handler());
|
2216
|
+
}
|
2217
|
+
|
2218
|
+
template <typename Id> FMT_CONSTEXPR void on_dynamic_precision(Id arg_id) {
|
2219
|
+
this->specs_.precision = get_dynamic_spec<precision_checker>(
|
2220
|
+
get_arg(arg_id), context_.error_handler());
|
2221
|
+
}
|
2222
|
+
|
2223
|
+
void on_error(const char* message) { context_.on_error(message); }
|
2224
|
+
|
2225
|
+
private:
|
2226
|
+
// This is only needed for compatibility with gcc 4.4.
|
2227
|
+
using format_arg = typename Context::format_arg;
|
2228
|
+
|
2229
|
+
FMT_CONSTEXPR format_arg get_arg(auto_id) {
|
2230
|
+
return internal::get_arg(context_, parse_context_.next_arg_id());
|
2231
|
+
}
|
2232
|
+
|
2233
|
+
FMT_CONSTEXPR format_arg get_arg(int arg_id) {
|
2234
|
+
parse_context_.check_arg_id(arg_id);
|
2235
|
+
return internal::get_arg(context_, arg_id);
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
FMT_CONSTEXPR format_arg get_arg(basic_string_view<char_type> arg_id) {
|
2239
|
+
parse_context_.check_arg_id(arg_id);
|
2240
|
+
return context_.arg(arg_id);
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
ParseContext& parse_context_;
|
2244
|
+
Context& context_;
|
2245
|
+
};
|
2246
|
+
|
2247
|
+
enum class arg_id_kind { none, index, name };
|
2248
|
+
|
2249
|
+
// An argument reference.
|
2250
|
+
template <typename Char> struct arg_ref {
|
2251
|
+
FMT_CONSTEXPR arg_ref() : kind(arg_id_kind::none), val() {}
|
2252
|
+
|
2253
|
+
FMT_CONSTEXPR explicit arg_ref(int index)
|
2254
|
+
: kind(arg_id_kind::index), val(index) {}
|
2255
|
+
FMT_CONSTEXPR explicit arg_ref(basic_string_view<Char> name)
|
2256
|
+
: kind(arg_id_kind::name), val(name) {}
|
2257
|
+
|
2258
|
+
FMT_CONSTEXPR arg_ref& operator=(int idx) {
|
2259
|
+
kind = arg_id_kind::index;
|
2260
|
+
val.index = idx;
|
2261
|
+
return *this;
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
arg_id_kind kind;
|
2265
|
+
union value {
|
2266
|
+
FMT_CONSTEXPR value(int id = 0) : index{id} {}
|
2267
|
+
FMT_CONSTEXPR value(basic_string_view<Char> n) : name(n) {}
|
2268
|
+
|
2269
|
+
int index;
|
2270
|
+
basic_string_view<Char> name;
|
2271
|
+
} val;
|
2272
|
+
};
|
2273
|
+
|
2274
|
+
// Format specifiers with width and precision resolved at formatting rather
|
2275
|
+
// than parsing time to allow re-using the same parsed specifiers with
|
2276
|
+
// different sets of arguments (precompilation of format strings).
|
2277
|
+
template <typename Char>
|
2278
|
+
struct dynamic_format_specs : basic_format_specs<Char> {
|
2279
|
+
arg_ref<Char> width_ref;
|
2280
|
+
arg_ref<Char> precision_ref;
|
2281
|
+
};
|
2282
|
+
|
2283
|
+
// Format spec handler that saves references to arguments representing dynamic
|
2284
|
+
// width and precision to be resolved at formatting time.
|
2285
|
+
template <typename ParseContext>
|
2286
|
+
class dynamic_specs_handler
|
2287
|
+
: public specs_setter<typename ParseContext::char_type> {
|
2288
|
+
public:
|
2289
|
+
using char_type = typename ParseContext::char_type;
|
2290
|
+
|
2291
|
+
FMT_CONSTEXPR dynamic_specs_handler(dynamic_format_specs<char_type>& specs,
|
2292
|
+
ParseContext& ctx)
|
2293
|
+
: specs_setter<char_type>(specs), specs_(specs), context_(ctx) {}
|
2294
|
+
|
2295
|
+
FMT_CONSTEXPR dynamic_specs_handler(const dynamic_specs_handler& other)
|
2296
|
+
: specs_setter<char_type>(other),
|
2297
|
+
specs_(other.specs_),
|
2298
|
+
context_(other.context_) {}
|
2299
|
+
|
2300
|
+
template <typename Id> FMT_CONSTEXPR void on_dynamic_width(Id arg_id) {
|
2301
|
+
specs_.width_ref = make_arg_ref(arg_id);
|
2302
|
+
}
|
2303
|
+
|
2304
|
+
template <typename Id> FMT_CONSTEXPR void on_dynamic_precision(Id arg_id) {
|
2305
|
+
specs_.precision_ref = make_arg_ref(arg_id);
|
2306
|
+
}
|
2307
|
+
|
2308
|
+
FMT_CONSTEXPR void on_error(const char* message) {
|
2309
|
+
context_.on_error(message);
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
private:
|
2313
|
+
using arg_ref_type = arg_ref<char_type>;
|
2314
|
+
|
2315
|
+
FMT_CONSTEXPR arg_ref_type make_arg_ref(int arg_id) {
|
2316
|
+
context_.check_arg_id(arg_id);
|
2317
|
+
return arg_ref_type(arg_id);
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
FMT_CONSTEXPR arg_ref_type make_arg_ref(auto_id) {
|
2321
|
+
return arg_ref_type(context_.next_arg_id());
|
2322
|
+
}
|
2323
|
+
|
2324
|
+
FMT_CONSTEXPR arg_ref_type make_arg_ref(basic_string_view<char_type> arg_id) {
|
2325
|
+
context_.check_arg_id(arg_id);
|
2326
|
+
basic_string_view<char_type> format_str(
|
2327
|
+
context_.begin(), to_unsigned(context_.end() - context_.begin()));
|
2328
|
+
return arg_ref_type(arg_id);
|
2329
|
+
}
|
2330
|
+
|
2331
|
+
dynamic_format_specs<char_type>& specs_;
|
2332
|
+
ParseContext& context_;
|
2333
|
+
};
|
2334
|
+
|
2335
|
+
template <typename Char, typename IDHandler>
|
2336
|
+
FMT_CONSTEXPR const Char* parse_arg_id(const Char* begin, const Char* end,
|
2337
|
+
IDHandler&& handler) {
|
2338
|
+
FMT_ASSERT(begin != end, "");
|
2339
|
+
Char c = *begin;
|
2340
|
+
if (c == '}' || c == ':') {
|
2341
|
+
handler();
|
2342
|
+
return begin;
|
2343
|
+
}
|
2344
|
+
if (c >= '0' && c <= '9') {
|
2345
|
+
int index = 0;
|
2346
|
+
if (c != '0')
|
2347
|
+
index = parse_nonnegative_int(begin, end, handler);
|
2348
|
+
else
|
2349
|
+
++begin;
|
2350
|
+
if (begin == end || (*begin != '}' && *begin != ':'))
|
2351
|
+
handler.on_error("invalid format string");
|
2352
|
+
else
|
2353
|
+
handler(index);
|
2354
|
+
return begin;
|
2355
|
+
}
|
2356
|
+
if (!is_name_start(c)) {
|
2357
|
+
handler.on_error("invalid format string");
|
2358
|
+
return begin;
|
2359
|
+
}
|
2360
|
+
auto it = begin;
|
2361
|
+
do {
|
2362
|
+
++it;
|
2363
|
+
} while (it != end && (is_name_start(c = *it) || ('0' <= c && c <= '9')));
|
2364
|
+
handler(basic_string_view<Char>(begin, to_unsigned(it - begin)));
|
2365
|
+
return it;
|
2366
|
+
}
|
2367
|
+
|
2368
|
+
// Adapts SpecHandler to IDHandler API for dynamic width.
|
2369
|
+
template <typename SpecHandler, typename Char> struct width_adapter {
|
2370
|
+
explicit FMT_CONSTEXPR width_adapter(SpecHandler& h) : handler(h) {}
|
2371
|
+
|
2372
|
+
FMT_CONSTEXPR void operator()() { handler.on_dynamic_width(auto_id()); }
|
2373
|
+
FMT_CONSTEXPR void operator()(int id) { handler.on_dynamic_width(id); }
|
2374
|
+
FMT_CONSTEXPR void operator()(basic_string_view<Char> id) {
|
2375
|
+
handler.on_dynamic_width(id);
|
2376
|
+
}
|
2377
|
+
|
2378
|
+
FMT_CONSTEXPR void on_error(const char* message) {
|
2379
|
+
handler.on_error(message);
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
SpecHandler& handler;
|
2383
|
+
};
|
2384
|
+
|
2385
|
+
// Adapts SpecHandler to IDHandler API for dynamic precision.
|
2386
|
+
template <typename SpecHandler, typename Char> struct precision_adapter {
|
2387
|
+
explicit FMT_CONSTEXPR precision_adapter(SpecHandler& h) : handler(h) {}
|
2388
|
+
|
2389
|
+
FMT_CONSTEXPR void operator()() { handler.on_dynamic_precision(auto_id()); }
|
2390
|
+
FMT_CONSTEXPR void operator()(int id) { handler.on_dynamic_precision(id); }
|
2391
|
+
FMT_CONSTEXPR void operator()(basic_string_view<Char> id) {
|
2392
|
+
handler.on_dynamic_precision(id);
|
2393
|
+
}
|
2394
|
+
|
2395
|
+
FMT_CONSTEXPR void on_error(const char* message) {
|
2396
|
+
handler.on_error(message);
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
SpecHandler& handler;
|
2400
|
+
};
|
2401
|
+
|
2402
|
+
template <typename Char>
|
2403
|
+
FMT_CONSTEXPR const Char* next_code_point(const Char* begin, const Char* end) {
|
2404
|
+
if (const_check(sizeof(Char) != 1) || (*begin & 0x80) == 0) return begin + 1;
|
2405
|
+
do {
|
2406
|
+
++begin;
|
2407
|
+
} while (begin != end && (*begin & 0xc0) == 0x80);
|
2408
|
+
return begin;
|
2409
|
+
}
|
2410
|
+
|
2411
|
+
// Parses fill and alignment.
|
2412
|
+
template <typename Char, typename Handler>
|
2413
|
+
FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end,
|
2414
|
+
Handler&& handler) {
|
2415
|
+
FMT_ASSERT(begin != end, "");
|
2416
|
+
auto align = align::none;
|
2417
|
+
auto p = next_code_point(begin, end);
|
2418
|
+
if (p == end) p = begin;
|
2419
|
+
for (;;) {
|
2420
|
+
switch (static_cast<char>(*p)) {
|
2421
|
+
case '<':
|
2422
|
+
align = align::left;
|
2423
|
+
break;
|
2424
|
+
case '>':
|
2425
|
+
align = align::right;
|
2426
|
+
break;
|
2427
|
+
#if FMT_NUMERIC_ALIGN
|
2428
|
+
case '=':
|
2429
|
+
align = align::numeric;
|
2430
|
+
break;
|
2431
|
+
#endif
|
2432
|
+
case '^':
|
2433
|
+
align = align::center;
|
2434
|
+
break;
|
2435
|
+
}
|
2436
|
+
if (align != align::none) {
|
2437
|
+
if (p != begin) {
|
2438
|
+
auto c = *begin;
|
2439
|
+
if (c == '{')
|
2440
|
+
return handler.on_error("invalid fill character '{'"), begin;
|
2441
|
+
handler.on_fill(basic_string_view<Char>(begin, to_unsigned(p - begin)));
|
2442
|
+
begin = p + 1;
|
2443
|
+
} else
|
2444
|
+
++begin;
|
2445
|
+
handler.on_align(align);
|
2446
|
+
break;
|
2447
|
+
} else if (p == begin) {
|
2448
|
+
break;
|
2449
|
+
}
|
2450
|
+
p = begin;
|
2451
|
+
}
|
2452
|
+
return begin;
|
2453
|
+
}
|
2454
|
+
|
2455
|
+
template <typename Char, typename Handler>
|
2456
|
+
FMT_CONSTEXPR const Char* parse_width(const Char* begin, const Char* end,
|
2457
|
+
Handler&& handler) {
|
2458
|
+
FMT_ASSERT(begin != end, "");
|
2459
|
+
if ('0' <= *begin && *begin <= '9') {
|
2460
|
+
handler.on_width(parse_nonnegative_int(begin, end, handler));
|
2461
|
+
} else if (*begin == '{') {
|
2462
|
+
++begin;
|
2463
|
+
if (begin != end)
|
2464
|
+
begin = parse_arg_id(begin, end, width_adapter<Handler, Char>(handler));
|
2465
|
+
if (begin == end || *begin != '}')
|
2466
|
+
return handler.on_error("invalid format string"), begin;
|
2467
|
+
++begin;
|
2468
|
+
}
|
2469
|
+
return begin;
|
2470
|
+
}
|
2471
|
+
|
2472
|
+
template <typename Char, typename Handler>
|
2473
|
+
FMT_CONSTEXPR const Char* parse_precision(const Char* begin, const Char* end,
|
2474
|
+
Handler&& handler) {
|
2475
|
+
++begin;
|
2476
|
+
auto c = begin != end ? *begin : Char();
|
2477
|
+
if ('0' <= c && c <= '9') {
|
2478
|
+
handler.on_precision(parse_nonnegative_int(begin, end, handler));
|
2479
|
+
} else if (c == '{') {
|
2480
|
+
++begin;
|
2481
|
+
if (begin != end) {
|
2482
|
+
begin =
|
2483
|
+
parse_arg_id(begin, end, precision_adapter<Handler, Char>(handler));
|
2484
|
+
}
|
2485
|
+
if (begin == end || *begin++ != '}')
|
2486
|
+
return handler.on_error("invalid format string"), begin;
|
2487
|
+
} else {
|
2488
|
+
return handler.on_error("missing precision specifier"), begin;
|
2489
|
+
}
|
2490
|
+
handler.end_precision();
|
2491
|
+
return begin;
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
// Parses standard format specifiers and sends notifications about parsed
|
2495
|
+
// components to handler.
|
2496
|
+
template <typename Char, typename SpecHandler>
|
2497
|
+
FMT_CONSTEXPR const Char* parse_format_specs(const Char* begin, const Char* end,
|
2498
|
+
SpecHandler&& handler) {
|
2499
|
+
if (begin == end || *begin == '}') return begin;
|
2500
|
+
|
2501
|
+
begin = parse_align(begin, end, handler);
|
2502
|
+
if (begin == end) return begin;
|
2503
|
+
|
2504
|
+
// Parse sign.
|
2505
|
+
switch (static_cast<char>(*begin)) {
|
2506
|
+
case '+':
|
2507
|
+
handler.on_plus();
|
2508
|
+
++begin;
|
2509
|
+
break;
|
2510
|
+
case '-':
|
2511
|
+
handler.on_minus();
|
2512
|
+
++begin;
|
2513
|
+
break;
|
2514
|
+
case ' ':
|
2515
|
+
handler.on_space();
|
2516
|
+
++begin;
|
2517
|
+
break;
|
2518
|
+
}
|
2519
|
+
if (begin == end) return begin;
|
2520
|
+
|
2521
|
+
if (*begin == '#') {
|
2522
|
+
handler.on_hash();
|
2523
|
+
if (++begin == end) return begin;
|
2524
|
+
}
|
2525
|
+
|
2526
|
+
// Parse zero flag.
|
2527
|
+
if (*begin == '0') {
|
2528
|
+
handler.on_zero();
|
2529
|
+
if (++begin == end) return begin;
|
2530
|
+
}
|
2531
|
+
|
2532
|
+
begin = parse_width(begin, end, handler);
|
2533
|
+
if (begin == end) return begin;
|
2534
|
+
|
2535
|
+
// Parse precision.
|
2536
|
+
if (*begin == '.') {
|
2537
|
+
begin = parse_precision(begin, end, handler);
|
2538
|
+
}
|
2539
|
+
|
2540
|
+
// Parse type.
|
2541
|
+
if (begin != end && *begin != '}') handler.on_type(*begin++);
|
2542
|
+
return begin;
|
2543
|
+
}
|
2544
|
+
|
2545
|
+
// Return the result via the out param to workaround gcc bug 77539.
|
2546
|
+
template <bool IS_CONSTEXPR, typename T, typename Ptr = const T*>
|
2547
|
+
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr& out) {
|
2548
|
+
for (out = first; out != last; ++out) {
|
2549
|
+
if (*out == value) return true;
|
2550
|
+
}
|
2551
|
+
return false;
|
2552
|
+
}
|
2553
|
+
|
2554
|
+
template <>
|
2555
|
+
inline bool find<false, char>(const char* first, const char* last, char value,
|
2556
|
+
const char*& out) {
|
2557
|
+
out = static_cast<const char*>(
|
2558
|
+
std::memchr(first, value, internal::to_unsigned(last - first)));
|
2559
|
+
return out != nullptr;
|
2560
|
+
}
|
2561
|
+
|
2562
|
+
template <typename Handler, typename Char> struct id_adapter {
|
2563
|
+
FMT_CONSTEXPR void operator()() { handler.on_arg_id(); }
|
2564
|
+
FMT_CONSTEXPR void operator()(int id) { handler.on_arg_id(id); }
|
2565
|
+
FMT_CONSTEXPR void operator()(basic_string_view<Char> id) {
|
2566
|
+
handler.on_arg_id(id);
|
2567
|
+
}
|
2568
|
+
FMT_CONSTEXPR void on_error(const char* message) {
|
2569
|
+
handler.on_error(message);
|
2570
|
+
}
|
2571
|
+
Handler& handler;
|
2572
|
+
};
|
2573
|
+
|
2574
|
+
template <bool IS_CONSTEXPR, typename Char, typename Handler>
|
2575
|
+
FMT_CONSTEXPR void parse_format_string(basic_string_view<Char> format_str,
|
2576
|
+
Handler&& handler) {
|
2577
|
+
struct pfs_writer {
|
2578
|
+
FMT_CONSTEXPR void operator()(const Char* begin, const Char* end) {
|
2579
|
+
if (begin == end) return;
|
2580
|
+
for (;;) {
|
2581
|
+
const Char* p = nullptr;
|
2582
|
+
if (!find<IS_CONSTEXPR>(begin, end, '}', p))
|
2583
|
+
return handler_.on_text(begin, end);
|
2584
|
+
++p;
|
2585
|
+
if (p == end || *p != '}')
|
2586
|
+
return handler_.on_error("unmatched '}' in format string");
|
2587
|
+
handler_.on_text(begin, p);
|
2588
|
+
begin = p + 1;
|
2589
|
+
}
|
2590
|
+
}
|
2591
|
+
Handler& handler_;
|
2592
|
+
} write{handler};
|
2593
|
+
auto begin = format_str.data();
|
2594
|
+
auto end = begin + format_str.size();
|
2595
|
+
while (begin != end) {
|
2596
|
+
// Doing two passes with memchr (one for '{' and another for '}') is up to
|
2597
|
+
// 2.5x faster than the naive one-pass implementation on big format strings.
|
2598
|
+
const Char* p = begin;
|
2599
|
+
if (*begin != '{' && !find<IS_CONSTEXPR>(begin + 1, end, '{', p))
|
2600
|
+
return write(begin, end);
|
2601
|
+
write(begin, p);
|
2602
|
+
++p;
|
2603
|
+
if (p == end) return handler.on_error("invalid format string");
|
2604
|
+
if (static_cast<char>(*p) == '}') {
|
2605
|
+
handler.on_arg_id();
|
2606
|
+
handler.on_replacement_field(p);
|
2607
|
+
} else if (*p == '{') {
|
2608
|
+
handler.on_text(p, p + 1);
|
2609
|
+
} else {
|
2610
|
+
p = parse_arg_id(p, end, id_adapter<Handler, Char>{handler});
|
2611
|
+
Char c = p != end ? *p : Char();
|
2612
|
+
if (c == '}') {
|
2613
|
+
handler.on_replacement_field(p);
|
2614
|
+
} else if (c == ':') {
|
2615
|
+
p = handler.on_format_specs(p + 1, end);
|
2616
|
+
if (p == end || *p != '}')
|
2617
|
+
return handler.on_error("unknown format specifier");
|
2618
|
+
} else {
|
2619
|
+
return handler.on_error("missing '}' in format string");
|
2620
|
+
}
|
2621
|
+
}
|
2622
|
+
begin = p + 1;
|
2623
|
+
}
|
2624
|
+
}
|
2625
|
+
|
2626
|
+
template <typename T, typename ParseContext>
|
2627
|
+
FMT_CONSTEXPR const typename ParseContext::char_type* parse_format_specs(
|
2628
|
+
ParseContext& ctx) {
|
2629
|
+
using char_type = typename ParseContext::char_type;
|
2630
|
+
using context = buffer_context<char_type>;
|
2631
|
+
using mapped_type =
|
2632
|
+
conditional_t<internal::mapped_type_constant<T, context>::value !=
|
2633
|
+
type::custom_type,
|
2634
|
+
decltype(arg_mapper<context>().map(std::declval<T>())), T>;
|
2635
|
+
auto f = conditional_t<has_formatter<mapped_type, context>::value,
|
2636
|
+
formatter<mapped_type, char_type>,
|
2637
|
+
internal::fallback_formatter<T, char_type>>();
|
2638
|
+
return f.parse(ctx);
|
2639
|
+
}
|
2640
|
+
|
2641
|
+
template <typename Char, typename ErrorHandler, typename... Args>
|
2642
|
+
class format_string_checker {
|
2643
|
+
public:
|
2644
|
+
explicit FMT_CONSTEXPR format_string_checker(
|
2645
|
+
basic_string_view<Char> format_str, ErrorHandler eh)
|
2646
|
+
: arg_id_(-1),
|
2647
|
+
context_(format_str, eh),
|
2648
|
+
parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}
|
2649
|
+
|
2650
|
+
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
2651
|
+
|
2652
|
+
FMT_CONSTEXPR void on_arg_id() {
|
2653
|
+
arg_id_ = context_.next_arg_id();
|
2654
|
+
check_arg_id();
|
2655
|
+
}
|
2656
|
+
FMT_CONSTEXPR void on_arg_id(int id) {
|
2657
|
+
arg_id_ = id;
|
2658
|
+
context_.check_arg_id(id);
|
2659
|
+
check_arg_id();
|
2660
|
+
}
|
2661
|
+
FMT_CONSTEXPR void on_arg_id(basic_string_view<Char>) {
|
2662
|
+
on_error("compile-time checks don't support named arguments");
|
2663
|
+
}
|
2664
|
+
|
2665
|
+
FMT_CONSTEXPR void on_replacement_field(const Char*) {}
|
2666
|
+
|
2667
|
+
FMT_CONSTEXPR const Char* on_format_specs(const Char* begin, const Char*) {
|
2668
|
+
advance_to(context_, begin);
|
2669
|
+
return arg_id_ < num_args ? parse_funcs_[arg_id_](context_) : begin;
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
FMT_CONSTEXPR void on_error(const char* message) {
|
2673
|
+
context_.on_error(message);
|
2674
|
+
}
|
2675
|
+
|
2676
|
+
private:
|
2677
|
+
using parse_context_type = basic_format_parse_context<Char, ErrorHandler>;
|
2678
|
+
enum { num_args = sizeof...(Args) };
|
2679
|
+
|
2680
|
+
FMT_CONSTEXPR void check_arg_id() {
|
2681
|
+
if (arg_id_ >= num_args) context_.on_error("argument index out of range");
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
// Format specifier parsing function.
|
2685
|
+
using parse_func = const Char* (*)(parse_context_type&);
|
2686
|
+
|
2687
|
+
int arg_id_;
|
2688
|
+
parse_context_type context_;
|
2689
|
+
parse_func parse_funcs_[num_args > 0 ? num_args : 1];
|
2690
|
+
};
|
2691
|
+
|
2692
|
+
template <typename Char, typename ErrorHandler, typename... Args>
|
2693
|
+
FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
|
2694
|
+
ErrorHandler eh = ErrorHandler()) {
|
2695
|
+
format_string_checker<Char, ErrorHandler, Args...> checker(s, eh);
|
2696
|
+
parse_format_string<true>(s, checker);
|
2697
|
+
return true;
|
2698
|
+
}
|
2699
|
+
|
2700
|
+
template <typename... Args, typename S,
|
2701
|
+
enable_if_t<(is_compile_string<S>::value), int>>
|
2702
|
+
void check_format_string(S format_str) {
|
2703
|
+
FMT_CONSTEXPR_DECL bool invalid_format = internal::do_check_format_string<
|
2704
|
+
typename S::char_type, internal::error_handler,
|
2705
|
+
remove_const_t<remove_reference_t<Args>>...>(to_string_view(format_str));
|
2706
|
+
(void)invalid_format;
|
2707
|
+
}
|
2708
|
+
|
2709
|
+
template <template <typename> class Handler, typename Context>
|
2710
|
+
void handle_dynamic_spec(int& value, arg_ref<typename Context::char_type> ref,
|
2711
|
+
Context& ctx) {
|
2712
|
+
switch (ref.kind) {
|
2713
|
+
case arg_id_kind::none:
|
2714
|
+
break;
|
2715
|
+
case arg_id_kind::index:
|
2716
|
+
value = internal::get_dynamic_spec<Handler>(ctx.arg(ref.val.index),
|
2717
|
+
ctx.error_handler());
|
2718
|
+
break;
|
2719
|
+
case arg_id_kind::name:
|
2720
|
+
value = internal::get_dynamic_spec<Handler>(ctx.arg(ref.val.name),
|
2721
|
+
ctx.error_handler());
|
2722
|
+
break;
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
|
2726
|
+
using format_func = void (*)(internal::buffer<char>&, int, string_view);
|
2727
|
+
|
2728
|
+
FMT_API void format_error_code(buffer<char>& out, int error_code,
|
2729
|
+
string_view message) FMT_NOEXCEPT;
|
2730
|
+
|
2731
|
+
FMT_API void report_error(format_func func, int error_code,
|
2732
|
+
string_view message) FMT_NOEXCEPT;
|
2733
|
+
} // namespace internal
|
2734
|
+
|
2735
|
+
template <typename Range>
|
2736
|
+
using basic_writer FMT_DEPRECATED_ALIAS = internal::basic_writer<Range>;
|
2737
|
+
using writer FMT_DEPRECATED_ALIAS = internal::writer;
|
2738
|
+
using wwriter FMT_DEPRECATED_ALIAS =
|
2739
|
+
internal::basic_writer<buffer_range<wchar_t>>;
|
2740
|
+
|
2741
|
+
/** The default argument formatter. */
|
2742
|
+
template <typename Range>
|
2743
|
+
class arg_formatter : public internal::arg_formatter_base<Range> {
|
2744
|
+
private:
|
2745
|
+
using char_type = typename Range::value_type;
|
2746
|
+
using base = internal::arg_formatter_base<Range>;
|
2747
|
+
using context_type = basic_format_context<typename base::iterator, char_type>;
|
2748
|
+
|
2749
|
+
context_type& ctx_;
|
2750
|
+
basic_format_parse_context<char_type>* parse_ctx_;
|
2751
|
+
|
2752
|
+
public:
|
2753
|
+
using range = Range;
|
2754
|
+
using iterator = typename base::iterator;
|
2755
|
+
using format_specs = typename base::format_specs;
|
2756
|
+
|
2757
|
+
/**
|
2758
|
+
\rst
|
2759
|
+
Constructs an argument formatter object.
|
2760
|
+
*ctx* is a reference to the formatting context,
|
2761
|
+
*specs* contains format specifier information for standard argument types.
|
2762
|
+
\endrst
|
2763
|
+
*/
|
2764
|
+
explicit arg_formatter(
|
2765
|
+
context_type& ctx,
|
2766
|
+
basic_format_parse_context<char_type>* parse_ctx = nullptr,
|
2767
|
+
format_specs* specs = nullptr)
|
2768
|
+
: base(Range(ctx.out()), specs, ctx.locale()),
|
2769
|
+
ctx_(ctx),
|
2770
|
+
parse_ctx_(parse_ctx) {}
|
2771
|
+
|
2772
|
+
using base::operator();
|
2773
|
+
|
2774
|
+
/** Formats an argument of a user-defined type. */
|
2775
|
+
iterator operator()(typename basic_format_arg<context_type>::handle handle) {
|
2776
|
+
handle.format(*parse_ctx_, ctx_);
|
2777
|
+
return ctx_.out();
|
2778
|
+
}
|
2779
|
+
};
|
2780
|
+
|
2781
|
+
/**
|
2782
|
+
An error returned by an operating system or a language runtime,
|
2783
|
+
for example a file opening error.
|
2784
|
+
*/
|
2785
|
+
FMT_CLASS_API
|
2786
|
+
class FMT_API system_error : public std::runtime_error {
|
2787
|
+
private:
|
2788
|
+
void init(int err_code, string_view format_str, format_args args);
|
2789
|
+
|
2790
|
+
protected:
|
2791
|
+
int error_code_;
|
2792
|
+
|
2793
|
+
system_error() : std::runtime_error(""), error_code_(0) {}
|
2794
|
+
|
2795
|
+
public:
|
2796
|
+
/**
|
2797
|
+
\rst
|
2798
|
+
Constructs a :class:`fmt::system_error` object with a description
|
2799
|
+
formatted with `fmt::format_system_error`. *message* and additional
|
2800
|
+
arguments passed into the constructor are formatted similarly to
|
2801
|
+
`fmt::format`.
|
2802
|
+
|
2803
|
+
**Example**::
|
2804
|
+
|
2805
|
+
// This throws a system_error with the description
|
2806
|
+
// cannot open file 'madeup': No such file or directory
|
2807
|
+
// or similar (system message may vary).
|
2808
|
+
const char *filename = "madeup";
|
2809
|
+
std::FILE *file = std::fopen(filename, "r");
|
2810
|
+
if (!file)
|
2811
|
+
throw fmt::system_error(errno, "cannot open file '{}'", filename);
|
2812
|
+
\endrst
|
2813
|
+
*/
|
2814
|
+
template <typename... Args>
|
2815
|
+
system_error(int error_code, string_view message, const Args&... args)
|
2816
|
+
: std::runtime_error("") {
|
2817
|
+
init(error_code, message, make_format_args(args...));
|
2818
|
+
}
|
2819
|
+
system_error(const system_error&) = default;
|
2820
|
+
system_error& operator=(const system_error&) = default;
|
2821
|
+
system_error(system_error&&) = default;
|
2822
|
+
system_error& operator=(system_error&&) = default;
|
2823
|
+
~system_error() FMT_NOEXCEPT FMT_OVERRIDE;
|
2824
|
+
|
2825
|
+
int error_code() const { return error_code_; }
|
2826
|
+
};
|
2827
|
+
|
2828
|
+
/**
|
2829
|
+
\rst
|
2830
|
+
Formats an error returned by an operating system or a language runtime,
|
2831
|
+
for example a file opening error, and writes it to *out* in the following
|
2832
|
+
form:
|
2833
|
+
|
2834
|
+
.. parsed-literal::
|
2835
|
+
*<message>*: *<system-message>*
|
2836
|
+
|
2837
|
+
where *<message>* is the passed message and *<system-message>* is
|
2838
|
+
the system message corresponding to the error code.
|
2839
|
+
*error_code* is a system error code as given by ``errno``.
|
2840
|
+
If *error_code* is not a valid error code such as -1, the system message
|
2841
|
+
may look like "Unknown error -1" and is platform-dependent.
|
2842
|
+
\endrst
|
2843
|
+
*/
|
2844
|
+
FMT_API void format_system_error(internal::buffer<char>& out, int error_code,
|
2845
|
+
string_view message) FMT_NOEXCEPT;
|
2846
|
+
|
2847
|
+
// Reports a system error without throwing an exception.
|
2848
|
+
// Can be used to report errors from destructors.
|
2849
|
+
FMT_API void report_system_error(int error_code,
|
2850
|
+
string_view message) FMT_NOEXCEPT;
|
2851
|
+
|
2852
|
+
/** Fast integer formatter. */
|
2853
|
+
class format_int {
|
2854
|
+
private:
|
2855
|
+
// Buffer should be large enough to hold all digits (digits10 + 1),
|
2856
|
+
// a sign and a null character.
|
2857
|
+
enum { buffer_size = std::numeric_limits<unsigned long long>::digits10 + 3 };
|
2858
|
+
mutable char buffer_[buffer_size];
|
2859
|
+
char* str_;
|
2860
|
+
|
2861
|
+
// Formats value in reverse and returns a pointer to the beginning.
|
2862
|
+
char* format_decimal(unsigned long long value) {
|
2863
|
+
char* ptr = buffer_ + (buffer_size - 1); // Parens to workaround MSVC bug.
|
2864
|
+
while (value >= 100) {
|
2865
|
+
// Integer division is slow so do it for a group of two digits instead
|
2866
|
+
// of for every digit. The idea comes from the talk by Alexandrescu
|
2867
|
+
// "Three Optimization Tips for C++". See speed-test for a comparison.
|
2868
|
+
auto index = static_cast<unsigned>((value % 100) * 2);
|
2869
|
+
value /= 100;
|
2870
|
+
*--ptr = internal::data::digits[index + 1];
|
2871
|
+
*--ptr = internal::data::digits[index];
|
2872
|
+
}
|
2873
|
+
if (value < 10) {
|
2874
|
+
*--ptr = static_cast<char>('0' + value);
|
2875
|
+
return ptr;
|
2876
|
+
}
|
2877
|
+
auto index = static_cast<unsigned>(value * 2);
|
2878
|
+
*--ptr = internal::data::digits[index + 1];
|
2879
|
+
*--ptr = internal::data::digits[index];
|
2880
|
+
return ptr;
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
void format_signed(long long value) {
|
2884
|
+
auto abs_value = static_cast<unsigned long long>(value);
|
2885
|
+
bool negative = value < 0;
|
2886
|
+
if (negative) abs_value = 0 - abs_value;
|
2887
|
+
str_ = format_decimal(abs_value);
|
2888
|
+
if (negative) *--str_ = '-';
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
public:
|
2892
|
+
explicit format_int(int value) { format_signed(value); }
|
2893
|
+
explicit format_int(long value) { format_signed(value); }
|
2894
|
+
explicit format_int(long long value) { format_signed(value); }
|
2895
|
+
explicit format_int(unsigned value) : str_(format_decimal(value)) {}
|
2896
|
+
explicit format_int(unsigned long value) : str_(format_decimal(value)) {}
|
2897
|
+
explicit format_int(unsigned long long value) : str_(format_decimal(value)) {}
|
2898
|
+
|
2899
|
+
/** Returns the number of characters written to the output buffer. */
|
2900
|
+
std::size_t size() const {
|
2901
|
+
return internal::to_unsigned(buffer_ - str_ + buffer_size - 1);
|
2902
|
+
}
|
2903
|
+
|
2904
|
+
/**
|
2905
|
+
Returns a pointer to the output buffer content. No terminating null
|
2906
|
+
character is appended.
|
2907
|
+
*/
|
2908
|
+
const char* data() const { return str_; }
|
2909
|
+
|
2910
|
+
/**
|
2911
|
+
Returns a pointer to the output buffer content with terminating null
|
2912
|
+
character appended.
|
2913
|
+
*/
|
2914
|
+
const char* c_str() const {
|
2915
|
+
buffer_[buffer_size - 1] = '\0';
|
2916
|
+
return str_;
|
2917
|
+
}
|
2918
|
+
|
2919
|
+
/**
|
2920
|
+
\rst
|
2921
|
+
Returns the content of the output buffer as an ``std::string``.
|
2922
|
+
\endrst
|
2923
|
+
*/
|
2924
|
+
std::string str() const { return std::string(str_, size()); }
|
2925
|
+
};
|
2926
|
+
|
2927
|
+
// A formatter specialization for the core types corresponding to internal::type
|
2928
|
+
// constants.
|
2929
|
+
template <typename T, typename Char>
|
2930
|
+
struct formatter<T, Char,
|
2931
|
+
enable_if_t<internal::type_constant<T, Char>::value !=
|
2932
|
+
internal::type::custom_type>> {
|
2933
|
+
FMT_CONSTEXPR formatter() = default;
|
2934
|
+
|
2935
|
+
// Parses format specifiers stopping either at the end of the range or at the
|
2936
|
+
// terminating '}'.
|
2937
|
+
template <typename ParseContext>
|
2938
|
+
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
2939
|
+
using handler_type = internal::dynamic_specs_handler<ParseContext>;
|
2940
|
+
auto type = internal::type_constant<T, Char>::value;
|
2941
|
+
internal::specs_checker<handler_type> handler(handler_type(specs_, ctx),
|
2942
|
+
type);
|
2943
|
+
auto it = parse_format_specs(ctx.begin(), ctx.end(), handler);
|
2944
|
+
auto eh = ctx.error_handler();
|
2945
|
+
switch (type) {
|
2946
|
+
case internal::type::none_type:
|
2947
|
+
case internal::type::named_arg_type:
|
2948
|
+
FMT_ASSERT(false, "invalid argument type");
|
2949
|
+
break;
|
2950
|
+
case internal::type::int_type:
|
2951
|
+
case internal::type::uint_type:
|
2952
|
+
case internal::type::long_long_type:
|
2953
|
+
case internal::type::ulong_long_type:
|
2954
|
+
case internal::type::int128_type:
|
2955
|
+
case internal::type::uint128_type:
|
2956
|
+
case internal::type::bool_type:
|
2957
|
+
handle_int_type_spec(specs_.type,
|
2958
|
+
internal::int_type_checker<decltype(eh)>(eh));
|
2959
|
+
break;
|
2960
|
+
case internal::type::char_type:
|
2961
|
+
handle_char_specs(
|
2962
|
+
&specs_, internal::char_specs_checker<decltype(eh)>(specs_.type, eh));
|
2963
|
+
break;
|
2964
|
+
case internal::type::float_type:
|
2965
|
+
if (internal::const_check(FMT_USE_FLOAT)) {
|
2966
|
+
internal::parse_float_type_spec(specs_, eh);
|
2967
|
+
} else {
|
2968
|
+
FMT_ASSERT(false, "float support disabled");
|
2969
|
+
}
|
2970
|
+
break;
|
2971
|
+
case internal::type::double_type:
|
2972
|
+
if (internal::const_check(FMT_USE_DOUBLE)) {
|
2973
|
+
internal::parse_float_type_spec(specs_, eh);
|
2974
|
+
} else {
|
2975
|
+
FMT_ASSERT(false, "double support disabled");
|
2976
|
+
}
|
2977
|
+
break;
|
2978
|
+
case internal::type::long_double_type:
|
2979
|
+
if (internal::const_check(FMT_USE_LONG_DOUBLE)) {
|
2980
|
+
internal::parse_float_type_spec(specs_, eh);
|
2981
|
+
} else {
|
2982
|
+
FMT_ASSERT(false, "long double support disabled");
|
2983
|
+
}
|
2984
|
+
break;
|
2985
|
+
case internal::type::cstring_type:
|
2986
|
+
internal::handle_cstring_type_spec(
|
2987
|
+
specs_.type, internal::cstring_type_checker<decltype(eh)>(eh));
|
2988
|
+
break;
|
2989
|
+
case internal::type::string_type:
|
2990
|
+
internal::check_string_type_spec(specs_.type, eh);
|
2991
|
+
break;
|
2992
|
+
case internal::type::pointer_type:
|
2993
|
+
internal::check_pointer_type_spec(specs_.type, eh);
|
2994
|
+
break;
|
2995
|
+
case internal::type::custom_type:
|
2996
|
+
// Custom format specifiers should be checked in parse functions of
|
2997
|
+
// formatter specializations.
|
2998
|
+
break;
|
2999
|
+
}
|
3000
|
+
return it;
|
3001
|
+
}
|
3002
|
+
|
3003
|
+
template <typename FormatContext>
|
3004
|
+
auto format(const T& val, FormatContext& ctx) -> decltype(ctx.out()) {
|
3005
|
+
internal::handle_dynamic_spec<internal::width_checker>(
|
3006
|
+
specs_.width, specs_.width_ref, ctx);
|
3007
|
+
internal::handle_dynamic_spec<internal::precision_checker>(
|
3008
|
+
specs_.precision, specs_.precision_ref, ctx);
|
3009
|
+
using range_type =
|
3010
|
+
internal::output_range<typename FormatContext::iterator,
|
3011
|
+
typename FormatContext::char_type>;
|
3012
|
+
return visit_format_arg(arg_formatter<range_type>(ctx, nullptr, &specs_),
|
3013
|
+
internal::make_arg<FormatContext>(val));
|
3014
|
+
}
|
3015
|
+
|
3016
|
+
private:
|
3017
|
+
internal::dynamic_format_specs<Char> specs_;
|
3018
|
+
};
|
3019
|
+
|
3020
|
+
#define FMT_FORMAT_AS(Type, Base) \
|
3021
|
+
template <typename Char> \
|
3022
|
+
struct formatter<Type, Char> : formatter<Base, Char> { \
|
3023
|
+
template <typename FormatContext> \
|
3024
|
+
auto format(Type const& val, FormatContext& ctx) -> decltype(ctx.out()) { \
|
3025
|
+
return formatter<Base, Char>::format(val, ctx); \
|
3026
|
+
} \
|
3027
|
+
}
|
3028
|
+
|
3029
|
+
FMT_FORMAT_AS(signed char, int);
|
3030
|
+
FMT_FORMAT_AS(unsigned char, unsigned);
|
3031
|
+
FMT_FORMAT_AS(short, int);
|
3032
|
+
FMT_FORMAT_AS(unsigned short, unsigned);
|
3033
|
+
FMT_FORMAT_AS(long, long long);
|
3034
|
+
FMT_FORMAT_AS(unsigned long, unsigned long long);
|
3035
|
+
FMT_FORMAT_AS(Char*, const Char*);
|
3036
|
+
FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
|
3037
|
+
FMT_FORMAT_AS(std::nullptr_t, const void*);
|
3038
|
+
FMT_FORMAT_AS(internal::std_string_view<Char>, basic_string_view<Char>);
|
3039
|
+
|
3040
|
+
template <typename Char>
|
3041
|
+
struct formatter<void*, Char> : formatter<const void*, Char> {
|
3042
|
+
template <typename FormatContext>
|
3043
|
+
auto format(void* val, FormatContext& ctx) -> decltype(ctx.out()) {
|
3044
|
+
return formatter<const void*, Char>::format(val, ctx);
|
3045
|
+
}
|
3046
|
+
};
|
3047
|
+
|
3048
|
+
template <typename Char, size_t N>
|
3049
|
+
struct formatter<Char[N], Char> : formatter<basic_string_view<Char>, Char> {
|
3050
|
+
template <typename FormatContext>
|
3051
|
+
auto format(const Char* val, FormatContext& ctx) -> decltype(ctx.out()) {
|
3052
|
+
return formatter<basic_string_view<Char>, Char>::format(val, ctx);
|
3053
|
+
}
|
3054
|
+
};
|
3055
|
+
|
3056
|
+
// A formatter for types known only at run time such as variant alternatives.
|
3057
|
+
//
|
3058
|
+
// Usage:
|
3059
|
+
// using variant = std::variant<int, std::string>;
|
3060
|
+
// template <>
|
3061
|
+
// struct formatter<variant>: dynamic_formatter<> {
|
3062
|
+
// void format(buffer &buf, const variant &v, context &ctx) {
|
3063
|
+
// visit([&](const auto &val) { format(buf, val, ctx); }, v);
|
3064
|
+
// }
|
3065
|
+
// };
|
3066
|
+
template <typename Char = char> class dynamic_formatter {
|
3067
|
+
private:
|
3068
|
+
struct null_handler : internal::error_handler {
|
3069
|
+
void on_align(align_t) {}
|
3070
|
+
void on_plus() {}
|
3071
|
+
void on_minus() {}
|
3072
|
+
void on_space() {}
|
3073
|
+
void on_hash() {}
|
3074
|
+
};
|
3075
|
+
|
3076
|
+
public:
|
3077
|
+
template <typename ParseContext>
|
3078
|
+
auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
3079
|
+
format_str_ = ctx.begin();
|
3080
|
+
// Checks are deferred to formatting time when the argument type is known.
|
3081
|
+
internal::dynamic_specs_handler<ParseContext> handler(specs_, ctx);
|
3082
|
+
return parse_format_specs(ctx.begin(), ctx.end(), handler);
|
3083
|
+
}
|
3084
|
+
|
3085
|
+
template <typename T, typename FormatContext>
|
3086
|
+
auto format(const T& val, FormatContext& ctx) -> decltype(ctx.out()) {
|
3087
|
+
handle_specs(ctx);
|
3088
|
+
internal::specs_checker<null_handler> checker(
|
3089
|
+
null_handler(),
|
3090
|
+
internal::mapped_type_constant<T, FormatContext>::value);
|
3091
|
+
checker.on_align(specs_.align);
|
3092
|
+
switch (specs_.sign) {
|
3093
|
+
case sign::none:
|
3094
|
+
break;
|
3095
|
+
case sign::plus:
|
3096
|
+
checker.on_plus();
|
3097
|
+
break;
|
3098
|
+
case sign::minus:
|
3099
|
+
checker.on_minus();
|
3100
|
+
break;
|
3101
|
+
case sign::space:
|
3102
|
+
checker.on_space();
|
3103
|
+
break;
|
3104
|
+
}
|
3105
|
+
if (specs_.alt) checker.on_hash();
|
3106
|
+
if (specs_.precision >= 0) checker.end_precision();
|
3107
|
+
using range = internal::output_range<typename FormatContext::iterator,
|
3108
|
+
typename FormatContext::char_type>;
|
3109
|
+
visit_format_arg(arg_formatter<range>(ctx, nullptr, &specs_),
|
3110
|
+
internal::make_arg<FormatContext>(val));
|
3111
|
+
return ctx.out();
|
3112
|
+
}
|
3113
|
+
|
3114
|
+
private:
|
3115
|
+
template <typename Context> void handle_specs(Context& ctx) {
|
3116
|
+
internal::handle_dynamic_spec<internal::width_checker>(
|
3117
|
+
specs_.width, specs_.width_ref, ctx);
|
3118
|
+
internal::handle_dynamic_spec<internal::precision_checker>(
|
3119
|
+
specs_.precision, specs_.precision_ref, ctx);
|
3120
|
+
}
|
3121
|
+
|
3122
|
+
internal::dynamic_format_specs<Char> specs_;
|
3123
|
+
const Char* format_str_;
|
3124
|
+
};
|
3125
|
+
|
3126
|
+
template <typename Range, typename Char>
|
3127
|
+
typename basic_format_context<Range, Char>::format_arg
|
3128
|
+
basic_format_context<Range, Char>::arg(basic_string_view<char_type> name) {
|
3129
|
+
map_.init(args_);
|
3130
|
+
format_arg arg = map_.find(name);
|
3131
|
+
if (arg.type() == internal::type::none_type)
|
3132
|
+
this->on_error("argument not found");
|
3133
|
+
return arg;
|
3134
|
+
}
|
3135
|
+
|
3136
|
+
template <typename Char, typename ErrorHandler>
|
3137
|
+
FMT_CONSTEXPR void advance_to(
|
3138
|
+
basic_format_parse_context<Char, ErrorHandler>& ctx, const Char* p) {
|
3139
|
+
ctx.advance_to(ctx.begin() + (p - &*ctx.begin()));
|
3140
|
+
}
|
3141
|
+
|
3142
|
+
template <typename ArgFormatter, typename Char, typename Context>
|
3143
|
+
struct format_handler : internal::error_handler {
|
3144
|
+
using range = typename ArgFormatter::range;
|
3145
|
+
|
3146
|
+
format_handler(range r, basic_string_view<Char> str,
|
3147
|
+
basic_format_args<Context> format_args,
|
3148
|
+
internal::locale_ref loc)
|
3149
|
+
: parse_context(str), context(r.begin(), format_args, loc) {}
|
3150
|
+
|
3151
|
+
void on_text(const Char* begin, const Char* end) {
|
3152
|
+
auto size = internal::to_unsigned(end - begin);
|
3153
|
+
auto out = context.out();
|
3154
|
+
auto&& it = internal::reserve(out, size);
|
3155
|
+
it = std::copy_n(begin, size, it);
|
3156
|
+
context.advance_to(out);
|
3157
|
+
}
|
3158
|
+
|
3159
|
+
void get_arg(int id) { arg = internal::get_arg(context, id); }
|
3160
|
+
|
3161
|
+
void on_arg_id() { get_arg(parse_context.next_arg_id()); }
|
3162
|
+
void on_arg_id(int id) {
|
3163
|
+
parse_context.check_arg_id(id);
|
3164
|
+
get_arg(id);
|
3165
|
+
}
|
3166
|
+
void on_arg_id(basic_string_view<Char> id) { arg = context.arg(id); }
|
3167
|
+
|
3168
|
+
void on_replacement_field(const Char* p) {
|
3169
|
+
advance_to(parse_context, p);
|
3170
|
+
context.advance_to(
|
3171
|
+
visit_format_arg(ArgFormatter(context, &parse_context), arg));
|
3172
|
+
}
|
3173
|
+
|
3174
|
+
const Char* on_format_specs(const Char* begin, const Char* end) {
|
3175
|
+
advance_to(parse_context, begin);
|
3176
|
+
internal::custom_formatter<Context> f(parse_context, context);
|
3177
|
+
if (visit_format_arg(f, arg)) return parse_context.begin();
|
3178
|
+
basic_format_specs<Char> specs;
|
3179
|
+
using internal::specs_handler;
|
3180
|
+
using parse_context_t = basic_format_parse_context<Char>;
|
3181
|
+
internal::specs_checker<specs_handler<parse_context_t, Context>> handler(
|
3182
|
+
specs_handler<parse_context_t, Context>(specs, parse_context, context),
|
3183
|
+
arg.type());
|
3184
|
+
begin = parse_format_specs(begin, end, handler);
|
3185
|
+
if (begin == end || *begin != '}') on_error("missing '}' in format string");
|
3186
|
+
advance_to(parse_context, begin);
|
3187
|
+
context.advance_to(
|
3188
|
+
visit_format_arg(ArgFormatter(context, &parse_context, &specs), arg));
|
3189
|
+
return begin;
|
3190
|
+
}
|
3191
|
+
|
3192
|
+
basic_format_parse_context<Char> parse_context;
|
3193
|
+
Context context;
|
3194
|
+
basic_format_arg<Context> arg;
|
3195
|
+
};
|
3196
|
+
|
3197
|
+
/** Formats arguments and writes the output to the range. */
|
3198
|
+
template <typename ArgFormatter, typename Char, typename Context>
|
3199
|
+
typename Context::iterator vformat_to(
|
3200
|
+
typename ArgFormatter::range out, basic_string_view<Char> format_str,
|
3201
|
+
basic_format_args<Context> args,
|
3202
|
+
internal::locale_ref loc = internal::locale_ref()) {
|
3203
|
+
format_handler<ArgFormatter, Char, Context> h(out, format_str, args, loc);
|
3204
|
+
internal::parse_format_string<false>(format_str, h);
|
3205
|
+
return h.context.out();
|
3206
|
+
}
|
3207
|
+
|
3208
|
+
// Casts ``p`` to ``const void*`` for pointer formatting.
|
3209
|
+
// Example:
|
3210
|
+
// auto s = format("{}", ptr(p));
|
3211
|
+
template <typename T> inline const void* ptr(const T* p) { return p; }
|
3212
|
+
template <typename T> inline const void* ptr(const std::unique_ptr<T>& p) {
|
3213
|
+
return p.get();
|
3214
|
+
}
|
3215
|
+
template <typename T> inline const void* ptr(const std::shared_ptr<T>& p) {
|
3216
|
+
return p.get();
|
3217
|
+
}
|
3218
|
+
|
3219
|
+
class bytes {
|
3220
|
+
private:
|
3221
|
+
string_view data_;
|
3222
|
+
friend struct formatter<bytes>;
|
3223
|
+
|
3224
|
+
public:
|
3225
|
+
explicit bytes(string_view data) : data_(data) {}
|
3226
|
+
};
|
3227
|
+
|
3228
|
+
template <> struct formatter<bytes> {
|
3229
|
+
template <typename ParseContext>
|
3230
|
+
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
3231
|
+
using handler_type = internal::dynamic_specs_handler<ParseContext>;
|
3232
|
+
internal::specs_checker<handler_type> handler(handler_type(specs_, ctx),
|
3233
|
+
internal::type::string_type);
|
3234
|
+
auto it = parse_format_specs(ctx.begin(), ctx.end(), handler);
|
3235
|
+
internal::check_string_type_spec(specs_.type, ctx.error_handler());
|
3236
|
+
return it;
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
template <typename FormatContext>
|
3240
|
+
auto format(bytes b, FormatContext& ctx) -> decltype(ctx.out()) {
|
3241
|
+
internal::handle_dynamic_spec<internal::width_checker>(
|
3242
|
+
specs_.width, specs_.width_ref, ctx);
|
3243
|
+
internal::handle_dynamic_spec<internal::precision_checker>(
|
3244
|
+
specs_.precision, specs_.precision_ref, ctx);
|
3245
|
+
using range_type =
|
3246
|
+
internal::output_range<typename FormatContext::iterator, char>;
|
3247
|
+
internal::basic_writer<range_type> writer(range_type(ctx.out()));
|
3248
|
+
writer.write_bytes(b.data_, specs_);
|
3249
|
+
return writer.out();
|
3250
|
+
}
|
3251
|
+
|
3252
|
+
private:
|
3253
|
+
internal::dynamic_format_specs<char> specs_;
|
3254
|
+
};
|
3255
|
+
|
3256
|
+
template <typename It, typename Char> struct arg_join : internal::view {
|
3257
|
+
It begin;
|
3258
|
+
It end;
|
3259
|
+
basic_string_view<Char> sep;
|
3260
|
+
|
3261
|
+
arg_join(It b, It e, basic_string_view<Char> s) : begin(b), end(e), sep(s) {}
|
3262
|
+
};
|
3263
|
+
|
3264
|
+
template <typename It, typename Char>
|
3265
|
+
struct formatter<arg_join<It, Char>, Char>
|
3266
|
+
: formatter<typename std::iterator_traits<It>::value_type, Char> {
|
3267
|
+
template <typename FormatContext>
|
3268
|
+
auto format(const arg_join<It, Char>& value, FormatContext& ctx)
|
3269
|
+
-> decltype(ctx.out()) {
|
3270
|
+
using base = formatter<typename std::iterator_traits<It>::value_type, Char>;
|
3271
|
+
auto it = value.begin;
|
3272
|
+
auto out = ctx.out();
|
3273
|
+
if (it != value.end) {
|
3274
|
+
out = base::format(*it++, ctx);
|
3275
|
+
while (it != value.end) {
|
3276
|
+
out = std::copy(value.sep.begin(), value.sep.end(), out);
|
3277
|
+
ctx.advance_to(out);
|
3278
|
+
out = base::format(*it++, ctx);
|
3279
|
+
}
|
3280
|
+
}
|
3281
|
+
return out;
|
3282
|
+
}
|
3283
|
+
};
|
3284
|
+
|
3285
|
+
/**
|
3286
|
+
Returns an object that formats the iterator range `[begin, end)` with elements
|
3287
|
+
separated by `sep`.
|
3288
|
+
*/
|
3289
|
+
template <typename It>
|
3290
|
+
arg_join<It, char> join(It begin, It end, string_view sep) {
|
3291
|
+
return {begin, end, sep};
|
3292
|
+
}
|
3293
|
+
|
3294
|
+
template <typename It>
|
3295
|
+
arg_join<It, wchar_t> join(It begin, It end, wstring_view sep) {
|
3296
|
+
return {begin, end, sep};
|
3297
|
+
}
|
3298
|
+
|
3299
|
+
/**
|
3300
|
+
\rst
|
3301
|
+
Returns an object that formats `range` with elements separated by `sep`.
|
3302
|
+
|
3303
|
+
**Example**::
|
3304
|
+
|
3305
|
+
std::vector<int> v = {1, 2, 3};
|
3306
|
+
fmt::print("{}", fmt::join(v, ", "));
|
3307
|
+
// Output: "1, 2, 3"
|
3308
|
+
|
3309
|
+
``fmt::join`` applies passed format specifiers to the range elements::
|
3310
|
+
|
3311
|
+
fmt::print("{:02}", fmt::join(v, ", "));
|
3312
|
+
// Output: "01, 02, 03"
|
3313
|
+
\endrst
|
3314
|
+
*/
|
3315
|
+
template <typename Range>
|
3316
|
+
arg_join<internal::iterator_t<const Range>, char> join(const Range& range,
|
3317
|
+
string_view sep) {
|
3318
|
+
return join(std::begin(range), std::end(range), sep);
|
3319
|
+
}
|
3320
|
+
|
3321
|
+
template <typename Range>
|
3322
|
+
arg_join<internal::iterator_t<const Range>, wchar_t> join(const Range& range,
|
3323
|
+
wstring_view sep) {
|
3324
|
+
return join(std::begin(range), std::end(range), sep);
|
3325
|
+
}
|
3326
|
+
|
3327
|
+
/**
|
3328
|
+
\rst
|
3329
|
+
Converts *value* to ``std::string`` using the default format for type *T*.
|
3330
|
+
|
3331
|
+
**Example**::
|
3332
|
+
|
3333
|
+
#include <fmt/format.h>
|
3334
|
+
|
3335
|
+
std::string answer = fmt::to_string(42);
|
3336
|
+
\endrst
|
3337
|
+
*/
|
3338
|
+
template <typename T> inline std::string to_string(const T& value) {
|
3339
|
+
return format("{}", value);
|
3340
|
+
}
|
3341
|
+
|
3342
|
+
/**
|
3343
|
+
Converts *value* to ``std::wstring`` using the default format for type *T*.
|
3344
|
+
*/
|
3345
|
+
template <typename T> inline std::wstring to_wstring(const T& value) {
|
3346
|
+
return format(L"{}", value);
|
3347
|
+
}
|
3348
|
+
|
3349
|
+
template <typename Char, std::size_t SIZE>
|
3350
|
+
std::basic_string<Char> to_string(const basic_memory_buffer<Char, SIZE>& buf) {
|
3351
|
+
return std::basic_string<Char>(buf.data(), buf.size());
|
3352
|
+
}
|
3353
|
+
|
3354
|
+
template <typename Char>
|
3355
|
+
typename buffer_context<Char>::iterator internal::vformat_to(
|
3356
|
+
internal::buffer<Char>& buf, basic_string_view<Char> format_str,
|
3357
|
+
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
3358
|
+
using range = buffer_range<Char>;
|
3359
|
+
return vformat_to<arg_formatter<range>>(buf, to_string_view(format_str),
|
3360
|
+
args);
|
3361
|
+
}
|
3362
|
+
|
3363
|
+
template <typename S, typename Char = char_t<S>,
|
3364
|
+
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
3365
|
+
inline typename buffer_context<Char>::iterator vformat_to(
|
3366
|
+
internal::buffer<Char>& buf, const S& format_str,
|
3367
|
+
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
3368
|
+
return internal::vformat_to(buf, to_string_view(format_str), args);
|
3369
|
+
}
|
3370
|
+
|
3371
|
+
template <typename S, typename... Args, std::size_t SIZE = inline_buffer_size,
|
3372
|
+
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
|
3373
|
+
inline typename buffer_context<Char>::iterator format_to(
|
3374
|
+
basic_memory_buffer<Char, SIZE>& buf, const S& format_str, Args&&... args) {
|
3375
|
+
internal::check_format_string<Args...>(format_str);
|
3376
|
+
using context = buffer_context<Char>;
|
3377
|
+
return internal::vformat_to(buf, to_string_view(format_str),
|
3378
|
+
make_format_args<context>(args...));
|
3379
|
+
}
|
3380
|
+
|
3381
|
+
template <typename OutputIt, typename Char = char>
|
3382
|
+
using format_context_t = basic_format_context<OutputIt, Char>;
|
3383
|
+
|
3384
|
+
template <typename OutputIt, typename Char = char>
|
3385
|
+
using format_args_t = basic_format_args<format_context_t<OutputIt, Char>>;
|
3386
|
+
|
3387
|
+
template <typename S, typename OutputIt, typename... Args,
|
3388
|
+
FMT_ENABLE_IF(
|
3389
|
+
internal::is_output_iterator<OutputIt>::value &&
|
3390
|
+
!internal::is_contiguous_back_insert_iterator<OutputIt>::value)>
|
3391
|
+
inline OutputIt vformat_to(
|
3392
|
+
OutputIt out, const S& format_str,
|
3393
|
+
format_args_t<type_identity_t<OutputIt>, char_t<S>> args) {
|
3394
|
+
using range = internal::output_range<OutputIt, char_t<S>>;
|
3395
|
+
return vformat_to<arg_formatter<range>>(range(out),
|
3396
|
+
to_string_view(format_str), args);
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
/**
|
3400
|
+
\rst
|
3401
|
+
Formats arguments, writes the result to the output iterator ``out`` and returns
|
3402
|
+
the iterator past the end of the output range.
|
3403
|
+
|
3404
|
+
**Example**::
|
3405
|
+
|
3406
|
+
std::vector<char> out;
|
3407
|
+
fmt::format_to(std::back_inserter(out), "{}", 42);
|
3408
|
+
\endrst
|
3409
|
+
*/
|
3410
|
+
template <typename OutputIt, typename S, typename... Args,
|
3411
|
+
FMT_ENABLE_IF(
|
3412
|
+
internal::is_output_iterator<OutputIt>::value &&
|
3413
|
+
!internal::is_contiguous_back_insert_iterator<OutputIt>::value &&
|
3414
|
+
internal::is_string<S>::value)>
|
3415
|
+
inline OutputIt format_to(OutputIt out, const S& format_str, Args&&... args) {
|
3416
|
+
internal::check_format_string<Args...>(format_str);
|
3417
|
+
using context = format_context_t<OutputIt, char_t<S>>;
|
3418
|
+
return vformat_to(out, to_string_view(format_str),
|
3419
|
+
make_format_args<context>(args...));
|
3420
|
+
}
|
3421
|
+
|
3422
|
+
template <typename OutputIt> struct format_to_n_result {
|
3423
|
+
/** Iterator past the end of the output range. */
|
3424
|
+
OutputIt out;
|
3425
|
+
/** Total (not truncated) output size. */
|
3426
|
+
std::size_t size;
|
3427
|
+
};
|
3428
|
+
|
3429
|
+
template <typename OutputIt, typename Char = typename OutputIt::value_type>
|
3430
|
+
using format_to_n_context =
|
3431
|
+
format_context_t<internal::truncating_iterator<OutputIt>, Char>;
|
3432
|
+
|
3433
|
+
template <typename OutputIt, typename Char = typename OutputIt::value_type>
|
3434
|
+
using format_to_n_args = basic_format_args<format_to_n_context<OutputIt, Char>>;
|
3435
|
+
|
3436
|
+
template <typename OutputIt, typename Char, typename... Args>
|
3437
|
+
inline format_arg_store<format_to_n_context<OutputIt, Char>, Args...>
|
3438
|
+
make_format_to_n_args(const Args&... args) {
|
3439
|
+
return format_arg_store<format_to_n_context<OutputIt, Char>, Args...>(
|
3440
|
+
args...);
|
3441
|
+
}
|
3442
|
+
|
3443
|
+
template <typename OutputIt, typename Char, typename... Args,
|
3444
|
+
FMT_ENABLE_IF(internal::is_output_iterator<OutputIt>::value)>
|
3445
|
+
inline format_to_n_result<OutputIt> vformat_to_n(
|
3446
|
+
OutputIt out, std::size_t n, basic_string_view<Char> format_str,
|
3447
|
+
format_to_n_args<type_identity_t<OutputIt>, type_identity_t<Char>> args) {
|
3448
|
+
auto it = vformat_to(internal::truncating_iterator<OutputIt>(out, n),
|
3449
|
+
format_str, args);
|
3450
|
+
return {it.base(), it.count()};
|
3451
|
+
}
|
3452
|
+
|
3453
|
+
/**
|
3454
|
+
\rst
|
3455
|
+
Formats arguments, writes up to ``n`` characters of the result to the output
|
3456
|
+
iterator ``out`` and returns the total output size and the iterator past the
|
3457
|
+
end of the output range.
|
3458
|
+
\endrst
|
3459
|
+
*/
|
3460
|
+
template <typename OutputIt, typename S, typename... Args,
|
3461
|
+
FMT_ENABLE_IF(internal::is_string<S>::value&&
|
3462
|
+
internal::is_output_iterator<OutputIt>::value)>
|
3463
|
+
inline format_to_n_result<OutputIt> format_to_n(OutputIt out, std::size_t n,
|
3464
|
+
const S& format_str,
|
3465
|
+
const Args&... args) {
|
3466
|
+
internal::check_format_string<Args...>(format_str);
|
3467
|
+
using context = format_to_n_context<OutputIt, char_t<S>>;
|
3468
|
+
return vformat_to_n(out, n, to_string_view(format_str),
|
3469
|
+
make_format_args<context>(args...));
|
3470
|
+
}
|
3471
|
+
|
3472
|
+
template <typename Char>
|
3473
|
+
inline std::basic_string<Char> internal::vformat(
|
3474
|
+
basic_string_view<Char> format_str,
|
3475
|
+
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
3476
|
+
basic_memory_buffer<Char> buffer;
|
3477
|
+
internal::vformat_to(buffer, format_str, args);
|
3478
|
+
return to_string(buffer);
|
3479
|
+
}
|
3480
|
+
|
3481
|
+
/**
|
3482
|
+
Returns the number of characters in the output of
|
3483
|
+
``format(format_str, args...)``.
|
3484
|
+
*/
|
3485
|
+
template <typename... Args>
|
3486
|
+
inline std::size_t formatted_size(string_view format_str, const Args&... args) {
|
3487
|
+
return format_to(internal::counting_iterator(), format_str, args...).count();
|
3488
|
+
}
|
3489
|
+
|
3490
|
+
template <typename Char, FMT_ENABLE_IF(std::is_same<Char, wchar_t>::value)>
|
3491
|
+
void vprint(std::FILE* f, basic_string_view<Char> format_str,
|
3492
|
+
wformat_args args) {
|
3493
|
+
wmemory_buffer buffer;
|
3494
|
+
internal::vformat_to(buffer, format_str, args);
|
3495
|
+
buffer.push_back(L'\0');
|
3496
|
+
if (std::fputws(buffer.data(), f) == -1)
|
3497
|
+
FMT_THROW(system_error(errno, "cannot write to file"));
|
3498
|
+
}
|
3499
|
+
|
3500
|
+
template <typename Char, FMT_ENABLE_IF(std::is_same<Char, wchar_t>::value)>
|
3501
|
+
void vprint(basic_string_view<Char> format_str, wformat_args args) {
|
3502
|
+
vprint(stdout, format_str, args);
|
3503
|
+
}
|
3504
|
+
|
3505
|
+
#if FMT_USE_USER_DEFINED_LITERALS
|
3506
|
+
namespace internal {
|
3507
|
+
|
3508
|
+
# if FMT_USE_UDL_TEMPLATE
|
3509
|
+
template <typename Char, Char... CHARS> class udl_formatter {
|
3510
|
+
public:
|
3511
|
+
template <typename... Args>
|
3512
|
+
std::basic_string<Char> operator()(Args&&... args) const {
|
3513
|
+
FMT_CONSTEXPR_DECL Char s[] = {CHARS..., '\0'};
|
3514
|
+
FMT_CONSTEXPR_DECL bool invalid_format =
|
3515
|
+
do_check_format_string<Char, error_handler, remove_cvref_t<Args>...>(
|
3516
|
+
basic_string_view<Char>(s, sizeof...(CHARS)));
|
3517
|
+
(void)invalid_format;
|
3518
|
+
return format(s, std::forward<Args>(args)...);
|
3519
|
+
}
|
3520
|
+
};
|
3521
|
+
# else
|
3522
|
+
template <typename Char> struct udl_formatter {
|
3523
|
+
basic_string_view<Char> str;
|
3524
|
+
|
3525
|
+
template <typename... Args>
|
3526
|
+
std::basic_string<Char> operator()(Args&&... args) const {
|
3527
|
+
return format(str, std::forward<Args>(args)...);
|
3528
|
+
}
|
3529
|
+
};
|
3530
|
+
# endif // FMT_USE_UDL_TEMPLATE
|
3531
|
+
|
3532
|
+
template <typename Char> struct udl_arg {
|
3533
|
+
basic_string_view<Char> str;
|
3534
|
+
|
3535
|
+
template <typename T> named_arg<T, Char> operator=(T&& value) const {
|
3536
|
+
return {str, std::forward<T>(value)};
|
3537
|
+
}
|
3538
|
+
};
|
3539
|
+
|
3540
|
+
// Converts string literals to basic_string_view.
|
3541
|
+
template <typename Char, size_t N>
|
3542
|
+
FMT_CONSTEXPR basic_string_view<Char> compile_string_to_view(
|
3543
|
+
const Char (&s)[N]) {
|
3544
|
+
// Remove trailing null character if needed. Won't be present if this is used
|
3545
|
+
// with raw character array (i.e. not defined as a string).
|
3546
|
+
return {s,
|
3547
|
+
N - ((std::char_traits<Char>::to_int_type(s[N - 1]) == 0) ? 1 : 0)};
|
3548
|
+
}
|
3549
|
+
|
3550
|
+
// Converts string_view to basic_string_view.
|
3551
|
+
template <typename Char>
|
3552
|
+
FMT_CONSTEXPR basic_string_view<Char> compile_string_to_view(
|
3553
|
+
const std_string_view<Char>& s) {
|
3554
|
+
return {s.data(), s.size()};
|
3555
|
+
}
|
3556
|
+
} // namespace internal
|
3557
|
+
|
3558
|
+
inline namespace literals {
|
3559
|
+
# if FMT_USE_UDL_TEMPLATE
|
3560
|
+
# pragma GCC diagnostic push
|
3561
|
+
# if FMT_CLANG_VERSION
|
3562
|
+
# pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template"
|
3563
|
+
# endif
|
3564
|
+
template <typename Char, Char... CHARS>
|
3565
|
+
FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...> operator""_format() {
|
3566
|
+
return {};
|
3567
|
+
}
|
3568
|
+
# pragma GCC diagnostic pop
|
3569
|
+
# else
|
3570
|
+
/**
|
3571
|
+
\rst
|
3572
|
+
User-defined literal equivalent of :func:`fmt::format`.
|
3573
|
+
|
3574
|
+
**Example**::
|
3575
|
+
|
3576
|
+
using namespace fmt::literals;
|
3577
|
+
std::string message = "The answer is {}"_format(42);
|
3578
|
+
\endrst
|
3579
|
+
*/
|
3580
|
+
FMT_CONSTEXPR internal::udl_formatter<char> operator"" _format(const char* s,
|
3581
|
+
std::size_t n) {
|
3582
|
+
return {{s, n}};
|
3583
|
+
}
|
3584
|
+
FMT_CONSTEXPR internal::udl_formatter<wchar_t> operator"" _format(
|
3585
|
+
const wchar_t* s, std::size_t n) {
|
3586
|
+
return {{s, n}};
|
3587
|
+
}
|
3588
|
+
# endif // FMT_USE_UDL_TEMPLATE
|
3589
|
+
|
3590
|
+
/**
|
3591
|
+
\rst
|
3592
|
+
User-defined literal equivalent of :func:`fmt::arg`.
|
3593
|
+
|
3594
|
+
**Example**::
|
3595
|
+
|
3596
|
+
using namespace fmt::literals;
|
3597
|
+
fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
|
3598
|
+
\endrst
|
3599
|
+
*/
|
3600
|
+
FMT_CONSTEXPR internal::udl_arg<char> operator"" _a(const char* s,
|
3601
|
+
std::size_t n) {
|
3602
|
+
return {{s, n}};
|
3603
|
+
}
|
3604
|
+
FMT_CONSTEXPR internal::udl_arg<wchar_t> operator"" _a(const wchar_t* s,
|
3605
|
+
std::size_t n) {
|
3606
|
+
return {{s, n}};
|
3607
|
+
}
|
3608
|
+
} // namespace literals
|
3609
|
+
#endif // FMT_USE_USER_DEFINED_LITERALS
|
3610
|
+
FMT_END_NAMESPACE
|
3611
|
+
|
3612
|
+
#define FMT_STRING_IMPL(s, ...) \
|
3613
|
+
[] { \
|
3614
|
+
/* Use a macro-like name to avoid shadowing warnings. */ \
|
3615
|
+
struct FMT_COMPILE_STRING : fmt::compile_string { \
|
3616
|
+
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
|
3617
|
+
FMT_MAYBE_UNUSED __VA_ARGS__ FMT_CONSTEXPR \
|
3618
|
+
operator fmt::basic_string_view<char_type>() const { \
|
3619
|
+
return fmt::internal::compile_string_to_view<char_type>(s); \
|
3620
|
+
} \
|
3621
|
+
}; \
|
3622
|
+
return FMT_COMPILE_STRING(); \
|
3623
|
+
}()
|
3624
|
+
|
3625
|
+
/**
|
3626
|
+
\rst
|
3627
|
+
Constructs a compile-time format string from a string literal *s*.
|
3628
|
+
|
3629
|
+
**Example**::
|
3630
|
+
|
3631
|
+
// A compile-time error because 'd' is an invalid specifier for strings.
|
3632
|
+
std::string s = format(FMT_STRING("{:d}"), "foo");
|
3633
|
+
\endrst
|
3634
|
+
*/
|
3635
|
+
#define FMT_STRING(s) FMT_STRING_IMPL(s, )
|
3636
|
+
|
3637
|
+
#if defined(FMT_STRING_ALIAS) && FMT_STRING_ALIAS
|
3638
|
+
# define fmt(s) FMT_STRING_IMPL(s, [[deprecated]])
|
3639
|
+
#endif
|
3640
|
+
|
3641
|
+
#ifdef FMT_HEADER_ONLY
|
3642
|
+
# define FMT_FUNC inline
|
3643
|
+
# include "format-inl.h"
|
3644
|
+
#else
|
3645
|
+
# define FMT_FUNC
|
3646
|
+
#endif
|
3647
|
+
|
3648
|
+
#endif // FMT_FORMAT_H_
|