react-native-windows 0.84.0 → 0.84.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +2 -17
- package/Folly/ThreadNameStub.cpp +4 -6
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -7
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -3
- package/PropertySheets/CIBuildOptimizations.props +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +10 -1
- package/PropertySheets/React.Cpp.props +3 -3
- package/PropertySheets/WinUI.props +2 -1
- package/ReactCommon/ReactCommon.vcxproj +0 -5
- package/Scripts/EnableInternalWinAppSDKFeed.ps1 +12 -5
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +61 -6
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +4 -37
- package/Scripts/UpdateNightlyDependencies.ps1 +47 -0
- package/Scripts/creaternwapp.cmd +5 -8
- package/Scripts/creaternwlib.cmd +10 -23
- package/Shared/Shared.vcxitems +2 -0
- package/{Folly → external}/.clang-format +0 -1
- package/external/External.vcxitems +10 -0
- package/external/fast-float/.syncignore +10 -0
- package/external/fast-float/LICENSE-APACHE +190 -0
- package/external/fast-float/LICENSE-BOOST +23 -0
- package/external/fast-float/LICENSE-MIT +27 -0
- package/external/fast-float/README.md +545 -0
- package/external/fast-float/cgmanifest.json +15 -0
- package/external/fast-float/fast-float.vcxitems +14 -0
- package/external/fast-float/include/fast_float/ascii_number.h +588 -0
- package/external/fast-float/include/fast_float/bigint.h +638 -0
- package/external/fast-float/include/fast_float/constexpr_feature_detect.h +46 -0
- package/external/fast-float/include/fast_float/decimal_to_binary.h +212 -0
- package/external/fast-float/include/fast_float/digit_comparison.h +457 -0
- package/external/fast-float/include/fast_float/fast_float.h +59 -0
- package/external/fast-float/include/fast_float/fast_table.h +708 -0
- package/external/fast-float/include/fast_float/float_common.h +1240 -0
- package/external/fast-float/include/fast_float/parse_number.h +399 -0
- package/external/fast-float/sync-config.json +8 -0
- package/external/fmt/.syncignore +10 -0
- package/external/fmt/CONTRIBUTING.md +20 -0
- package/external/fmt/LICENSE +27 -0
- package/external/fmt/README.md +484 -0
- package/external/fmt/doc/ChangeLog-old.md +3290 -0
- package/external/fmt/doc/api.md +650 -0
- package/external/fmt/doc/fmt.css +61 -0
- package/external/fmt/doc/fmt.js +4 -0
- package/external/fmt/doc/get-started.md +222 -0
- package/external/fmt/doc/index.md +151 -0
- package/external/fmt/doc/perf.svg +1 -0
- package/external/fmt/doc/python-license.txt +290 -0
- package/external/fmt/doc/syntax.md +887 -0
- package/external/fmt/fmt.vcxitems +28 -0
- package/external/fmt/include/fmt/args.h +228 -0
- package/external/fmt/include/fmt/base.h +3077 -0
- package/external/fmt/include/fmt/chrono.h +2432 -0
- package/external/fmt/include/fmt/color.h +612 -0
- package/external/fmt/include/fmt/compile.h +529 -0
- package/external/fmt/include/fmt/core.h +5 -0
- package/external/fmt/include/fmt/format-inl.h +1928 -0
- package/external/fmt/include/fmt/format.h +4427 -0
- package/external/fmt/include/fmt/os.h +439 -0
- package/external/fmt/include/fmt/ostream.h +211 -0
- package/external/fmt/include/fmt/printf.h +656 -0
- package/external/fmt/include/fmt/ranges.h +882 -0
- package/external/fmt/include/fmt/std.h +699 -0
- package/external/fmt/include/fmt/xchar.h +322 -0
- package/external/fmt/src/fmt.cc +135 -0
- package/external/fmt/src/format.cc +43 -0
- package/external/fmt/src/os.cc +403 -0
- package/external/fmt/sync-config.json +8 -0
- package/external/folly/.syncignore +60 -0
- package/external/folly/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/{fmt → external/folly/folly}/.clang-format +0 -1
- package/external/folly/folly/AtomicHashArray-inl.h +546 -0
- package/external/folly/folly/AtomicHashArray.h +431 -0
- package/external/folly/folly/AtomicHashMap-inl.h +653 -0
- package/external/folly/folly/AtomicHashMap.h +484 -0
- package/external/folly/folly/AtomicIntrusiveLinkedList.h +206 -0
- package/external/folly/folly/AtomicLinkedList.h +110 -0
- package/external/folly/folly/AtomicUnorderedMap.h +522 -0
- package/external/folly/folly/BUCK +1631 -0
- package/external/folly/folly/BUILD_MODE.bzl +72 -0
- package/external/folly/folly/Benchmark.cpp +986 -0
- package/external/folly/folly/Benchmark.h +680 -0
- package/external/folly/folly/BenchmarkUtil.h +47 -0
- package/external/folly/folly/Bits.h +17 -0
- package/external/folly/folly/CMakeLists.txt +110 -0
- package/external/folly/folly/CPortability.h +338 -0
- package/external/folly/folly/CancellationToken-inl.h +449 -0
- package/external/folly/folly/CancellationToken.cpp +250 -0
- package/external/folly/folly/CancellationToken.h +365 -0
- package/external/folly/folly/Chrono.h +132 -0
- package/external/folly/folly/ClockGettimeWrappers.cpp +93 -0
- package/external/folly/folly/ClockGettimeWrappers.h +29 -0
- package/external/folly/folly/ConcurrentBitSet.h +157 -0
- package/external/folly/folly/ConcurrentLazy.h +74 -0
- package/external/folly/folly/ConcurrentSkipList-inl.h +341 -0
- package/external/folly/folly/ConcurrentSkipList.h +824 -0
- package/external/folly/folly/ConstructorCallbackList.h +158 -0
- package/external/folly/folly/Conv.h +2026 -0
- package/external/folly/folly/CppAttributes.h +170 -0
- package/external/folly/folly/CpuId.h +297 -0
- package/external/folly/folly/DefaultKeepAliveExecutor.h +172 -0
- package/external/folly/folly/Demangle.cpp +255 -0
- package/external/folly/folly/Demangle.h +73 -0
- package/external/folly/folly/DiscriminatedPtr.h +236 -0
- package/external/folly/folly/DynamicConverter.h +17 -0
- package/external/folly/folly/Exception.h +150 -0
- package/external/folly/folly/ExceptionString.cpp +51 -0
- package/external/folly/folly/ExceptionString.h +33 -0
- package/external/folly/folly/ExceptionWrapper-inl.h +264 -0
- package/external/folly/folly/ExceptionWrapper.cpp +37 -0
- package/external/folly/folly/ExceptionWrapper.h +377 -0
- package/external/folly/folly/Executor.cpp +111 -0
- package/external/folly/folly/Executor.h +351 -0
- package/external/folly/folly/Expected.h +1725 -0
- package/external/folly/folly/FBString.h +2888 -0
- package/external/folly/folly/FBVector.h +17 -0
- package/external/folly/folly/File.cpp +180 -0
- package/external/folly/folly/File.h +177 -0
- package/external/folly/folly/FileUtil.cpp +378 -0
- package/external/folly/folly/FileUtil.h +332 -0
- package/external/folly/folly/Fingerprint.cpp +135 -0
- package/external/folly/folly/Fingerprint.h +289 -0
- package/external/folly/folly/FixedString.h +2965 -0
- package/external/folly/folly/FollyMemcpy.cpp +30 -0
- package/external/folly/folly/FollyMemcpy.h +23 -0
- package/external/folly/folly/FollyMemset.cpp +29 -0
- package/external/folly/folly/FollyMemset.h +25 -0
- package/external/folly/folly/Format-inl.h +1152 -0
- package/external/folly/folly/Format.cpp +429 -0
- package/external/folly/folly/Format.h +463 -0
- package/external/folly/folly/FormatArg.h +285 -0
- package/external/folly/folly/FormatTraits.h +65 -0
- package/external/folly/folly/Function.h +1159 -0
- package/external/folly/folly/GLog.h +85 -0
- package/external/folly/folly/GroupVarint.cpp +153 -0
- package/external/folly/folly/GroupVarint.h +630 -0
- package/external/folly/folly/Hash.h +20 -0
- package/external/folly/folly/IPAddress.cpp +490 -0
- package/external/folly/folly/IPAddress.h +667 -0
- package/external/folly/folly/IPAddressException.h +82 -0
- package/external/folly/folly/IPAddressV4.cpp +305 -0
- package/external/folly/folly/IPAddressV4.h +495 -0
- package/external/folly/folly/IPAddressV6.cpp +541 -0
- package/external/folly/folly/IPAddressV6.h +627 -0
- package/external/folly/folly/Indestructible.h +164 -0
- package/external/folly/folly/IndexedMemPool.h +550 -0
- package/external/folly/folly/IntrusiveList.h +17 -0
- package/external/folly/folly/Lazy.h +142 -0
- package/external/folly/folly/Likely.h +76 -0
- package/external/folly/folly/MPMCPipeline.h +280 -0
- package/external/folly/folly/MPMCQueue.h +1556 -0
- package/external/folly/folly/MacAddress.cpp +188 -0
- package/external/folly/folly/MacAddress.h +260 -0
- package/external/folly/folly/MapUtil.h +17 -0
- package/external/folly/folly/Math.h +258 -0
- package/external/folly/folly/MaybeManagedPtr.h +120 -0
- package/external/folly/folly/Memory.h +900 -0
- package/external/folly/folly/MicroLock.cpp +76 -0
- package/external/folly/folly/MicroLock.h +354 -0
- package/external/folly/folly/MicroSpinLock.h +17 -0
- package/external/folly/folly/MoveWrapper.h +76 -0
- package/external/folly/folly/ObserverContainer.h +1026 -0
- package/external/folly/folly/Optional.h +743 -0
- package/external/folly/folly/Overload.h +325 -0
- package/external/folly/folly/PackedSyncPtr.h +147 -0
- package/external/folly/folly/Padded.h +464 -0
- package/external/folly/folly/Poly-inl.h +230 -0
- package/external/folly/folly/Poly.h +1095 -0
- package/external/folly/folly/PolyException.h +43 -0
- package/external/folly/folly/Portability.h +644 -0
- package/external/folly/folly/Preprocessor.h +236 -0
- package/external/folly/folly/ProducerConsumerQueue.h +182 -0
- package/external/folly/folly/RWSpinLock.h +17 -0
- package/external/folly/folly/Random-inl.h +86 -0
- package/external/folly/folly/Random.cpp +184 -0
- package/external/folly/folly/Random.h +434 -0
- package/external/folly/folly/Range.h +1772 -0
- package/external/folly/folly/Replaceable.h +636 -0
- package/external/folly/folly/ScopeGuard.cpp +29 -0
- package/external/folly/folly/ScopeGuard.h +420 -0
- package/external/folly/folly/SharedMutex.cpp +81 -0
- package/external/folly/folly/SharedMutex.h +1751 -0
- package/external/folly/folly/Singleton-inl.h +332 -0
- package/external/folly/folly/Singleton.cpp +512 -0
- package/external/folly/folly/Singleton.h +891 -0
- package/external/folly/folly/SingletonThreadLocal.cpp +53 -0
- package/external/folly/folly/SingletonThreadLocal.h +263 -0
- package/external/folly/folly/SocketAddress.cpp +786 -0
- package/external/folly/folly/SocketAddress.h +768 -0
- package/external/folly/folly/SpinLock.h +55 -0
- package/external/folly/folly/String-inl.h +668 -0
- package/external/folly/folly/String.cpp +777 -0
- package/external/folly/folly/String.h +767 -0
- package/external/folly/folly/Subprocess.cpp +1142 -0
- package/external/folly/folly/Subprocess.h +1055 -0
- package/external/folly/folly/Synchronized.h +1833 -0
- package/external/folly/folly/SynchronizedPtr.h +106 -0
- package/external/folly/folly/ThreadCachedInt.h +175 -0
- package/external/folly/folly/ThreadLocal.h +478 -0
- package/external/folly/folly/TimeoutQueue.cpp +78 -0
- package/external/folly/folly/TimeoutQueue.h +123 -0
- package/external/folly/folly/TokenBucket.h +673 -0
- package/external/folly/folly/Traits.h +1442 -0
- package/external/folly/folly/Try-inl.h +372 -0
- package/external/folly/folly/Try.cpp +23 -0
- package/external/folly/folly/Try.h +728 -0
- package/external/folly/folly/UTF8String.h +56 -0
- package/external/folly/folly/Unicode.cpp +201 -0
- package/external/folly/folly/Unicode.h +94 -0
- package/external/folly/folly/Unit.h +65 -0
- package/external/folly/folly/Uri-inl.h +101 -0
- package/external/folly/folly/Uri.cpp +190 -0
- package/external/folly/folly/Uri.h +142 -0
- package/external/folly/folly/Utility.h +932 -0
- package/external/folly/folly/VERSION +1 -0
- package/external/folly/folly/Varint.h +230 -0
- package/external/folly/folly/VirtualExecutor.h +17 -0
- package/external/folly/folly/algorithm/simd/BUCK +47 -0
- package/external/folly/folly/algorithm/simd/Contains.cpp +42 -0
- package/external/folly/folly/algorithm/simd/Contains.h +116 -0
- package/external/folly/folly/algorithm/simd/FindFixed.h +301 -0
- package/external/folly/folly/algorithm/simd/Ignore.h +52 -0
- package/external/folly/folly/algorithm/simd/Movemask.h +207 -0
- package/external/folly/folly/algorithm/simd/detail/BUCK +70 -0
- package/external/folly/folly/algorithm/simd/detail/ContainsImpl.h +91 -0
- package/external/folly/folly/algorithm/simd/detail/SimdAnyOf.h +83 -0
- package/external/folly/folly/algorithm/simd/detail/SimdForEach.h +209 -0
- package/external/folly/folly/algorithm/simd/detail/SimdPlatform.h +445 -0
- package/external/folly/folly/algorithm/simd/detail/Traits.h +125 -0
- package/external/folly/folly/algorithm/simd/detail/UnrollUtils.h +126 -0
- package/external/folly/folly/base64.h +264 -0
- package/external/folly/folly/chrono/BUCK +29 -0
- package/external/folly/folly/chrono/Clock.h +65 -0
- package/external/folly/folly/chrono/Conv.h +712 -0
- package/external/folly/folly/chrono/test/BUCK +26 -0
- package/external/folly/folly/chrono/test/ClockTest.cpp +68 -0
- package/external/folly/folly/chrono/test/ConvTest.cpp +652 -0
- package/external/folly/folly/concurrency/AtomicSharedPtr.h +387 -0
- package/external/folly/folly/concurrency/BUCK +170 -0
- package/external/folly/folly/concurrency/CacheLocality.h +460 -0
- package/external/folly/folly/concurrency/ConcurrentHashMap.h +822 -0
- package/external/folly/folly/concurrency/CoreCachedSharedPtr.h +232 -0
- package/external/folly/folly/concurrency/DeadlockDetector.cpp +27 -0
- package/external/folly/folly/concurrency/DeadlockDetector.h +44 -0
- package/external/folly/folly/concurrency/DynamicBoundedQueue.h +751 -0
- package/external/folly/folly/concurrency/PriorityUnboundedQueueSet.h +207 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.cpp +46 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.h +38 -0
- package/external/folly/folly/concurrency/SingletonRelaxedCounter.h +325 -0
- package/external/folly/folly/concurrency/ThreadCachedSynchronized.h +227 -0
- package/external/folly/folly/concurrency/UnboundedQueue.h +891 -0
- package/external/folly/folly/concurrency/container/BUCK +77 -0
- package/external/folly/folly/concurrency/container/FlatCombiningPriorityQueue.h +426 -0
- package/external/folly/folly/concurrency/container/LockFreeRingBuffer.h +306 -0
- package/external/folly/folly/concurrency/container/RelaxedConcurrentPriorityQueue.h +1212 -0
- package/external/folly/folly/concurrency/container/SingleWriterFixedHashMap.h +322 -0
- package/external/folly/folly/concurrency/container/atomic_grow_array.h +564 -0
- package/external/folly/folly/concurrency/container/test/BUCK +75 -0
- package/external/folly/folly/concurrency/container/test/FlatCombiningPriorityQueueTest.cpp +570 -0
- package/external/folly/folly/concurrency/container/test/LockFreeRingBufferTest.cpp +276 -0
- package/external/folly/folly/concurrency/container/test/RelaxedConcurrentPriorityQueueTest.cpp +1570 -0
- package/external/folly/folly/concurrency/container/test/SingleWriterFixedHashMapTest.cpp +401 -0
- package/external/folly/folly/concurrency/container/test/atomic_grow_array_test.cpp +187 -0
- package/external/folly/folly/concurrency/detail/AtomicSharedPtr-detail.h +212 -0
- package/external/folly/folly/concurrency/detail/ConcurrentHashMap-detail.h +1911 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.cpp +43 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.h +190 -0
- package/external/folly/folly/concurrency/memory/BUCK +53 -0
- package/external/folly/folly/concurrency/memory/PrimaryPtr.h +338 -0
- package/external/folly/folly/concurrency/memory/ReadMostlySharedPtr.h +511 -0
- package/external/folly/folly/concurrency/memory/TLRefCount.h +228 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrBenchmark.cpp +56 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrTest.cpp +454 -0
- package/external/folly/folly/concurrency/memory/test/BUCK +95 -0
- package/external/folly/folly/concurrency/memory/test/PrimaryPtrTest.cpp +303 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrBenchmark.cpp +138 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrStressTest.cpp +75 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrTest.cpp +378 -0
- package/external/folly/folly/concurrency/memory/test/RefCountBenchmark.cpp +90 -0
- package/external/folly/folly/concurrency/memory/test/RefCountTest.cpp +168 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrCounted.h +156 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrPerformance.cpp +255 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrTest.cpp +257 -0
- package/external/folly/folly/concurrency/test/BUCK +229 -0
- package/external/folly/folly/concurrency/test/CacheLocalityBenchmark.cpp +392 -0
- package/external/folly/folly/concurrency/test/CacheLocalityTest.cpp +1229 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapBench.cpp +260 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapTest.cpp +1242 -0
- package/external/folly/folly/concurrency/test/CoreCachedSharedPtrTest.cpp +408 -0
- package/external/folly/folly/concurrency/test/DynamicBoundedQueueTest.cpp +984 -0
- package/external/folly/folly/concurrency/test/PriorityUnboundedQueueSetTest.cpp +73 -0
- package/external/folly/folly/concurrency/test/ProcessLocalUniqueIdTest.cpp +66 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterBench.cpp +101 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterTest.cpp +185 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp +76 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedTest.cpp +93 -0
- package/external/folly/folly/concurrency/test/UnboundedQueueTest.cpp +1302 -0
- package/external/folly/folly/container/Access.h +57 -0
- package/external/folly/folly/container/Array.h +87 -0
- package/external/folly/folly/container/BUCK +353 -0
- package/external/folly/folly/container/BitIterator.h +203 -0
- package/external/folly/folly/container/Enumerate.h +162 -0
- package/external/folly/folly/container/EvictingCacheMap.h +730 -0
- package/external/folly/folly/container/F14.md +300 -0
- package/external/folly/folly/container/F14Map-fwd.h +113 -0
- package/external/folly/folly/container/F14Map.h +2108 -0
- package/external/folly/folly/container/F14Set-fwd.h +95 -0
- package/external/folly/folly/container/F14Set.h +1603 -0
- package/external/folly/folly/container/FBVector.h +1711 -0
- package/external/folly/folly/container/Foreach-inl.h +316 -0
- package/external/folly/folly/container/Foreach.h +209 -0
- package/external/folly/folly/container/HeterogeneousAccess-fwd.h +33 -0
- package/external/folly/folly/container/HeterogeneousAccess.h +171 -0
- package/external/folly/folly/container/IntrusiveHeap.h +268 -0
- package/external/folly/folly/container/IntrusiveList.h +131 -0
- package/external/folly/folly/container/Iterator.h +843 -0
- package/external/folly/folly/container/MapUtil.h +376 -0
- package/external/folly/folly/container/Merge.h +90 -0
- package/external/folly/folly/container/RegexMatchCache.cpp +521 -0
- package/external/folly/folly/container/RegexMatchCache.h +699 -0
- package/external/folly/folly/container/Reserve.h +109 -0
- package/external/folly/folly/container/SparseByteSet.h +123 -0
- package/external/folly/folly/container/View.h +81 -0
- package/external/folly/folly/container/WeightedEvictingCacheMap.h +651 -0
- package/external/folly/folly/container/detail/BUCK +115 -0
- package/external/folly/folly/container/detail/BitIteratorDetail.h +87 -0
- package/external/folly/folly/container/detail/F14Defaults.h +34 -0
- package/external/folly/folly/container/detail/F14IntrinsicsAvailability.h +67 -0
- package/external/folly/folly/container/detail/F14MapFallback.h +717 -0
- package/external/folly/folly/container/detail/F14Mask.h +235 -0
- package/external/folly/folly/container/detail/F14Policy.h +1523 -0
- package/external/folly/folly/container/detail/F14SetFallback.h +528 -0
- package/external/folly/folly/container/detail/F14Table.cpp +71 -0
- package/external/folly/folly/container/detail/F14Table.h +2680 -0
- package/external/folly/folly/container/detail/Util.h +303 -0
- package/external/folly/folly/container/detail/tape_detail.h +135 -0
- package/external/folly/folly/container/detail/test/BUCK +14 -0
- package/external/folly/folly/container/detail/test/F14DetailTest.cpp +47 -0
- package/external/folly/folly/container/heap_vector_types.h +1683 -0
- package/external/folly/folly/container/range_traits.h +81 -0
- package/external/folly/folly/container/small_vector.h +1476 -0
- package/external/folly/folly/container/sorted_vector_types.h +1652 -0
- package/external/folly/folly/container/span.h +408 -0
- package/external/folly/folly/container/tape.h +608 -0
- package/external/folly/folly/container/test/.clang-tidy +12 -0
- package/external/folly/folly/container/test/AccessTest.cpp +138 -0
- package/external/folly/folly/container/test/ArrayTest.cpp +84 -0
- package/external/folly/folly/container/test/BUCK +568 -0
- package/external/folly/folly/container/test/BitIteratorBench.cpp +112 -0
- package/external/folly/folly/container/test/BitIteratorTest.cpp +109 -0
- package/external/folly/folly/container/test/EnumerateTest.cpp +294 -0
- package/external/folly/folly/container/test/EvictingCacheMapBench.cpp +80 -0
- package/external/folly/folly/container/test/EvictingCacheMapTest.cpp +842 -0
- package/external/folly/folly/container/test/F14AsanSupportTest.cpp +143 -0
- package/external/folly/folly/container/test/F14FwdTest.cpp +37 -0
- package/external/folly/folly/container/test/F14InterprocessTest.cpp +404 -0
- package/external/folly/folly/container/test/F14MapTest.cpp +2543 -0
- package/external/folly/folly/container/test/F14PolicyTest.cpp +49 -0
- package/external/folly/folly/container/test/F14SetTest.cpp +1738 -0
- package/external/folly/folly/container/test/F14SmallOverheads.cpp +215 -0
- package/external/folly/folly/container/test/F14TestUtil.h +117 -0
- package/external/folly/folly/container/test/FBVectorBenchmark.cpp +380 -0
- package/external/folly/folly/container/test/FBVectorBenchmarks.cpp.h +100 -0
- package/external/folly/folly/container/test/FBVectorTest.cpp +326 -0
- package/external/folly/folly/container/test/FBVectorTests.cpp.h +304 -0
- package/external/folly/folly/container/test/ForeachBenchmark.cpp +388 -0
- package/external/folly/folly/container/test/ForeachTest.cpp +338 -0
- package/external/folly/folly/container/test/HashMapsBench.cpp +458 -0
- package/external/folly/folly/container/test/HeterogeneousAccessTest.cpp +242 -0
- package/external/folly/folly/container/test/IntrusiveHeapTest.cpp +262 -0
- package/external/folly/folly/container/test/IteratorTest.cpp +989 -0
- package/external/folly/folly/container/test/MapUtilTest.cpp +365 -0
- package/external/folly/folly/container/test/MergeTest.cpp +66 -0
- package/external/folly/folly/container/test/RegexMatchCacheTest.cpp +634 -0
- package/external/folly/folly/container/test/ReserveTest.cpp +173 -0
- package/external/folly/folly/container/test/SparseByteSetBenchmark.cpp +153 -0
- package/external/folly/folly/container/test/SparseByteSetTest.cpp +117 -0
- package/external/folly/folly/container/test/TrackingTypes.h +584 -0
- package/external/folly/folly/container/test/UtilTest.cpp +609 -0
- package/external/folly/folly/container/test/WeightedEvictingCacheMapTest.cpp +800 -0
- package/external/folly/folly/container/test/heap_vector_types_test.cpp +1774 -0
- package/external/folly/folly/container/test/range_traits_test.cpp +59 -0
- package/external/folly/folly/container/test/small_vector_test.cpp +1571 -0
- package/external/folly/folly/container/test/sorted_vector_test.cpp +1589 -0
- package/external/folly/folly/container/test/span_test.cpp +520 -0
- package/external/folly/folly/container/test/tape_bench.cpp +200 -0
- package/external/folly/folly/container/test/tape_test.cpp +590 -0
- package/external/folly/folly/defs.bzl +238 -0
- package/external/folly/folly/detail/AsyncTrace.cpp +36 -0
- package/external/folly/folly/detail/AsyncTrace.h +44 -0
- package/external/folly/folly/detail/AtomicHashUtils.h +42 -0
- package/external/folly/folly/detail/AtomicUnorderedMapUtils.h +80 -0
- package/external/folly/folly/detail/BUCK +406 -0
- package/external/folly/folly/detail/DiscriminatedPtrDetail.h +172 -0
- package/external/folly/folly/detail/FileUtilDetail.cpp +63 -0
- package/external/folly/folly/detail/FileUtilDetail.h +85 -0
- package/external/folly/folly/detail/FileUtilVectorDetail.h +81 -0
- package/external/folly/folly/detail/FingerprintPolynomial.h +132 -0
- package/external/folly/folly/detail/Futex-inl.h +123 -0
- package/external/folly/folly/detail/Futex.cpp +273 -0
- package/external/folly/folly/detail/Futex.h +109 -0
- package/external/folly/folly/detail/GroupVarintDetail.h +101 -0
- package/external/folly/folly/detail/IPAddress.cpp +37 -0
- package/external/folly/folly/detail/IPAddress.h +57 -0
- package/external/folly/folly/detail/IPAddressSource.h +278 -0
- package/external/folly/folly/detail/Iterators.h +156 -0
- package/external/folly/folly/detail/MPMCPipelineDetail.h +122 -0
- package/external/folly/folly/detail/MemoryIdler.cpp +233 -0
- package/external/folly/folly/detail/MemoryIdler.h +216 -0
- package/external/folly/folly/detail/PerfScoped.cpp +112 -0
- package/external/folly/folly/detail/PerfScoped.h +70 -0
- package/external/folly/folly/detail/PolyDetail.h +921 -0
- package/external/folly/folly/detail/RangeCommon.cpp +55 -0
- package/external/folly/folly/detail/RangeCommon.h +93 -0
- package/external/folly/folly/detail/RangeSse42.cpp +198 -0
- package/external/folly/folly/detail/RangeSse42.h +30 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.cpp +31 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.h +27 -0
- package/external/folly/folly/detail/SimpleSimdStringUtilsImpl.h +63 -0
- package/external/folly/folly/detail/Singleton.h +34 -0
- package/external/folly/folly/detail/SlowFingerprint.h +90 -0
- package/external/folly/folly/detail/SocketFastOpen.cpp +175 -0
- package/external/folly/folly/detail/SocketFastOpen.h +89 -0
- package/external/folly/folly/detail/SplitStringSimd.cpp +84 -0
- package/external/folly/folly/detail/SplitStringSimd.h +151 -0
- package/external/folly/folly/detail/SplitStringSimdImpl.h +149 -0
- package/external/folly/folly/detail/Sse.cpp +35 -0
- package/external/folly/folly/detail/Sse.h +45 -0
- package/external/folly/folly/detail/StaticSingletonManager.cpp +119 -0
- package/external/folly/folly/detail/StaticSingletonManager.h +298 -0
- package/external/folly/folly/detail/ThreadLocalDetail.cpp +492 -0
- package/external/folly/folly/detail/ThreadLocalDetail.h +800 -0
- package/external/folly/folly/detail/TrapOnAvx512.cpp +41 -0
- package/external/folly/folly/detail/TrapOnAvx512.h +21 -0
- package/external/folly/folly/detail/TurnSequencer.h +295 -0
- package/external/folly/folly/detail/TypeList.h +551 -0
- package/external/folly/folly/detail/UniqueInstance.cpp +136 -0
- package/external/folly/folly/detail/UniqueInstance.h +68 -0
- package/external/folly/folly/detail/base64_detail/BUCK +102 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.cpp +40 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.h +101 -0
- package/external/folly/folly/detail/base64_detail/Base64Common.h +80 -0
- package/external/folly/folly/detail/base64_detail/Base64Constants.h +79 -0
- package/external/folly/folly/detail/base64_detail/Base64HiddenConstants.h +129 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.cpp +161 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.h +32 -0
- package/external/folly/folly/detail/base64_detail/Base64Scalar.h +262 -0
- package/external/folly/folly/detail/base64_detail/Base64Simd.h +102 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.cpp +42 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.h +33 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2_Platform.h +167 -0
- package/external/folly/folly/detail/base64_detail/README.md +392 -0
- package/external/folly/folly/detail/base64_detail/tests/BUCK +36 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64AgainstScalarTest.cpp +141 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64PlatformTest.cpp +273 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64SpecialCasesTest.cpp +555 -0
- package/external/folly/folly/detail/test/AsyncTraceTest.cpp +43 -0
- package/external/folly/folly/detail/test/BUCK +118 -0
- package/external/folly/folly/detail/test/FileUtilDetailTest.cpp +56 -0
- package/external/folly/folly/detail/test/PerfScopedTest.cpp +107 -0
- package/external/folly/folly/detail/test/SimpleSimdStringUtilsTest.cpp +92 -0
- package/external/folly/folly/detail/test/SplitStringSimdTest.cpp +242 -0
- package/external/folly/folly/detail/test/StaticSingletonManagerTest.cpp +121 -0
- package/external/folly/folly/detail/test/ThreadLocalBenchmark.cpp +116 -0
- package/external/folly/folly/detail/test/ThreadLocalDetailTest.cpp +194 -0
- package/external/folly/folly/detail/test/TrapOnAvx512TestNegative.cpp +29 -0
- package/external/folly/folly/detail/test/UniqueInstanceTest.cpp +60 -0
- package/external/folly/folly/detail/thread_local_globals.cpp +69 -0
- package/external/folly/folly/detail/thread_local_globals.h +36 -0
- package/external/folly/folly/docs/AtomicHashMap.md +134 -0
- package/external/folly/folly/docs/Benchmark.md +310 -0
- package/external/folly/folly/docs/Conv.md +291 -0
- package/external/folly/folly/docs/Dynamic.md +220 -0
- package/external/folly/folly/docs/DynamicConverter.md +71 -0
- package/external/folly/folly/docs/Executors.md +63 -0
- package/external/folly/folly/docs/FBString.md +46 -0
- package/external/folly/folly/docs/FBVector.md +200 -0
- package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
- package/external/folly/folly/docs/Format.md +177 -0
- package/external/folly/folly/docs/Function.md +92 -0
- package/external/folly/folly/docs/Futures.md +263 -0
- package/external/folly/folly/docs/GroupVarint.md +46 -0
- package/external/folly/folly/docs/Histogram.md +104 -0
- package/external/folly/folly/docs/MapUtils.md +80 -0
- package/external/folly/folly/docs/Overview.md +263 -0
- package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
- package/external/folly/folly/docs/Poly.md +500 -0
- package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
- package/external/folly/folly/docs/Rcu.md +218 -0
- package/external/folly/folly/docs/SmallLocks.md +24 -0
- package/external/folly/folly/docs/Synchronized.md +793 -0
- package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
- package/external/folly/folly/docs/ThreadLocal.md +105 -0
- package/external/folly/folly/docs/Traits.md +161 -0
- package/external/folly/folly/docs/small_vector.md +64 -0
- package/external/folly/folly/docs/style.css +23 -0
- package/external/folly/folly/dynamic-inl.h +17 -0
- package/external/folly/folly/dynamic.h +17 -0
- package/external/folly/folly/folly_extended_library.bzl +28 -0
- package/external/folly/folly/functional/ApplyTuple.h +204 -0
- package/external/folly/folly/functional/BUCK +57 -0
- package/external/folly/folly/functional/Invoke.h +880 -0
- package/external/folly/folly/functional/Partial.h +130 -0
- package/external/folly/folly/functional/protocol.h +203 -0
- package/external/folly/folly/functional/test/ApplyTupleTest.cpp +549 -0
- package/external/folly/folly/functional/test/BUCK +57 -0
- package/external/folly/folly/functional/test/InvokeTest.cpp +483 -0
- package/external/folly/folly/functional/test/PartialTest.cpp +141 -0
- package/external/folly/folly/functional/test/protocol_test.cpp +177 -0
- package/external/folly/folly/functional/test/traits_test.cpp +551 -0
- package/external/folly/folly/functional/traits.h +675 -0
- package/external/folly/folly/hash/BUCK +86 -0
- package/external/folly/folly/hash/Checksum.cpp +275 -0
- package/external/folly/folly/hash/Checksum.h +94 -0
- package/external/folly/folly/hash/FarmHash.h +46 -0
- package/external/folly/folly/hash/Hash.h +1045 -0
- package/external/folly/folly/hash/MurmurHash.h +86 -0
- package/external/folly/folly/hash/SpookyHashV1.cpp +391 -0
- package/external/folly/folly/hash/SpookyHashV1.h +307 -0
- package/external/folly/folly/hash/SpookyHashV2.cpp +392 -0
- package/external/folly/folly/hash/SpookyHashV2.h +339 -0
- package/external/folly/folly/hash/detail/BUCK +26 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.cpp +296 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.h +137 -0
- package/external/folly/folly/hash/detail/Crc32CombineDetail.cpp +191 -0
- package/external/folly/folly/hash/detail/Crc32cDetail.cpp +303 -0
- package/external/folly/folly/hash/test/BUCK +132 -0
- package/external/folly/folly/hash/test/ChecksumBenchmark.cpp +91 -0
- package/external/folly/folly/hash/test/ChecksumTest.cpp +587 -0
- package/external/folly/folly/hash/test/FarmHashTest.cpp +41 -0
- package/external/folly/folly/hash/test/HashBenchmark.cpp +238 -0
- package/external/folly/folly/hash/test/HashTest.cpp +997 -0
- package/external/folly/folly/hash/test/MurmurHashTest.cpp +76 -0
- package/external/folly/folly/hash/test/SpookyHashV1Test.cpp +559 -0
- package/external/folly/folly/hash/test/SpookyHashV2Test.cpp +549 -0
- package/external/folly/folly/hash/test/traits_test.cpp +69 -0
- package/external/folly/folly/hash/traits.h +115 -0
- package/external/folly/folly/json/BUCK +155 -0
- package/external/folly/folly/json/DynamicConverter.h +464 -0
- package/external/folly/folly/json/DynamicParser-inl.h +316 -0
- package/external/folly/folly/json/DynamicParser.cpp +198 -0
- package/external/folly/folly/json/DynamicParser.h +394 -0
- package/external/folly/folly/json/JSONSchema.cpp +1030 -0
- package/external/folly/folly/json/JSONSchema.h +73 -0
- package/external/folly/folly/json/JsonMockUtil.h +73 -0
- package/external/folly/folly/json/JsonTestUtil.cpp +167 -0
- package/external/folly/folly/json/JsonTestUtil.h +88 -0
- package/external/folly/folly/json/bser/BUCK +24 -0
- package/external/folly/folly/json/bser/Bser.h +107 -0
- package/external/folly/folly/json/bser/Dump.cpp +253 -0
- package/external/folly/folly/json/bser/Load.cpp +246 -0
- package/external/folly/folly/json/bser/test/BUCK +14 -0
- package/external/folly/folly/json/bser/test/BserTest.cpp +149 -0
- package/external/folly/folly/json/dynamic.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -0
- package/external/folly/folly/json/json.h +238 -0
- package/external/folly/folly/json/json_patch.cpp +325 -0
- package/external/folly/folly/json/json_patch.h +126 -0
- package/external/folly/folly/json/json_pointer.cpp +114 -0
- package/external/folly/folly/json/json_pointer.h +87 -0
- package/external/folly/folly/json/test/BUCK +147 -0
- package/external/folly/folly/json/test/DynamicBenchmark.cpp +146 -0
- package/external/folly/folly/json/test/DynamicConverterTest.cpp +518 -0
- package/external/folly/folly/json/test/DynamicOtherTest.cpp +344 -0
- package/external/folly/folly/json/test/DynamicParserTest.cpp +443 -0
- package/external/folly/folly/json/test/DynamicTest.cpp +1647 -0
- package/external/folly/folly/json/test/JSONSchemaTest.cpp +450 -0
- package/external/folly/folly/json/test/JsonBenchmark.cpp +264 -0
- package/external/folly/folly/json/test/JsonOtherTest.cpp +51 -0
- package/external/folly/folly/json/test/JsonTest.cpp +1153 -0
- package/external/folly/folly/json/test/JsonTestUtilTest.cpp +97 -0
- package/external/folly/folly/json/test/json_patch_test.cpp +361 -0
- package/external/folly/folly/json/test/json_pointer_test.cpp +58 -0
- package/external/folly/folly/json/tool/BUCK +13 -0
- package/external/folly/folly/json/tool/JSONSchemaTester.cpp +58 -0
- package/external/folly/folly/json.h +17 -0
- package/external/folly/folly/json_patch.h +17 -0
- package/external/folly/folly/json_pointer.h +17 -0
- package/external/folly/folly/lang/Access.h +29 -0
- package/external/folly/folly/lang/Align.h +240 -0
- package/external/folly/folly/lang/Aligned.h +92 -0
- package/external/folly/folly/lang/Assume.h +82 -0
- package/external/folly/folly/lang/BUCK +287 -0
- package/external/folly/folly/lang/Badge.h +108 -0
- package/external/folly/folly/lang/Bits.h +570 -0
- package/external/folly/folly/lang/BitsClass.h +312 -0
- package/external/folly/folly/lang/Builtin.h +74 -0
- package/external/folly/folly/lang/CArray.h +34 -0
- package/external/folly/folly/lang/CString.cpp +86 -0
- package/external/folly/folly/lang/CString.h +55 -0
- package/external/folly/folly/lang/Cast.h +51 -0
- package/external/folly/folly/lang/CheckedMath.h +253 -0
- package/external/folly/folly/lang/CustomizationPoint.h +58 -0
- package/external/folly/folly/lang/Exception.cpp +822 -0
- package/external/folly/folly/lang/Exception.h +716 -0
- package/external/folly/folly/lang/Extern.h +55 -0
- package/external/folly/folly/lang/Hint-inl.h +144 -0
- package/external/folly/folly/lang/Hint.h +238 -0
- package/external/folly/folly/lang/Keep.h +98 -0
- package/external/folly/folly/lang/New.h +124 -0
- package/external/folly/folly/lang/Ordering.h +140 -0
- package/external/folly/folly/lang/Pretty.h +159 -0
- package/external/folly/folly/lang/PropagateConst.h +413 -0
- package/external/folly/folly/lang/RValueReferenceWrapper.h +152 -0
- package/external/folly/folly/lang/SafeAssert.cpp +589 -0
- package/external/folly/folly/lang/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -0
- package/external/folly/folly/lang/TypeInfo.h +58 -0
- package/external/folly/folly/lang/UncaughtExceptions.cpp +17 -0
- package/external/folly/folly/lang/UncaughtExceptions.h +19 -0
- package/external/folly/folly/lang/test/AlignTest.cpp +87 -0
- package/external/folly/folly/lang/test/AlignedTest.cpp +130 -0
- package/external/folly/folly/lang/test/BUCK +258 -0
- package/external/folly/folly/lang/test/BadgeTest.cpp +89 -0
- package/external/folly/folly/lang/test/BitsBenchmark.cpp +164 -0
- package/external/folly/folly/lang/test/BitsClassBenchmark.cpp +122 -0
- package/external/folly/folly/lang/test/BitsClassTest.cpp +379 -0
- package/external/folly/folly/lang/test/BitsTest.cpp +577 -0
- package/external/folly/folly/lang/test/CStringTest.cpp +60 -0
- package/external/folly/folly/lang/test/CastTest.cpp +47 -0
- package/external/folly/folly/lang/test/CheckedMathTest.cpp +394 -0
- package/external/folly/folly/lang/test/ExceptionBench.cpp +427 -0
- package/external/folly/folly/lang/test/ExceptionTest.cpp +413 -0
- package/external/folly/folly/lang/test/ExternTest.cpp +39 -0
- package/external/folly/folly/lang/test/HintTest.cpp +100 -0
- package/external/folly/folly/lang/test/NewTest.cpp +38 -0
- package/external/folly/folly/lang/test/OrderingTest.cpp +105 -0
- package/external/folly/folly/lang/test/PrettyTest.cpp +44 -0
- package/external/folly/folly/lang/test/PropagateConstTest.cpp +356 -0
- package/external/folly/folly/lang/test/RValueReferenceWrapperTest.cpp +85 -0
- package/external/folly/folly/lang/test/SafeAssertTest.cpp +75 -0
- package/external/folly/folly/lang/test/ThunkTest.cpp +105 -0
- package/external/folly/folly/lang/test/ToAsciiBench.cpp +466 -0
- package/external/folly/folly/lang/test/ToAsciiTest.cpp +266 -0
- package/external/folly/folly/lang/test/TypeInfoTest.cpp +56 -0
- package/external/folly/folly/memcpy.S +292 -0
- package/external/folly/folly/memcpy_select_aarch64.cpp +145 -0
- package/external/folly/folly/memory/Arena-inl.h +83 -0
- package/external/folly/folly/memory/Arena.h +325 -0
- package/external/folly/folly/memory/BUCK +191 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.cpp +449 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.h +105 -0
- package/external/folly/folly/memory/JemallocHugePageAllocatorTest.cpp +341 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.cpp +176 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.h +119 -0
- package/external/folly/folly/memory/JemallocNodumpAllocatorTest.cpp +61 -0
- package/external/folly/folly/memory/MallctlHelper.cpp +37 -0
- package/external/folly/folly/memory/MallctlHelper.h +167 -0
- package/external/folly/folly/memory/Malloc.h +551 -0
- package/external/folly/folly/memory/MemoryResource.h +57 -0
- package/external/folly/folly/memory/ReentrantAllocator.cpp +162 -0
- package/external/folly/folly/memory/ReentrantAllocator.h +261 -0
- package/external/folly/folly/memory/SanitizeAddress.cpp +75 -0
- package/external/folly/folly/memory/SanitizeAddress.h +117 -0
- package/external/folly/folly/memory/SanitizeLeak.cpp +119 -0
- package/external/folly/folly/memory/SanitizeLeak.h +108 -0
- package/external/folly/folly/memory/ThreadCachedArena.cpp +53 -0
- package/external/folly/folly/memory/ThreadCachedArena.h +90 -0
- package/external/folly/folly/memory/UninitializedMemoryHacks.h +426 -0
- package/external/folly/folly/memory/detail/BUCK +10 -0
- package/external/folly/folly/memory/detail/MallocImpl.cpp +52 -0
- package/external/folly/folly/memory/detail/MallocImpl.h +97 -0
- package/external/folly/folly/memory/not_null-inl.h +522 -0
- package/external/folly/folly/memory/not_null.h +449 -0
- package/external/folly/folly/memory/test/ArenaTest.cpp +354 -0
- package/external/folly/folly/memory/test/BUCK +146 -0
- package/external/folly/folly/memory/test/MallctlHelperTest.cpp +169 -0
- package/external/folly/folly/memory/test/MallocBenchmark.cpp +91 -0
- package/external/folly/folly/memory/test/MallocTest.cpp +78 -0
- package/external/folly/folly/memory/test/MemoryResourceTest.cpp +31 -0
- package/external/folly/folly/memory/test/ReentrantAllocatorTest.cpp +144 -0
- package/external/folly/folly/memory/test/SanitizeAddressTest.cpp +67 -0
- package/external/folly/folly/memory/test/SanitizeLeakTest.cpp +139 -0
- package/external/folly/folly/memory/test/ThreadCachedArenaTest.cpp +276 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksODR.cpp +21 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksTest.cpp +327 -0
- package/external/folly/folly/memory/test/not_null_test.cpp +608 -0
- package/external/folly/folly/memset.S +245 -0
- package/external/folly/folly/memset_select_aarch64.cpp +72 -0
- package/external/folly/folly/portability/Asm.h +50 -0
- package/external/folly/folly/portability/Atomic.h +31 -0
- package/external/folly/folly/portability/BUCK +456 -0
- package/external/folly/folly/portability/Builtins.cpp +31 -0
- package/external/folly/folly/portability/Builtins.h +161 -0
- package/external/folly/folly/portability/Config.h +43 -0
- package/external/folly/folly/portability/Constexpr.h +145 -0
- package/external/folly/folly/portability/Dirent.cpp +140 -0
- package/external/folly/folly/portability/Dirent.h +41 -0
- package/external/folly/folly/portability/Event.h +44 -0
- package/external/folly/folly/portability/Fcntl.cpp +120 -0
- package/external/folly/folly/portability/Fcntl.h +67 -0
- package/external/folly/folly/portability/Filesystem.cpp +67 -0
- package/external/folly/folly/portability/Filesystem.h +114 -0
- package/external/folly/folly/portability/FmtCompile.h +40 -0
- package/external/folly/folly/portability/GFlags.h +139 -0
- package/external/folly/folly/portability/GMock.h +35 -0
- package/external/folly/folly/portability/GTest.h +35 -0
- package/external/folly/folly/portability/IOVec.h +34 -0
- package/external/folly/folly/portability/Libgen.cpp +59 -0
- package/external/folly/folly/portability/Libgen.h +29 -0
- package/external/folly/folly/portability/Libunwind.h +21 -0
- package/external/folly/folly/portability/Malloc.cpp +31 -0
- package/external/folly/folly/portability/Malloc.h +53 -0
- package/external/folly/folly/portability/Math.h +90 -0
- package/external/folly/folly/portability/Memory.h +26 -0
- package/external/folly/folly/portability/OpenSSL.cpp +17 -0
- package/external/folly/folly/portability/OpenSSL.h +102 -0
- package/external/folly/folly/portability/PThread.cpp +697 -0
- package/external/folly/folly/portability/PThread.h +148 -0
- package/external/folly/folly/portability/README.md +21 -0
- package/external/folly/folly/portability/Sched.cpp +41 -0
- package/external/folly/folly/portability/Sched.h +45 -0
- package/external/folly/folly/portability/Sockets.cpp +245 -0
- package/external/folly/folly/portability/Sockets.h +155 -0
- package/external/folly/folly/portability/SourceLocation.h +49 -0
- package/external/folly/folly/portability/Stdio.cpp +77 -0
- package/external/folly/folly/portability/Stdio.h +32 -0
- package/external/folly/folly/portability/Stdlib.cpp +172 -0
- package/external/folly/folly/portability/Stdlib.h +64 -0
- package/external/folly/folly/portability/String.cpp +53 -0
- package/external/folly/folly/portability/String.h +39 -0
- package/external/folly/folly/portability/SysFile.cpp +46 -0
- package/external/folly/folly/portability/SysFile.h +27 -0
- package/external/folly/folly/portability/SysMembarrier.cpp +104 -0
- package/external/folly/folly/portability/SysMembarrier.h +26 -0
- package/external/folly/folly/portability/SysMman.cpp +242 -0
- package/external/folly/folly/portability/SysMman.h +68 -0
- package/external/folly/folly/portability/SysResource.cpp +108 -0
- package/external/folly/folly/portability/SysResource.h +71 -0
- package/external/folly/folly/portability/SysStat.cpp +66 -0
- package/external/folly/folly/portability/SysStat.h +52 -0
- package/external/folly/folly/portability/SysSyscall.h +73 -0
- package/external/folly/folly/portability/SysTime.cpp +62 -0
- package/external/folly/folly/portability/SysTime.h +50 -0
- package/external/folly/folly/portability/SysTypes.h +44 -0
- package/external/folly/folly/portability/SysUio.cpp +179 -0
- package/external/folly/folly/portability/SysUio.h +51 -0
- package/external/folly/folly/portability/Syslog.h +39 -0
- package/external/folly/folly/portability/Time.cpp +357 -0
- package/external/folly/folly/portability/Time.h +74 -0
- package/external/folly/folly/portability/Unistd.h +111 -0
- package/external/folly/folly/portability/Windows.h +108 -0
- package/external/folly/folly/portability/openat2.c +30 -0
- package/external/folly/folly/portability/openat2.h +39 -0
- package/external/folly/folly/portability/test/BUCK +59 -0
- package/external/folly/folly/portability/test/ConstexprTest.cpp +102 -0
- package/external/folly/folly/portability/test/FilesystemTest.cpp +35 -0
- package/external/folly/folly/portability/test/LibgenTest.cpp +35 -0
- package/external/folly/folly/portability/test/OpenSSLPortabilityTest.cpp +108 -0
- package/external/folly/folly/portability/test/PThreadTest.cpp +80 -0
- package/external/folly/folly/portability/test/TimeTest.cpp +90 -0
- package/external/folly/folly/small_vector.h +17 -0
- package/external/folly/folly/somerge_defs.bzl +399 -0
- package/external/folly/folly/sorted_vector_types.h +17 -0
- package/external/folly/folly/stop_watch.h +317 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.cpp +91 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.h +60 -0
- package/external/folly/folly/synchronization/AtomicNotification-inl.h +146 -0
- package/external/folly/folly/synchronization/AtomicNotification.cpp +34 -0
- package/external/folly/folly/synchronization/AtomicNotification.h +117 -0
- package/external/folly/folly/synchronization/AtomicRef.h +181 -0
- package/external/folly/folly/synchronization/AtomicStruct.h +150 -0
- package/external/folly/folly/synchronization/AtomicUtil-inl.h +482 -0
- package/external/folly/folly/synchronization/AtomicUtil.h +179 -0
- package/external/folly/folly/synchronization/BUCK +418 -0
- package/external/folly/folly/synchronization/Baton.h +419 -0
- package/external/folly/folly/synchronization/CallOnce.h +263 -0
- package/external/folly/folly/synchronization/DelayedInit.h +179 -0
- package/external/folly/folly/synchronization/DistributedMutex-inl.h +1744 -0
- package/external/folly/folly/synchronization/DistributedMutex.cpp +27 -0
- package/external/folly/folly/synchronization/DistributedMutex.h +342 -0
- package/external/folly/folly/synchronization/EventCount.h +200 -0
- package/external/folly/folly/synchronization/FlatCombining.h +629 -0
- package/external/folly/folly/synchronization/Hazptr-fwd.h +217 -0
- package/external/folly/folly/synchronization/Hazptr.cpp +36 -0
- package/external/folly/folly/synchronization/Hazptr.h +209 -0
- package/external/folly/folly/synchronization/HazptrDomain.cpp +68 -0
- package/external/folly/folly/synchronization/HazptrDomain.h +832 -0
- package/external/folly/folly/synchronization/HazptrHolder.h +431 -0
- package/external/folly/folly/synchronization/HazptrObj.h +533 -0
- package/external/folly/folly/synchronization/HazptrObjLinked.h +315 -0
- package/external/folly/folly/synchronization/HazptrRec.h +68 -0
- package/external/folly/folly/synchronization/HazptrThrLocal.h +180 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.cpp +46 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.h +25 -0
- package/external/folly/folly/synchronization/Latch.h +160 -0
- package/external/folly/folly/synchronization/LifoSem.h +767 -0
- package/external/folly/folly/synchronization/Lock.h +887 -0
- package/external/folly/folly/synchronization/MicroSpinLock.h +154 -0
- package/external/folly/folly/synchronization/NativeSemaphore.h +187 -0
- package/external/folly/folly/synchronization/ParkingLot.cpp +37 -0
- package/external/folly/folly/synchronization/ParkingLot.h +330 -0
- package/external/folly/folly/synchronization/PicoSpinLock.h +167 -0
- package/external/folly/folly/synchronization/RWSpinLock.h +549 -0
- package/external/folly/folly/synchronization/Rcu.cpp +26 -0
- package/external/folly/folly/synchronization/Rcu.h +553 -0
- package/external/folly/folly/synchronization/RelaxedAtomic.h +336 -0
- package/external/folly/folly/synchronization/SanitizeThread.cpp +141 -0
- package/external/folly/folly/synchronization/SanitizeThread.h +166 -0
- package/external/folly/folly/synchronization/SaturatingSemaphore.h +324 -0
- package/external/folly/folly/synchronization/SmallLocks.h +36 -0
- package/external/folly/folly/synchronization/ThrottledLifoSem.h +362 -0
- package/external/folly/folly/synchronization/WaitOptions.cpp +25 -0
- package/external/folly/folly/synchronization/WaitOptions.h +75 -0
- package/external/folly/folly/synchronization/detail/AtomicUtils.h +59 -0
- package/external/folly/folly/synchronization/detail/BUCK +104 -0
- package/external/folly/folly/synchronization/detail/Hardware.cpp +192 -0
- package/external/folly/folly/synchronization/detail/Hardware.h +75 -0
- package/external/folly/folly/synchronization/detail/HazptrUtils.h +339 -0
- package/external/folly/folly/synchronization/detail/InlineFunctionRef.h +229 -0
- package/external/folly/folly/synchronization/detail/Sleeper.cpp +27 -0
- package/external/folly/folly/synchronization/detail/Sleeper.h +62 -0
- package/external/folly/folly/synchronization/detail/Spin.h +96 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedLists.h +174 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedReaders.h +189 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedTag.h +26 -0
- package/external/folly/folly/synchronization/detail/test/BUCK +28 -0
- package/external/folly/folly/synchronization/detail/test/HardwareTest.cpp +74 -0
- package/external/folly/folly/synchronization/detail/test/InlineFunctionRefTest.cpp +286 -0
- package/external/folly/folly/synchronization/example/BUCK +27 -0
- package/external/folly/folly/synchronization/example/HazptrLockFreeLIFO.h +88 -0
- package/external/folly/folly/synchronization/example/HazptrSWMRSet.h +133 -0
- package/external/folly/folly/synchronization/example/HazptrWideCAS.h +62 -0
- package/external/folly/folly/synchronization/test/AtomicNotificationTest.cpp +236 -0
- package/external/folly/folly/synchronization/test/AtomicRefTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/AtomicStructTest.cpp +65 -0
- package/external/folly/folly/synchronization/test/AtomicUtilBench.cpp +457 -0
- package/external/folly/folly/synchronization/test/AtomicUtilTest.cpp +650 -0
- package/external/folly/folly/synchronization/test/BUCK +495 -0
- package/external/folly/folly/synchronization/test/Barrier.h +52 -0
- package/external/folly/folly/synchronization/test/BarrierTest.cpp +56 -0
- package/external/folly/folly/synchronization/test/BatonBenchmark.cpp +77 -0
- package/external/folly/folly/synchronization/test/BatonTest.cpp +164 -0
- package/external/folly/folly/synchronization/test/BatonTestHelpers.h +118 -0
- package/external/folly/folly/synchronization/test/CallOnceBenchmark.cpp +72 -0
- package/external/folly/folly/synchronization/test/CallOnceTest.cpp +153 -0
- package/external/folly/folly/synchronization/test/DelayedInitTest.cpp +281 -0
- package/external/folly/folly/synchronization/test/DistributedMutexTest.cpp +2074 -0
- package/external/folly/folly/synchronization/test/EventCountTest.cpp +124 -0
- package/external/folly/folly/synchronization/test/FlatCombiningBenchmark.cpp +1789 -0
- package/external/folly/folly/synchronization/test/FlatCombiningExamples.h +222 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTest.cpp +121 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTestHelpers.h +227 -0
- package/external/folly/folly/synchronization/test/HazptrTest.cpp +1689 -0
- package/external/folly/folly/synchronization/test/LatchTest.cpp +224 -0
- package/external/folly/folly/synchronization/test/LifoSemBench.cpp +185 -0
- package/external/folly/folly/synchronization/test/LifoSemTests.cpp +353 -0
- package/external/folly/folly/synchronization/test/LockTest.cpp +1239 -0
- package/external/folly/folly/synchronization/test/NativeSemaphoreTest.cpp +37 -0
- package/external/folly/folly/synchronization/test/ParkingLotBenchmark.cpp +239 -0
- package/external/folly/folly/synchronization/test/ParkingLotTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/RWSpinLockTest.cpp +235 -0
- package/external/folly/folly/synchronization/test/RcuBench.cpp +66 -0
- package/external/folly/folly/synchronization/test/RcuTest.cpp +330 -0
- package/external/folly/folly/synchronization/test/RelaxedAtomicTest.cpp +389 -0
- package/external/folly/folly/synchronization/test/SaturatingSemaphoreTest.cpp +166 -0
- package/external/folly/folly/synchronization/test/Semaphore.h +242 -0
- package/external/folly/folly/synchronization/test/SemaphoreTest.cpp +271 -0
- package/external/folly/folly/synchronization/test/SmallLocksBenchmark.cpp +1296 -0
- package/external/folly/folly/synchronization/test/SmallLocksTest.cpp +510 -0
- package/external/folly/folly/synchronization/test/ThreadCachedEpochBench.h +67 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersBench.cpp +42 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersTest.cpp +52 -0
- package/external/folly/folly/synchronization/test/ThrottledLifoSemTest.cpp +243 -0
- package/external/folly/folly/system/AtFork.cpp +205 -0
- package/external/folly/folly/system/AtFork.h +116 -0
- package/external/folly/folly/system/AuxVector.h +198 -0
- package/external/folly/folly/system/BUCK +144 -0
- package/external/folly/folly/system/EnvUtil.cpp +93 -0
- package/external/folly/folly/system/EnvUtil.h +113 -0
- package/external/folly/folly/system/HardwareConcurrency.cpp +39 -0
- package/external/folly/folly/system/HardwareConcurrency.h +23 -0
- package/external/folly/folly/system/MemoryMapping.cpp +477 -0
- package/external/folly/folly/system/MemoryMapping.h +287 -0
- package/external/folly/folly/system/Pid.cpp +87 -0
- package/external/folly/folly/system/Pid.h +34 -0
- package/external/folly/folly/system/Shell.cpp +33 -0
- package/external/folly/folly/system/Shell.h +93 -0
- package/external/folly/folly/system/ThreadId.cpp +89 -0
- package/external/folly/folly/system/ThreadId.h +62 -0
- package/external/folly/folly/system/ThreadName.cpp +330 -0
- package/external/folly/folly/system/ThreadName.h +72 -0
- package/external/folly/folly/system/test/AtForkTest.cpp +309 -0
- package/external/folly/folly/system/test/AuxVectorTest.cpp +55 -0
- package/external/folly/folly/system/test/BUCK +120 -0
- package/external/folly/folly/system/test/EnvUtilSubprocess.cpp +26 -0
- package/external/folly/folly/system/test/EnvUtilTest.cpp +197 -0
- package/external/folly/folly/system/test/MemoryMappingTest.cpp +179 -0
- package/external/folly/folly/system/test/PidTest.cpp +46 -0
- package/external/folly/folly/system/test/ShellTest.cpp +66 -0
- package/external/folly/folly/system/test/ThreadIdTest.cpp +114 -0
- package/external/folly/folly/system/test/ThreadNameTest.cpp +85 -0
- package/external/folly/folly.vcxitems +164 -0
- package/external/folly/static/logo.svg +1 -0
- package/external/folly/sync-config.json +8 -0
- package/package.json +6 -6
- package/template/cpp-lib/proj/MyLib.sln +0 -33
- package/template/cs-lib/proj/MyLib.sln +0 -33
- package/templates/cpp-app/windows/MyApp.sln +0 -33
- package/templates/cpp-lib/example/metro.config.js +30 -4
- package/templates/cpp-lib/windows/MyLib.sln +0 -33
- package/Folly/Folly.vcxproj +0 -378
- package/Folly/Folly.vcxproj.filters +0 -558
- package/fmt/fmt.vcxproj +0 -153
- package/fmt/fmt.vcxproj.filters +0 -59
- package/fmt/pch.cpp +0 -4
- package/fmt/pch.h +0 -2
- /package/{fmt → external/fmt}/cgmanifest.json +0 -0
- /package/{Folly → external/folly}/Folly.natvis +0 -0
- /package/{Folly → external/folly}/cgmanifest.json +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/ConstexprMath.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/Conv.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/chrono/Hardware.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/concurrency/CacheLocality.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/dynamic-inl.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/json.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/SafeAssert.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/portability/Unistd.cpp +0 -0
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef FOLLY_FORMAT_H_
|
|
18
|
+
#error This file may only be included from Format.h.
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#include <array>
|
|
22
|
+
#include <cinttypes>
|
|
23
|
+
#include <deque>
|
|
24
|
+
#include <map>
|
|
25
|
+
#include <unordered_map>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
#include <folly/Exception.h>
|
|
29
|
+
#include <folly/FormatTraits.h>
|
|
30
|
+
#include <folly/MapUtil.h>
|
|
31
|
+
#include <folly/Portability.h>
|
|
32
|
+
#include <folly/Traits.h>
|
|
33
|
+
#include <folly/lang/Exception.h>
|
|
34
|
+
#include <folly/lang/ToAscii.h>
|
|
35
|
+
#include <folly/portability/Windows.h>
|
|
36
|
+
|
|
37
|
+
// Ignore -Wformat-nonliteral and -Wconversion warnings within this file
|
|
38
|
+
FOLLY_PUSH_WARNING
|
|
39
|
+
FOLLY_GNU_DISABLE_WARNING("-Wformat-nonliteral")
|
|
40
|
+
FOLLY_GNU_DISABLE_WARNING("-Wconversion")
|
|
41
|
+
|
|
42
|
+
namespace folly {
|
|
43
|
+
|
|
44
|
+
namespace detail {
|
|
45
|
+
|
|
46
|
+
// Updates the end of the buffer after the comma separators have been added.
|
|
47
|
+
void insertThousandsGroupingUnsafe(char* start_buffer, char** end_buffer);
|
|
48
|
+
|
|
49
|
+
extern const std::array<std::array<char, 2>, 256> formatHexUpper;
|
|
50
|
+
extern const std::array<std::array<char, 2>, 256> formatHexLower;
|
|
51
|
+
extern const std::array<std::array<char, 3>, 512> formatOctal;
|
|
52
|
+
extern const std::array<std::array<char, 8>, 256> formatBinary;
|
|
53
|
+
|
|
54
|
+
const size_t kMaxHexLength = 2 * sizeof(uintmax_t);
|
|
55
|
+
const size_t kMaxOctalLength = 3 * sizeof(uintmax_t);
|
|
56
|
+
const size_t kMaxBinaryLength = 8 * sizeof(uintmax_t);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Convert an unsigned to hex, using repr (which maps from each possible
|
|
60
|
+
* 2-hex-bytes value to the 2-character representation).
|
|
61
|
+
*
|
|
62
|
+
* Just like folly::detail::uintToBuffer in Conv.h, writes at the *end* of
|
|
63
|
+
* the supplied buffer and returns the offset of the beginning of the string
|
|
64
|
+
* from the start of the buffer. The formatted string will be in range
|
|
65
|
+
* [buf+begin, buf+bufLen).
|
|
66
|
+
*/
|
|
67
|
+
template <class Uint>
|
|
68
|
+
size_t uintToHex(
|
|
69
|
+
char* buffer,
|
|
70
|
+
size_t bufLen,
|
|
71
|
+
Uint v,
|
|
72
|
+
std::array<std::array<char, 2>, 256> const& repr) {
|
|
73
|
+
// 'v >>= 7, v >>= 1' is no more than a work around to get rid of shift size
|
|
74
|
+
// warning when Uint = uint8_t (it's false as v >= 256 implies sizeof(v) > 1).
|
|
75
|
+
for (; !less_than<unsigned, 256>(v); v >>= 7, v >>= 1) {
|
|
76
|
+
auto b = v & 0xff;
|
|
77
|
+
bufLen -= 2;
|
|
78
|
+
buffer[bufLen] = repr[b][0];
|
|
79
|
+
buffer[bufLen + 1] = repr[b][1];
|
|
80
|
+
}
|
|
81
|
+
buffer[--bufLen] = repr[v][1];
|
|
82
|
+
if (v >= 16) {
|
|
83
|
+
buffer[--bufLen] = repr[v][0];
|
|
84
|
+
}
|
|
85
|
+
return bufLen;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Convert an unsigned to hex, using lower-case letters for the digits
|
|
90
|
+
* above 9. See the comments for uintToHex.
|
|
91
|
+
*/
|
|
92
|
+
template <class Uint>
|
|
93
|
+
inline size_t uintToHexLower(char* buffer, size_t bufLen, Uint v) {
|
|
94
|
+
return uintToHex(buffer, bufLen, v, formatHexLower);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Convert an unsigned to hex, using upper-case letters for the digits
|
|
99
|
+
* above 9. See the comments for uintToHex.
|
|
100
|
+
*/
|
|
101
|
+
template <class Uint>
|
|
102
|
+
inline size_t uintToHexUpper(char* buffer, size_t bufLen, Uint v) {
|
|
103
|
+
return uintToHex(buffer, bufLen, v, formatHexUpper);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Convert an unsigned to octal.
|
|
108
|
+
*
|
|
109
|
+
* Just like folly::detail::uintToBuffer in Conv.h, writes at the *end* of
|
|
110
|
+
* the supplied buffer and returns the offset of the beginning of the string
|
|
111
|
+
* from the start of the buffer. The formatted string will be in range
|
|
112
|
+
* [buf+begin, buf+bufLen).
|
|
113
|
+
*/
|
|
114
|
+
template <class Uint>
|
|
115
|
+
size_t uintToOctal(char* buffer, size_t bufLen, Uint v) {
|
|
116
|
+
auto& repr = formatOctal;
|
|
117
|
+
// 'v >>= 7, v >>= 2' is no more than a work around to get rid of shift size
|
|
118
|
+
// warning when Uint = uint8_t (it's false as v >= 512 implies sizeof(v) > 1).
|
|
119
|
+
for (; !less_than<unsigned, 512>(v); v >>= 7, v >>= 2) {
|
|
120
|
+
auto b = v & 0x1ff;
|
|
121
|
+
bufLen -= 3;
|
|
122
|
+
buffer[bufLen] = repr[b][0];
|
|
123
|
+
buffer[bufLen + 1] = repr[b][1];
|
|
124
|
+
buffer[bufLen + 2] = repr[b][2];
|
|
125
|
+
}
|
|
126
|
+
buffer[--bufLen] = repr[v][2];
|
|
127
|
+
if (v >= 8) {
|
|
128
|
+
buffer[--bufLen] = repr[v][1];
|
|
129
|
+
}
|
|
130
|
+
if (v >= 64) {
|
|
131
|
+
buffer[--bufLen] = repr[v][0];
|
|
132
|
+
}
|
|
133
|
+
return bufLen;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Convert an unsigned to binary.
|
|
138
|
+
*
|
|
139
|
+
* Just like folly::detail::uintToBuffer in Conv.h, writes at the *end* of
|
|
140
|
+
* the supplied buffer and returns the offset of the beginning of the string
|
|
141
|
+
* from the start of the buffer. The formatted string will be in range
|
|
142
|
+
* [buf+begin, buf+bufLen).
|
|
143
|
+
*/
|
|
144
|
+
template <class Uint>
|
|
145
|
+
size_t uintToBinary(char* buffer, size_t bufLen, Uint v) {
|
|
146
|
+
auto& repr = formatBinary;
|
|
147
|
+
if (v == 0) {
|
|
148
|
+
buffer[--bufLen] = '0';
|
|
149
|
+
return bufLen;
|
|
150
|
+
}
|
|
151
|
+
for (; v; v >>= 7, v >>= 1) {
|
|
152
|
+
auto b = v & 0xff;
|
|
153
|
+
bufLen -= 8;
|
|
154
|
+
memcpy(buffer + bufLen, &(repr[b][0]), 8);
|
|
155
|
+
}
|
|
156
|
+
while (buffer[bufLen] == '0') {
|
|
157
|
+
++bufLen;
|
|
158
|
+
}
|
|
159
|
+
return bufLen;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
template <bool containerMode, bool RecordUsedArg, class Output>
|
|
163
|
+
void baseFormatterCallImpl(
|
|
164
|
+
Output& out,
|
|
165
|
+
size_t nargs,
|
|
166
|
+
const int widths[],
|
|
167
|
+
std::bool_constant<RecordUsedArg>(used)(const BaseFormatterBase&, size_t),
|
|
168
|
+
BaseFormatterBase::DoFormatFn<Output>* const funs[],
|
|
169
|
+
const BaseFormatterBase& base) {
|
|
170
|
+
// Copy raw string (without format specifiers) to output;
|
|
171
|
+
// not as simple as we'd like, as we still need to translate "}}" to "}"
|
|
172
|
+
// and throw if we see any lone "}"
|
|
173
|
+
auto outputString = [&out](StringPiece s) {
|
|
174
|
+
auto p = s.begin();
|
|
175
|
+
auto end = s.end();
|
|
176
|
+
while (p != end) {
|
|
177
|
+
auto q = static_cast<const char*>(memchr(p, '}', size_t(end - p)));
|
|
178
|
+
if (!q) {
|
|
179
|
+
out(StringPiece(p, end));
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
++q;
|
|
183
|
+
out(StringPiece(p, q));
|
|
184
|
+
p = q;
|
|
185
|
+
|
|
186
|
+
if (p == end || *p != '}') {
|
|
187
|
+
throw_exception<BadFormatArg>(
|
|
188
|
+
"folly::format: single '}' in format string");
|
|
189
|
+
}
|
|
190
|
+
++p;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
auto str_ = base.str_;
|
|
195
|
+
auto p = str_.begin();
|
|
196
|
+
auto end = str_.end();
|
|
197
|
+
|
|
198
|
+
int nextArg = 0;
|
|
199
|
+
bool hasDefaultArgIndex = false;
|
|
200
|
+
bool hasExplicitArgIndex = false;
|
|
201
|
+
while (p != end) {
|
|
202
|
+
auto q = static_cast<const char*>(memchr(p, '{', size_t(end - p)));
|
|
203
|
+
if (!q) {
|
|
204
|
+
outputString(StringPiece(p, end));
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
outputString(StringPiece(p, q));
|
|
208
|
+
p = q + 1;
|
|
209
|
+
|
|
210
|
+
if (p == end) {
|
|
211
|
+
throw_exception<BadFormatArg>(
|
|
212
|
+
"folly::format: '}' at end of format string");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// "{{" -> "{"
|
|
216
|
+
if (*p == '{') {
|
|
217
|
+
out(StringPiece(p, 1));
|
|
218
|
+
++p;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Format string
|
|
223
|
+
q = static_cast<const char*>(memchr(p, '}', size_t(end - p)));
|
|
224
|
+
if (q == nullptr) {
|
|
225
|
+
throw_exception<BadFormatArg>("folly::format: missing ending '}'");
|
|
226
|
+
}
|
|
227
|
+
FormatArg arg(StringPiece(p, q));
|
|
228
|
+
p = q + 1;
|
|
229
|
+
|
|
230
|
+
int argIndex = 0;
|
|
231
|
+
auto piece = arg.splitKey<true>(); // empty key component is okay
|
|
232
|
+
if constexpr (containerMode) {
|
|
233
|
+
arg.enforce(
|
|
234
|
+
arg.width != FormatArg::kDynamicWidth,
|
|
235
|
+
"dynamic field width not supported in vformat()");
|
|
236
|
+
if (piece.empty()) {
|
|
237
|
+
arg.setNextIntKey(nextArg++);
|
|
238
|
+
hasDefaultArgIndex = true;
|
|
239
|
+
} else {
|
|
240
|
+
arg.setNextKey(piece);
|
|
241
|
+
hasExplicitArgIndex = true;
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
if (piece.empty()) {
|
|
245
|
+
if (arg.width == FormatArg::kDynamicWidth) {
|
|
246
|
+
arg.enforce(
|
|
247
|
+
arg.widthIndex == FormatArg::kNoIndex,
|
|
248
|
+
"cannot provide width arg index without value arg index");
|
|
249
|
+
auto sizeArg = size_t(nextArg++);
|
|
250
|
+
detail::formatCheckIndex(sizeArg, arg, nargs);
|
|
251
|
+
if (RecordUsedArg) {
|
|
252
|
+
used(base, sizeArg);
|
|
253
|
+
}
|
|
254
|
+
auto w = widths[sizeArg];
|
|
255
|
+
arg.enforce(w >= 0, "dynamic field width argument must be integral");
|
|
256
|
+
arg.width = w;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
argIndex = nextArg++;
|
|
260
|
+
hasDefaultArgIndex = true;
|
|
261
|
+
} else {
|
|
262
|
+
if (arg.width == FormatArg::kDynamicWidth) {
|
|
263
|
+
arg.enforce(
|
|
264
|
+
arg.widthIndex != FormatArg::kNoIndex,
|
|
265
|
+
"cannot provide value arg index without width arg index");
|
|
266
|
+
auto sizeArg = size_t(arg.widthIndex);
|
|
267
|
+
detail::formatCheckIndex(sizeArg, arg, nargs);
|
|
268
|
+
if (RecordUsedArg) {
|
|
269
|
+
used(base, sizeArg);
|
|
270
|
+
}
|
|
271
|
+
auto w = widths[sizeArg];
|
|
272
|
+
arg.enforce(w >= 0, "dynamic field width argument must be integral");
|
|
273
|
+
arg.width = w;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
auto result = tryTo<int>(piece);
|
|
277
|
+
arg.enforce(result, "argument index must be integer");
|
|
278
|
+
argIndex = *result;
|
|
279
|
+
arg.enforce(argIndex >= 0, "argument index must be non-negative");
|
|
280
|
+
hasExplicitArgIndex = true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (hasDefaultArgIndex && hasExplicitArgIndex) {
|
|
285
|
+
throw_exception<BadFormatArg>(
|
|
286
|
+
"folly::format: may not have both default and explicit arg indexes");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (RecordUsedArg) {
|
|
290
|
+
used(base, argIndex);
|
|
291
|
+
} else {
|
|
292
|
+
formatCheckIndex(argIndex, arg, nargs);
|
|
293
|
+
funs[argIndex](base, arg, out);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
} // namespace detail
|
|
299
|
+
|
|
300
|
+
template <class Derived, bool containerMode, size_t... I, class... Args>
|
|
301
|
+
template <class Output>
|
|
302
|
+
void BaseFormatterImpl<
|
|
303
|
+
Derived,
|
|
304
|
+
containerMode,
|
|
305
|
+
std::index_sequence<I...>,
|
|
306
|
+
Args...>::operator()(Output& out) const {
|
|
307
|
+
constexpr size_t nargs = sizeof...(Args);
|
|
308
|
+
using RecordUsedSizeArgs = decltype(Derived::recordUsedArg(*this, 0));
|
|
309
|
+
constexpr auto used = Derived::recordUsedArg;
|
|
310
|
+
static constexpr auto funs = getDoFormatFnArray<Output>();
|
|
311
|
+
constexpr auto in = unsafe_default_initialized;
|
|
312
|
+
int widths[nargs + 1] = {conditional_t<!alignof(Args), int, int>{in}..., in};
|
|
313
|
+
getSizeArg(widths);
|
|
314
|
+
detail::baseFormatterCallImpl<containerMode, RecordUsedSizeArgs::value>(
|
|
315
|
+
out, nargs, widths, *used, funs.data, *this);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
namespace format_value {
|
|
319
|
+
|
|
320
|
+
template <class FormatCallback>
|
|
321
|
+
void formatString(StringPiece val, FormatArg& arg, FormatCallback& cb) {
|
|
322
|
+
if (arg.width != FormatArg::kDefaultWidth && arg.width < 0) {
|
|
323
|
+
throw_exception<BadFormatArg>("folly::format: invalid width");
|
|
324
|
+
}
|
|
325
|
+
if (arg.precision != FormatArg::kDefaultPrecision && arg.precision < 0) {
|
|
326
|
+
throw_exception<BadFormatArg>("folly::format: invalid precision");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (arg.precision != FormatArg::kDefaultPrecision &&
|
|
330
|
+
val.size() > static_cast<size_t>(arg.precision)) {
|
|
331
|
+
val.reset(val.data(), static_cast<size_t>(arg.precision));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
constexpr int padBufSize = 128;
|
|
335
|
+
char padBuf[padBufSize];
|
|
336
|
+
|
|
337
|
+
// Output padding, no more than padBufSize at once
|
|
338
|
+
auto pad = [&padBuf, &cb, padBufSize](int chars) {
|
|
339
|
+
while (chars) {
|
|
340
|
+
int n = std::min(chars, padBufSize);
|
|
341
|
+
cb(StringPiece(padBuf, size_t(n)));
|
|
342
|
+
chars -= n;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
int padRemaining = 0;
|
|
347
|
+
if (arg.width != FormatArg::kDefaultWidth &&
|
|
348
|
+
val.size() < static_cast<size_t>(arg.width)) {
|
|
349
|
+
char fill = arg.fill == FormatArg::kDefaultFill ? ' ' : arg.fill;
|
|
350
|
+
int padChars = static_cast<int>(arg.width - val.size());
|
|
351
|
+
memset(padBuf, fill, size_t(std::min(padBufSize, padChars)));
|
|
352
|
+
|
|
353
|
+
FOLLY_PUSH_WARNING
|
|
354
|
+
FOLLY_CLANG_DISABLE_WARNING("-Wcovered-switch-default")
|
|
355
|
+
switch (arg.align) {
|
|
356
|
+
case FormatArg::Align::DEFAULT:
|
|
357
|
+
case FormatArg::Align::LEFT:
|
|
358
|
+
padRemaining = padChars;
|
|
359
|
+
break;
|
|
360
|
+
case FormatArg::Align::CENTER:
|
|
361
|
+
pad(padChars / 2);
|
|
362
|
+
padRemaining = padChars - padChars / 2;
|
|
363
|
+
break;
|
|
364
|
+
case FormatArg::Align::RIGHT:
|
|
365
|
+
case FormatArg::Align::PAD_AFTER_SIGN:
|
|
366
|
+
pad(padChars);
|
|
367
|
+
break;
|
|
368
|
+
case FormatArg::Align::INVALID:
|
|
369
|
+
default:
|
|
370
|
+
abort();
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
FOLLY_POP_WARNING
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
cb(val);
|
|
377
|
+
|
|
378
|
+
if (padRemaining) {
|
|
379
|
+
pad(padRemaining);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
template <class FormatCallback>
|
|
384
|
+
void formatNumber(
|
|
385
|
+
StringPiece val, int prefixLen, FormatArg& arg, FormatCallback& cb) {
|
|
386
|
+
// precision means something different for numbers
|
|
387
|
+
arg.precision = FormatArg::kDefaultPrecision;
|
|
388
|
+
if (arg.align == FormatArg::Align::DEFAULT) {
|
|
389
|
+
arg.align = FormatArg::Align::RIGHT;
|
|
390
|
+
} else if (prefixLen && arg.align == FormatArg::Align::PAD_AFTER_SIGN) {
|
|
391
|
+
// Split off the prefix, then do any padding if necessary
|
|
392
|
+
cb(val.subpiece(0, size_t(prefixLen)));
|
|
393
|
+
val.advance(size_t(prefixLen));
|
|
394
|
+
arg.width = std::max(arg.width - prefixLen, 0);
|
|
395
|
+
}
|
|
396
|
+
format_value::formatString(val, arg, cb);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
template <typename FormatCallback>
|
|
400
|
+
struct FormatFormatterFn {
|
|
401
|
+
FormatArg& arg;
|
|
402
|
+
FormatCallback& cb;
|
|
403
|
+
void operator()(StringPiece sp) {
|
|
404
|
+
int sz = static_cast<int>(sp.size());
|
|
405
|
+
if (arg.precision != FormatArg::kDefaultPrecision) {
|
|
406
|
+
sz = std::min(arg.precision, sz);
|
|
407
|
+
sp.reset(sp.data(), size_t(sz));
|
|
408
|
+
arg.precision -= sz;
|
|
409
|
+
}
|
|
410
|
+
if (!sp.empty()) {
|
|
411
|
+
cb(sp);
|
|
412
|
+
if (arg.width != FormatArg::kDefaultWidth) {
|
|
413
|
+
arg.width = std::max(arg.width - sz, 0);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
template <class FormatCallback, bool containerMode, class... Args>
|
|
420
|
+
void formatFormatter(
|
|
421
|
+
const Formatter<containerMode, Args...>& formatter,
|
|
422
|
+
FormatArg& arg,
|
|
423
|
+
FormatCallback& cb) {
|
|
424
|
+
if (arg.width == FormatArg::kDefaultWidth &&
|
|
425
|
+
arg.precision == FormatArg::kDefaultPrecision) {
|
|
426
|
+
// nothing to do
|
|
427
|
+
formatter(cb);
|
|
428
|
+
} else if (
|
|
429
|
+
arg.align != FormatArg::Align::LEFT &&
|
|
430
|
+
arg.align != FormatArg::Align::DEFAULT) {
|
|
431
|
+
// We can only avoid creating a temporary string if we align left,
|
|
432
|
+
// as we'd need to know the size beforehand otherwise
|
|
433
|
+
format_value::formatString(formatter.str(), arg, cb);
|
|
434
|
+
} else {
|
|
435
|
+
auto fn = FormatFormatterFn<FormatCallback>{arg, cb};
|
|
436
|
+
formatter(fn);
|
|
437
|
+
if (arg.width != FormatArg::kDefaultWidth && arg.width != 0) {
|
|
438
|
+
// Rely on formatString to do appropriate padding
|
|
439
|
+
format_value::formatString(StringPiece(), arg, cb);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
} // namespace format_value
|
|
445
|
+
|
|
446
|
+
// Definitions for default FormatValue classes
|
|
447
|
+
|
|
448
|
+
// Integral types (except bool)
|
|
449
|
+
template <class T>
|
|
450
|
+
class FormatValue<
|
|
451
|
+
T,
|
|
452
|
+
typename std::enable_if<
|
|
453
|
+
std::is_integral<T>::value && !std::is_same<T, bool>::value>::type> {
|
|
454
|
+
public:
|
|
455
|
+
explicit FormatValue(T val) : val_(val) {}
|
|
456
|
+
|
|
457
|
+
T getValue() const { return val_; }
|
|
458
|
+
|
|
459
|
+
template <class FormatCallback>
|
|
460
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
461
|
+
arg.validate(FormatArg::Type::INTEGER);
|
|
462
|
+
doFormat(arg, cb);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
template <class FormatCallback>
|
|
466
|
+
void doFormat(FormatArg& arg, FormatCallback& cb) const {
|
|
467
|
+
char presentation = arg.presentation;
|
|
468
|
+
if (presentation == FormatArg::kDefaultPresentation) {
|
|
469
|
+
presentation = std::is_same<T, char>::value ? 'c' : 'd';
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Do all work as unsigned, we'll add the prefix ('0' or '0x' if necessary)
|
|
473
|
+
// and sign ourselves.
|
|
474
|
+
typedef typename std::make_unsigned<T>::type UT;
|
|
475
|
+
UT uval;
|
|
476
|
+
char sign;
|
|
477
|
+
if constexpr (std::is_signed<T>::value) {
|
|
478
|
+
if (folly::is_negative(val_)) {
|
|
479
|
+
// avoid unary negation of unsigned types, which may be warned against
|
|
480
|
+
// avoid ub signed integer overflow, which ubsan checks against
|
|
481
|
+
uval = UT(0 - static_cast<UT>(val_));
|
|
482
|
+
sign = '-';
|
|
483
|
+
} else {
|
|
484
|
+
uval = static_cast<UT>(val_);
|
|
485
|
+
FOLLY_PUSH_WARNING
|
|
486
|
+
FOLLY_CLANG_DISABLE_WARNING("-Wcovered-switch-default")
|
|
487
|
+
switch (arg.sign) {
|
|
488
|
+
case FormatArg::Sign::PLUS_OR_MINUS:
|
|
489
|
+
sign = '+';
|
|
490
|
+
break;
|
|
491
|
+
case FormatArg::Sign::SPACE_OR_MINUS:
|
|
492
|
+
sign = ' ';
|
|
493
|
+
break;
|
|
494
|
+
case FormatArg::Sign::DEFAULT:
|
|
495
|
+
case FormatArg::Sign::MINUS:
|
|
496
|
+
case FormatArg::Sign::INVALID:
|
|
497
|
+
default:
|
|
498
|
+
sign = '\0';
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
FOLLY_POP_WARNING
|
|
502
|
+
}
|
|
503
|
+
} else {
|
|
504
|
+
uval = static_cast<UT>(val_);
|
|
505
|
+
sign = '\0';
|
|
506
|
+
|
|
507
|
+
arg.enforce(
|
|
508
|
+
arg.sign == FormatArg::Sign::DEFAULT,
|
|
509
|
+
"sign specifications not allowed for unsigned values");
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// 1 byte for sign, plus max of:
|
|
513
|
+
// #x: two byte "0x" prefix + kMaxHexLength
|
|
514
|
+
// #o: one byte "0" prefix + kMaxOctalLength
|
|
515
|
+
// #b: two byte "0b" prefix + kMaxBinaryLength
|
|
516
|
+
// n: 19 bytes + 1 NUL
|
|
517
|
+
// ,d: 26 bytes (including thousands separators!)
|
|
518
|
+
//
|
|
519
|
+
// Binary format must take the most space, so we use that.
|
|
520
|
+
//
|
|
521
|
+
// Note that we produce a StringPiece rather than NUL-terminating,
|
|
522
|
+
// so we don't need an extra byte for a NUL.
|
|
523
|
+
constexpr size_t valBufSize = 1 + 2 + detail::kMaxBinaryLength;
|
|
524
|
+
char valBuf[valBufSize];
|
|
525
|
+
char* valBufBegin = nullptr;
|
|
526
|
+
char* valBufEnd = nullptr;
|
|
527
|
+
|
|
528
|
+
int prefixLen = 0;
|
|
529
|
+
switch (presentation) {
|
|
530
|
+
case 'n': {
|
|
531
|
+
arg.enforce(
|
|
532
|
+
!arg.basePrefix,
|
|
533
|
+
"base prefix not allowed with '",
|
|
534
|
+
presentation,
|
|
535
|
+
"' specifier");
|
|
536
|
+
|
|
537
|
+
arg.enforce(
|
|
538
|
+
!arg.thousandsSeparator,
|
|
539
|
+
"cannot use ',' with the '",
|
|
540
|
+
presentation,
|
|
541
|
+
"' specifier");
|
|
542
|
+
|
|
543
|
+
valBufBegin = valBuf + 1; // room for sign
|
|
544
|
+
#if defined(__ANDROID__)
|
|
545
|
+
int len = snprintf(
|
|
546
|
+
valBufBegin,
|
|
547
|
+
(valBuf + valBufSize) - valBufBegin,
|
|
548
|
+
"%" PRIuMAX,
|
|
549
|
+
static_cast<uintmax_t>(uval));
|
|
550
|
+
#else
|
|
551
|
+
int len = snprintf(
|
|
552
|
+
valBufBegin,
|
|
553
|
+
size_t((valBuf + valBufSize) - valBufBegin),
|
|
554
|
+
"%ju",
|
|
555
|
+
static_cast<uintmax_t>(uval));
|
|
556
|
+
#endif
|
|
557
|
+
// valBufSize should always be big enough, so this should never
|
|
558
|
+
// happen.
|
|
559
|
+
assert(len < valBuf + valBufSize - valBufBegin);
|
|
560
|
+
valBufEnd = valBufBegin + len;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
case 'd':
|
|
564
|
+
arg.enforce(
|
|
565
|
+
!arg.basePrefix,
|
|
566
|
+
"base prefix not allowed with '",
|
|
567
|
+
presentation,
|
|
568
|
+
"' specifier");
|
|
569
|
+
valBufBegin = valBuf + 1; // room for sign
|
|
570
|
+
|
|
571
|
+
// Use to_ascii_decimal, faster than sprintf
|
|
572
|
+
valBufEnd = valBufBegin +
|
|
573
|
+
to_ascii_decimal(valBufBegin, valBuf + sizeof(valBuf), uval);
|
|
574
|
+
if (arg.thousandsSeparator) {
|
|
575
|
+
detail::insertThousandsGroupingUnsafe(valBufBegin, &valBufEnd);
|
|
576
|
+
}
|
|
577
|
+
break;
|
|
578
|
+
case 'c':
|
|
579
|
+
arg.enforce(
|
|
580
|
+
!arg.basePrefix,
|
|
581
|
+
"base prefix not allowed with '",
|
|
582
|
+
presentation,
|
|
583
|
+
"' specifier");
|
|
584
|
+
arg.enforce(
|
|
585
|
+
!arg.thousandsSeparator,
|
|
586
|
+
"thousands separator (',') not allowed with '",
|
|
587
|
+
presentation,
|
|
588
|
+
"' specifier");
|
|
589
|
+
valBufBegin = valBuf + 1; // room for sign
|
|
590
|
+
*valBufBegin = static_cast<char>(uval);
|
|
591
|
+
valBufEnd = valBufBegin + 1;
|
|
592
|
+
break;
|
|
593
|
+
case 'o':
|
|
594
|
+
case 'O':
|
|
595
|
+
arg.enforce(
|
|
596
|
+
!arg.thousandsSeparator,
|
|
597
|
+
"thousands separator (',') not allowed with '",
|
|
598
|
+
presentation,
|
|
599
|
+
"' specifier");
|
|
600
|
+
valBufEnd = valBuf + valBufSize;
|
|
601
|
+
valBufBegin = &valBuf[detail::uintToOctal(valBuf, valBufSize, uval)];
|
|
602
|
+
if (arg.basePrefix) {
|
|
603
|
+
*--valBufBegin = '0';
|
|
604
|
+
prefixLen = 1;
|
|
605
|
+
}
|
|
606
|
+
break;
|
|
607
|
+
case 'x':
|
|
608
|
+
arg.enforce(
|
|
609
|
+
!arg.thousandsSeparator,
|
|
610
|
+
"thousands separator (',') not allowed with '",
|
|
611
|
+
presentation,
|
|
612
|
+
"' specifier");
|
|
613
|
+
valBufEnd = valBuf + valBufSize;
|
|
614
|
+
valBufBegin = &valBuf[detail::uintToHexLower(valBuf, valBufSize, uval)];
|
|
615
|
+
if (arg.basePrefix) {
|
|
616
|
+
*--valBufBegin = 'x';
|
|
617
|
+
*--valBufBegin = '0';
|
|
618
|
+
prefixLen = 2;
|
|
619
|
+
}
|
|
620
|
+
break;
|
|
621
|
+
case 'X':
|
|
622
|
+
arg.enforce(
|
|
623
|
+
!arg.thousandsSeparator,
|
|
624
|
+
"thousands separator (',') not allowed with '",
|
|
625
|
+
presentation,
|
|
626
|
+
"' specifier");
|
|
627
|
+
valBufEnd = valBuf + valBufSize;
|
|
628
|
+
valBufBegin = &valBuf[detail::uintToHexUpper(valBuf, valBufSize, uval)];
|
|
629
|
+
if (arg.basePrefix) {
|
|
630
|
+
*--valBufBegin = 'X';
|
|
631
|
+
*--valBufBegin = '0';
|
|
632
|
+
prefixLen = 2;
|
|
633
|
+
}
|
|
634
|
+
break;
|
|
635
|
+
case 'b':
|
|
636
|
+
case 'B':
|
|
637
|
+
arg.enforce(
|
|
638
|
+
!arg.thousandsSeparator,
|
|
639
|
+
"thousands separator (',') not allowed with '",
|
|
640
|
+
presentation,
|
|
641
|
+
"' specifier");
|
|
642
|
+
valBufEnd = valBuf + valBufSize;
|
|
643
|
+
valBufBegin = &valBuf[detail::uintToBinary(valBuf, valBufSize, uval)];
|
|
644
|
+
if (arg.basePrefix) {
|
|
645
|
+
*--valBufBegin = presentation; // 0b or 0B
|
|
646
|
+
*--valBufBegin = '0';
|
|
647
|
+
prefixLen = 2;
|
|
648
|
+
}
|
|
649
|
+
break;
|
|
650
|
+
default:
|
|
651
|
+
arg.error("invalid specifier '", presentation, "'");
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
if (sign) {
|
|
655
|
+
*--valBufBegin = sign;
|
|
656
|
+
++prefixLen;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
format_value::formatNumber(
|
|
660
|
+
StringPiece(valBufBegin, valBufEnd), prefixLen, arg, cb);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
private:
|
|
664
|
+
T val_;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// Bool
|
|
668
|
+
template <>
|
|
669
|
+
class FormatValue<bool> {
|
|
670
|
+
public:
|
|
671
|
+
explicit FormatValue(bool val) : val_(val) {}
|
|
672
|
+
|
|
673
|
+
template <class FormatCallback>
|
|
674
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
675
|
+
if (arg.presentation == FormatArg::kDefaultPresentation) {
|
|
676
|
+
arg.validate(FormatArg::Type::OTHER);
|
|
677
|
+
format_value::formatString(val_ ? "true" : "false", arg, cb);
|
|
678
|
+
} else { // number
|
|
679
|
+
FormatValue<int>(val_).format(arg, cb);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
private:
|
|
684
|
+
bool val_;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// double
|
|
688
|
+
template <>
|
|
689
|
+
class FormatValue<double> {
|
|
690
|
+
public:
|
|
691
|
+
explicit FormatValue(double val) : val_(val) {}
|
|
692
|
+
|
|
693
|
+
template <class FormatCallback>
|
|
694
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
695
|
+
fbstring piece;
|
|
696
|
+
int prefixLen;
|
|
697
|
+
formatHelper(piece, prefixLen, arg);
|
|
698
|
+
format_value::formatNumber(piece, prefixLen, arg, cb);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
private:
|
|
702
|
+
void formatHelper(fbstring& piece, int& prefixLen, FormatArg& arg) const;
|
|
703
|
+
|
|
704
|
+
double val_;
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// float (defer to double)
|
|
708
|
+
template <>
|
|
709
|
+
class FormatValue<float> {
|
|
710
|
+
public:
|
|
711
|
+
explicit FormatValue(float val) : val_(val) {}
|
|
712
|
+
|
|
713
|
+
template <class FormatCallback>
|
|
714
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
715
|
+
FormatValue<double>(val_).format(arg, cb);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
private:
|
|
719
|
+
float val_;
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
// String-y types (implicitly convertible to StringPiece, except char*)
|
|
723
|
+
template <class T>
|
|
724
|
+
class FormatValue<
|
|
725
|
+
T,
|
|
726
|
+
typename std::enable_if<
|
|
727
|
+
(!std::is_pointer<T>::value ||
|
|
728
|
+
!std::is_same<
|
|
729
|
+
char,
|
|
730
|
+
typename std::decay<typename std::remove_pointer<T>::type>::type>::
|
|
731
|
+
value) &&
|
|
732
|
+
std::is_convertible<T, StringPiece>::value>::type> {
|
|
733
|
+
public:
|
|
734
|
+
explicit FormatValue(StringPiece val) : val_(val) {}
|
|
735
|
+
|
|
736
|
+
template <class FormatCallback>
|
|
737
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
738
|
+
if (arg.keyEmpty()) {
|
|
739
|
+
arg.validate(FormatArg::Type::OTHER);
|
|
740
|
+
arg.enforce(
|
|
741
|
+
arg.presentation == FormatArg::kDefaultPresentation ||
|
|
742
|
+
arg.presentation == 's',
|
|
743
|
+
"invalid specifier '",
|
|
744
|
+
arg.presentation,
|
|
745
|
+
"'");
|
|
746
|
+
format_value::formatString(val_, arg, cb);
|
|
747
|
+
} else {
|
|
748
|
+
FormatValue<char>(val_.at(size_t(arg.splitIntKey()))).format(arg, cb);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
private:
|
|
753
|
+
StringPiece val_;
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// Null
|
|
757
|
+
template <>
|
|
758
|
+
class FormatValue<std::nullptr_t> {
|
|
759
|
+
public:
|
|
760
|
+
explicit FormatValue(std::nullptr_t) {}
|
|
761
|
+
|
|
762
|
+
template <class FormatCallback>
|
|
763
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
764
|
+
arg.validate(FormatArg::Type::OTHER);
|
|
765
|
+
arg.enforce(
|
|
766
|
+
arg.presentation == FormatArg::kDefaultPresentation,
|
|
767
|
+
"invalid specifier '",
|
|
768
|
+
arg.presentation,
|
|
769
|
+
"'");
|
|
770
|
+
format_value::formatString("(null)", arg, cb);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// Partial specialization of FormatValue for char*
|
|
775
|
+
template <class T>
|
|
776
|
+
class FormatValue<
|
|
777
|
+
T*,
|
|
778
|
+
typename std::enable_if<
|
|
779
|
+
std::is_same<char, typename std::decay<T>::type>::value>::type> {
|
|
780
|
+
public:
|
|
781
|
+
explicit FormatValue(T* val) : val_(val) {}
|
|
782
|
+
|
|
783
|
+
template <class FormatCallback>
|
|
784
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
785
|
+
if (arg.keyEmpty()) {
|
|
786
|
+
if (!val_) {
|
|
787
|
+
FormatValue<std::nullptr_t>(nullptr).format(arg, cb);
|
|
788
|
+
} else {
|
|
789
|
+
FormatValue<StringPiece>(val_).format(arg, cb);
|
|
790
|
+
}
|
|
791
|
+
} else {
|
|
792
|
+
FormatValue<typename std::decay<T>::type>(val_[arg.splitIntKey()])
|
|
793
|
+
.format(arg, cb);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
private:
|
|
798
|
+
T* val_;
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
// Partial specialization of FormatValue for void*
|
|
802
|
+
template <class T>
|
|
803
|
+
class FormatValue<
|
|
804
|
+
T*,
|
|
805
|
+
typename std::enable_if<
|
|
806
|
+
std::is_same<void, typename std::decay<T>::type>::value>::type> {
|
|
807
|
+
public:
|
|
808
|
+
explicit FormatValue(T* val) : val_(val) {}
|
|
809
|
+
|
|
810
|
+
template <class FormatCallback>
|
|
811
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
812
|
+
if (!val_) {
|
|
813
|
+
FormatValue<std::nullptr_t>(nullptr).format(arg, cb);
|
|
814
|
+
} else {
|
|
815
|
+
// Print as a pointer, in hex.
|
|
816
|
+
arg.validate(FormatArg::Type::OTHER);
|
|
817
|
+
arg.enforce(
|
|
818
|
+
arg.presentation == FormatArg::kDefaultPresentation,
|
|
819
|
+
"invalid specifier '",
|
|
820
|
+
arg.presentation,
|
|
821
|
+
"'");
|
|
822
|
+
arg.basePrefix = true;
|
|
823
|
+
arg.presentation = 'x';
|
|
824
|
+
if (arg.align == FormatArg::Align::DEFAULT) {
|
|
825
|
+
arg.align = FormatArg::Align::LEFT;
|
|
826
|
+
}
|
|
827
|
+
FormatValue<uintptr_t>(reinterpret_cast<uintptr_t>(val_))
|
|
828
|
+
.doFormat(arg, cb);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
private:
|
|
833
|
+
T* val_;
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
template <class T, class = void>
|
|
837
|
+
class TryFormatValue {
|
|
838
|
+
public:
|
|
839
|
+
template <class FormatCallback>
|
|
840
|
+
static void formatOrFail(
|
|
841
|
+
T& /* value */, FormatArg& arg, FormatCallback& /* cb */) {
|
|
842
|
+
arg.error("No formatter available for this type");
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
template <class T>
|
|
847
|
+
class TryFormatValue<
|
|
848
|
+
T,
|
|
849
|
+
typename std::enable_if<
|
|
850
|
+
0 < sizeof(FormatValue<typename std::decay<T>::type>)>::type> {
|
|
851
|
+
public:
|
|
852
|
+
template <class FormatCallback>
|
|
853
|
+
static void formatOrFail(T& value, FormatArg& arg, FormatCallback& cb) {
|
|
854
|
+
FormatValue<typename std::decay<T>::type>(value).format(arg, cb);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
// Partial specialization of FormatValue for other pointers
|
|
859
|
+
template <class T>
|
|
860
|
+
class FormatValue<
|
|
861
|
+
T*,
|
|
862
|
+
typename std::enable_if<
|
|
863
|
+
!std::is_same<char, typename std::decay<T>::type>::value &&
|
|
864
|
+
!std::is_same<void, typename std::decay<T>::type>::value>::type> {
|
|
865
|
+
public:
|
|
866
|
+
explicit FormatValue(T* val) : val_(val) {}
|
|
867
|
+
|
|
868
|
+
template <class FormatCallback>
|
|
869
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
870
|
+
if (arg.keyEmpty()) {
|
|
871
|
+
FormatValue<void*>((void*)val_).format(arg, cb);
|
|
872
|
+
} else {
|
|
873
|
+
TryFormatValue<T>::formatOrFail(val_[arg.splitIntKey()], arg, cb);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
private:
|
|
878
|
+
T* val_;
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
namespace detail {
|
|
882
|
+
|
|
883
|
+
// std::array
|
|
884
|
+
template <class T, size_t N>
|
|
885
|
+
struct IndexableTraits<std::array<T, N>>
|
|
886
|
+
: public IndexableTraitsSeq<std::array<T, N>> {};
|
|
887
|
+
|
|
888
|
+
// std::vector
|
|
889
|
+
template <class T, class A>
|
|
890
|
+
struct IndexableTraits<std::vector<T, A>>
|
|
891
|
+
: public IndexableTraitsSeq<std::vector<T, A>> {};
|
|
892
|
+
|
|
893
|
+
// std::deque
|
|
894
|
+
template <class T, class A>
|
|
895
|
+
struct IndexableTraits<std::deque<T, A>>
|
|
896
|
+
: public IndexableTraitsSeq<std::deque<T, A>> {};
|
|
897
|
+
|
|
898
|
+
// std::map with integral keys
|
|
899
|
+
template <class K, class T, class C, class A>
|
|
900
|
+
struct IndexableTraits<
|
|
901
|
+
std::map<K, T, C, A>,
|
|
902
|
+
typename std::enable_if<std::is_integral<K>::value>::type>
|
|
903
|
+
: public IndexableTraitsAssoc<std::map<K, T, C, A>> {};
|
|
904
|
+
|
|
905
|
+
// std::unordered_map with integral keys
|
|
906
|
+
template <class K, class T, class H, class E, class A>
|
|
907
|
+
struct IndexableTraits<
|
|
908
|
+
std::unordered_map<K, T, H, E, A>,
|
|
909
|
+
typename std::enable_if<std::is_integral<K>::value>::type>
|
|
910
|
+
: public IndexableTraitsAssoc<std::unordered_map<K, T, H, E, A>> {};
|
|
911
|
+
|
|
912
|
+
} // namespace detail
|
|
913
|
+
|
|
914
|
+
// Partial specialization of FormatValue for integer-indexable containers
|
|
915
|
+
template <class T>
|
|
916
|
+
class FormatValue<T, typename detail::IndexableTraits<T>::enabled> {
|
|
917
|
+
public:
|
|
918
|
+
explicit FormatValue(const T& val) : val_(val) {}
|
|
919
|
+
|
|
920
|
+
template <class FormatCallback>
|
|
921
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
922
|
+
FormatValue<typename std::decay<
|
|
923
|
+
typename detail::IndexableTraits<T>::value_type>::type>(
|
|
924
|
+
detail::IndexableTraits<T>::at(val_, arg.splitIntKey()))
|
|
925
|
+
.format(arg, cb);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
private:
|
|
929
|
+
const T& val_;
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
template <class Container, class Value>
|
|
933
|
+
class FormatValue<
|
|
934
|
+
detail::DefaultValueWrapper<Container, Value>,
|
|
935
|
+
typename detail::IndexableTraits<Container>::enabled> {
|
|
936
|
+
public:
|
|
937
|
+
explicit FormatValue(const detail::DefaultValueWrapper<Container, Value>& val)
|
|
938
|
+
: val_(val) {}
|
|
939
|
+
|
|
940
|
+
template <class FormatCallback>
|
|
941
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
942
|
+
FormatValue<typename std::decay<
|
|
943
|
+
typename detail::IndexableTraits<Container>::value_type>::type>(
|
|
944
|
+
detail::IndexableTraits<Container>::at(
|
|
945
|
+
val_.container, arg.splitIntKey(), val_.defaultValue))
|
|
946
|
+
.format(arg, cb);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
private:
|
|
950
|
+
const detail::DefaultValueWrapper<Container, Value>& val_;
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
namespace detail {
|
|
954
|
+
|
|
955
|
+
// Define enabled, key_type, convert from StringPiece to the key types
|
|
956
|
+
// that we support
|
|
957
|
+
template <class T>
|
|
958
|
+
struct KeyFromStringPiece;
|
|
959
|
+
|
|
960
|
+
// std::string
|
|
961
|
+
template <>
|
|
962
|
+
struct KeyFromStringPiece<std::string> : public FormatTraitsBase {
|
|
963
|
+
typedef std::string key_type;
|
|
964
|
+
static std::string convert(StringPiece s) { return s.toString(); }
|
|
965
|
+
typedef void enabled;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
// fbstring
|
|
969
|
+
template <>
|
|
970
|
+
struct KeyFromStringPiece<fbstring> : public FormatTraitsBase {
|
|
971
|
+
typedef fbstring key_type;
|
|
972
|
+
static fbstring convert(StringPiece s) { return s.to<fbstring>(); }
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
// StringPiece
|
|
976
|
+
template <>
|
|
977
|
+
struct KeyFromStringPiece<StringPiece> : public FormatTraitsBase {
|
|
978
|
+
typedef StringPiece key_type;
|
|
979
|
+
static StringPiece convert(StringPiece s) { return s; }
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// Base class for associative types keyed by strings
|
|
983
|
+
template <class T>
|
|
984
|
+
struct KeyableTraitsAssoc : public FormatTraitsBase {
|
|
985
|
+
typedef typename T::key_type key_type;
|
|
986
|
+
typedef typename T::value_type::second_type value_type;
|
|
987
|
+
static const value_type& at(const T& map, StringPiece key) {
|
|
988
|
+
if (auto ptr = get_ptr(map, KeyFromStringPiece<key_type>::convert(key))) {
|
|
989
|
+
return *ptr;
|
|
990
|
+
}
|
|
991
|
+
throw_exception<FormatKeyNotFoundException>(key);
|
|
992
|
+
}
|
|
993
|
+
static const value_type& at(
|
|
994
|
+
const T& map, StringPiece key, const value_type& dflt) {
|
|
995
|
+
auto pos = map.find(KeyFromStringPiece<key_type>::convert(key));
|
|
996
|
+
return pos != map.end() ? pos->second : dflt;
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
// Define enabled, key_type, value_type, at() for supported string-keyed
|
|
1001
|
+
// types
|
|
1002
|
+
template <class T, class Enabled = void>
|
|
1003
|
+
struct KeyableTraits;
|
|
1004
|
+
|
|
1005
|
+
// std::map with string key
|
|
1006
|
+
template <class K, class T, class C, class A>
|
|
1007
|
+
struct KeyableTraits<
|
|
1008
|
+
std::map<K, T, C, A>,
|
|
1009
|
+
typename KeyFromStringPiece<K>::enabled>
|
|
1010
|
+
: public KeyableTraitsAssoc<std::map<K, T, C, A>> {};
|
|
1011
|
+
|
|
1012
|
+
// std::unordered_map with string key
|
|
1013
|
+
template <class K, class T, class H, class E, class A>
|
|
1014
|
+
struct KeyableTraits<
|
|
1015
|
+
std::unordered_map<K, T, H, E, A>,
|
|
1016
|
+
typename KeyFromStringPiece<K>::enabled>
|
|
1017
|
+
: public KeyableTraitsAssoc<std::unordered_map<K, T, H, E, A>> {};
|
|
1018
|
+
|
|
1019
|
+
} // namespace detail
|
|
1020
|
+
|
|
1021
|
+
// Partial specialization of FormatValue for string-keyed containers
|
|
1022
|
+
template <class T>
|
|
1023
|
+
class FormatValue<T, typename detail::KeyableTraits<T>::enabled> {
|
|
1024
|
+
public:
|
|
1025
|
+
explicit FormatValue(const T& val) : val_(val) {}
|
|
1026
|
+
|
|
1027
|
+
template <class FormatCallback>
|
|
1028
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
1029
|
+
FormatValue<typename std::decay<
|
|
1030
|
+
typename detail::KeyableTraits<T>::value_type>::type>(
|
|
1031
|
+
detail::KeyableTraits<T>::at(val_, arg.splitKey()))
|
|
1032
|
+
.format(arg, cb);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
private:
|
|
1036
|
+
const T& val_;
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
template <class Container, class Value>
|
|
1040
|
+
class FormatValue<
|
|
1041
|
+
detail::DefaultValueWrapper<Container, Value>,
|
|
1042
|
+
typename detail::KeyableTraits<Container>::enabled> {
|
|
1043
|
+
public:
|
|
1044
|
+
explicit FormatValue(const detail::DefaultValueWrapper<Container, Value>& val)
|
|
1045
|
+
: val_(val) {}
|
|
1046
|
+
|
|
1047
|
+
template <class FormatCallback>
|
|
1048
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
1049
|
+
FormatValue<typename std::decay<
|
|
1050
|
+
typename detail::KeyableTraits<Container>::value_type>::type>(
|
|
1051
|
+
detail::KeyableTraits<Container>::at(
|
|
1052
|
+
val_.container, arg.splitKey(), val_.defaultValue))
|
|
1053
|
+
.format(arg, cb);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
private:
|
|
1057
|
+
const detail::DefaultValueWrapper<Container, Value>& val_;
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
// Partial specialization of FormatValue for pairs
|
|
1061
|
+
template <class A, class B>
|
|
1062
|
+
class FormatValue<std::pair<A, B>> {
|
|
1063
|
+
public:
|
|
1064
|
+
explicit FormatValue(const std::pair<A, B>& val) : val_(val) {}
|
|
1065
|
+
|
|
1066
|
+
template <class FormatCallback>
|
|
1067
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
1068
|
+
int key = arg.splitIntKey();
|
|
1069
|
+
switch (key) {
|
|
1070
|
+
case 0:
|
|
1071
|
+
FormatValue<typename std::decay<A>::type>(val_.first).format(arg, cb);
|
|
1072
|
+
break;
|
|
1073
|
+
case 1:
|
|
1074
|
+
FormatValue<typename std::decay<B>::type>(val_.second).format(arg, cb);
|
|
1075
|
+
break;
|
|
1076
|
+
default:
|
|
1077
|
+
arg.error("invalid index for pair");
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
private:
|
|
1082
|
+
const std::pair<A, B>& val_;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
// Partial specialization of FormatValue for tuples
|
|
1086
|
+
template <class... Args>
|
|
1087
|
+
class FormatValue<std::tuple<Args...>> {
|
|
1088
|
+
typedef std::tuple<Args...> Tuple;
|
|
1089
|
+
|
|
1090
|
+
public:
|
|
1091
|
+
explicit FormatValue(const Tuple& val) : val_(val) {}
|
|
1092
|
+
|
|
1093
|
+
template <class FormatCallback>
|
|
1094
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
1095
|
+
int key = arg.splitIntKey();
|
|
1096
|
+
arg.enforce(key >= 0, "tuple index must be non-negative");
|
|
1097
|
+
doFormat(size_t(key), arg, cb);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
private:
|
|
1101
|
+
template <size_t K>
|
|
1102
|
+
using FV = FormatValue<
|
|
1103
|
+
typename std::decay<typename std::tuple_element<K, Tuple>::type>::type>;
|
|
1104
|
+
|
|
1105
|
+
template <class Callback, size_t... I>
|
|
1106
|
+
void doFormat(
|
|
1107
|
+
size_t i, FormatArg& arg, Callback& cb, std::index_sequence<I...>) const {
|
|
1108
|
+
using _ = int[];
|
|
1109
|
+
detail::formatCheckIndex(i, arg, sizeof...(Args));
|
|
1110
|
+
void(_{(i == I ? (FV<I>(std::get<I>(val_)).format(arg, cb), 0) : 0)..., 0});
|
|
1111
|
+
}
|
|
1112
|
+
template <class Callback>
|
|
1113
|
+
void doFormat(size_t i, FormatArg& arg, Callback& cb) const {
|
|
1114
|
+
return doFormat(i, arg, cb, std::index_sequence_for<Args...>{});
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
const Tuple& val_;
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
// Partial specialization of FormatValue for nested Formatters
|
|
1121
|
+
template <bool containerMode, class... Args, template <bool, class...> class F>
|
|
1122
|
+
class FormatValue<
|
|
1123
|
+
F<containerMode, Args...>,
|
|
1124
|
+
typename std::enable_if<
|
|
1125
|
+
detail::IsFormatter<F<containerMode, Args...>>::value>::type> {
|
|
1126
|
+
typedef F<containerMode, Args...> FormatterValue;
|
|
1127
|
+
|
|
1128
|
+
public:
|
|
1129
|
+
explicit FormatValue(const FormatterValue& f) : f_(f) {}
|
|
1130
|
+
|
|
1131
|
+
template <class FormatCallback>
|
|
1132
|
+
void format(FormatArg& arg, FormatCallback& cb) const {
|
|
1133
|
+
format_value::formatFormatter(f_, arg, cb);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
private:
|
|
1137
|
+
const FormatterValue& f_;
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Formatter objects can be appended to strings, and therefore they're
|
|
1142
|
+
* compatible with folly::toAppend and folly::to.
|
|
1143
|
+
*/
|
|
1144
|
+
template <class Tgt, bool containerMode, class... Args>
|
|
1145
|
+
typename std::enable_if<IsSomeString<Tgt>::value>::type toAppend(
|
|
1146
|
+
const Formatter<containerMode, Args...>& value, Tgt* result) {
|
|
1147
|
+
value.appendTo(*result);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
} // namespace folly
|
|
1151
|
+
|
|
1152
|
+
FOLLY_POP_WARNING
|