Compare commits

..

67 Commits

Author SHA1 Message Date
Mayukha Vadari
d1b4c76c29 Merge branch 'develop' into mvadari/fix-bad-cast 2026-04-09 15:44:12 -04:00
Mayukha Vadari
d1f1546c70 Merge branch 'develop' into mvadari/fix-bad-cast 2026-04-03 10:23:44 -04:00
Mayukha Vadari
a29404c706 Merge branch 'develop' into mvadari/fix-bad-cast 2026-04-01 16:15:11 -04:00
Mayukha Vadari
9ac820d96b one more 2026-04-01 16:14:22 -04:00
Mayukha Vadari
9d4574a82c respond to comments 2026-04-01 16:13:36 -04:00
Mayukha Vadari
8deb43c358 Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-01 16:12:46 -04:00
Mayukha Vadari
cc120beed1 >= -> == 2026-04-01 16:09:37 -04:00
Mayukha Vadari
fa7e1fa3c0 fix tests 2026-04-01 16:07:28 -04:00
Mayukha Vadari
61eddd76cb fix comments 2026-04-01 15:49:10 -04:00
Mayukha Vadari
f934239276 fix clang-tidy issues 2026-04-01 15:46:26 -04:00
Mayukha Vadari
01da501753 Merge branch 'develop' into mvadari/fix-bad-cast 2026-04-01 15:13:39 -04:00
Mayukha Vadari
1bf9dbf7c2 Merge branch 'develop' into mvadari/fix-bad-cast 2026-03-12 14:44:37 -04:00
Mayukha Vadari
c7b39df08f Merge branch 'develop' into mvadari/fix-bad-cast 2026-03-02 17:06:13 -05:00
Mayukha Vadari
c7f9904112 Update src/xrpld/rpc/detail/RPCCall.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-02 17:59:07 -04:00
Mayukha Vadari
26bdc7198c Merge branch 'develop' into mvadari/fix-bad-cast 2026-02-27 16:41:43 -05:00
Mayukha Vadari
1868979227 Merge branch 'develop' into mvadari/fix-bad-cast 2026-02-27 13:49:24 -05:00
Mayukha Vadari
e9a0f1fba5 Merge branch 'develop' into mvadari/fix-bad-cast 2026-02-26 00:05:08 -05:00
Mayukha Vadari
45b35aef64 Merge branch 'develop' into mvadari/fix-bad-cast 2026-02-24 17:23:56 -05:00
Mayukha Vadari
4e298efb85 fix formatting 2026-02-24 17:23:49 -05:00
Mayukha Vadari
319eb41df9 Merge commit '2c1fad1023' into mvadari/fix-bad-cast 2026-02-24 17:23:20 -05:00
Mayukha Vadari
90d7d38e76 Merge commit '25cca465538a56cce501477f9e5e2c1c7ea2d84c' into mvadari/fix-bad-cast 2026-02-24 17:23:13 -05:00
Mayukha Vadari
040231a6b8 Merge remote-tracking branch 'upstream/develop' into mvadari/fix-bad-cast 2026-02-13 17:03:41 -05:00
Mayukha Vadari
77989d9dc5 Merge remote-tracking branch 'upstream/develop' into mvadari/fix-bad-cast 2026-02-12 17:18:03 -05:00
Mayukha Vadari
72a61484ae Merge remote-tracking branch 'upstream/develop' into mvadari/fix-bad-cast 2026-02-10 17:24:53 -05:00
Mayukha Vadari
d2f3d392eb Merge remote-tracking branch 'upstream/develop' into mvadari/fix-bad-cast 2026-02-06 11:04:25 -05:00
Mayukha Vadari
83137a289a Merge remote-tracking branch 'upstream/develop' into mvadari/fix-bad-cast 2026-02-04 17:06:02 -05:00
Mayukha Vadari
d24f40ac13 Merge branch 'develop' into mvadari/fix-bad-cast 2026-02-03 10:20:31 -05:00
Mayukha Vadari
e46b3468ae Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-30 12:11:28 -05:00
Mayukha Vadari
e2a273dfa0 respond to comments 2026-01-30 12:11:24 -05:00
Mayukha Vadari
37e3f03764 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-28 15:52:10 -05:00
Mayukha Vadari
a227fe826f Merge commit '5f638f55536def0d88b970d1018a465a238e55f4' into mvadari/fix-bad-cast 2026-01-28 15:52:02 -05:00
Mayukha Vadari
840e4303e3 Merge commit '92046785d1fea5f9efe5a770d636792ea6cab78b' into mvadari/fix-bad-cast 2026-01-28 15:51:13 -05:00
Mayukha Vadari
949ba8e335 check int limit 2026-01-22 12:17:55 -05:00
Mayukha Vadari
bdc8dc3746 fix build 2026-01-22 12:08:10 -05:00
Mayukha Vadari
ff4125f7f8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-22 12:07:02 -05:00
Mayukha Vadari
e42f243913 respond to comments 2026-01-22 12:02:53 -05:00
Mayukha Vadari
b4fcf80df3 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-22 10:35:39 -05:00
Mayukha Vadari
39dfcdfeb8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-21 18:14:23 -05:00
Mayukha Vadari
d4c2154d6e Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-13 17:51:17 -05:00
Mayukha Vadari
acd34177c8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-07 16:55:29 -05:00
Mayukha Vadari
36c4060d65 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-05 15:39:32 -05:00
Mayukha Vadari
eb681adbd3 Merge branch 'develop' into mvadari/fix-bad-cast 2025-12-23 11:52:15 -08:00
Mayukha Vadari
d78bc9e780 Update src/xrpld/rpc/detail/RPCCall.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 11:52:07 -08:00
Mayukha Vadari
2b61b2257b Update API-CHANGELOG.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 11:51:16 -08:00
Mayukha Vadari
100ad8b531 Merge branch 'develop' into mvadari/fix-bad-cast 2025-12-02 17:57:07 -05:00
Mayukha Vadari
df5226692e fix tests 2025-11-20 18:35:22 +05:30
Mayukha Vadari
eca65c04ee respond to comments (mostly more consts) 2025-11-20 17:49:49 +05:30
Mayukha Vadari
2d53099539 update changelog 2025-11-20 17:45:56 +05:30
Mayukha Vadari
69dba2e36b Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-20 17:45:48 +05:30
Mayukha Vadari
fd2f2b1095 Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-20 15:35:22 +05:30
Mayukha Vadari
50f418f40b add consts 2025-11-20 15:34:44 +05:30
Mayukha Vadari
5154649ff0 remove now-unneeded comments 2025-11-20 15:34:44 +05:30
Mayukha Vadari
96287e20be remove jss::proof 2025-11-20 15:34:44 +05:30
Mayukha Vadari
3e07a64339 Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-18 13:57:57 +05:30
Mayukha Vadari
c326a80abd re-remove debug lines 2025-11-17 18:16:14 +05:30
Mayukha Vadari
efa2a1b4e7 simplify tests 2025-11-17 18:13:13 +05:30
Mayukha Vadari
8852594a7b fix test 2025-11-17 18:13:03 +05:30
Mayukha Vadari
711d765a80 clean up book_offers 2025-11-17 18:05:01 +05:30
Mayukha Vadari
400cd02325 remove debug lines 2025-11-17 18:01:51 +05:30
Mayukha Vadari
2116ea6eae fix tx_history 2025-11-17 18:01:26 +05:30
Mayukha Vadari
f1f2cc70ab fix get_counts 2025-11-17 17:59:50 +05:30
Mayukha Vadari
9e23d50339 fix connect 2025-11-17 17:58:57 +05:30
Mayukha Vadari
fb5d878b86 fix can_delete 2025-11-17 17:58:22 +05:30
Mayukha Vadari
403bfaa636 fix account_tx 2025-11-17 17:48:20 +05:30
Mayukha Vadari
9fb088cb42 remove debug statements 2025-11-17 17:47:20 +05:30
Mayukha Vadari
e66cfab251 fix tests, more cleanup 2025-11-17 17:20:13 +05:30
Mayukha Vadari
17e4d38dde Fix index for iLimit in RPCCall.cpp 2025-11-17 16:11:35 +05:30
1313 changed files with 10509 additions and 24270 deletions

View File

@@ -50,21 +50,20 @@ ForEachMacros: [Q_FOREACH, BOOST_FOREACH]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: "^<(test)/"
Priority: 1
Priority: 0
- Regex: "^<(xrpld)/"
Priority: 2
Priority: 1
- Regex: "^<(xrpl)/"
Priority: 3
Priority: 2
- Regex: "^<(boost)/"
Priority: 4
Priority: 3
- Regex: "^.*/"
Priority: 5
Priority: 4
- Regex: '^.*\.h'
Priority: 6
Priority: 5
- Regex: ".*"
Priority: 7
Priority: 6
IncludeIsMainRegex: "$"
MainIncludeChar: AngleBracket
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false
IndentRequiresClause: true

View File

@@ -10,26 +10,26 @@ Checks: "-*,
bugprone-chained-comparison,
bugprone-compare-pointer-to-member-virtual-function,
bugprone-copy-constructor-init,
bugprone-crtp-constructor-accessibility,
# bugprone-crtp-constructor-accessibility, # has issues
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-empty-catch,
# bugprone-empty-catch, # has issues
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-inaccurate-erase,
bugprone-inc-dec-in-conditions,
bugprone-incorrect-enable-if,
bugprone-incorrect-roundings,
bugprone-infinite-loop,
bugprone-integer-division,
# bugprone-forward-declaration-namespace, # has issues
# bugprone-inaccurate-erase,
# bugprone-inc-dec-in-conditions,
# bugprone-incorrect-enable-if,
# bugprone-incorrect-roundings,
# bugprone-infinite-loop,
# bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
# bugprone-macro-parentheses, # has issues
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multi-level-implicit-pointer-conversion,
# bugprone-multi-level-implicit-pointer-conversion, # has issues
bugprone-multiple-new-in-one-expression,
bugprone-multiple-statement-macro,
bugprone-no-escape,
@@ -39,13 +39,13 @@ Checks: "-*,
bugprone-pointer-arithmetic-on-polymorphic-object,
bugprone-posix-return,
bugprone-redundant-branch-condition,
bugprone-reserved-identifier,
bugprone-return-const-ref-from-parameter,
# bugprone-reserved-identifier, # has issues
# bugprone-return-const-ref-from-parameter, # has issues
bugprone-shared-ptr-array-mismatch,
bugprone-signal-handler,
bugprone-signed-char-misuse,
bugprone-sizeof-container,
bugprone-sizeof-expression,
# bugprone-sizeof-expression, # has issues
bugprone-spuriously-wake-up-functions,
bugprone-standalone-empty,
bugprone-string-constructor,
@@ -62,18 +62,18 @@ Checks: "-*,
bugprone-suspicious-string-compare,
bugprone-suspicious-stringview-data-usage,
bugprone-swapped-arguments,
bugprone-switch-missing-default-case,
# bugprone-switch-missing-default-case, # has issues
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-unchecked-optional-access,
# bugprone-unchecked-optional-access, # see https://github.com/XRPLF/rippled/pull/6502
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-exception-at-new,
bugprone-unhandled-self-assignment,
bugprone-unique-ptr-array-mismatch,
bugprone-unsafe-functions,
bugprone-use-after-move,
# bugprone-use-after-move, # has issues
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-unused-local-non-trivial-variable,
@@ -90,29 +90,15 @@ Checks: "-*,
misc-const-correctness,
misc-definitions-in-headers,
misc-header-include-cycle,
misc-include-cleaner,
misc-misplaced-const,
misc-redundant-expression,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-unused-alias-decls,
misc-unused-using-decls,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-type-traits,
modernize-use-designated-initializers,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-override,
modernize-use-ranges,
modernize-use-starts-ends-with,
modernize-use-std-numbers,
modernize-use-using,
modernize-deprecated-headers,
llvm-namespace-comment,
performance-faster-string-find,
performance-for-range-copy,
@@ -122,38 +108,53 @@ Checks: "-*,
performance-move-constructor-init,
performance-no-automatic-move,
performance-trivially-destructible,
readability-avoid-nested-conditional-operator,
readability-avoid-return-with-void-value,
readability-braces-around-statements,
readability-const-return-type,
readability-container-contains,
readability-container-size-empty,
readability-convert-member-functions-to-static,
# readability-avoid-nested-conditional-operator, # has issues
# readability-avoid-return-with-void-value, # has issues
# readability-braces-around-statements, # has issues
# readability-const-return-type, # has issues
# readability-container-contains, # has issues
# readability-container-size-empty, # has issues
# readability-convert-member-functions-to-static, # has issues
readability-duplicate-include,
readability-else-after-return,
readability-enum-initial-value,
readability-implicit-bool-conversion,
readability-make-member-function-const,
readability-math-missing-parentheses,
# readability-else-after-return, # has issues
# readability-enum-initial-value, # has issues
# readability-implicit-bool-conversion, # has issues
# readability-make-member-function-const, # has issues
# readability-math-missing-parentheses, # has issues
readability-misleading-indentation,
readability-non-const-parameter,
readability-redundant-casting,
readability-redundant-declaration,
readability-redundant-inline-specifier,
readability-redundant-member-init,
# readability-redundant-casting, # has issues
# readability-redundant-declaration, # has issues
# readability-redundant-inline-specifier, # has issues
# readability-redundant-member-init, # has issues
readability-redundant-string-init,
readability-reference-to-constructed-temporary,
readability-simplify-boolean-expr,
readability-static-definition-in-anonymous-namespace,
readability-suspicious-call-argument,
# readability-simplify-boolean-expr, # has issues
# readability-static-definition-in-anonymous-namespace, # has issues
# readability-suspicious-call-argument, # has issues
readability-use-std-min-max
"
# ---
# other checks that have issues that need to be resolved:
#
# misc-include-cleaner,
#
# readability-inconsistent-declaration-parameter-name, # in this codebase this check will break a lot of arg names
# readability-static-accessed-through-instance, # this check is probably unnecessary. it makes the code less readable
# readability-identifier-naming, # https://github.com/XRPLF/rippled/pull/6571
#
# modernize-concat-nested-namespaces,
# modernize-pass-by-value,
# modernize-type-traits,
# modernize-use-designated-initializers,
# modernize-use-emplace,
# modernize-use-equals-default,
# modernize-use-equals-delete,
# modernize-use-override,
# modernize-use-ranges,
# modernize-use-starts-ends-with,
# modernize-use-std-numbers,
# modernize-use-using,
# ---
#
CheckOptions:
@@ -193,7 +194,7 @@ CheckOptions:
# readability-identifier-naming.FunctionIgnoredRegexp: ".*tag_invoke.*"
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
misc-include-cleaner.IgnoreHeaders: ".*/(detail|impl)/.*;.*fwd\\.h(pp)?;time.h;stdlib.h;sqlite3.h;netinet/in\\.h;sys/resource\\.h;sys/sysinfo\\.h;linux/sysinfo\\.h;__chrono/.*;bits/.*;_abort\\.h;boost/uuid/uuid_hash.hpp;boost/beast/core/flat_buffer\\.hpp;boost/beast/http/field\\.hpp;boost/beast/http/dynamic_body\\.hpp;boost/beast/http/message\\.hpp;boost/beast/http/read\\.hpp;boost/beast/http/write\\.hpp;openssl/obj_mac\\.h"
# misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*;.*(expected|unexpected).*;.*ranges_lower_bound\.h;time.h;stdlib.h;__chrono/.*;fmt/chrono.h;boost/uuid/uuid_hash.hpp'
#
HeaderFilterRegex: '^.*/(test|xrpl|xrpld)/.*\.(h|hpp)$'
ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$'

View File

@@ -1,85 +0,0 @@
#!/usr/bin/env python3
"""
Checks that a pull request description has been customized from the
pull_request_template.md. Exits with code 1 if the description is empty
or identical to the template (ignoring HTML comments and whitespace).
Usage:
python check-pr-description.py --template-file TEMPLATE --pr-body-file BODY
"""
import argparse
import re
import sys
from pathlib import Path
def normalize(text: str) -> str:
"""Strip HTML comments, trim lines, and remove blank lines."""
# Remove HTML comments (possibly multi-line)
text = re.sub(r"<!--.*?-->", "", text, flags=re.DOTALL)
# Strip each line and drop empties
lines = [line.strip() for line in text.splitlines()]
lines = [line for line in lines if line]
return "\n".join(lines)
def main() -> int:
parser = argparse.ArgumentParser(
description="Check that a PR description differs from the template."
)
parser.add_argument(
"--template-file",
type=Path,
required=True,
help="Path to the pull request template file.",
)
parser.add_argument(
"--pr-body-file",
type=Path,
required=True,
help="Path to a file containing the PR body text.",
)
args = parser.parse_args()
template_path: Path = args.template_file
pr_body_path: Path = args.pr_body_file
if not template_path.is_file():
print(f"::error::Template file {template_path} not found")
return 1
if not pr_body_path.is_file():
print(f"::error::PR body file {pr_body_path} not found")
return 1
template = template_path.read_text(encoding="utf-8")
pr_body = pr_body_path.read_text(encoding="utf-8")
# Check if the PR body is empty or whitespace-only
if not pr_body.strip():
print(
"::error::PR description is empty. "
"Please fill in the pull request template."
)
return 1
norm_template = normalize(template)
norm_pr_body = normalize(pr_body)
if norm_pr_body == norm_template:
print(
"::error::PR description (ignoring HTML comments) is identical"
" to the template. Please fill in the details of your change."
f"\n\nVisible template content:\n---\n{norm_template}\n---"
f"\n\nVisible PR description content:\n---\n{norm_pr_body}\n---"
)
return 1
print("PR description has been customized from the template.")
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -2,19 +2,19 @@ Loop: test.jtx test.toplevel
test.toplevel > test.jtx
Loop: test.jtx test.unit_test
test.unit_test ~= test.jtx
test.unit_test == test.jtx
Loop: xrpld.app xrpld.overlay
xrpld.app > xrpld.overlay
xrpld.overlay ~= xrpld.app
Loop: xrpld.app xrpld.peerfinder
xrpld.peerfinder ~= xrpld.app
xrpld.peerfinder == xrpld.app
Loop: xrpld.app xrpld.rpc
xrpld.rpc > xrpld.app
Loop: xrpld.app xrpld.shamap
xrpld.shamap > xrpld.app
xrpld.shamap ~= xrpld.app
Loop: xrpld.overlay xrpld.rpc
xrpld.rpc ~= xrpld.overlay

View File

@@ -3,17 +3,13 @@ libxrpl.conditions > xrpl.basics
libxrpl.conditions > xrpl.conditions
libxrpl.core > xrpl.basics
libxrpl.core > xrpl.core
libxrpl.core > xrpl.json
libxrpl.crypto > xrpl.basics
libxrpl.json > xrpl.basics
libxrpl.json > xrpl.json
libxrpl.ledger > xrpl.basics
libxrpl.ledger > xrpl.json
libxrpl.ledger > xrpl.ledger
libxrpl.ledger > xrpl.nodestore
libxrpl.ledger > xrpl.protocol
libxrpl.ledger > xrpl.server
libxrpl.ledger > xrpl.shamap
libxrpl.net > xrpl.basics
libxrpl.net > xrpl.net
libxrpl.nodestore > xrpl.basics
@@ -23,22 +19,19 @@ libxrpl.nodestore > xrpl.protocol
libxrpl.protocol > xrpl.basics
libxrpl.protocol > xrpl.json
libxrpl.protocol > xrpl.protocol
libxrpl.protocol_autogen > xrpl.protocol_autogen
libxrpl.rdb > xrpl.basics
libxrpl.rdb > xrpl.core
libxrpl.rdb > xrpl.rdb
libxrpl.resource > xrpl.basics
libxrpl.resource > xrpl.json
libxrpl.resource > xrpl.protocol
libxrpl.resource > xrpl.resource
libxrpl.server > xrpl.basics
libxrpl.server > xrpl.core
libxrpl.server > xrpl.json
libxrpl.server > xrpl.protocol
libxrpl.server > xrpl.rdb
libxrpl.server > xrpl.resource
libxrpl.server > xrpl.server
libxrpl.shamap > xrpl.basics
libxrpl.shamap > xrpl.nodestore
libxrpl.shamap > xrpl.protocol
libxrpl.shamap > xrpl.shamap
libxrpl.tx > xrpl.basics
@@ -50,11 +43,12 @@ libxrpl.tx > xrpl.protocol
libxrpl.tx > xrpl.server
libxrpl.tx > xrpl.tx
test.app > test.jtx
test.app > test.rpc
test.app > test.toplevel
test.app > test.unit_test
test.app > xrpl.basics
test.app > xrpl.core
test.app > xrpld.app
test.app > xrpld.consensus
test.app > xrpld.core
test.app > xrpld.overlay
test.app > xrpld.rpc
@@ -62,9 +56,9 @@ test.app > xrpl.json
test.app > xrpl.ledger
test.app > xrpl.nodestore
test.app > xrpl.protocol
test.app > xrpl.rdb
test.app > xrpl.resource
test.app > xrpl.server
test.app > xrpl.shamap
test.app > xrpl.tx
test.basics > test.jtx
test.basics > test.unit_test
@@ -77,23 +71,21 @@ test.beast > xrpl.basics
test.conditions > xrpl.basics
test.conditions > xrpl.conditions
test.consensus > test.csf
test.consensus > test.jtx
test.consensus > test.toplevel
test.consensus > test.unit_test
test.consensus > xrpl.basics
test.consensus > xrpld.app
test.consensus > xrpld.consensus
test.consensus > xrpl.json
test.consensus > xrpl.ledger
test.consensus > xrpl.protocol
test.consensus > xrpl.shamap
test.consensus > xrpl.tx
test.core > test.jtx
test.core > test.toplevel
test.core > test.unit_test
test.core > xrpl.basics
test.core > xrpl.core
test.core > xrpld.core
test.core > xrpl.json
test.core > xrpl.protocol
test.core > xrpl.rdb
test.core > xrpl.server
test.csf > xrpl.basics
@@ -116,32 +108,27 @@ test.jtx > xrpl.resource
test.jtx > xrpl.server
test.jtx > xrpl.tx
test.ledger > test.jtx
test.ledger > test.toplevel
test.ledger > xrpl.basics
test.ledger > xrpl.core
test.ledger > xrpld.app
test.ledger > xrpld.core
test.ledger > xrpl.json
test.ledger > xrpl.ledger
test.ledger > xrpl.protocol
test.nodestore > test.jtx
test.nodestore > test.toplevel
test.nodestore > test.unit_test
test.nodestore > xrpl.basics
test.nodestore > xrpld.core
test.nodestore > xrpl.nodestore
test.nodestore > xrpl.protocol
test.nodestore > xrpl.rdb
test.overlay > test.jtx
test.overlay > test.toplevel
test.overlay > test.unit_test
test.overlay > xrpl.basics
test.overlay > xrpld.app
test.overlay > xrpld.core
test.overlay > xrpld.overlay
test.overlay > xrpld.peerfinder
test.overlay > xrpl.json
test.overlay > xrpl.ledger
test.overlay > xrpl.nodestore
test.overlay > xrpl.protocol
test.overlay > xrpl.resource
test.overlay > xrpl.server
test.overlay > xrpl.shamap
test.peerfinder > test.beast
test.peerfinder > test.unit_test
@@ -149,7 +136,7 @@ test.peerfinder > xrpl.basics
test.peerfinder > xrpld.core
test.peerfinder > xrpld.peerfinder
test.peerfinder > xrpl.protocol
test.protocol > test.jtx
test.protocol > test.toplevel
test.protocol > test.unit_test
test.protocol > xrpl.basics
test.protocol > xrpl.json
@@ -158,6 +145,7 @@ test.resource > test.unit_test
test.resource > xrpl.basics
test.resource > xrpl.resource
test.rpc > test.jtx
test.rpc > test.toplevel
test.rpc > xrpl.basics
test.rpc > xrpl.core
test.rpc > xrpld.app
@@ -171,12 +159,13 @@ test.rpc > xrpl.resource
test.rpc > xrpl.server
test.rpc > xrpl.tx
test.server > test.jtx
test.server > test.toplevel
test.server > test.unit_test
test.server > xrpl.basics
test.server > xrpld.app
test.server > xrpld.core
test.server > xrpld.rpc
test.server > xrpl.json
test.server > xrpl.protocol
test.server > xrpl.server
test.shamap > test.unit_test
test.shamap > xrpl.basics
@@ -250,20 +239,19 @@ xrpld.consensus > xrpl.ledger
xrpld.consensus > xrpl.protocol
xrpld.core > xrpl.basics
xrpld.core > xrpl.core
xrpld.core > xrpl.json
xrpld.core > xrpl.net
xrpld.core > xrpl.protocol
xrpld.core > xrpl.rdb
xrpld.overlay > xrpl.basics
xrpld.overlay > xrpl.core
xrpld.overlay > xrpld.consensus
xrpld.overlay > xrpld.core
xrpld.overlay > xrpld.peerfinder
xrpld.overlay > xrpl.json
xrpld.overlay > xrpl.ledger
xrpld.overlay > xrpl.protocol
xrpld.overlay > xrpl.rdb
xrpld.overlay > xrpl.resource
xrpld.overlay > xrpl.server
xrpld.overlay > xrpl.shamap
xrpld.overlay > xrpl.tx
xrpld.peerfinder > xrpl.basics
xrpld.peerfinder > xrpld.core
@@ -273,7 +261,6 @@ xrpld.perflog > xrpl.basics
xrpld.perflog > xrpl.core
xrpld.perflog > xrpld.rpc
xrpld.perflog > xrpl.json
xrpld.perflog > xrpl.protocol
xrpld.rpc > xrpl.basics
xrpld.rpc > xrpl.core
xrpld.rpc > xrpld.core
@@ -285,9 +272,5 @@ xrpld.rpc > xrpl.protocol
xrpld.rpc > xrpl.rdb
xrpld.rpc > xrpl.resource
xrpld.rpc > xrpl.server
xrpld.rpc > xrpl.shamap
xrpld.rpc > xrpl.tx
xrpld.shamap > xrpl.basics
xrpld.shamap > xrpld.core
xrpld.shamap > xrpl.protocol
xrpld.shamap > xrpl.shamap

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script changes the binary name from `rippled` to `xrpld`, and reverses

View File

@@ -8,16 +8,16 @@ set -e
SED_COMMAND=sed
HEAD_COMMAND=head
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v ghead &> /dev/null; then
echo "Error: ghead is not installed. Please install it using 'brew install coreutils'."
exit 1
fi
HEAD_COMMAND=ghead
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v ghead &> /dev/null; then
echo "Error: ghead is not installed. Please install it using 'brew install coreutils'."
exit 1
fi
HEAD_COMMAND=ghead
fi
# This script renames CMake files from `RippleXXX.cmake` or `RippledXXX.cmake`
@@ -44,10 +44,10 @@ pushd "${DIRECTORY}"
find cmake -type f -name 'Rippled*.cmake' -exec bash -c 'mv "${1}" "${1/Rippled/Xrpl}"' - {} \;
find cmake -type f -name 'Ripple*.cmake' -exec bash -c 'mv "${1}" "${1/Ripple/Xrpl}"' - {} \;
if [ -e cmake/xrpl_add_test.cmake ]; then
mv cmake/xrpl_add_test.cmake cmake/XrplAddTest.cmake
mv cmake/xrpl_add_test.cmake cmake/XrplAddTest.cmake
fi
if [ -e include/xrpl/proto/ripple.proto ]; then
mv include/xrpl/proto/ripple.proto include/xrpl/proto/xrpl.proto
mv include/xrpl/proto/ripple.proto include/xrpl/proto/xrpl.proto
fi
# Rename inside the files.
@@ -71,14 +71,14 @@ ${SED_COMMAND} -i 's@xrpl/validator-keys-tool@ripple/validator-keys-tool@' cmake
# Ensure the name of the binary and config remain 'rippled' for now.
${SED_COMMAND} -i -E 's/xrpld(-example)?\.cfg/rippled\1.cfg/g' cmake/XrplInstall.cmake
if grep -q '"xrpld"' cmake/XrplCore.cmake; then
# The script has been rerun, so just restore the name of the binary.
${SED_COMMAND} -i 's/"xrpld"/"rippled"/' cmake/XrplCore.cmake
# The script has been rerun, so just restore the name of the binary.
${SED_COMMAND} -i 's/"xrpld"/"rippled"/' cmake/XrplCore.cmake
elif ! grep -q '"rippled"' cmake/XrplCore.cmake; then
${HEAD_COMMAND} -n -1 cmake/XrplCore.cmake > cmake.tmp
echo ' # For the time being, we will keep the name of the binary as it was.' >> cmake.tmp
echo ' set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")' >> cmake.tmp
tail -1 cmake/XrplCore.cmake >> cmake.tmp
mv cmake.tmp cmake/XrplCore.cmake
${HEAD_COMMAND} -n -1 cmake/XrplCore.cmake > cmake.tmp
echo ' # For the time being, we will keep the name of the binary as it was.' >> cmake.tmp
echo ' set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")' >> cmake.tmp
tail -1 cmake/XrplCore.cmake >> cmake.tmp
mv cmake.tmp cmake/XrplCore.cmake
fi
# Restore the symlink from 'xrpld' to 'rippled'.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the config from `rippled.cfg` to `xrpld.cfg`, and updates
@@ -32,28 +32,28 @@ pushd "${DIRECTORY}"
# Add the xrpld.cfg to the .gitignore.
if ! grep -q 'xrpld.cfg' .gitignore; then
${SED_COMMAND} -i '/rippled.cfg/a\
${SED_COMMAND} -i '/rippled.cfg/a\
/xrpld.cfg' .gitignore
fi
# Rename the files.
if [ -e rippled.cfg ]; then
mv rippled.cfg xrpld.cfg
mv rippled.cfg xrpld.cfg
fi
if [ -e cfg/rippled-example.cfg ]; then
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
fi
# Rename inside the files.
DIRECTORIES=("cfg" "cmake" "include" "src")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' "${FILE}"
done
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' "${FILE}"
done
done
${SED_COMMAND} -i 's/rippled/xrpld/g' cfg/xrpld-example.cfg
${SED_COMMAND} -i 's/rippled/xrpld/g' src/test/core/Config_test.cpp

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script removes superfluous copyright notices in source and header files
@@ -43,56 +43,56 @@ ${SED_COMMAND} -i -E "s@\\\t@${PLACEHOLDER_TAB}@g" src/test/rpc/ValidatorInfo_te
# Process the include/ and src/ directories.
DIRECTORIES=("include" "src")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
# Handle the cases where the copyright notice is enclosed in /* ... */
# and usually surrounded by //---- and //======.
${SED_COMMAND} -z -i -E 's@^//-------+\n+@@' "${FILE}"
${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" # cspell: ignore Bougalis Falco Hinnant Ritchford
${SED_COMMAND} -z -i -E 's@^//=======+\n+@@' "${FILE}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
# Handle the cases where the copyright notice is enclosed in /* ... */
# and usually surrounded by //---- and //======.
${SED_COMMAND} -z -i -E 's@^//-------+\n+@@' "${FILE}"
${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" # cspell: ignore Bougalis Falco Hinnant Ritchford
${SED_COMMAND} -z -i -E 's@^//=======+\n+@@' "${FILE}"
# Handle the cases where the copyright notice is commented out with //.
${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" # cspell: ignore Vinnie Falco
done
# Handle the cases where the copyright notice is commented out with //.
${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" # cspell: ignore Vinnie Falco
done
done
# Restore copyright notices that were removed from specific files, without
# restoring the verbiage that is already present in LICENSE.md. Ensure that if
# the script is run multiple times, duplicate notices are not added.
if ! grep -q 'Raw Material Software' include/xrpl/beast/core/CurrentThreadName.h; then
echo -e "// Portions of this file are from JUCE (http://www.juce.com).\n// Copyright (c) 2013 - Raw Material Software Ltd.\n// Please visit http://www.juce.com\n\n$(cat include/xrpl/beast/core/CurrentThreadName.h)" > include/xrpl/beast/core/CurrentThreadName.h
echo -e "// Portions of this file are from JUCE (http://www.juce.com).\n// Copyright (c) 2013 - Raw Material Software Ltd.\n// Please visit http://www.juce.com\n\n$(cat include/xrpl/beast/core/CurrentThreadName.h)" > include/xrpl/beast/core/CurrentThreadName.h
fi
if ! grep -q 'Dev Null' src/test/app/NetworkID_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/NetworkID_test.cpp)" > src/test/app/NetworkID_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/NetworkID_test.cpp)" > src/test/app/NetworkID_test.cpp
fi
if ! grep -q 'Dev Null' src/test/app/tx/apply_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp
fi
if ! grep -q 'Dev Null' src/test/rpc/ManifestRPC_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp
fi
if ! grep -q 'Dev Null' src/test/rpc/ValidatorInfo_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ValidatorInfo_test.cpp)" > src/test/rpc/ValidatorInfo_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ValidatorInfo_test.cpp)" > src/test/rpc/ValidatorInfo_test.cpp
fi
if ! grep -q 'Dev Null' src/xrpld/rpc/handlers/server_info/Manifest.cpp; then
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/server_info/Manifest.cpp)" > src/xrpld/rpc/handlers/server_info/Manifest.cpp
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/server_info/Manifest.cpp)" > src/xrpld/rpc/handlers/server_info/Manifest.cpp
fi
if ! grep -q 'Dev Null' src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp; then
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp)" > src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp)" > src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp
fi
if ! grep -q 'Bougalis' include/xrpl/basics/SlabAllocator.h; then
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Bougalis' include/xrpl/basics/spinlock.h; then
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Bougalis' include/xrpl/basics/tagged_integer.h; then
echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Ritchford' include/xrpl/beast/utility/Zero.h; then
echo -e "// Copyright (c) 2014, Tom Ritchford <tom@swirly.com>\n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h # cspell: ignore Ritchford
echo -e "// Copyright (c) 2014, Tom Ritchford <tom@swirly.com>\n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h # cspell: ignore Ritchford
fi
# Restore newlines and tabs in string literals in the affected file.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames definitions, such as include guards, in this project.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames all remaining references to `ripple` and `rippled` to

View File

@@ -23,8 +23,8 @@ fi
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
if grep -q "#ifndef XRPL_" "${FILE}"; then
echo "Please replace all include guards by #pragma once."
exit 1
echo "Please replace all include guards by #pragma once."
exit 1
fi
done
echo "Checking complete."

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the `ripple` namespace to `xrpl` in this project.
@@ -35,15 +35,15 @@ pushd "${DIRECTORY}"
DIRECTORIES=("include" "src" "tests")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
${SED_COMMAND} -i 's/"ripple:/"xrpl::/g' "${FILE}"
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
done
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
${SED_COMMAND} -i 's/"ripple:/"xrpl::/g' "${FILE}"
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
done
done
# Special case for NuDBFactory that has ripple twice in the test suite name.

View File

@@ -1,30 +0,0 @@
name: Check PR description
on:
merge_group:
types:
- checks_requested
pull_request:
types: [opened, edited, reopened, synchronize, ready_for_review]
branches: [develop]
jobs:
check_description:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Write PR body to file
env:
PR_BODY: ${{ github.event.pull_request.body }}
if: ${{ github.event_name == 'pull_request' }}
run: printenv PR_BODY > pr_body.md
- name: Check PR description differs from template
if: ${{ github.event_name == 'pull_request' }}
run: >
python .github/scripts/check-pr-description.py
--template-file .github/pull_request_template.md
--pr-body-file pr_body.md

View File

@@ -46,7 +46,7 @@ jobs:
# that Github considers any skipped jobs to have passed, and in
# turn the required checks as well.
id: changes
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: |
# These paths are unique to `on-pr.yml`.

View File

@@ -82,7 +82,7 @@ jobs:
- name: Create documentation artifact
if: ${{ github.event.repository.visibility == 'public' && github.event_name == 'push' }}
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: ${{ env.BUILD_DIR }}/docs/html

View File

@@ -153,32 +153,6 @@ jobs:
${CMAKE_ARGS} \
..
- name: Check protocol autogen files are up-to-date
working-directory: ${{ env.BUILD_DIR }}
env:
MESSAGE: |
The generated protocol wrapper classes are out of date.
This typically happens when the macro files or generator scripts
have changed but the generated files were not regenerated.
To fix this:
1. Run: cmake --build . --target setup_code_gen
2. Run: cmake --build . --target code_gen
3. Commit and push the regenerated files
run: |
set -e
cmake --build . --target setup_code_gen
cmake --build . --target code_gen
DIFF=$(git -C .. status --porcelain -- include/xrpl/protocol_autogen src/tests/libxrpl/protocol_autogen)
if [ -n "${DIFF}" ]; then
echo "::error::Generated protocol files are out of date"
git -C .. diff -- include/xrpl/protocol_autogen src/tests/libxrpl/protocol_autogen
echo "${MESSAGE}"
exit 1
fi
- name: Build the binary
working-directory: ${{ env.BUILD_DIR }}
env:
@@ -192,6 +166,29 @@ jobs:
--parallel "${BUILD_NPROC}" \
--target "${CMAKE_TARGET}"
- name: Check protocol autogen files are up-to-date
env:
MESSAGE: |
The generated protocol wrapper classes are out of date.
This typically happens when your branch is behind develop and
the macro files or generator scripts have changed.
To fix this:
1. Update your branch from develop (merge or rebase)
2. Build with code generation enabled (XRPL_NO_CODEGEN=OFF)
3. Commit and push the regenerated files
run: |
set -e
DIFF=$(git status --porcelain -- include/xrpl/protocol_autogen src/tests/libxrpl/protocol_autogen)
if [ -n "${DIFF}" ]; then
echo "::error::Generated protocol files are out of date"
git diff -- include/xrpl/protocol_autogen src/tests/libxrpl/protocol_autogen
echo "${MESSAGE}"
exit 1
fi
- name: Show ccache statistics
if: ${{ inputs.ccache_enabled }}
run: |
@@ -203,29 +200,13 @@ jobs:
- name: Upload the binary (Linux)
if: ${{ github.event.repository.visibility == 'public' && runner.os == 'Linux' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: xrpld-${{ inputs.config_name }}
path: ${{ env.BUILD_DIR }}/xrpld
retention-days: 3
if-no-files-found: error
- name: Export server definitions
if: ${{ runner.os != 'Windows' && !inputs.build_only && env.VOIDSTAR_ENABLED != 'true' }}
working-directory: ${{ env.BUILD_DIR }}
run: |
set -o pipefail
./xrpld --definitions | python3 -m json.tool > server_definitions.json
- name: Upload server definitions
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'debian-bookworm-gcc-13-amd64-release' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: server-definitions
path: ${{ env.BUILD_DIR }}/server_definitions.json
retention-days: 3
if-no-files-found: error
- name: Check linking (Linux)
if: ${{ runner.os == 'Linux' && env.SANITIZERS_ENABLED == 'false' }}
working-directory: ${{ env.BUILD_DIR }}

View File

@@ -80,31 +80,18 @@ jobs:
env:
TARGETS: ${{ inputs.files != '' && inputs.files || 'src tests' }}
run: |
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -allow-no-checks ${TARGETS} 2>&1 | tee clang-tidy-output.txt
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -allow-no-checks ${TARGETS} 2>&1 | tee clang-tidy-output.txt
- name: Upload clang-tidy output
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: clang-tidy-results
path: clang-tidy-output.txt
retention-days: 30
- name: Generate git diff
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
run: |
git diff | tee clang-tidy-git-diff.txt
- name: Upload clang-tidy diff output
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: clang-tidy-git-diff
path: clang-tidy-git-diff.txt
retention-days: 30
- name: Create an issue
if: ${{ steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure }}
if: steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure
id: create_issue
shell: bash
env:
@@ -169,7 +156,7 @@ jobs:
rm -f create_issue.log issue.md clang-tidy-output.txt
- name: Fail the workflow if clang-tidy failed
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
if: steps.run_clang_tidy.outcome != 'success'
run: |
echo "Clang-tidy check failed!"
exit 1

View File

@@ -31,7 +31,7 @@ jobs:
- name: Get changed C++ files
id: changed_files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: |
**/*.cpp
@@ -41,7 +41,7 @@ jobs:
- name: Get changed clang-tidy configuration
id: changed_clang_tidy
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: |
.clang-tidy

1
.gitignore vendored
View File

@@ -13,7 +13,6 @@
Debug/
Release/
/.build/
/.venv/
/build/
/db/
/out.txt

View File

@@ -17,25 +17,10 @@ repos:
args: [--maxkb=400, --enforce-all]
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-merge-conflict
args: [--assume-in-merge]
- repo: local
hooks:
- id: clang-tidy
name: "clang-tidy (enable with: TIDY=1)"
entry: ./bin/pre-commit/clang_tidy_check.py
language: python
types_or: [c++, c]
exclude: ^include/xrpl/protocol_autogen
pass_filenames: false # script determines the staged files itself
- id: fix-include-style
name: fix include style
entry: ./bin/pre-commit/fix_include_style.py
language: python
types_or: [c++, c]
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_entries)/
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: cd481d7b0bfb5c7b3090c21846317f9a8262e891 # frozen: v22.1.0
hooks:
@@ -53,19 +38,12 @@ repos:
rev: c2bc67fe8f8f549cc489e00ba8b45aa18ee713b1 # frozen: v3.8.1
hooks:
- id: prettier
args: [--end-of-line=auto]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: ea488cebbfd88a5f50b8bd95d5c829d0bb76feb8 # frozen: 26.1.0
hooks:
- id: black
- repo: https://github.com/openstack/bashate
rev: 5798d24d571676fc407e81df574c1ef57b520f23 # frozen: 2.1.1
hooks:
- id: bashate
args: ["--ignore=E006"]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: a42085ade523f591dca134379a595e7859986445 # frozen: v9.7.0
hooks:

View File

@@ -26,6 +26,10 @@ This version is supported by all `xrpld` versions. For WebSocket and HTTP JSON-R
This section contains changes targeting a future version.
### Breaking Changes
- `book_offers`: the `proof` parameter has been removed from the CLI interface and is no longer processed by the server. For HTTP and WebSocket API requests, `proof` is still accepted and ignored if present, so this is not a breaking change.
### Additions
- `server_definitions`: Added the following new sections to the response ([#6321](https://github.com/XRPLF/rippled/pull/6321)):

View File

@@ -459,21 +459,6 @@ install ccache --version 4.11.3 --allow-downgrade`.
The location of `xrpld` binary in your build directory depends on your
CMake generator. Pass `--help` to see the rest of the command line options.
## Code generation
The protocol wrapper classes in `include/xrpl/protocol_autogen/` are generated
from macro definition files in `include/xrpl/protocol/detail/`. If you modify
the macro files (e.g. `transactions.macro`, `ledger_entries.macro`) or the
generation scripts/templates in `cmake/scripts/codegen/`, you need to regenerate the
files:
```
cmake --build . --target setup_code_gen # create venv and install dependencies (once)
cmake --build . --target code_gen # regenerate code
```
The regenerated files should be committed alongside your changes.
## Coverage report
The coverage report is intended for developers using compilers GCC

View File

@@ -132,7 +132,6 @@ if(coverage)
endif()
include(XrplCore)
include(XrplProtocolAutogen)
include(XrplInstall)
include(XrplValidatorKeys)

View File

@@ -267,26 +267,6 @@ See the [environment setup guide](./docs/build/environment.md#clang-tidy) for pl
Before running clang-tidy, you must build the project to generate required files (particularly protobuf headers). Refer to [`BUILD.md`](./BUILD.md) for build instructions.
#### Via pre-commit (recommended)
If you have already installed the pre-commit hooks (see above), you can run clang-tidy on your staged files using:
```
TIDY=1 pre-commit run clang-tidy
```
This runs clang-tidy locally with the same configuration/flags as CI, scoped to your staged C++ files. The `TIDY=1` environment variable is required to opt in — without it the hook is skipped.
You can also have clang-tidy run automatically on every `git commit` by setting `TIDY=1` in your shell environment:
```
export TIDY=1
```
With this set, the hook will run as part of `git commit` alongside the other pre-commit checks.
#### Manually
Then run clang-tidy on your local changes:
```

View File

@@ -22,10 +22,117 @@ Responsible investigation includes, but isn't limited to, the following:
- Not targeting physical security measures, or attempting to use social engineering, spam, distributed denial of service (DDOS) attacks, etc.
- Investigating bugs in a way that makes a reasonable, good faith effort not to be disruptive or harmful to the XRP Ledger and the broader ecosystem.
### Responsible Disclosure
If you discover a vulnerability or potential threat, or if you _think_
you have, please reach out by dropping an email using the contact
information below.
Your report should include the following:
- Your contact information (typically, an email address);
- The description of the vulnerability;
- The attack scenario (if any);
- The steps to reproduce the vulnerability;
- Any other relevant details or artifacts, including code, scripts or patches.
In your email, please describe the issue or potential threat. If possible, include a "repro" (code that can reproduce the issue) or describe the best way to reproduce and replicate the issue. Please make your report as detailed and comprehensive as possible.
For more information on responsible disclosure, please read this [Wikipedia article](https://en.wikipedia.org/wiki/Responsible_disclosure).
## Report Handling Process
Please report the bug directly to us and limit further disclosure. If you want to prove that you knew the bug as of a given time, consider using a cryptographic pre-commitment: hash the content of your report and publish the hash on a medium of your choice (e.g. on Twitter or as a memo in a transaction) as "proof" that you had written the text at a given point in time.
Once we receive a report, we:
1. Assign two people to independently evaluate the report;
2. Consider their recommendations;
3. If action is necessary, formulate a plan to address the issue;
4. Communicate privately with the reporter to explain our plan.
5. Prepare, test and release a version which fixes the issue; and
6. Announce the vulnerability publicly.
We will triage and respond to your disclosure within 24 hours. Beyond that, we will work to analyze the issue in more detail, formulate, develop and test a fix.
While we commit to responding with 24 hours of your initial report with our triage assessment, we cannot guarantee a response time for the remaining steps. We will communicate with you throughout this process, letting you know where we are and keeping you updated on the timeframe.
## Bug Bounty Program
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`xrpld`](https://github.com/XRPLF/rippled) (and other related projects, like [`Clio`](https://github.com/XRPLF/clio), [`xrpl.js`](https://github.com/XRPLF/xrpl.js), [`xrpl-py`](https://github.com/XRPLF/xrpl-py), [`xrpl4j`](https://github.com/XRPLF/xrpl4j)).
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`xrpld`](https://github.com/XRPLF/rippled) (and other related projects, like [`xrpl.js`](https://github.com/XRPLF/xrpl.js), [`xrpl-py`](https://github.com/XRPLF/xrpl-py), [`xrpl4j`](https://github.com/XRPLF/xrpl4j)).
This program allows us to recognize and reward individuals or groups that identify and report bugs.
This program allows us to recognize and reward individuals or groups that identify and report bugs. In summary, in order to qualify for a bounty, the bug must be:
We have partnered with Bugcrowd to manage this program. It is a private program, and security researchers can participate based on invitation. If you need access to the program, please email bugs@ripple.com with your Bugcrowd handle or Bugcrowd registered email, and we will get you added to the program. Once you have been added, please submit vulnerability reports through Bugcrowd, not by email. The detailed bug bounty policy is available on the Bugcrowd website.
1. **In scope**. Only bugs in software under the scope of the program qualify. Currently, that means `xrpld`, `xrpl.js`, `xrpl-py`, `xrpl4j`.
2. **Relevant**. A security issue, posing a danger to user funds, privacy, or the operation of the XRP Ledger.
3. **Original and previously unknown**. Bugs that are already known and discussed in public do not qualify. Previously reported bugs, even if publicly unknown, are not eligible.
4. **Specific**. We welcome general security advice or recommendations, but we cannot pay bounties for that.
5. **Fixable**. There has to be something we can do to permanently fix the problem. Note that bugs in other peoples software may still qualify in some cases. For example, if you find a bug in a library that we use which can compromise the security of software that is in scope and we can get it fixed, you may qualify for a bounty.
6. **Unused**. If you use the exploit to attack the XRP Ledger, you do not qualify for a bounty. If you report a vulnerability used in an ongoing or past attack and there is specific, concrete evidence that suggests you are the attacker we reserve the right not to pay a bounty.
The amount paid varies dramatically. Vulnerabilities that are harmless on their own, but could form part of a critical exploit will usually receive a bounty. Full-blown exploits can receive much higher bounties. Please dont hold back partial vulnerabilities while trying to construct a full-blown exploit. We will pay a bounty to anyone who reports a complete chain of vulnerabilities even if they have reported each component of the exploit separately and those vulnerabilities have been fixed in the meantime. However, to qualify for a the full bounty, you must to have been the first to report each of the partial exploits.
### Contacting Us
To report a qualifying bug, please send a detailed report to:
| Email Address | bugs@ripple.com |
| :-----------: | :-------------------------------------------------- |
| Short Key ID | `0xA9F514E0` |
| Long Key ID | `0xD900855AA9F514E0` |
| Fingerprint | `B72C 0654 2F2A E250 2763 A268 D900 855A A9F5 14E0` |
The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is:
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGkSZAQBEACprU199OhgdsOsygNjiQV4msuN3vDOUooehL+NwfsGfW79Tbqq
Q2u7uQ3NZjW+M2T4nsDwuhkr7pe7xSReR5W8ssaczvtUyxkvbMClilcgZ2OSCAuC
N9tzJsqOqkwBvXoNXkn//T2jnPz0ZU2wSF+NrEibq5FeuyGdoX3yXXBxq9pW9HzK
HkQll63QSl6BzVSGRQq+B6lGgaZGLwf3mzmIND9Z5VGLNK2jKynyz9z091whNG/M
kV+E7/r/bujHk7WIVId07G5/COTXmSr7kFnNEkd2Umw42dkgfiNKvlmJ9M7c1wLK
KbL9Eb4ADuW6rRc5k4s1e6GT8R4/VPliWbCl9SE32hXH8uTkqVIFZP2eyM5WRRHs
aKzitkQG9UK9gcb0kdgUkxOvvgPHAe5IuZlcHFzU4y0dBbU1VEFWVpiLU0q+IuNw
5BRemeHc59YNsngkmAZ+/9zouoShRusZmC8Wzotv75C2qVBcjijPvmjWAUz0Zunm
Lsr+O71vqHE73pERjD07wuD/ISjiYRYYE/bVrXtXLZijC7qAH4RE3nID+2ojcZyO
/2jMQvt7un56RsGH4UBHi3aBHi9bUoDGCXKiQY981cEuNaOxpou7Mh3x/ONzzSvk
sTV6nl1LOZHykN1JyKwaNbTSAiuyoN+7lOBqbV04DNYAHL88PrT21P83aQARAQAB
tB1SaXBwbGUgTGFicyA8YnVnc0ByaXBwbGUuY29tPokCTgQTAQgAOBYhBLcsBlQv
KuJQJ2OiaNkAhVqp9RTgBQJpEmQEAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
AAoJENkAhVqp9RTgBzgP/i7y+aDWl1maig1XMdyb+o0UGusumFSW4Hmj278wlKVv
usgLPihYgHE0PKrv6WRyKOMC1tQEcYYN93M+OeQ1vFhS2YyURq6RCMmh4zq/awXG
uZbG36OURB5NH8lGBOHiN/7O+nY0CgenBT2JWm+GW3nEOAVOVm4+r5GlpPlv+Dp1
NPBThcKXFMnH73++NpSQoDzTfRYHPxhDAX3jkLi/moXfSanOLlR6l94XNNN0jBHW
Quao0rzf4WSXq9g6AS224xhAA5JyIcFl8TX7hzj5HaFn3VWo3COoDu4U7H+BM0fl
85yqiMQypp7EhN2gxpMMWaHY5TFM85U/bFXFYfEgihZ4/gt4uoIzsNI9jlX7mYvG
KFdDij+oTlRsuOxdIy60B3dKcwOH9nZZCz0SPsN/zlRWgKzK4gDKdGhFkU9OlvPu
94ZqscanoiWKDoZkF96+sjgfjkuHsDK7Lwc1Xi+T4drHG/3aVpkYabXox+lrKB/S
yxZjeqOIQzWPhnLgCaLyvsKo5hxKzL0w3eURu8F3IS7RgOOlljv4M+Me9sEVcdNV
aN3/tQwbaomSX1X5D5YXqhBwC3rU3wXwamsscRTGEpkV+JCX6KUqGP7nWmxCpAly
FL05XuOd5SVHJjXLeuje0JqLUpN514uL+bThWwDbDTdAdwW3oK/2WbXz7IfJRLBj
uQINBGkSZAQBEADdI3SL2F72qkrgFqXWE6HSRBu9bsAvTE5QrRPWk7ux6at537r4
S4sIw2dOwLvbyIrDgKNq3LQ5wCK88NO/NeCOFm4AiCJSl3pJHXYnTDoUxTrrxx+o
vSRI4I3fHEql/MqzgiAb0YUezjgFdh3vYheMPp/309PFbOLhiFqEcx80Mx5h06UH
gDzu1qNj3Ec+31NLic5zwkrAkvFvD54d6bqYR3SEgMau6aYEewpGHbWBi2pLqSi2
lQcAeOFixqGpTwDmAnYR8YtjBYepy0MojEAdTHcQQlOYSDk4q4elG+io2N8vECfU
rD6ORecN48GXdZINYWTAdslrUeanmBdgQrYkSpce8TSghgT9P01SNaXxmyaehVUO
lqI4pcg5G2oojAE8ncNS3TwDtt7daTaTC3bAdr4PXDVAzNAiewjMNZPB7xidkDGQ
Y4W1LxTMXyJVWxehYOH7tsbBRKninlfRnLgYzmtIbNRAAvNcsxU6ihv3AV0WFknN
YbSzotEv1Xq/5wk309x8zCDe+sP0cQicvbXafXmUzPAZzeqFg+VLFn7F9MP1WGlW
B1u7VIvBF1Mp9Nd3EAGBAoLRdRu+0dVWIjPTQuPIuD9cCatJA0wVaKUrjYbBMl88
a12LixNVGeSFS9N7ADHx0/o7GNT6l88YbaLP6zggUHpUD/bR+cDN7vllIQARAQAB
iQI2BBgBCAAgFiEEtywGVC8q4lAnY6Jo2QCFWqn1FOAFAmkSZAQCGwwACgkQ2QCF
Wqn1FOAfAA/8CYq4p0p4bobY20CKEMsZrkBTFJyPDqzFwMeTjgpzqbD7Y3Qq5QCK
OBbvY02GWdiIsNOzKdBxiuam2xYP9WHZj4y7/uWEvT0qlPVmDFu+HXjoJ43oxwFd
CUp2gMuQ4cSL3X94VRJ3BkVL+tgBm8CNY0vnTLLOO3kum/R69VsGJS1JSGUWjNM+
4qwS3mz+73xJu1HmERyN2RZF/DGIZI2PyONQQ6aH85G1Dd2ohu2/DBAkQAMBrPbj
FrbDaBLyFhODxU3kTWqnfLlaElSm2EGdIU2yx7n4BggEa//NZRMm5kyeo4vzhtlQ
YIVUMLAOLZvnEqDnsLKp+22FzNR/O+htBQC4lPywl53oYSALdhz1IQlcAC1ru5KR
XPzhIXV6IIzkcx9xNkEclZxmsuy5ERXyKEmLbIHAlzFmnrldlt2ZgXDtzaorLmxj
klKibxd5tF50qOpOivz+oPtFo7n+HmFa1nlVAMxlDCUdM0pEVeYDKI5zfVwalyhZ
NnjpakdZSXMwgc7NP/hH9buF35hKDp7EckT2y3JNYwHsDdy1icXN2q40XZw5tSIn
zkPWdu3OUY8PISohN6Pw4h0RH4ZmoX97E8sEfmdKaT58U4Hf2aAv5r9IWCSrAVqY
u5jvac29CzQR9Kal0A+8phHAXHNFD83SwzIC0syaT9ficAguwGH8X6Q=
=nGuD
-----END PGP PUBLIC KEY BLOCK-----
```

View File

@@ -1,13 +1,14 @@
#!/bin/bash
if [[ $# -ne 1 || "$1" == "--help" || "$1" == "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name <username>
if [[ $# -ne 1 || "$1" == "--help" || "$1" == "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name <username>
Where <username> is the Github username of the upstream repo. e.g. XRPLF
Where <username> is the Github username of the upstream repo. e.g. XRPLF
USAGE
exit 0
exit 0
fi
# Create upstream remotes based on origin
@@ -15,9 +16,10 @@ shift
user="$1"
# Get the origin URL. Expect it be an SSH-style URL
origin=$( git remote get-url origin )
if [[ "${origin}" == "" ]]; then
echo Invalid origin remote >&2
exit 1
if [[ "${origin}" == "" ]]
then
echo Invalid origin remote >&2
exit 1
fi
# echo "Origin: ${origin}"
# Parse the origin
@@ -28,9 +30,11 @@ IFS='@' read sshuser server <<< "${remote}"
# echo "SSHUser: ${sshuser}, Server: ${server}"
IFS='/' read originuser repo <<< "${originpath}"
# echo "Originuser: ${originuser}, Repo: ${repo}"
if [[ "${sshuser}" == "" || "${server}" == "" || "${originuser}" == "" || "${repo}" == "" ]]; then
echo "Can't parse origin URL: ${origin}" >&2
exit 1
if [[ "${sshuser}" == "" || "${server}" == "" || "${originuser}" == ""
|| "${repo}" == "" ]]
then
echo "Can't parse origin URL: ${origin}" >&2
exit 1
fi
upstream="https://${server}/${user}/${repo}"
upstreampush="${remote}:${user}/${repo}"
@@ -38,34 +42,42 @@ upstreamgroup="upstream upstream-push"
current=$( git remote get-url upstream 2>/dev/null )
currentpush=$( git remote get-url upstream-push 2>/dev/null )
currentgroup=$( git config remotes.upstreams )
if [[ "${current}" == "${upstream}" ]]; then
echo "Upstream already set up correctly. Skip"
elif [[ -n "${current}" && "${current}" != "${upstream}" && "${current}" != "${upstreampush}" ]]; then
echo "Upstream already set up as: ${current}. Skip"
if [[ "${current}" == "${upstream}" ]]
then
echo "Upstream already set up correctly. Skip"
elif [[ -n "${current}" && "${current}" != "${upstream}" &&
"${current}" != "${upstreampush}" ]]
then
echo "Upstream already set up as: ${current}. Skip"
else
if [[ "${current}" == "${upstreampush}" ]]; then
echo "Upstream set to dangerous push URL. Update."
_run git remote rename upstream upstream-push || \
_run git remote remove upstream
currentpush=$( git remote get-url upstream-push 2>/dev/null )
fi
_run git remote add upstream "${upstream}"
if [[ "${current}" == "${upstreampush}" ]]
then
echo "Upstream set to dangerous push URL. Update."
_run git remote rename upstream upstream-push || \
_run git remote remove upstream
currentpush=$( git remote get-url upstream-push 2>/dev/null )
fi
_run git remote add upstream "${upstream}"
fi
if [[ "${currentpush}" == "${upstreampush}" ]]; then
echo "upstream-push already set up correctly. Skip"
elif [[ -n "${currentpush}" && "${currentpush}" != "${upstreampush}" ]]; then
echo "upstream-push already set up as: ${currentpush}. Skip"
if [[ "${currentpush}" == "${upstreampush}" ]]
then
echo "upstream-push already set up correctly. Skip"
elif [[ -n "${currentpush}" && "${currentpush}" != "${upstreampush}" ]]
then
echo "upstream-push already set up as: ${currentpush}. Skip"
else
_run git remote add upstream-push "${upstreampush}"
_run git remote add upstream-push "${upstreampush}"
fi
if [[ "${currentgroup}" == "${upstreamgroup}" ]]; then
echo "Upstreams group already set up correctly. Skip"
elif [[ -n "${currentgroup}" && "${currentgroup}" != "${upstreamgroup}" ]]; then
echo "Upstreams group already set up as: ${currentgroup}. Skip"
if [[ "${currentgroup}" == "${upstreamgroup}" ]]
then
echo "Upstreams group already set up correctly. Skip"
elif [[ -n "${currentgroup}" && "${currentgroup}" != "${upstreamgroup}" ]]
then
echo "Upstreams group already set up as: ${currentgroup}. Skip"
else
_run git config --add remotes.upstreams "${upstreamgroup}"
_run git config --add remotes.upstreams "${upstreamgroup}"
fi
_run git fetch --jobs=$(nproc) upstreams

View File

@@ -1,16 +1,17 @@
#!/bin/bash
if [[ $# -lt 3 || "$1" == "--help" || "$1" = "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch user/branch [user/branch [...]]
if [[ $# -lt 3 || "$1" == "--help" || "$1" = "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch user/branch [user/branch [...]]
* workbranch will be created locally from base/branch
* base/branch and user/branch may be specified as user:branch to allow
easy copying from Github PRs
* Remotes for each user must already be set up
* workbranch will be created locally from base/branch
* base/branch and user/branch may be specified as user:branch to allow
easy copying from Github PRs
* Remotes for each user must already be set up
USAGE
exit 0
exit 0
fi
work="$1"
@@ -23,8 +24,9 @@ unset branches[0]
set -e
users=()
for b in "${branches[@]}"; do
users+=( $( echo $b | cut -d/ -f1 ) )
for b in "${branches[@]}"
do
users+=( $( echo $b | cut -d/ -f1 ) )
done
users=( $( printf '%s\n' "${users[@]}" | sort -u ) )
@@ -32,9 +34,10 @@ users=( $( printf '%s\n' "${users[@]}" | sort -u ) )
git fetch --multiple upstreams "${users[@]}"
git checkout -B "$work" --no-track "$base"
for b in "${branches[@]}"; do
git merge --squash "${b}"
git commit -S # Use the commit message provided on the PR
for b in "${branches[@]}"
do
git merge --squash "${b}"
git commit -S # Use the commit message provided on the PR
done
# Make sure the commits look right
@@ -44,11 +47,13 @@ parts=( $( echo $base | sed "s/\// /" ) )
repo="${parts[0]}"
b="${parts[1]}"
push=$repo
if [[ "$push" == "upstream" ]]; then
push="upstream-push"
if [[ "$push" == "upstream" ]]
then
push="upstream-push"
fi
if [[ "$repo" == "upstream" ]]; then
repo="upstreams"
if [[ "$repo" == "upstream" ]]
then
repo="upstreams"
fi
cat << PUSH

View File

@@ -1,16 +1,17 @@
#!/bin/bash
if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch version
if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch version
* workbranch will be created locally from base/branch. If it exists,
it will be reused, so make sure you don't overwrite any work.
* base/branch may be specified as user:branch to allow easy copying
from Github PRs.
* workbranch will be created locally from base/branch. If it exists,
it will be reused, so make sure you don't overwrite any work.
* base/branch may be specified as user:branch to allow easy copying
from Github PRs.
USAGE
exit 0
exit 0
fi
work="$1"
@@ -29,9 +30,10 @@ git fetch upstreams
git checkout -B "${work}" --no-track "${base}"
push=$( git rev-parse --abbrev-ref --symbolic-full-name '@{push}' \
2>/dev/null ) || true
if [[ "${push}" != "" ]]; then
echo "Warning: ${push} may already exist."
2>/dev/null ) || true
if [[ "${push}" != "" ]]
then
echo "Warning: ${push} may already exist."
fi
build=$( find -name BuildInfo.cpp )

View File

@@ -1,206 +0,0 @@
#!/usr/bin/env python3
"""Pre-commit hook that runs clang-tidy on changed files using run-clang-tidy."""
from __future__ import annotations
import json
import os
import re
import shutil
import subprocess
import sys
from collections import defaultdict
from pathlib import Path
HEADER_EXTENSIONS = {".h", ".hpp", ".ipp"}
SOURCE_EXTENSIONS = {".cpp"}
INCLUDE_RE = re.compile(r"^\s*#\s*include\s*[<\"]([^>\"]+)[>\"]")
def find_run_clang_tidy() -> str | None:
for candidate in ("run-clang-tidy-21", "run-clang-tidy"):
if path := shutil.which(candidate):
return path
return None
def find_build_dir(repo_root: Path) -> Path | None:
for name in (".build", "build"):
candidate = repo_root / name
if (candidate / "compile_commands.json").exists():
return candidate
return None
def build_include_graph(build_dir: Path, repo_root: Path) -> tuple[dict, set]:
"""
Scan all files reachable from compile_commands.json and build an inverted include graph.
Returns:
inverted: header_path -> set of files that include it
source_files: set of all TU paths from compile_commands.json
"""
with open(build_dir / "compile_commands.json") as f:
db = json.load(f)
source_files = {Path(e["file"]).resolve() for e in db}
include_roots = [repo_root / "include", repo_root / "src"]
inverted: dict[Path, set[Path]] = defaultdict(set)
to_scan: set[Path] = set(source_files)
scanned: set[Path] = set()
while to_scan:
file = to_scan.pop()
if file in scanned or not file.exists():
continue
scanned.add(file)
content = file.read_text()
for line in content.splitlines():
m = INCLUDE_RE.match(line)
if not m:
continue
for root in include_roots:
candidate = (root / m.group(1)).resolve()
if candidate.exists():
inverted[candidate].add(file)
if candidate not in scanned:
to_scan.add(candidate)
break
return inverted, source_files
def find_tus_for_headers(
headers: list[Path],
inverted: dict[Path, set[Path]],
source_files: set[Path],
) -> set[Path]:
"""
For each header, pick one TU that transitively includes it.
Prefers a TU whose stem matches the header's stem, otherwise picks the first found.
"""
result: set[Path] = set()
for header in headers:
preferred: Path | None = None
visited: set[Path] = {header}
stack: list[Path] = [header]
while stack:
h = stack.pop()
for inc in inverted.get(h, ()):
if inc in source_files:
if inc.stem == header.stem:
preferred = inc
break
if preferred is None:
preferred = inc
if inc not in visited:
visited.add(inc)
stack.append(inc)
if preferred is not None and preferred.stem == header.stem:
break
if preferred is not None:
result.add(preferred)
return result
def resolve_files(
input_files: list[str], build_dir: Path, repo_root: Path
) -> list[str]:
"""
Split input into source files and headers. Source files are passed through;
headers are resolved to the TUs that transitively include them.
"""
sources: list[Path] = []
headers: list[Path] = []
for f in input_files:
p = Path(f).resolve()
if p.suffix in SOURCE_EXTENSIONS:
sources.append(p)
elif p.suffix in HEADER_EXTENSIONS:
headers.append(p)
if not headers:
return [str(p) for p in sources]
print(
f"Resolving {len(headers)} header(s) to compilation units...", file=sys.stderr
)
inverted, source_files = build_include_graph(build_dir, repo_root)
tus = find_tus_for_headers(headers, inverted, source_files)
if not tus:
print(
"Warning: no compilation units found that include the modified headers; "
"skipping clang-tidy for headers.",
file=sys.stderr,
)
return sorted({str(p) for p in (*sources, *tus)})
def staged_files(repo_root: Path) -> list[str]:
result = subprocess.run(
["git", "diff", "--staged", "--name-only", "--diff-filter=d"],
capture_output=True,
text=True,
cwd=repo_root,
)
if result.returncode != 0:
print(
"clang-tidy check failed: 'git diff --staged' command failed.",
file=sys.stderr,
)
if result.stderr:
print(result.stderr, file=sys.stderr)
sys.exit(result.returncode or 1)
return [str(repo_root / p) for p in result.stdout.splitlines() if p]
def main():
if not os.environ.get("TIDY"):
return 0
repo_root = Path(__file__).parent.parent
files = staged_files(repo_root)
if not files:
return 0
run_clang_tidy = find_run_clang_tidy()
if not run_clang_tidy:
print(
"clang-tidy check failed: TIDY is enabled but neither "
"'run-clang-tidy-21' nor 'run-clang-tidy' was found in PATH.",
file=sys.stderr,
)
return 1
build_dir = find_build_dir(repo_root)
if not build_dir:
print(
"clang-tidy check failed: no build directory with compile_commands.json found "
"(looked for .build/ and build/)",
file=sys.stderr,
)
return 1
tidy_files = resolve_files(files, build_dir, repo_root)
if not tidy_files:
return 0
result = subprocess.run(
[run_clang_tidy, "-quiet", "-p", str(build_dir), "-fix", "-allow-no-checks"]
+ tidy_files
)
return result.returncode
if __name__ == "__main__":
sys.exit(main())

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env python3
"""
Converts quoted includes (#include "...") to angle-bracket includes
(#include <...>), which is the required style in this project.
Usage: ./bin/pre-commit/fix_include_style.py <file1> <file2> ...
"""
import re
import sys
from pathlib import Path
PATTERN = re.compile(r'^(\s*#include\s*)"([^"]+)"', re.MULTILINE)
def fix_includes(path: Path) -> bool:
original = path.read_text(encoding="utf-8")
fixed = PATTERN.sub(r"\1<\2>", original)
if fixed != original:
path.write_text(fixed, encoding="utf-8")
return False
return True
def main() -> int:
files = [Path(f) for f in sys.argv[1:]]
success = True
for path in files:
success &= fix_includes(path)
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())

View File

@@ -1416,12 +1416,6 @@
# in this section to a comma-separated list of the addresses
# of your Clio servers, in order to bypass xrpld's rate limiting.
#
# TLS/SSL can be enabled for gRPC by specifying ssl_cert and ssl_key.
# Both parameters must be provided together. The ssl_cert_chain parameter
# is optional and provides intermediate CA certificates for the certificate
# chain. The ssl_client_ca parameter is optional and enables mutual TLS
# (client certificate verification).
#
# This port is commented out but can be enabled by removing
# the '#' from each corresponding line including the entry under [server]
#
@@ -1471,74 +1465,11 @@ admin = 127.0.0.1
protocol = ws
send_queue_limit = 500
# gRPC TLS/SSL Configuration
#
# The gRPC port supports optional TLS/SSL encryption. When TLS is not
# configured, the gRPC server will accept unencrypted connections.
#
# ssl_cert = <filename>
# ssl_key = <filename>
#
# To enable TLS for gRPC, both ssl_cert and ssl_key must be specified.
# If only one is provided, xrpld will fail to start.
#
# ssl_cert: Path to the server's SSL certificate file in PEM format.
# ssl_key: Path to the server's SSL private key file in PEM format.
#
# When configured, the gRPC server will only accept TLS-encrypted
# connections. Clients must use TLS (secure) channel credentials rather
# than plaintext / insecure connections.
#
# ssl_cert_chain = <filename>
#
# Optional. Path to intermediate CA certificate(s) in PEM format that
# complete the server's certificate chain.
#
# This file should contain the intermediate CA certificate(s) needed
# to build a trust chain from the server certificate (ssl_cert) to a
# root CA that clients trust. Multiple certificates should be
# concatenated in PEM format.
#
# This is needed when your server certificate was signed by an
# intermediate CA rather than directly by a root CA. Without this,
# clients may fail to verify your server certificate.
#
# If not specified, only the server certificate from ssl_cert will be
# presented to clients.
#
# ssl_client_ca = <filename>
#
# Optional. Path to a CA certificate file in PEM format for verifying
# client certificates (mutual TLS / mTLS).
#
# When specified, the gRPC server will verify client certificates
# against this CA. This enables mutual authentication where both the
# server and client verify each other's identity.
#
# This is typically NOT needed for public-facing gRPC servers. Only
# use this if you want to restrict access to clients with valid
# certificates signed by the specified CA.
#
# If not specified, the server will use one-way TLS (server
# authentication only) and will accept connections from any client.
#
[port_grpc]
port = 50051
ip = 127.0.0.1
secure_gateway = 127.0.0.1
# Optional TLS/SSL configuration for gRPC
# To enable TLS, uncomment and configure both ssl_cert and ssl_key:
#ssl_cert = /etc/ssl/certs/grpc-server.crt
#ssl_key = /etc/ssl/private/grpc-server.key
# Optional: Include intermediate CA certificates for complete certificate chain
#ssl_cert_chain = /etc/ssl/certs/grpc-intermediate-ca.crt
# Optional: Enable mutual TLS (client certificate verification)
# Uncomment to require and verify client certificates:
#ssl_client_ca = /etc/ssl/certs/grpc-client-ca.crt
#[port_ws_public]
#port = 6005
#ip = 127.0.0.1

View File

@@ -118,7 +118,7 @@ if(MSVC)
NOMINMAX
# TODO: Resolve these warnings, don't just silence them
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>,$<NOT:$<BOOL:${is_ci}>>>:_CRTDBG_MAP_ALLOC>
)
target_link_libraries(common INTERFACE -errorreport:none -machine:X64)
else()

View File

@@ -108,12 +108,24 @@ target_link_libraries(
)
# Level 05
## Set up code generation for protocol_autogen module
include(XrplProtocolAutogen)
# Must call setup_protocol_autogen before add_module so that:
# 1. Stale generated files are cleared before GLOB runs
# 2. Output file list is known for custom commands
setup_protocol_autogen()
add_module(xrpl protocol_autogen)
target_link_libraries(
xrpl.libxrpl.protocol_autogen
PUBLIC xrpl.libxrpl.protocol
)
# Ensure code generation runs before compiling protocol_autogen
if(TARGET protocol_autogen_generate)
add_dependencies(xrpl.libxrpl.protocol_autogen protocol_autogen_generate)
endif()
# Level 06
add_module(xrpl core)
target_link_libraries(

View File

@@ -2,145 +2,308 @@
Protocol Autogen - Code generation for protocol wrapper classes
#]===================================================================]
# Options for code generation
option(
XRPL_NO_CODEGEN
"Disable code generation (use pre-generated files from repository)"
OFF
)
set(CODEGEN_VENV_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/.venv"
""
CACHE PATH
"Path to a Python virtual environment for code generation. A venv will be created here by setup_code_gen and used to run generation scripts."
"Path to Python virtual environment for code generation. If provided, automatic venv setup is skipped."
)
# Directory paths
set(MACRO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol/detail")
set(AUTOGEN_HEADER_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol_autogen"
)
set(AUTOGEN_TEST_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/src/tests/libxrpl/protocol_autogen"
)
set(SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/codegen")
# Input macro files
set(TRANSACTIONS_MACRO "${MACRO_DIR}/transactions.macro")
set(LEDGER_ENTRIES_MACRO "${MACRO_DIR}/ledger_entries.macro")
set(SFIELDS_MACRO "${MACRO_DIR}/sfields.macro")
# Python scripts and templates
set(GENERATE_TX_SCRIPT "${SCRIPTS_DIR}/generate_tx_classes.py")
set(GENERATE_LEDGER_SCRIPT "${SCRIPTS_DIR}/generate_ledger_classes.py")
set(REQUIREMENTS_FILE "${SCRIPTS_DIR}/requirements.txt")
set(MACRO_PARSER_COMMON "${SCRIPTS_DIR}/macro_parser_common.py")
set(TX_TEMPLATE "${SCRIPTS_DIR}/templates/Transaction.h.mako")
set(TX_TEST_TEMPLATE "${SCRIPTS_DIR}/templates/TransactionTests.cpp.mako")
set(LEDGER_TEMPLATE "${SCRIPTS_DIR}/templates/LedgerEntry.h.mako")
set(LEDGER_TEST_TEMPLATE "${SCRIPTS_DIR}/templates/LedgerEntryTests.cpp.mako")
set(ALL_INPUT_FILES
"${TRANSACTIONS_MACRO}"
"${LEDGER_ENTRIES_MACRO}"
"${SFIELDS_MACRO}"
"${GENERATE_TX_SCRIPT}"
"${GENERATE_LEDGER_SCRIPT}"
"${REQUIREMENTS_FILE}"
"${MACRO_PARSER_COMMON}"
"${TX_TEMPLATE}"
"${TX_TEST_TEMPLATE}"
"${LEDGER_TEMPLATE}"
"${LEDGER_TEST_TEMPLATE}"
)
# Create output directories
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/transactions")
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/ledger_entries")
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/ledger_entries")
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/transactions")
# Find Python3
if(NOT Python3_EXECUTABLE)
find_package(Python3 COMPONENTS Interpreter QUIET)
endif()
if(NOT Python3_EXECUTABLE)
find_program(Python3_EXECUTABLE NAMES python3 python)
endif()
if(NOT Python3_EXECUTABLE)
message(
WARNING
"Python3 not found. The 'code_gen' and 'setup_code_gen' targets will not be available."
# Function to set up code generation for protocol_autogen module
# This runs at configure time to generate C++ wrapper classes from macro files
function(setup_protocol_autogen)
# Directory paths
set(MACRO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol/detail")
set(AUTOGEN_HEADER_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol_autogen"
)
return()
endif()
# Warn if pip is configured with a non-default index (may need VPN).
execute_process(
COMMAND ${Python3_EXECUTABLE} -m pip config get global.index-url
OUTPUT_VARIABLE PIP_INDEX_URL
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
RESULT_VARIABLE PIP_CONFIG_RESULT
)
if(PIP_CONFIG_RESULT EQUAL 0 AND PIP_INDEX_URL)
if(
NOT PIP_INDEX_URL STREQUAL "https://pypi.org/simple"
AND NOT PIP_INDEX_URL STREQUAL "https://pypi.python.org/simple"
set(AUTOGEN_TEST_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/src/tests/libxrpl/protocol_autogen"
)
set(SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
# Input macro files
set(TRANSACTIONS_MACRO "${MACRO_DIR}/transactions.macro")
set(LEDGER_ENTRIES_MACRO "${MACRO_DIR}/ledger_entries.macro")
set(SFIELDS_MACRO "${MACRO_DIR}/sfields.macro")
# Python scripts and templates
set(GENERATE_TX_SCRIPT "${SCRIPTS_DIR}/generate_tx_classes.py")
set(GENERATE_LEDGER_SCRIPT "${SCRIPTS_DIR}/generate_ledger_classes.py")
set(REQUIREMENTS_FILE "${SCRIPTS_DIR}/requirements.txt")
set(MACRO_PARSER_COMMON "${SCRIPTS_DIR}/macro_parser_common.py")
set(TX_TEMPLATE "${SCRIPTS_DIR}/templates/Transaction.h.mako")
set(TX_TEST_TEMPLATE "${SCRIPTS_DIR}/templates/TransactionTests.cpp.mako")
set(LEDGER_TEMPLATE "${SCRIPTS_DIR}/templates/LedgerEntry.h.mako")
set(LEDGER_TEST_TEMPLATE
"${SCRIPTS_DIR}/templates/LedgerEntryTests.cpp.mako"
)
# Check if code generation is disabled
if(XRPL_NO_CODEGEN)
message(
WARNING
"Private pip index URL detected: ${PIP_INDEX_URL}\n"
"You may need to connect to VPN to access this URL."
"Protocol autogen: Code generation is disabled (XRPL_NO_CODEGEN=ON). "
"Generated files may be out of date."
)
return()
endif()
# Create output directories
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/transactions")
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/ledger_entries")
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/ledger_entries")
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/transactions")
# Find Python3 - check if already found by Conan or find it ourselves
if(NOT Python3_EXECUTABLE)
find_package(Python3 COMPONENTS Interpreter QUIET)
endif()
if(NOT Python3_EXECUTABLE)
# Try finding python3 executable directly
find_program(Python3_EXECUTABLE NAMES python3 python)
endif()
if(NOT Python3_EXECUTABLE)
message(
FATAL_ERROR
"Python3 not found. Code generation cannot proceed.\n"
"Please install Python 3, or set -DXRPL_NO_CODEGEN=ON to use existing generated files."
)
return()
endif()
message(STATUS "Using Python3 for code generation: ${Python3_EXECUTABLE}")
# Set up Python virtual environment for code generation
if(CODEGEN_VENV_DIR)
# User-provided venv - skip automatic setup
set(VENV_DIR "${CODEGEN_VENV_DIR}")
message(STATUS "Using user-provided Python venv: ${VENV_DIR}")
else()
# Use default venv in build directory
set(VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/codegen_venv")
endif()
# Determine the Python executable path in the venv
if(WIN32)
set(VENV_PYTHON "${VENV_DIR}/Scripts/python.exe")
set(VENV_PIP "${VENV_DIR}/Scripts/pip.exe")
else()
set(VENV_PYTHON "${VENV_DIR}/bin/python")
set(VENV_PIP "${VENV_DIR}/bin/pip")
endif()
# Only auto-setup venv if not user-provided
if(NOT CODEGEN_VENV_DIR)
# Check if venv needs to be created or updated
set(VENV_NEEDS_UPDATE FALSE)
if(NOT EXISTS "${VENV_PYTHON}")
set(VENV_NEEDS_UPDATE TRUE)
message(
STATUS
"Creating Python virtual environment for code generation..."
)
elseif(
"${REQUIREMENTS_FILE}"
IS_NEWER_THAN
"${VENV_DIR}/.requirements_installed"
)
set(VENV_NEEDS_UPDATE TRUE)
message(
STATUS
"Updating Python virtual environment (requirements changed)..."
)
endif()
# Create/update virtual environment if needed
if(VENV_NEEDS_UPDATE)
message(
STATUS
"Setting up Python virtual environment at ${VENV_DIR}"
)
execute_process(
COMMAND ${Python3_EXECUTABLE} -m venv "${VENV_DIR}"
RESULT_VARIABLE VENV_RESULT
ERROR_VARIABLE VENV_ERROR
)
if(NOT VENV_RESULT EQUAL 0)
message(
FATAL_ERROR
"Failed to create virtual environment: ${VENV_ERROR}"
)
endif()
# Check pip index URL configuration
execute_process(
COMMAND ${VENV_PIP} config get global.index-url
OUTPUT_VARIABLE PIP_INDEX_URL
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
# Default PyPI URL
set(DEFAULT_PIP_INDEX "https://pypi.org/simple")
# Show warning if using non-default index
if(PIP_INDEX_URL AND NOT PIP_INDEX_URL STREQUAL "")
if(NOT PIP_INDEX_URL STREQUAL DEFAULT_PIP_INDEX)
message(
WARNING
"Private pip index URL detected: ${PIP_INDEX_URL}\n"
"You may need to connect to VPN to access this URL."
)
endif()
endif()
message(STATUS "Installing Python dependencies...")
execute_process(
COMMAND ${VENV_PIP} install --upgrade pip
RESULT_VARIABLE PIP_UPGRADE_RESULT
OUTPUT_QUIET
ERROR_VARIABLE PIP_UPGRADE_ERROR
)
if(NOT PIP_UPGRADE_RESULT EQUAL 0)
message(WARNING "Failed to upgrade pip: ${PIP_UPGRADE_ERROR}")
endif()
execute_process(
COMMAND ${VENV_PIP} install -r "${REQUIREMENTS_FILE}"
RESULT_VARIABLE PIP_INSTALL_RESULT
ERROR_VARIABLE PIP_INSTALL_ERROR
)
if(NOT PIP_INSTALL_RESULT EQUAL 0)
message(
FATAL_ERROR
"Failed to install Python dependencies: ${PIP_INSTALL_ERROR}"
)
endif()
# Mark requirements as installed
file(TOUCH "${VENV_DIR}/.requirements_installed")
message(STATUS "Python virtual environment ready")
endif()
endif()
# At configure time - get list of output files for transactions
execute_process(
COMMAND
${VENV_PYTHON} "${GENERATE_TX_SCRIPT}" "${TRANSACTIONS_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/transactions" --test-dir
"${AUTOGEN_TEST_DIR}/transactions" --list-outputs
OUTPUT_VARIABLE TX_OUTPUT_FILES
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE TX_LIST_RESULT
ERROR_VARIABLE TX_LIST_ERROR
)
if(NOT TX_LIST_RESULT EQUAL 0)
message(
FATAL_ERROR
"Failed to list transaction output files:\n${TX_LIST_ERROR}"
)
endif()
endif()
# Convert newline-separated list to CMake list
string(REPLACE "\\" "/" TX_OUTPUT_FILES "${TX_OUTPUT_FILES}")
string(REPLACE "\n" ";" TX_OUTPUT_FILES "${TX_OUTPUT_FILES}")
# Determine which Python interpreter to use for code generation.
if(CODEGEN_VENV_DIR)
if(WIN32)
set(CODEGEN_PYTHON "${CODEGEN_VENV_DIR}/Scripts/python.exe")
else()
set(CODEGEN_PYTHON "${CODEGEN_VENV_DIR}/bin/python")
# At configure time - get list of output files for ledger entries
execute_process(
COMMAND
${VENV_PYTHON} "${GENERATE_LEDGER_SCRIPT}" "${LEDGER_ENTRIES_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/ledger_entries" --test-dir
"${AUTOGEN_TEST_DIR}/ledger_entries" --list-outputs
OUTPUT_VARIABLE LEDGER_OUTPUT_FILES
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE LEDGER_LIST_RESULT
ERROR_VARIABLE LEDGER_LIST_ERROR
)
if(NOT LEDGER_LIST_RESULT EQUAL 0)
message(
FATAL_ERROR
"Failed to list ledger entry output files:\n${LEDGER_LIST_ERROR}"
)
endif()
else()
set(CODEGEN_PYTHON "${Python3_EXECUTABLE}")
message(
WARNING
"CODEGEN_VENV_DIR is not set. Dependencies will be installed globally.\n"
"If this is not intended, reconfigure with:\n"
" cmake . -UCODEGEN_VENV_DIR"
)
endif()
# Convert newline-separated list to CMake list
string(REPLACE "\\" "/" LEDGER_OUTPUT_FILES "${LEDGER_OUTPUT_FILES}")
string(REPLACE "\n" ";" LEDGER_OUTPUT_FILES "${LEDGER_OUTPUT_FILES}")
# Custom target to create a venv and install Python dependencies.
# Run manually with: cmake --build . --target setup_code_gen
if(CODEGEN_VENV_DIR)
add_custom_target(
setup_code_gen
COMMAND ${Python3_EXECUTABLE} -m venv "${CODEGEN_VENV_DIR}"
COMMAND ${CODEGEN_PYTHON} -m pip install -r "${REQUIREMENTS_FILE}"
# Custom command to generate transaction classes at build time
add_custom_command(
OUTPUT ${TX_OUTPUT_FILES}
COMMAND
${VENV_PYTHON} "${GENERATE_TX_SCRIPT}" "${TRANSACTIONS_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/transactions" --test-dir
"${AUTOGEN_TEST_DIR}/transactions" --sfields-macro
"${SFIELDS_MACRO}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Creating venv and installing code generation dependencies..."
DEPENDS
"${TRANSACTIONS_MACRO}"
"${SFIELDS_MACRO}"
"${GENERATE_TX_SCRIPT}"
"${MACRO_PARSER_COMMON}"
"${TX_TEMPLATE}"
"${TX_TEST_TEMPLATE}"
"${REQUIREMENTS_FILE}"
COMMENT "Generating transaction classes from transactions.macro..."
VERBATIM
)
else()
add_custom_target(
setup_code_gen
COMMAND ${Python3_EXECUTABLE} -m pip install -r "${REQUIREMENTS_FILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Installing code generation dependencies..."
)
endif()
# Custom target for code generation, excluded from ALL.
# Run manually with: cmake --build . --target code_gen
add_custom_target(
code_gen
COMMAND
${CMAKE_COMMAND} -DCODEGEN_PYTHON=${CODEGEN_PYTHON}
-DGENERATE_TX_SCRIPT=${GENERATE_TX_SCRIPT}
-DGENERATE_LEDGER_SCRIPT=${GENERATE_LEDGER_SCRIPT}
-DTRANSACTIONS_MACRO=${TRANSACTIONS_MACRO}
-DLEDGER_ENTRIES_MACRO=${LEDGER_ENTRIES_MACRO}
-DSFIELDS_MACRO=${SFIELDS_MACRO}
-DAUTOGEN_HEADER_DIR=${AUTOGEN_HEADER_DIR}
-DAUTOGEN_TEST_DIR=${AUTOGEN_TEST_DIR} -P
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/XrplProtocolAutogenRun.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running protocol code generation..."
SOURCES ${ALL_INPUT_FILES}
)
# Custom command to generate ledger entry classes at build time
add_custom_command(
OUTPUT ${LEDGER_OUTPUT_FILES}
COMMAND
${VENV_PYTHON} "${GENERATE_LEDGER_SCRIPT}" "${LEDGER_ENTRIES_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/ledger_entries" --test-dir
"${AUTOGEN_TEST_DIR}/ledger_entries" --sfields-macro
"${SFIELDS_MACRO}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS
"${LEDGER_ENTRIES_MACRO}"
"${SFIELDS_MACRO}"
"${GENERATE_LEDGER_SCRIPT}"
"${MACRO_PARSER_COMMON}"
"${LEDGER_TEMPLATE}"
"${LEDGER_TEST_TEMPLATE}"
"${REQUIREMENTS_FILE}"
COMMENT "Generating ledger entry classes from ledger_entries.macro..."
VERBATIM
)
# Create a custom target that depends on all generated files
add_custom_target(
protocol_autogen_generate
DEPENDS ${TX_OUTPUT_FILES} ${LEDGER_OUTPUT_FILES}
COMMENT "Protocol autogen code generation"
)
# Extract test files from output lists (files ending in Tests.cpp)
set(PROTOCOL_AUTOGEN_TEST_SOURCES "")
foreach(FILE ${TX_OUTPUT_FILES} ${LEDGER_OUTPUT_FILES})
if(FILE MATCHES "Tests\\.cpp$")
list(APPEND PROTOCOL_AUTOGEN_TEST_SOURCES "${FILE}")
endif()
endforeach()
# Export test sources to parent scope for use in test CMakeLists.txt
set(PROTOCOL_AUTOGEN_TEST_SOURCES
"${PROTOCOL_AUTOGEN_TEST_SOURCES}"
CACHE INTERNAL
"Generated protocol_autogen test sources"
)
# Register dependencies so CMake reconfigures when macro files change
# (to update the list of output files)
set_property(
DIRECTORY
APPEND
PROPERTY
CMAKE_CONFIGURE_DEPENDS
"${TRANSACTIONS_MACRO}"
"${LEDGER_ENTRIES_MACRO}"
)
endfunction()

View File

@@ -1,39 +0,0 @@
#[===================================================================[
Protocol Autogen - Run script invoked by the 'code_gen' target
#]===================================================================]
# Generate transaction classes.
execute_process(
COMMAND
${CODEGEN_PYTHON} "${GENERATE_TX_SCRIPT}" "${TRANSACTIONS_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/transactions" --test-dir
"${AUTOGEN_TEST_DIR}/transactions" --sfields-macro "${SFIELDS_MACRO}"
RESULT_VARIABLE TX_RESULT
OUTPUT_VARIABLE TX_OUTPUT
ERROR_VARIABLE TX_ERROR
)
if(NOT TX_RESULT EQUAL 0)
message(
FATAL_ERROR
"Transaction code generation failed:\n${TX_OUTPUT}\n${TX_ERROR}\n${TX_RESULT}"
)
endif()
# Generate ledger entry classes.
execute_process(
COMMAND
${CODEGEN_PYTHON} "${GENERATE_LEDGER_SCRIPT}" "${LEDGER_ENTRIES_MACRO}"
--header-dir "${AUTOGEN_HEADER_DIR}/ledger_entries" --test-dir
"${AUTOGEN_TEST_DIR}/ledger_entries" --sfields-macro "${SFIELDS_MACRO}"
RESULT_VARIABLE LEDGER_RESULT
OUTPUT_VARIABLE LEDGER_OUTPUT
ERROR_VARIABLE LEDGER_ERROR
)
if(NOT LEDGER_RESULT EQUAL 0)
message(
FATAL_ERROR
"Ledger entry code generation failed:\n${LEDGER_OUTPUT}\n${LEDGER_ERROR}\n${TX_RESULT}"
)
endif()
message(STATUS "Protocol autogen: code generation complete")

View File

@@ -23,14 +23,14 @@ rm -f conan.lock
# first create command will create a new lockfile, while the subsequent create
# commands will merge any additional dependencies into the created lockfile.
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/linux.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/linux.profile
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/macos.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/macos.profile
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/windows.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/windows.profile

View File

@@ -1,6 +1,6 @@
#pragma once
#include <filesystem>
#include <boost/filesystem.hpp>
namespace xrpl {
@@ -12,6 +12,6 @@ namespace xrpl {
@throws runtime_error
*/
void
extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst);
extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst);
} // namespace xrpl

View File

@@ -33,10 +33,10 @@ private:
public:
/** Create an empty section. */
explicit Section(std::string name = "");
explicit Section(std::string const& name = "");
/** Returns the name of this section. */
[[nodiscard]] std::string const&
std::string const&
name() const
{
return name_;
@@ -45,7 +45,7 @@ public:
/** Returns all the lines in the section.
This includes everything.
*/
[[nodiscard]] std::vector<std::string> const&
std::vector<std::string> const&
lines() const
{
return lines_;
@@ -54,7 +54,7 @@ public:
/** Returns all the values in the section.
Values are non-empty lines which are not key/value pairs.
*/
[[nodiscard]] std::vector<std::string> const&
std::vector<std::string> const&
values() const
{
return values_;
@@ -67,13 +67,9 @@ public:
legacy(std::string value)
{
if (lines_.empty())
{
lines_.emplace_back(std::move(value));
}
else
{
lines_[0] = std::move(value);
}
}
/**
@@ -82,16 +78,14 @@ public:
* @return The retrieved value. A section with an empty legacy value returns
an empty string.
*/
[[nodiscard]] std::string
std::string
legacy() const
{
if (lines_.empty())
return "";
if (lines_.size() > 1)
{
Throw<std::runtime_error>(
"A legacy value must have exactly one line. Section: " + name_);
}
return lines_[0];
}
@@ -117,11 +111,11 @@ public:
}
/** Returns `true` if a key with the given name exists. */
[[nodiscard]] bool
bool
exists(std::string const& name) const;
template <class T = std::string>
[[nodiscard]] std::optional<T>
std::optional<T>
get(std::string const& name) const
{
auto const iter = lookup_.find(name);
@@ -132,7 +126,7 @@ public:
/// Returns a value if present, else another value.
template <class T>
[[nodiscard]] T
T
value_or(std::string const& name, T const& other) const
{
auto const v = get<T>(name);
@@ -141,7 +135,7 @@ public:
// indicates if trailing comments were seen
// during the appending of any lines/values
[[nodiscard]] bool
bool
had_trailing_comments() const
{
return had_trailing_comments_;
@@ -151,42 +145,42 @@ public:
operator<<(std::ostream&, Section const& section);
// Returns `true` if there are no key/value pairs.
[[nodiscard]] bool
bool
empty() const
{
return lookup_.empty();
}
// Returns the number of key/value pairs.
[[nodiscard]] std::size_t
std::size_t
size() const
{
return lookup_.size();
}
// For iteration of key/value pairs.
[[nodiscard]] const_iterator
const_iterator
begin() const
{
return lookup_.cbegin();
}
// For iteration of key/value pairs.
[[nodiscard]] const_iterator
const_iterator
cbegin() const
{
return lookup_.cbegin();
}
// For iteration of key/value pairs.
[[nodiscard]] const_iterator
const_iterator
end() const
{
return lookup_.cend();
}
// For iteration of key/value pairs.
[[nodiscard]] const_iterator
const_iterator
cend() const
{
return lookup_.cend();
@@ -206,7 +200,7 @@ private:
public:
/** Returns `true` if a section with the given name exists. */
[[nodiscard]] bool
bool
exists(std::string const& name) const;
/** Returns the section with the given name.
@@ -216,7 +210,7 @@ public:
Section&
section(std::string const& name);
[[nodiscard]] Section const&
Section const&
section(std::string const& name) const;
Section const&
@@ -264,7 +258,7 @@ public:
* legacy value.
* @return Contents of the legacy value.
*/
[[nodiscard]] std::string
std::string
legacy(std::string const& sectionName) const;
friend std::ostream&
@@ -272,10 +266,11 @@ public:
// indicates if trailing comments were seen
// in any loaded Sections
[[nodiscard]] bool
bool
had_trailing_comments() const
{
return std::ranges::any_of(map_, [](auto s) { return s.second.had_trailing_comments(); });
return std::any_of(
map_.cbegin(), map_.cend(), [](auto s) { return s.second.had_trailing_comments(); });
}
protected:
@@ -301,7 +296,7 @@ set(T& target, std::string const& name, Section const& section)
if ((found_and_valid = val.has_value()))
target = *val;
}
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
catch (boost::bad_lexical_cast&)
{
}
return found_and_valid;
@@ -335,7 +330,7 @@ get(Section const& section, std::string const& name, T const& defaultValue = T{}
{
return section.value_or<T>(name, defaultValue);
}
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
catch (boost::bad_lexical_cast&)
{
}
return defaultValue;
@@ -350,7 +345,7 @@ get(Section const& section, std::string const& name, char const* defaultValue)
if (val.has_value())
return *val;
}
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
catch (boost::bad_lexical_cast&)
{
}
return defaultValue;

View File

@@ -24,8 +24,7 @@ public:
Buffer() = default;
/** Create an uninitialized buffer with the given size. */
explicit Buffer(std::size_t size)
: p_((size != 0u) ? new std::uint8_t[size] : nullptr), size_(size)
explicit Buffer(std::size_t size) : p_(size ? new std::uint8_t[size] : nullptr), size_(size)
{
}
@@ -37,7 +36,7 @@ public:
*/
Buffer(void const* data, std::size_t size) : Buffer(size)
{
if (size != 0u)
if (size)
std::memcpy(p_.get(), data, size);
}
@@ -92,7 +91,7 @@ public:
{
// Ensure the slice isn't a subset of the buffer.
XRPL_ASSERT(
s.empty() || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
"xrpl::Buffer::operator=(Slice) : input not a subset");
if (auto p = alloc(s.size()))
@@ -101,13 +100,13 @@ public:
}
/** Returns the number of bytes in the buffer. */
[[nodiscard]] std::size_t
std::size_t
size() const noexcept
{
return size_;
}
[[nodiscard]] bool
bool
empty() const noexcept
{
return 0 == size_;
@@ -115,7 +114,7 @@ public:
operator Slice() const noexcept
{
if (size_ == 0u)
if (!size_)
return Slice{};
return Slice{p_.get(), size_};
}
@@ -125,7 +124,7 @@ public:
to a single byte, to facilitate pointer arithmetic.
*/
/** @{ */
[[nodiscard]] std::uint8_t const*
std::uint8_t const*
data() const noexcept
{
return p_.get();
@@ -156,7 +155,7 @@ public:
{
if (n != size_)
{
p_.reset((n != 0u) ? new std::uint8_t[n] : nullptr);
p_.reset(n ? new std::uint8_t[n] : nullptr);
size_ = n;
}
return p_.get();
@@ -169,25 +168,25 @@ public:
return alloc(n);
}
[[nodiscard]] const_iterator
const_iterator
begin() const noexcept
{
return p_.get();
}
[[nodiscard]] const_iterator
const_iterator
cbegin() const noexcept
{
return p_.get();
}
[[nodiscard]] const_iterator
const_iterator
end() const noexcept
{
return p_.get() + size_;
}
[[nodiscard]] const_iterator
const_iterator
cend() const noexcept
{
return p_.get() + size_;
@@ -200,7 +199,7 @@ operator==(Buffer const& lhs, Buffer const& rhs) noexcept
if (lhs.size() != rhs.size())
return false;
if (lhs.empty())
if (lhs.size() == 0)
return true;
return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;

View File

@@ -9,7 +9,9 @@
#include <stdexcept>
#include <vector>
namespace xrpl::compression_algorithms {
namespace xrpl {
namespace compression_algorithms {
/** LZ4 block compression.
* @tparam BufferFactory Callable object or lambda.
@@ -66,15 +68,12 @@ lz4Decompress(
if (decompressedSize <= 0)
Throw<std::runtime_error>("lz4Decompress: integer overflow (output)");
// NOLINTNEXTLINE(readability-suspicious-call-argument)
if (LZ4_decompress_safe(
reinterpret_cast<char const*>(in),
reinterpret_cast<char*>(decompressed),
inSize,
decompressedSize) != decompressedSize)
{
Throw<std::runtime_error>("lz4Decompress: failed");
}
return decompressedSize;
}
@@ -139,4 +138,6 @@ lz4Decompress(
return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
}
} // namespace xrpl::compression_algorithms
} // namespace compression_algorithms
} // namespace xrpl

View File

@@ -19,7 +19,7 @@ public:
using Entry = std::pair<std::string, int>;
using List = std::vector<Entry>;
[[nodiscard]] List
List
getCounts(int minimumThreshold) const;
public:
@@ -59,19 +59,19 @@ public:
return --count_;
}
[[nodiscard]] int
int
getCount() const noexcept
{
return count_.load();
}
[[nodiscard]] Counter*
Counter*
getNext() const noexcept
{
return next_;
}
[[nodiscard]] std::string const&
std::string const&
getName() const noexcept
{
return name_;
@@ -112,6 +112,7 @@ private:
return c;
}
public:
CountedObject() noexcept
{
getCounter().increment();
@@ -125,13 +126,10 @@ private:
CountedObject&
operator=(CountedObject const&) noexcept = default;
public:
~CountedObject() noexcept
{
getCounter().decrement();
}
friend Object;
};
} // namespace xrpl

View File

@@ -67,7 +67,7 @@ private:
}
else
{
while ((elapsed--) != 0u)
while (elapsed--)
m_value -= (m_value + Window - 1) / Window;
}
}

View File

@@ -61,7 +61,7 @@ template <class E>
class Unexpected
{
public:
static_assert(!std::is_same_v<E, void>, "E must not be void");
static_assert(!std::is_same<E, void>::value, "E must not be void");
Unexpected() = delete;
@@ -73,7 +73,7 @@ public:
{
}
[[nodiscard]] constexpr E const&
constexpr E const&
value() const&
{
return val_;
@@ -91,7 +91,7 @@ public:
return std::move(val_);
}
[[nodiscard]] constexpr E const&&
constexpr E const&&
value() const&&
{
return std::move(val_);
@@ -125,13 +125,13 @@ public:
{
}
[[nodiscard]] constexpr bool
constexpr bool
has_value() const
{
return Base::has_value();
}
[[nodiscard]] constexpr T const&
constexpr T const&
value() const
{
return Base::value();
@@ -143,7 +143,7 @@ public:
return Base::value();
}
[[nodiscard]] constexpr E const&
constexpr E const&
error() const
{
return Base::error();
@@ -210,7 +210,7 @@ public:
{
}
[[nodiscard]] constexpr E const&
constexpr E const&
error() const
{
return Base::error();

View File

@@ -1,22 +1,22 @@
#pragma once
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
#include <optional>
#include <string>
#include <system_error>
namespace xrpl {
std::string
getFileContents(
std::error_code& ec,
std::filesystem::path const& sourcePath,
boost::system::error_code& ec,
boost::filesystem::path const& sourcePath,
std::optional<std::size_t> maxSize = std::nullopt);
void
writeFileContents(
std::error_code& ec,
std::filesystem::path const& destPath,
boost::system::error_code& ec,
boost::filesystem::path const& destPath,
std::string const& contents);
} // namespace xrpl

View File

@@ -159,11 +159,11 @@ public:
reset();
/** Get the raw pointer */
[[nodiscard]] T*
T*
get() const;
/** Return the strong count */
[[nodiscard]] std::size_t
std::size_t
use_count() const;
template <class TT, class... Args>
@@ -181,7 +181,7 @@ public:
private:
/** Return the raw pointer held by this object. */
[[nodiscard]] T*
T*
unsafeGetRawPtr() const;
/** Exchange the current raw pointer held by this object with the given
@@ -260,7 +260,7 @@ public:
lock() const;
/** Return true if the strong count is zero. */
[[nodiscard]] bool
bool
expired() const;
/** Set the pointer to null and decrement the weak count.
@@ -339,7 +339,7 @@ public:
don't lock the weak pointer. Use the `lock` method if that's what's
needed)
*/
[[nodiscard]] SharedIntrusive<T>
SharedIntrusive<T>
getStrong() const;
/** Return true if this is a strong pointer and the strong pointer is
@@ -357,31 +357,31 @@ public:
/** If this is a strong pointer, return the raw pointer. Otherwise
return null.
*/
[[nodiscard]] T*
T*
get() const;
/** If this is a strong pointer, return the strong count. Otherwise
* return 0
*/
[[nodiscard]] std::size_t
std::size_t
use_count() const;
/** Return true if there is a non-zero strong count. */
[[nodiscard]] bool
bool
expired() const;
/** If this is a strong pointer, return the strong pointer. Otherwise
attempt to lock the weak pointer.
*/
[[nodiscard]] SharedIntrusive<T>
SharedIntrusive<T>
lock() const;
/** Return true is this represents a strong pointer. */
[[nodiscard]] bool
bool
isStrong() const;
/** Return true is this represents a weak pointer. */
[[nodiscard]] bool
bool
isWeak() const;
/** If this is a weak pointer, attempt to convert it to a strong
@@ -412,7 +412,7 @@ private:
private:
/** Return the raw pointer held by this object.
*/
[[nodiscard]] T*
T*
unsafeGetRawPtr() const;
enum class RefStrength { strong, weak };

View File

@@ -207,7 +207,7 @@ private:
RefCountPair(CountType s, CountType w) noexcept;
/** Convert back to the packed integer form. */
[[nodiscard]] FieldType
FieldType
combinedValue() const noexcept;
static constexpr CountType maxStrongValue =
@@ -247,7 +247,7 @@ IntrusiveRefCounts::releaseStrongRef() const
using enum ReleaseStrongRefAction;
auto prevIntVal = refCounts.load(std::memory_order_acquire);
while (true)
while (1)
{
RefCountPair const prevVal{prevIntVal};
XRPL_ASSERT(
@@ -298,7 +298,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
// Note: If this becomes a perf bottleneck, the `partialDestroyStartedMask`
// may be able to be set non-atomically. But it is easier to reason about
// the code if the flag is set atomically.
while (true)
while (1)
{
RefCountPair const prevVal{prevIntVal};
// Converted the last strong pointer to a weak pointer.
@@ -343,7 +343,7 @@ IntrusiveRefCounts::releaseWeakRef() const
RefCountPair prev = prevIntVal;
if (prev.weak == 1 && prev.strong == 0)
{
if (prev.partialDestroyStartedBit == 0u)
if (!prev.partialDestroyStartedBit)
{
// This case should only be hit if the partialDestroyStartedBit is
// set non-atomically (and even then very rarely). The code is kept
@@ -352,7 +352,7 @@ IntrusiveRefCounts::releaseWeakRef() const
prevIntVal = refCounts.load(std::memory_order_acquire);
prev = RefCountPair{prevIntVal};
}
if (prev.partialDestroyFinishedBit == 0u)
if (!prev.partialDestroyFinishedBit)
{
// partial destroy MUST finish before running a full destroy (when
// using weak pointers)
@@ -372,7 +372,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
while (!refCounts.compare_exchange_weak(curValue, desiredValue, std::memory_order_acq_rel))
{
RefCountPair const prev{curValue};
if (prev.strong == 0u)
if (!prev.strong)
return false;
desiredValue = curValue + strongDelta;

View File

@@ -4,7 +4,6 @@
#include <memory>
#include <unordered_map>
#include <utility>
namespace xrpl {
@@ -29,7 +28,7 @@ struct LocalValues
T t_;
Value() = default;
explicit Value(T t) : t_(std::move(t))
explicit Value(T const& t) : t_(t)
{
}
@@ -43,10 +42,10 @@ struct LocalValues
// Keys are the address of a LocalValue.
std::unordered_map<void const*, std::unique_ptr<BasicValue>> values;
static void
static inline void
cleanup(LocalValues* lvs)
{
if ((lvs != nullptr) && !lvs->onCoro)
if (lvs && !lvs->onCoro)
delete lvs;
}
};
@@ -90,7 +89,7 @@ T&
LocalValue<T>::operator*()
{
auto lvs = detail::getLocalValues().get();
if (lvs == nullptr)
if (!lvs)
{
lvs = new detail::LocalValues();
lvs->onCoro = false;

View File

@@ -4,8 +4,8 @@
#include <xrpl/beast/utility/Journal.h>
#include <boost/beast/core/string.hpp>
#include <boost/filesystem.hpp>
#include <filesystem>
#include <fstream>
#include <map>
#include <memory>
@@ -38,7 +38,7 @@ private:
std::string partition_;
public:
Sink(std::string partition, beast::severities::Severity thresh, Logs& logs);
Sink(std::string const& partition, beast::severities::Severity thresh, Logs& logs);
Sink(Sink const&) = delete;
Sink&
@@ -76,7 +76,7 @@ private:
@return `true` if a system file is associated and opened for
writing.
*/
[[nodiscard]] bool
bool
isOpen() const noexcept;
/** Associate a system file with the log.
@@ -88,7 +88,7 @@ private:
@return `true` if the file was opened.
*/
bool
open(std::filesystem::path const& path);
open(boost::filesystem::path const& path);
/** Close and re-open the system file associated with the log
This assists in interoperating with external log management tools.
@@ -130,7 +130,7 @@ private:
private:
std::unique_ptr<std::ofstream> m_stream;
std::filesystem::path m_path;
boost::filesystem::path m_path;
};
std::mutex mutable mutex_;
@@ -149,7 +149,7 @@ public:
virtual ~Logs() = default;
bool
open(std::filesystem::path const& pathToLogFile);
open(boost::filesystem::path const& pathToLogFile);
beast::Journal::Sink&
get(std::string const& name);
@@ -226,7 +226,7 @@ private:
// expensive argument lists if the stream is not active.
#ifndef JLOG
#define JLOG(x) \
if (!(x)) \
if (!x) \
{ \
} \
else \
@@ -235,7 +235,7 @@ private:
#ifndef CLOG
#define CLOG(ss) \
if (!(ss)) \
if (!ss) \
; \
else \
*ss

View File

@@ -44,7 +44,7 @@ public:
return data_;
}
[[nodiscard]] ProtectedDataType const&
ProtectedDataType const&
get() const
{
return data_;

View File

@@ -78,7 +78,7 @@ struct MantissaRange
}
rep min;
rep max{(min * 10) - 1};
rep max{min * 10 - 1};
int log;
mantissa_scale scale;
@@ -252,9 +252,9 @@ public:
// Assume unsigned values are... unsigned. i.e. positive
explicit Number(internalrep mantissa, int exponent, normalized);
[[nodiscard]] constexpr rep
constexpr rep
mantissa() const noexcept;
[[nodiscard]] constexpr int
constexpr int
exponent() const noexcept;
constexpr Number
@@ -339,15 +339,13 @@ public:
}
/** Return the sign of the amount */
[[nodiscard]] constexpr int
constexpr int
signum() const noexcept
{
if (negative_)
return -1;
return (mantissa_ != 0u) ? 1 : 0;
return negative_ ? -1 : (mantissa_ ? 1 : 0);
}
[[nodiscard]] Number
Number
truncate() const noexcept;
friend constexpr bool
@@ -404,19 +402,19 @@ public:
static void
setMantissaScale(MantissaRange::mantissa_scale scale);
static internalrep
inline static internalrep
minMantissa()
{
return range_.get().min;
}
static internalrep
inline static internalrep
maxMantissa()
{
return range_.get().max;
}
static int
inline static int
mantissaLog()
{
return range_.get().log;
@@ -490,13 +488,13 @@ private:
MantissaRange::rep const& minMantissa,
MantissaRange::rep const& maxMantissa);
[[nodiscard]] bool
bool
isnormal() const noexcept;
// Copy the number, but modify the exponent by "exponentDelta". Because the
// mantissa doesn't change, the result will be "mostly" normalized, but the
// exponent could go out of range, so it will be checked.
[[nodiscard]] Number
Number
shiftExponent(int exponentDelta) const;
// Safely convert rep (int64) mantissa to internalrep (uint64). If the rep
@@ -509,12 +507,16 @@ private:
class Guard;
};
constexpr Number::Number(bool negative, internalrep mantissa, int exponent, unchecked) noexcept
inline constexpr Number::Number(
bool negative,
internalrep mantissa,
int exponent,
unchecked) noexcept
: negative_(negative), mantissa_{mantissa}, exponent_{exponent}
{
}
constexpr Number::Number(internalrep mantissa, int exponent, unchecked) noexcept
inline constexpr Number::Number(internalrep mantissa, int exponent, unchecked) noexcept
: Number(false, mantissa, exponent, unchecked{})
{
}
@@ -546,7 +548,7 @@ inline Number::Number(rep mantissa) : Number{mantissa, 0}
* Please see the "---- External Interface ----" section of the class
* documentation for an explanation of why the internal value may be modified.
*/
constexpr Number::rep
inline constexpr Number::rep
Number::mantissa() const noexcept
{
auto m = mantissa_;
@@ -567,7 +569,7 @@ Number::mantissa() const noexcept
* Please see the "---- External Interface ----" section of the class
* documentation for an explanation of why the internal value may be modified.
*/
constexpr int
inline constexpr int
Number::exponent() const noexcept
{
auto e = exponent_;
@@ -582,13 +584,13 @@ Number::exponent() const noexcept
return e;
}
constexpr Number
inline constexpr Number
Number::operator+() const noexcept
{
return *this;
}
constexpr Number
inline constexpr Number
Number::operator-() const noexcept
{
if (mantissa_ == 0)
@@ -703,19 +705,17 @@ Number::normalizeToRange(T minMantissa, T maxMantissa) const
int exponent = exponent_;
if constexpr (std::is_unsigned_v<T>)
{
XRPL_ASSERT_PARTS(
!negative,
"xrpl::Number::normalizeToRange",
"Number is non-negative for unsigned range.");
}
Number::normalize(negative, mantissa, exponent, minMantissa, maxMantissa);
auto const sign = negative ? -1 : 1;
return std::make_pair(static_cast<T>(sign * mantissa), exponent);
}
constexpr Number
inline constexpr Number
abs(Number x) noexcept
{
if (x < Number{})
@@ -746,7 +746,7 @@ power(Number const& f, unsigned n, unsigned d);
// Return 0 if abs(x) < limit, else returns x
constexpr Number
inline constexpr Number
squelch(Number const& x, Number const& limit) noexcept
{
if (abs(x) < limit)

View File

@@ -117,32 +117,22 @@ from_string(RangeSet<T>& rs, std::string const& s)
case 1: {
T front;
if (!beast::lexicalCastChecked(front, intervals.front()))
{
result = false;
}
else
{
rs.insert(front);
}
break;
}
case 2: {
T front;
if (!beast::lexicalCastChecked(front, intervals.front()))
{
result = false;
}
else
{
T back;
if (!beast::lexicalCastChecked(back, intervals.back()))
{
result = false;
}
else
{
rs.insert(range(front, back));
}
}
break;
}

View File

@@ -20,7 +20,7 @@ public:
{
}
[[nodiscard]] uint256 const&
uint256 const&
as_uint256() const
{
return hash_;
@@ -30,17 +30,17 @@ public:
{
return hash_;
}
[[nodiscard]] bool
bool
isZero() const
{
return hash_.isZero();
}
[[nodiscard]] bool
bool
isNonZero() const
{
return hash_.isNonZero();
}
[[nodiscard]] int
int
signum() const
{
return hash_.signum();

View File

@@ -49,7 +49,7 @@ public:
/** Return a strong pointer if this is already a strong pointer (i.e. don't
lock the weak pointer. Use the `lock` method if that's what's needed)
*/
[[nodiscard]] std::shared_ptr<T> const&
std::shared_ptr<T> const&
getStrong() const;
/** Return true if this is a strong pointer and the strong pointer is
@@ -67,30 +67,30 @@ public:
/** If this is a strong pointer, return the raw pointer. Otherwise return
null.
*/
[[nodiscard]] T*
T*
get() const;
/** If this is a strong pointer, return the strong count. Otherwise return 0
*/
[[nodiscard]] std::size_t
std::size_t
use_count() const;
/** Return true if there is a non-zero strong count. */
[[nodiscard]] bool
bool
expired() const;
/** If this is a strong pointer, return the strong pointer. Otherwise
attempt to lock the weak pointer.
*/
[[nodiscard]] std::shared_ptr<T>
std::shared_ptr<T>
lock() const;
/** Return true is this represents a strong pointer. */
[[nodiscard]] bool
bool
isStrong() const;
/** Return true is this represents a weak pointer. */
[[nodiscard]] bool
bool
isWeak() const;
/** If this is a weak pointer, attempt to convert it to a strong pointer.

View File

@@ -60,16 +60,18 @@ class SlabAllocator
{
// Use memcpy to avoid unaligned UB
// (will optimize to equivalent code)
std::memcpy(data, static_cast<void const*>(&l_), sizeof(std::uint8_t*));
std::memcpy(data, &l_, sizeof(std::uint8_t*));
l_ = data;
data += item;
}
}
// Calling this destructor will release the allocated memory but
// will not properly destroy any objects that are constructed in
// the block itself.
~SlabBlock() = default;
~SlabBlock()
{
// Calling this destructor will release the allocated memory but
// will not properly destroy any objects that are constructed in
// the block itself.
}
SlabBlock(SlabBlock const& other) = delete;
SlabBlock&
@@ -96,11 +98,11 @@ class SlabAllocator
ret = l_;
if (ret != nullptr)
if (ret)
{
// Use memcpy to avoid unaligned UB
// (will optimize to equivalent code)
std::memcpy(static_cast<void*>(&l_), ret, sizeof(std::uint8_t*));
std::memcpy(&l_, ret, sizeof(std::uint8_t*));
}
}
@@ -125,7 +127,7 @@ class SlabAllocator
// Use memcpy to avoid unaligned UB
// (will optimize to equivalent code)
std::memcpy(ptr, static_cast<void const*>(&l_), sizeof(std::uint8_t*));
std::memcpy(ptr, &l_, sizeof(std::uint8_t*));
l_ = ptr;
}
};
@@ -157,7 +159,7 @@ public:
std::size_t extra,
std::size_t alloc = 0,
std::size_t align = 0)
: itemAlignment_((align != 0u) ? align : alignof(Type))
: itemAlignment_(align ? align : alignof(Type))
, itemSize_(boost::alignment::align_up(sizeof(Type) + extra, itemAlignment_))
, slabSize_(alloc)
{
@@ -174,13 +176,15 @@ public:
SlabAllocator&
operator=(SlabAllocator&& other) = delete;
// FIXME: We can't destroy the memory blocks we've allocated, because
// we can't be sure that they are not being used. Cleaning the
// shutdown process up could make this possible.
~SlabAllocator() = default;
~SlabAllocator()
{
// FIXME: We can't destroy the memory blocks we've allocated, because
// we can't be sure that they are not being used. Cleaning the
// shutdown process up could make this possible.
}
/** Returns the size of the memory block this allocator returns. */
[[nodiscard]] constexpr std::size_t
constexpr std::size_t
size() const noexcept
{
return itemSize_;
@@ -211,7 +215,7 @@ public:
// We want to allocate the memory at a 2 MiB boundary, to make it
// possible to use hugepage mappings on Linux:
auto buf = boost::alignment::aligned_alloc(megabytes(std::size_t(2)), size);
if (buf == nullptr) [[unlikely]]
if (!buf) [[unlikely]]
return nullptr;
#if BOOST_OS_LINUX
@@ -231,7 +235,7 @@ public:
// This operation is essentially guaranteed not to fail but
// let's be careful anyways.
if (boost::alignment::align(itemAlignment_, itemSize_, slabData, slabSize) == nullptr)
if (!boost::alignment::align(itemAlignment_, itemSize_, slabData, slabSize))
{
boost::alignment::aligned_free(buf);
return nullptr;
@@ -284,7 +288,7 @@ class SlabAllocatorSet
{
private:
// The list of allocators that belong to this set
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_{};
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_;
std::size_t maxSize_ = 0;
@@ -343,7 +347,9 @@ public:
SlabAllocatorSet&
operator=(SlabAllocatorSet&& other) = delete;
~SlabAllocatorSet() = default;
~SlabAllocatorSet()
{
}
/** Returns a suitably aligned pointer, if one is available.

View File

@@ -74,7 +74,7 @@ public:
@note The return type is guaranteed to be a pointer
to a single byte, to facilitate pointer arithmetic.
*/
[[nodiscard]] std::uint8_t const*
std::uint8_t const*
data() const noexcept
{
return data_;
@@ -123,25 +123,25 @@ public:
size_ -= n;
}
[[nodiscard]] const_iterator
const_iterator
begin() const noexcept
{
return data_;
}
[[nodiscard]] const_iterator
const_iterator
cbegin() const noexcept
{
return data_;
}
[[nodiscard]] const_iterator
const_iterator
end() const noexcept
{
return data_ + size_;
}
[[nodiscard]] const_iterator
const_iterator
cend() const noexcept
{
return data_ + size_;
@@ -158,7 +158,7 @@ public:
@returns The requested subslice, if the request is valid.
@throws std::out_of_range if pos > size()
*/
[[nodiscard]] Slice
Slice
substr(std::size_t pos, std::size_t count = std::numeric_limits<std::size_t>::max()) const
{
if (pos > size())
@@ -183,7 +183,7 @@ operator==(Slice const& lhs, Slice const& rhs) noexcept
if (lhs.size() != rhs.size())
return false;
if (lhs.empty())
if (lhs.size() == 0)
return true;
return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
@@ -211,14 +211,14 @@ operator<<(Stream& s, Slice const& v)
}
template <class T, std::size_t N>
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
makeSlice(std::array<T, N> const& a)
{
return Slice(a.data(), a.size());
}
template <class T, class Alloc>
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
makeSlice(std::vector<T, Alloc> const& v)
{
return Slice(v.data(), v.size());

View File

@@ -222,19 +222,19 @@ private:
{
}
[[nodiscard]] bool
bool
isWeak() const
{
if (!ptr)
return true;
return ptr.isWeak();
}
[[nodiscard]] bool
bool
isCached() const
{
return ptr && ptr.isStrong();
}
[[nodiscard]] bool
bool
isExpired() const
{
return ptr.expired();
@@ -251,7 +251,7 @@ private:
}
};
using Entry = std::conditional_t<IsKeyCache, KeyOnlyEntry, ValueEntry>;
typedef typename std::conditional<IsKeyCache, KeyOnlyEntry, ValueEntry>::type Entry;
using KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;

View File

@@ -12,7 +12,7 @@ namespace xrpl {
*/
template <class T>
std::enable_if_t<std::is_arithmetic_v<T>, std::string>
typename std::enable_if<std::is_arithmetic<T>::value, std::string>::type
to_string(T t)
{
return std::to_string(t);

View File

@@ -23,10 +23,8 @@ generalized_set_intersection(
{
while (first1 != last1 && first2 != last2)
{
if (comp(*first1, *first2))
{ // if *first1 < *first2
++first1; // then reduce first range
}
if (comp(*first1, *first2)) // if *first1 < *first2
++first1; // then reduce first range
else
{
if (!comp(*first2, *first1)) // if *first1 == *first2

View File

@@ -102,7 +102,7 @@ public:
{
return reinterpret_cast<pointer>(data_.data());
}
[[nodiscard]] const_pointer
const_pointer
data() const
{
return reinterpret_cast<const_pointer>(data_.data());
@@ -118,22 +118,22 @@ public:
{
return data() + bytes;
}
[[nodiscard]] const_iterator
const_iterator
begin() const
{
return data();
}
[[nodiscard]] const_iterator
const_iterator
end() const
{
return data() + bytes;
}
[[nodiscard]] const_iterator
const_iterator
cbegin() const
{
return data();
}
[[nodiscard]] const_iterator
const_iterator
cend() const
{
return data() + bytes;
@@ -183,17 +183,11 @@ private:
return ParseResult::badChar;
if (c >= 'a')
{
nibble = static_cast<std::uint32_t>(c - 'a' + 0xA);
}
else if (c >= 'A')
{
nibble = static_cast<std::uint32_t>(c - 'A' + 0xA);
}
else if (c <= '9')
{
nibble = static_cast<std::uint32_t>(c - '0');
}
if (nibble > 0xFu)
return ParseResult::badChar;
@@ -269,7 +263,7 @@ public:
class Container,
class = std::enable_if_t<
detail::is_contiguous_container<Container>::value &&
std::is_trivially_copyable_v<typename Container::value_type>>>
std::is_trivially_copyable<typename Container::value_type>::value>>
explicit base_uint(Container const& c)
{
XRPL_ASSERT(
@@ -281,7 +275,7 @@ public:
template <class Container>
std::enable_if_t<
detail::is_contiguous_container<Container>::value &&
std::is_trivially_copyable_v<typename Container::value_type>,
std::is_trivially_copyable<typename Container::value_type>::value,
base_uint&>
operator=(Container const& c)
{
@@ -310,14 +304,12 @@ public:
return fromVoid(from.data());
}
[[nodiscard]] constexpr int
constexpr int
signum() const
{
for (int i = 0; i < WIDTH; i++)
{
if (data_[i] != 0)
return 1;
}
return 0;
}
@@ -398,7 +390,7 @@ public:
return *this;
}
base_uint
base_uint const
operator++(int)
{
// postfix operator
@@ -423,7 +415,7 @@ public:
return *this;
}
base_uint
base_uint const
operator--(int)
{
// postfix operator
@@ -433,14 +425,14 @@ public:
return ret;
}
[[nodiscard]] base_uint
base_uint
next() const
{
auto ret = *this;
return ++ret;
}
[[nodiscard]] base_uint
base_uint
prev() const
{
auto ret = *this;
@@ -452,7 +444,7 @@ public:
{
std::uint64_t carry = 0;
for (int i = WIDTH - 1; i >= 0; i--)
for (int i = WIDTH; i--;)
{
std::uint64_t const n = carry + boost::endian::big_to_native(data_[i]) +
boost::endian::big_to_native(b.data_[i]);
@@ -517,12 +509,12 @@ public:
}
// Deprecated.
[[nodiscard]] bool
bool
isZero() const
{
return *this == beast::zero;
}
[[nodiscard]] bool
bool
isNonZero() const
{
return *this != beast::zero;
@@ -540,7 +532,7 @@ using uint256 = base_uint<256>;
using uint192 = base_uint<192>;
template <std::size_t Bits, class Tag>
[[nodiscard]] constexpr std::strong_ordering
[[nodiscard]] inline constexpr std::strong_ordering
operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
{
// This comparison might seem wrong on a casual inspection because it
@@ -561,7 +553,7 @@ operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
}
template <std::size_t Bits, typename Tag>
[[nodiscard]] constexpr bool
[[nodiscard]] inline constexpr bool
operator==(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
{
return (lhs <=> rhs) == 0;
@@ -569,7 +561,7 @@ operator==(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
//------------------------------------------------------------------------------
template <std::size_t Bits, class Tag>
constexpr bool
inline constexpr bool
operator==(base_uint<Bits, Tag> const& a, std::uint64_t b)
{
return a == base_uint<Bits, Tag>(b);
@@ -577,28 +569,28 @@ operator==(base_uint<Bits, Tag> const& a, std::uint64_t b)
//------------------------------------------------------------------------------
template <std::size_t Bits, class Tag>
constexpr base_uint<Bits, Tag>
inline constexpr base_uint<Bits, Tag>
operator^(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
{
return base_uint<Bits, Tag>(a) ^= b;
}
template <std::size_t Bits, class Tag>
constexpr base_uint<Bits, Tag>
inline constexpr base_uint<Bits, Tag>
operator&(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
{
return base_uint<Bits, Tag>(a) &= b;
}
template <std::size_t Bits, class Tag>
constexpr base_uint<Bits, Tag>
inline constexpr base_uint<Bits, Tag>
operator|(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
{
return base_uint<Bits, Tag>(a) |= b;
}
template <std::size_t Bits, class Tag>
constexpr base_uint<Bits, Tag>
inline constexpr base_uint<Bits, Tag>
operator+(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
{
return base_uint<Bits, Tag>(a) += b;

View File

@@ -49,7 +49,8 @@ template <class E, class... Args>
Throw(Args&&... args)
{
static_assert(
std::is_convertible_v<E*, std::exception*>, "Exception must derive from std::exception.");
std::is_convertible<E*, std::exception*>::value,
"Exception must derive from std::exception.");
E e(std::forward<Args>(args)...);
LogThrow(std::string("Throwing exception of type " + beast::type_name<E>() + ": ") + e.what());

View File

@@ -72,12 +72,14 @@ template <class HashAlgorithm = beast::xxhasher>
class hardened_hash
{
private:
detail::seed_pair m_seeds{detail::make_seed_pair<>()};
detail::seed_pair m_seeds;
public:
using result_type = typename HashAlgorithm::result_type;
hardened_hash() = default;
hardened_hash() : m_seeds(detail::make_seed_pair<>())
{
}
template <class T>
result_type

View File

@@ -57,7 +57,7 @@ public:
{
using iterator_category = std::forward_iterator_tag;
partition_map_type* map_{nullptr};
typename partition_map_type::iterator ait_{};
typename partition_map_type::iterator ait_;
typename map_type::iterator mit_;
iterator() = default;
@@ -126,7 +126,7 @@ public:
using iterator_category = std::forward_iterator_tag;
partition_map_type* map_{nullptr};
typename partition_map_type::iterator ait_{};
typename partition_map_type::iterator ait_;
typename map_type::iterator mit_;
const_iterator() = default;
@@ -231,8 +231,7 @@ public:
{
// Set partitions to the number of hardware threads if the parameter
// is either empty or set to 0.
partitions_ =
partitions && (*partitions != 0u) ? *partitions : std::thread::hardware_concurrency();
partitions_ = partitions && *partitions ? *partitions : std::thread::hardware_concurrency();
map_.resize(partitions_);
XRPL_ASSERT(
partitions_,

View File

@@ -15,8 +15,8 @@ namespace xrpl {
#ifndef __INTELLISENSE__
static_assert(
// NOLINTNEXTLINE(misc-redundant-expression)
std::is_integral_v<beast::xor_shift_engine::result_type> &&
std::is_unsigned_v<beast::xor_shift_engine::result_type>,
std::is_integral<beast::xor_shift_engine::result_type>::value &&
std::is_unsigned<beast::xor_shift_engine::result_type>::value,
"The XRPL default PRNG engine must return an unsigned integral type.");
static_assert(
@@ -91,7 +91,7 @@ default_prng()
*/
/** @{ */
template <class Engine, class Integral>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine, Integral min, Integral max)
{
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
@@ -103,35 +103,35 @@ rand_int(Engine& engine, Integral min, Integral max)
}
template <class Integral>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
rand_int(Integral min, Integral max)
{
return rand_int(default_prng(), min, max);
}
template <class Engine, class Integral>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine, Integral max)
{
return rand_int(engine, Integral(0), max);
}
template <class Integral>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
rand_int(Integral max)
{
return rand_int(default_prng(), max);
}
template <class Integral, class Engine>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine)
{
return rand_int(engine, std::numeric_limits<Integral>::max());
}
template <class Integral = int>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
rand_int()
{
return rand_int(default_prng(), std::numeric_limits<Integral>::max());
@@ -142,7 +142,7 @@ rand_int()
/** @{ */
template <class Byte, class Engine>
std::enable_if_t<
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value) &&
detail::is_engine<Engine>::value,
Byte>
rand_byte(Engine& engine)
@@ -152,7 +152,9 @@ rand_byte(Engine& engine)
}
template <class Byte = std::uint8_t>
std::enable_if_t<(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>), Byte>
std::enable_if_t<
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value),
Byte>
rand_byte()
{
return rand_byte<Byte>(default_prng());

View File

@@ -12,12 +12,12 @@ namespace xrpl {
template <class Src, class Dest>
concept SafeToCast = (std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
(std::is_signed_v<Src> || std::is_unsigned_v<Dest>) &&
(std::is_signed_v<Src> != std::is_signed_v<Dest> ? sizeof(Dest) > sizeof(Src)
: sizeof(Dest) >= sizeof(Src));
(std::is_signed<Src>::value || std::is_unsigned<Dest>::value) &&
(std::is_signed<Src>::value != std::is_signed<Dest>::value ? sizeof(Dest) > sizeof(Src)
: sizeof(Dest) >= sizeof(Src));
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
safe_cast(Src s) noexcept
{
static_assert(
@@ -30,14 +30,14 @@ safe_cast(Src s) noexcept
}
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
safe_cast(Src s) noexcept
{
return static_cast<Dest>(safe_cast<std::underlying_type_t<Dest>>(s));
}
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
safe_cast(Src s) noexcept
{
return safe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
@@ -48,7 +48,7 @@ safe_cast(Src s) noexcept
// underlying types become safe, it can be converted to a safe_cast.
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
unsafe_cast(Src s) noexcept
{
static_assert(
@@ -59,14 +59,14 @@ unsafe_cast(Src s) noexcept
}
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
unsafe_cast(Src s) noexcept
{
return static_cast<Dest>(unsafe_cast<std::underlying_type_t<Dest>>(s));
}
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
unsafe_cast(Src s) noexcept
{
return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));

View File

@@ -10,9 +10,9 @@ std::string
strHex(FwdIt begin, FwdIt end)
{
static_assert(
std::is_convertible_v<
std::is_convertible<
typename std::iterator_traits<FwdIt>::iterator_category,
std::forward_iterator_tag>,
std::forward_iterator_tag>::value,
"FwdIt must be a forward iterator");
std::string result;
result.reserve(2 * std::distance(begin, end));

View File

@@ -44,7 +44,8 @@ public:
template <
class OtherInt,
class = std::enable_if_t<std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int)>>
class = typename std::enable_if<
std::is_integral<OtherInt>::value && sizeof(OtherInt) <= sizeof(Int)>::type>
explicit constexpr tagged_integer(OtherInt value) noexcept : m_value(value)
{
static_assert(sizeof(tagged_integer) == sizeof(Int), "tagged_integer is adding padding");

View File

@@ -49,7 +49,7 @@ public:
return m_ios;
}
[[nodiscard]] boost::asio::io_context const&
boost::asio::io_context const&
get_io_context() const
{
return m_ios;
@@ -184,7 +184,7 @@ private:
void
operator()() const
{
if (m_probe == nullptr)
if (!m_probe)
return;
typename Clock::time_point const now(Clock::now());
typename Clock::duration const elapsed(now - m_start);
@@ -202,7 +202,7 @@ private:
// Calculate when we want to sample again, and
// adjust for the expected latency.
//
typename Clock::time_point const when(now + m_probe->m_period - (2 * elapsed));
typename Clock::time_point const when(now + m_probe->m_period - 2 * elapsed);
if (when <= now)
{
@@ -224,7 +224,7 @@ private:
void
operator()(boost::system::error_code const& ec)
{
if (m_probe == nullptr)
if (!m_probe)
return;
typename Clock::time_point const now(Clock::now());
boost::asio::post(

View File

@@ -63,7 +63,7 @@ struct abstract_clock_wrapper : public abstract_clock<Facade>
using typename abstract_clock<Facade>::duration;
using typename abstract_clock<Facade>::time_point;
[[nodiscard]] time_point
time_point
now() const override
{
return Clock::now();

View File

@@ -32,7 +32,7 @@ public:
{
}
[[nodiscard]] time_point
time_point
now() const override
{
return now_;

View File

@@ -9,7 +9,7 @@ namespace beast {
/** Expire aged container items past the specified age. */
template <class AgedContainer, class Rep, class Period>
std::enable_if_t<is_aged_container<AgedContainer>::value, std::size_t>
typename std::enable_if<is_aged_container<AgedContainer>::value, std::size_t>::type
expire(AgedContainer& c, std::chrono::duration<Rep, Period> const& age)
{
std::size_t n(0);

View File

@@ -1,6 +1,7 @@
#pragma once
namespace beast::detail {
namespace beast {
namespace detail {
// Extracts the key portion of value
template <bool maybe_map>
@@ -25,8 +26,9 @@ struct aged_associative_container_extract_t<false>
Value const&
operator()(Value const& value) const
{
return value; // NOLINT(bugprone-return-const-ref-from-parameter)
return value;
}
};
} // namespace beast::detail
} // namespace detail
} // namespace beast

View File

@@ -2,7 +2,6 @@
#include <iterator>
#include <type_traits>
#include <utility>
namespace beast {
@@ -17,10 +16,10 @@ class aged_container_iterator
{
public:
using iterator_category = typename std::iterator_traits<Iterator>::iterator_category;
using value_type = std::conditional_t<
using value_type = typename std::conditional<
is_const,
typename Iterator::value_type::stashed::value_type const,
typename Iterator::value_type::stashed::value_type>;
typename Iterator::value_type::stashed::value_type>::type;
using difference_type = typename std::iterator_traits<Iterator>::difference_type;
using pointer = value_type*;
using reference = value_type&;
@@ -33,9 +32,9 @@ public:
template <
bool other_is_const,
class OtherIterator,
class = std::enable_if_t<
(!other_is_const || is_const) &&
!static_cast<bool>(std::is_same_v<Iterator, OtherIterator>)>>
class = typename std::enable_if<
(other_is_const == false || is_const == true) &&
std::is_same<Iterator, OtherIterator>::value == false>::type>
explicit aged_container_iterator(
aged_container_iterator<other_is_const, OtherIterator> const& other)
: m_iter(other.m_iter)
@@ -43,7 +42,9 @@ public:
}
// Disable constructing a const_iterator from a non-const_iterator.
template <bool other_is_const, class = std::enable_if_t<!other_is_const || is_const>>
template <
bool other_is_const,
class = typename std::enable_if<other_is_const == false || is_const == true>::type>
aged_container_iterator(aged_container_iterator<other_is_const, Iterator> const& other)
: m_iter(other.m_iter)
{
@@ -52,8 +53,8 @@ public:
// Disable assigning a const_iterator to a non-const iterator
template <bool other_is_const, class OtherIterator>
auto
operator=(aged_container_iterator<other_is_const, OtherIterator> const& other)
-> std::enable_if_t<!other_is_const || is_const, aged_container_iterator&>
operator=(aged_container_iterator<other_is_const, OtherIterator> const& other) -> typename std::
enable_if<other_is_const == false || is_const == true, aged_container_iterator&>::type
{
m_iter = other.m_iter;
return *this;
@@ -115,7 +116,7 @@ public:
return &m_iter->value;
}
[[nodiscard]] time_point const&
time_point const&
when() const
{
return m_iter->when;
@@ -132,11 +133,11 @@ private:
friend class aged_container_iterator;
template <class OtherIterator>
aged_container_iterator(OtherIterator iter) : m_iter(std::move(iter))
aged_container_iterator(OtherIterator const& iter) : m_iter(iter)
{
}
[[nodiscard]] Iterator const&
Iterator const&
iterator() const
{
return m_iter;

View File

@@ -57,7 +57,8 @@ template <
class T,
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
class Allocator =
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
class aged_ordered_container
{
public:
@@ -66,7 +67,7 @@ public:
using duration = typename clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -109,7 +110,8 @@ private:
template <
class... Args,
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
class =
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
element(time_point const& when_, Args&&... args)
: value(std::forward<Args>(args)...), when(when_)
{
@@ -133,7 +135,9 @@ private:
return Compare::operator()(lhs.first, rhs.first);
}
pair_value_compare() = default;
pair_value_compare()
{
}
pair_value_compare(pair_value_compare const& other) : Compare(other)
{
@@ -186,7 +190,7 @@ private:
return *this;
}
[[nodiscard]] Compare const&
Compare const&
compare() const
{
return *this;
@@ -196,7 +200,7 @@ private:
using list_type = typename boost::intrusive::
make_list<element, boost::intrusive::constant_time_size<false>>::type;
using cont_type = std::conditional_t<
using cont_type = typename std::conditional<
IsMulti,
typename boost::intrusive::make_multiset<
element,
@@ -205,7 +209,7 @@ private:
typename boost::intrusive::make_set<
element,
boost::intrusive::constant_time_size<true>,
boost::intrusive::compare<KeyValueCompare>>::type>;
boost::intrusive::compare<KeyValueCompare>>::type>::type;
using ElementAllocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<element>;
@@ -253,8 +257,7 @@ private:
config_t(config_t&& other)
: KeyValueCompare(std::move(other.key_compare()))
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(
static_cast<beast::detail::empty_base_optimization<ElementAllocator>&>(other)))
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(other))
, clock(other.clock)
{
}
@@ -295,7 +298,7 @@ private:
return KeyValueCompare::compare();
}
[[nodiscard]] Compare const&
Compare const&
compare() const
{
return KeyValueCompare::compare();
@@ -307,7 +310,7 @@ private:
return *this;
}
[[nodiscard]] KeyValueCompare const&
KeyValueCompare const&
key_compare() const
{
return *this;
@@ -319,7 +322,7 @@ private:
return beast::detail::empty_base_optimization<ElementAllocator>::member();
}
[[nodiscard]] ElementAllocator const&
ElementAllocator const&
alloc() const
{
return beast::detail::empty_base_optimization<ElementAllocator>::member();
@@ -370,7 +373,7 @@ private:
public:
using key_compare = Compare;
using value_compare = std::conditional_t<IsMap, pair_value_compare, Compare>;
using value_compare = typename std::conditional<IsMap, pair_value_compare, Compare>::type;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = value_type const&;
@@ -398,8 +401,6 @@ public:
class chronological_t
{
chronological_t() = default;
public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
@@ -487,7 +488,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -496,16 +497,20 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
}
private:
chronological_t()
{
}
chronological_t(chronological_t const&) = delete;
chronological_t(chronological_t&&) = delete;
private:
friend class aged_ordered_container;
list_type mutable list;
} chronological;
@@ -611,30 +616,30 @@ public:
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
at(K const& k);
template <
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type const&
at(K const& k) const;
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
operator[](Key const& key);
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
operator[](Key&& key);
//--------------------------------------------------------------------------
@@ -718,7 +723,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -727,7 +732,7 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -769,35 +774,37 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
insert(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
// set
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value)
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
insert(value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
// multiset
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
insert(value_type&& value) ->
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
//---
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(const_iterator hint, value_type const& value)
-> std::enable_if_t<!maybe_multi, iterator>;
insert(const_iterator hint, value_type const& value) ->
typename std::enable_if<!maybe_multi, iterator>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -807,11 +814,12 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(const_iterator hint, value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>;
insert(const_iterator hint, value_type&& value) ->
typename std::enable_if<!maybe_multi, iterator>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -820,9 +828,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
insert(P&& value)
{
return emplace(std::forward<P>(value));
@@ -830,9 +838,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
insert(const_iterator hint, P&& value)
{
return emplace_hint(hint, std::forward<P>(value));
@@ -855,22 +863,23 @@ public:
// map, set
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
emplace(Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
// map, set
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint(const_iterator hint, Args&&... args)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
emplace_hint(const_iterator hint, Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
emplace_hint(const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -1154,12 +1163,12 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
std::enable_if_t<maybe_propagate>
typename std::enable_if<maybe_propagate>::type
swap_data(aged_ordered_container& other) noexcept;
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
std::enable_if_t<!maybe_propagate>
typename std::enable_if<!maybe_propagate>::type
swap_data(aged_ordered_container& other) noexcept;
private:
@@ -1386,7 +1395,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K const& k)
{
auto const iter(m_cont.find(k, std::cref(m_config.key_compare())));
@@ -1408,7 +1417,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](
Key const& key)
{
@@ -1427,7 +1436,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key&& key)
{
typename cont_type::insert_commit_data d;
@@ -1462,7 +1471,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
@@ -1481,7 +1491,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
{
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
element* const p(new_element(value));
@@ -1495,7 +1505,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, bool maybe_map>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
@@ -1514,7 +1525,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, bool maybe_map>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
{
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
element* const p(new_element(std::move(value)));
@@ -1531,7 +1542,7 @@ template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
const_iterator hint,
value_type const& value) -> std::enable_if_t<!maybe_multi, iterator>
value_type const& value) -> typename std::enable_if<!maybe_multi, iterator>::type
{
typename cont_type::insert_commit_data d;
auto const result(
@@ -1552,7 +1563,7 @@ template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
const_iterator hint,
value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>
value_type&& value) -> typename std::enable_if<!maybe_multi, iterator>::type
{
typename cont_type::insert_commit_data d;
auto const result(
@@ -1572,7 +1583,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
-> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
// VFALCO NOTE Its unfortunate that we need to
// construct element here
@@ -1594,7 +1605,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
-> std::enable_if_t<maybe_multi, iterator>
-> typename std::enable_if<maybe_multi, iterator>::type
{
element* const p(new_element(std::forward<Args>(args)...));
auto const before(m_cont.upper_bound(extract(p->value), std::cref(m_config.key_compare())));
@@ -1609,7 +1620,7 @@ template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace_hint(
const_iterator hint,
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
// VFALCO NOTE Its unfortunate that we need to
// construct element here
@@ -1759,7 +1770,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::touch
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_propagate>
std::enable_if_t<maybe_propagate>
typename std::enable_if<maybe_propagate>::type
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
aged_ordered_container& other) noexcept
{
@@ -1770,7 +1781,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_propagate>
std::enable_if_t<!maybe_propagate>
typename std::enable_if<!maybe_propagate>::type
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
aged_ordered_container& other) noexcept
{

View File

@@ -62,7 +62,8 @@ template <
class Clock = std::chrono::steady_clock,
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
class Allocator =
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
class aged_unordered_container
{
public:
@@ -71,7 +72,7 @@ public:
using duration = typename clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -114,7 +115,8 @@ private:
template <
class... Args,
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
class =
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
element(time_point const& when_, Args&&... args)
: value(std::forward<Args>(args)...), when(when_)
{
@@ -131,7 +133,9 @@ private:
using argument_type = element;
using result_type = size_t;
ValueHash() = default;
ValueHash()
{
}
ValueHash(Hash const& h) : Hash(h)
{
@@ -149,7 +153,7 @@ private:
return *this;
}
[[nodiscard]] Hash const&
Hash const&
hash_function() const
{
return *this;
@@ -165,7 +169,9 @@ private:
using second_argument_type = element;
using result_type = bool;
KeyValueEqual() = default;
KeyValueEqual()
{
}
KeyValueEqual(KeyEqual const& keyEqual) : KeyEqual(keyEqual)
{
@@ -195,7 +201,7 @@ private:
return *this;
}
[[nodiscard]] KeyEqual const&
KeyEqual const&
key_eq() const
{
return *this;
@@ -205,7 +211,7 @@ private:
using list_type = typename boost::intrusive::
make_list<element, boost::intrusive::constant_time_size<false>>::type;
using cont_type = std::conditional_t<
using cont_type = typename std::conditional<
IsMulti,
typename boost::intrusive::make_unordered_multiset<
element,
@@ -218,7 +224,7 @@ private:
boost::intrusive::constant_time_size<true>,
boost::intrusive::hash<ValueHash>,
boost::intrusive::equal<KeyValueEqual>,
boost::intrusive::cache_begin<true>>::type>;
boost::intrusive::cache_begin<true>>::type>::type;
using bucket_type = typename cont_type::bucket_type;
using bucket_traits = typename cont_type::bucket_traits;
@@ -348,7 +354,7 @@ private:
return *this;
}
[[nodiscard]] ValueHash const&
ValueHash const&
value_hash() const
{
return *this;
@@ -360,7 +366,7 @@ private:
return ValueHash::hash_function();
}
[[nodiscard]] Hash const&
Hash const&
hash_function() const
{
return ValueHash::hash_function();
@@ -372,7 +378,7 @@ private:
return *this;
}
[[nodiscard]] KeyValueEqual const&
KeyValueEqual const&
key_value_equal() const
{
return *this;
@@ -384,7 +390,7 @@ private:
return key_value_equal().key_eq();
}
[[nodiscard]] KeyEqual const&
KeyEqual const&
key_eq() const
{
return key_value_equal().key_eq();
@@ -396,7 +402,7 @@ private:
return beast::detail::empty_base_optimization<ElementAllocator>::member();
}
[[nodiscard]] ElementAllocator const&
ElementAllocator const&
alloc() const
{
return beast::detail::empty_base_optimization<ElementAllocator>::member();
@@ -433,7 +439,7 @@ private:
m_vec.clear();
}
[[nodiscard]] size_type
size_type
max_bucket_count() const
{
return m_vec.max_size();
@@ -445,7 +451,7 @@ private:
return m_max_load_factor;
}
[[nodiscard]] float const&
float const&
max_load_factor() const
{
return m_max_load_factor;
@@ -656,7 +662,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -665,17 +671,20 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
}
private:
chronological_t()
{
}
chronological_t(chronological_t const&) = delete;
chronological_t(chronological_t&&) = delete;
chronological_t() = default;
private:
friend class aged_unordered_container;
list_type mutable list;
} chronological;
@@ -853,30 +862,30 @@ public:
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
at(K const& k);
template <
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type const&
at(K const& k) const;
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
operator[](Key const& key);
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
operator[](Key&& key);
//--------------------------------------------------------------------------
@@ -924,7 +933,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -933,7 +942,7 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -975,27 +984,29 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
insert(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
// map, set
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value)
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
insert(value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
insert(value_type&& value) ->
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
// map, set
template <bool maybe_multi = IsMulti>
std::enable_if_t<!maybe_multi, iterator>
typename std::enable_if<!maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type const& value)
{
// Hint is ignored but we provide the interface so
@@ -1005,7 +1016,7 @@ public:
// multimap, multiset
template <bool maybe_multi = IsMulti>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO The hint could be used to let
@@ -1015,7 +1026,7 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
std::enable_if_t<!maybe_multi, iterator>
typename std::enable_if<!maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type&& value)
{
// Hint is ignored but we provide the interface so
@@ -1025,7 +1036,7 @@ public:
// multimap, multiset
template <bool maybe_multi = IsMulti>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
insert(const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO The hint could be used to let
@@ -1035,9 +1046,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
insert(P&& value)
{
return emplace(std::forward<P>(value));
@@ -1045,9 +1056,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
insert(const_iterator hint, P&& value)
{
return emplace_hint(hint, std::forward<P>(value));
@@ -1069,22 +1080,23 @@ public:
// set, map
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
emplace(Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
// set, map
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint(const_iterator /*hint*/, Args&&... args)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
emplace_hint(const_iterator /*hint*/, Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
std::enable_if_t<maybe_multi, iterator>
typename std::enable_if<maybe_multi, iterator>::type
emplace_hint(const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO The hint could be used for multi, to let
@@ -1316,7 +1328,7 @@ public:
class OtherHash,
class OtherAllocator,
bool maybe_multi = IsMulti>
std::enable_if_t<!maybe_multi, bool>
typename std::enable_if<!maybe_multi, bool>::type
operator==(aged_unordered_container<
false,
OtherIsMap,
@@ -1335,7 +1347,7 @@ public:
class OtherHash,
class OtherAllocator,
bool maybe_multi = IsMulti>
std::enable_if_t<maybe_multi, bool>
typename std::enable_if<maybe_multi, bool>::type
operator==(aged_unordered_container<
true,
OtherIsMap,
@@ -1389,13 +1401,14 @@ private:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert_unchecked(value_type const& value)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
insert_unchecked(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
insert_unchecked(value_type const& value) ->
typename std::enable_if<maybe_multi, iterator>::type;
template <class InputIt>
void
@@ -1436,7 +1449,7 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
std::enable_if_t<maybe_propagate>
typename std::enable_if<maybe_propagate>::type
swap_data(aged_unordered_container& other) noexcept
{
std::swap(m_config.key_compare(), other.m_config.key_compare());
@@ -1446,7 +1459,7 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
std::enable_if_t<!maybe_propagate>
typename std::enable_if<!maybe_propagate>::type
swap_data(aged_unordered_container& other) noexcept
{
std::swap(m_config.key_compare(), other.m_config.key_compare());
@@ -2101,7 +2114,7 @@ template <
class KeyEqual,
class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::at(K const& k)
{
auto const iter(
@@ -2142,7 +2155,7 @@ template <
class KeyEqual,
class Allocator>
template <bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
Key const& key)
{
@@ -2171,7 +2184,7 @@ template <
class KeyEqual,
class Allocator>
template <bool maybe_multi, bool maybe_map, class>
std::conditional_t<IsMap, T, void*>&
typename std::conditional<IsMap, T, void*>::type&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
Key&& key)
{
@@ -2226,7 +2239,8 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
maybe_rehash(1);
typename cont_type::insert_commit_data d;
@@ -2258,7 +2272,7 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
{
maybe_rehash(1);
element* const p(new_element(value));
@@ -2280,7 +2294,8 @@ template <
template <bool maybe_multi, bool maybe_map>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
{
maybe_rehash(1);
typename cont_type::insert_commit_data d;
@@ -2312,7 +2327,7 @@ template <
template <bool maybe_multi, bool maybe_map>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
{
maybe_rehash(1);
element* const p(new_element(std::move(value)));
@@ -2335,7 +2350,7 @@ template <
template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
maybe_rehash(1);
// VFALCO NOTE Its unfortunate that we need to
@@ -2400,7 +2415,7 @@ template <
template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
Args&&... args) -> std::enable_if_t<maybe_multi, iterator>
Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type
{
maybe_rehash(1);
element* const p(new_element(std::forward<Args>(args)...));
@@ -2423,7 +2438,7 @@ template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace_hint(
const_iterator /*hint*/,
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
maybe_rehash(1);
// VFALCO NOTE Its unfortunate that we need to
@@ -2575,7 +2590,7 @@ template <
class OtherHash,
class OtherAllocator,
bool maybe_multi>
std::enable_if_t<!maybe_multi, bool>
typename std::enable_if<!maybe_multi, bool>::type
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
aged_unordered_container<
false,
@@ -2615,7 +2630,7 @@ template <
class OtherHash,
class OtherAllocator,
bool maybe_multi>
std::enable_if_t<maybe_multi, bool>
typename std::enable_if<maybe_multi, bool>::type
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
aged_unordered_container<
true,
@@ -2662,8 +2677,8 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
insert_unchecked(value_type const& value)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
insert_unchecked(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(
@@ -2694,7 +2709,8 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
insert_unchecked(value_type const& value) ->
typename std::enable_if<maybe_multi, iterator>::type
{
element* const p(new_element(value));
chronological.list.push_back(*p);

View File

@@ -11,11 +11,12 @@
#include <type_traits>
#include <utility>
namespace beast::detail {
namespace beast {
namespace detail {
template <class T>
struct is_empty_base_optimization_derived
: std::integral_constant<bool, std::is_empty_v<T> && !boost::is_final<T>::value>
: std::integral_constant<bool, std::is_empty<T>::value && !boost::is_final<T>::value>
{
};
@@ -43,7 +44,7 @@ public:
return *this;
}
[[nodiscard]] T const&
T const&
member() const noexcept
{
return *this;
@@ -85,4 +86,5 @@ public:
}
};
} // namespace beast::detail
} // namespace detail
} // namespace beast

View File

@@ -16,7 +16,7 @@ struct CopyConst
{
explicit CopyConst() = default;
using type = std::remove_const_t<U>;
using type = typename std::remove_const<U>::type;
};
template <typename T, typename U>
@@ -35,11 +35,9 @@ struct CopyConst<T const, U>
template <typename T, typename Tag>
class ListNode
{
ListNode() = default;
private:
using value_type = T;
friend T;
friend class List<T, Tag>;
template <typename>
@@ -128,7 +126,7 @@ public:
}
private:
[[nodiscard]] reference
reference
dereference() const noexcept
{
return static_cast<reference>(*m_node);
@@ -287,14 +285,14 @@ public:
/** Determine if the list is empty.
@return `true` if the list is empty.
*/
[[nodiscard]] bool
bool
empty() const noexcept
{
return size() == 0;
}
/** Returns the number of elements in the list. */
[[nodiscard]] size_type
size_type
size() const noexcept
{
return m_size;
@@ -314,7 +312,7 @@ public:
@invariant The list may not be empty.
@return A const reference to the first element.
*/
[[nodiscard]] const_reference
const_reference
front() const noexcept
{
return element_from(m_head.m_next);
@@ -334,7 +332,7 @@ public:
@invariant The list may not be empty.
@return A const reference to the last element.
*/
[[nodiscard]] const_reference
const_reference
back() const noexcept
{
return element_from(m_tail.m_prev);
@@ -352,7 +350,7 @@ public:
/** Obtain a const iterator to the beginning of the list.
@return A const iterator pointing to the beginning of the list.
*/
[[nodiscard]] const_iterator
const_iterator
begin() const noexcept
{
return const_iterator(m_head.m_next);
@@ -361,7 +359,7 @@ public:
/** Obtain a const iterator to the beginning of the list.
@return A const iterator pointing to the beginning of the list.
*/
[[nodiscard]] const_iterator
const_iterator
cbegin() const noexcept
{
return const_iterator(m_head.m_next);
@@ -379,7 +377,7 @@ public:
/** Obtain a const iterator to the end of the list.
@return A constiterator pointing to the end of the list.
*/
[[nodiscard]] const_iterator
const_iterator
end() const noexcept
{
return const_iterator(&m_tail);
@@ -388,7 +386,7 @@ public:
/** Obtain a const iterator to the end of the list
@return A constiterator pointing to the end of the list.
*/
[[nodiscard]] const_iterator
const_iterator
cend() const noexcept
{
return const_iterator(&m_tail);
@@ -549,7 +547,7 @@ public:
@param element The element to obtain an iterator for.
@return A const iterator to the element.
*/
[[nodiscard]] const_iterator
const_iterator
const_iterator_to(T const& element) const noexcept
{
return const_iterator(static_cast<Node const*>(&element));

View File

@@ -13,18 +13,22 @@ class LockFreeStackIterator
{
protected:
using Node = typename Container::Node;
using NodePtr = std::conditional_t<IsConst, Node const*, Node*>;
using NodePtr = typename std::conditional<IsConst, Node const*, Node*>::type;
public:
using iterator_category = std::forward_iterator_tag;
using value_type = typename Container::value_type;
using difference_type = typename Container::difference_type;
using pointer =
std::conditional_t<IsConst, typename Container::const_pointer, typename Container::pointer>;
using reference = std::
conditional_t<IsConst, typename Container::const_reference, typename Container::reference>;
using pointer = typename std::
conditional<IsConst, typename Container::const_pointer, typename Container::pointer>::type;
using reference = typename std::conditional<
IsConst,
typename Container::const_reference,
typename Container::reference>::type;
LockFreeStackIterator() = default;
LockFreeStackIterator() : m_node()
{
}
LockFreeStackIterator(NodePtr node) : m_node(node)
{
@@ -77,7 +81,7 @@ public:
}
private:
NodePtr m_node{};
NodePtr m_node;
};
//------------------------------------------------------------------------------
@@ -162,7 +166,7 @@ public:
operator=(LockFreeStack const&) = delete;
/** Returns true if the stack is empty. */
[[nodiscard]] bool
bool
empty() const
{
return m_head.load() == &m_end;
@@ -237,25 +241,25 @@ public:
return iterator(&m_end);
}
[[nodiscard]] const_iterator
const_iterator
begin() const
{
return const_iterator(m_head.load());
}
[[nodiscard]] const_iterator
const_iterator
end() const
{
return const_iterator(&m_end);
}
[[nodiscard]] const_iterator
const_iterator
cbegin() const
{
return const_iterator(m_head.load());
}
[[nodiscard]] const_iterator
const_iterator
cend() const
{
return const_iterator(&m_end);

View File

@@ -37,15 +37,15 @@ public:
parse(std::string_view input);
/** Produce a string from semantic version components. */
[[nodiscard]] std::string
std::string
print() const;
[[nodiscard]] bool
inline bool
isRelease() const noexcept
{
return preReleaseIdentifiers.empty();
}
[[nodiscard]] bool
inline bool
isPreRelease() const noexcept
{
return !isRelease();

View File

@@ -69,7 +69,7 @@ template <class T>
struct is_uniquely_represented
: public std::integral_constant<
bool,
std::is_integral_v<T> || std::is_enum_v<T> || std::is_pointer_v<T>>
std::is_integral<T>::value || std::is_enum<T>::value || std::is_pointer<T>::value>
{
explicit is_uniquely_represented() = default;
};
@@ -203,14 +203,13 @@ template <class Hasher, class T>
inline std::enable_if_t<is_contiguously_hashable<T, Hasher>::value>
hash_append(Hasher& h, T const& t) noexcept
{
// NOLINTNEXTLINE(bugprone-sizeof-expression)
h(static_cast<void const*>(std::addressof(t)), sizeof(t));
h(std::addressof(t), sizeof(t));
}
template <class Hasher, class T>
inline std::enable_if_t<
!is_contiguously_hashable<T, Hasher>::value &&
(std::is_integral_v<T> || std::is_pointer_v<T> || std::is_enum_v<T>)>
(std::is_integral<T>::value || std::is_pointer<T>::value || std::is_enum<T>::value)>
hash_append(Hasher& h, T t) noexcept
{
detail::reverse_bytes(t);
@@ -218,7 +217,7 @@ hash_append(Hasher& h, T t) noexcept
}
template <class Hasher, class T>
inline std::enable_if_t<std::is_floating_point_v<T>>
inline std::enable_if_t<std::is_floating_point<T>::value>
hash_append(Hasher& h, T t) noexcept
{
if (t == 0)

View File

@@ -64,7 +64,7 @@ private:
void
flushToState(void const* data, std::size_t len)
{
if (state_ == nullptr)
if (!state_)
{
state_ = allocState();
if (seed_.has_value())
@@ -78,7 +78,7 @@ private:
}
XXH3_64bits_update(state_, readBuffer_.data(), readBuffer_.size());
resetBuffers();
if ((data != nullptr) && (len != 0u))
if (data && len)
{
XXH3_64bits_update(state_, data, len);
}
@@ -87,18 +87,22 @@ private:
result_type
retrieveHash()
{
if (state_ != nullptr)
if (state_)
{
flushToState(nullptr, 0);
return XXH3_64bits_digest(state_);
}
if (seed_.has_value())
else
{
return XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), *seed_);
if (seed_.has_value())
{
return XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), *seed_);
}
else
{
return XXH3_64bits(readBuffer_.data(), readBuffer_.size());
}
}
return XXH3_64bits(readBuffer_.data(), readBuffer_.size());
}
public:
@@ -115,19 +119,19 @@ public:
~xxhasher() noexcept
{
if (state_ != nullptr)
if (state_)
{
XXH3_freeState(state_);
}
}
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
explicit xxhasher(Seed seed) : seed_(seed)
{
resetBuffers();
}
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
xxhasher(Seed seed, Seed) : seed_(seed)
{
resetBuffers();

View File

@@ -8,7 +8,8 @@
#include <string>
namespace beast::insight {
namespace beast {
namespace insight {
/** Interface for a manager that allows collection of metrics.
@@ -116,4 +117,5 @@ public:
/** @} */
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
@@ -22,7 +23,9 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Counter() = default;
Counter()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -88,4 +91,5 @@ private:
std::shared_ptr<CounterImpl> m_impl;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -3,7 +3,8 @@
#include <cstdint>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
class Counter;
@@ -17,4 +18,5 @@ public:
increment(value_type amount) = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -5,7 +5,8 @@
#include <chrono>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
/** A metric for reporting event timing.
@@ -24,7 +25,9 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Event() = default;
Event()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -45,7 +48,7 @@ public:
m_impl->notify(ceil<value_type>(value));
}
[[nodiscard]] std::shared_ptr<EventImpl> const&
std::shared_ptr<EventImpl> const&
impl() const
{
return m_impl;
@@ -55,4 +58,5 @@ private:
std::shared_ptr<EventImpl> m_impl;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -3,7 +3,8 @@
#include <chrono>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
class Event;
@@ -17,4 +18,5 @@ public:
notify(value_type const& value) = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
@@ -24,7 +25,9 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Gauge() = default;
Gauge()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -108,7 +111,7 @@ public:
}
/** @} */
[[nodiscard]] std::shared_ptr<GaugeImpl> const&
std::shared_ptr<GaugeImpl> const&
impl() const
{
return m_impl;
@@ -118,4 +121,5 @@ private:
std::shared_ptr<GaugeImpl> m_impl;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -3,7 +3,8 @@
#include <cstdint>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
class Gauge;
@@ -20,4 +21,5 @@ public:
increment(difference_type amount) = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -5,7 +5,8 @@
#include <memory>
#include <string>
namespace beast::insight {
namespace beast {
namespace insight {
/** A collector front-end that manages a group of metrics. */
class Group : public Collector
@@ -14,8 +15,9 @@ public:
using ptr = std::shared_ptr<Group>;
/** Returns the name of this group, for diagnostics. */
[[nodiscard]] virtual std::string const&
virtual std::string const&
name() const = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -6,7 +6,8 @@
#include <memory>
#include <string>
namespace beast::insight {
namespace beast {
namespace insight {
/** A container for managing a set of metric groups. */
class Groups
@@ -31,4 +32,5 @@ public:
std::unique_ptr<Groups>
make_Groups(Collector::ptr const& collector);
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
/** A reference to a handler for performing polled collection. */
class Hook final
@@ -13,7 +14,9 @@ public:
/** Create a null hook.
A null hook has no associated handler.
*/
Hook() = default;
Hook()
{
}
/** Create a hook referencing the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -24,7 +27,7 @@ public:
{
}
[[nodiscard]] std::shared_ptr<HookImpl> const&
std::shared_ptr<HookImpl> const&
impl() const
{
return m_impl;
@@ -34,4 +37,5 @@ private:
std::shared_ptr<HookImpl> m_impl;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -3,7 +3,8 @@
#include <functional>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
class HookImpl : public std::enable_shared_from_this<HookImpl>
{
@@ -13,4 +14,5 @@ public:
virtual ~HookImpl() = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
@@ -21,7 +22,9 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Meter() = default;
Meter()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -63,7 +66,7 @@ public:
}
/** @} */
[[nodiscard]] std::shared_ptr<MeterImpl> const&
std::shared_ptr<MeterImpl> const&
impl() const
{
return m_impl;
@@ -73,4 +76,5 @@ private:
std::shared_ptr<MeterImpl> m_impl;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -3,7 +3,8 @@
#include <cstdint>
#include <memory>
namespace beast::insight {
namespace beast {
namespace insight {
class Meter;
@@ -17,4 +18,5 @@ public:
increment(value_type amount) = 0;
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -2,7 +2,8 @@
#include <xrpl/beast/insight/Collector.h>
namespace beast::insight {
namespace beast {
namespace insight {
/** A Collector which does not collect metrics. */
class NullCollector : public Collector
@@ -14,4 +15,5 @@ public:
New();
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <xrpl/beast/net/IPEndpoint.h>
#include <xrpl/beast/utility/Journal.h>
namespace beast::insight {
namespace beast {
namespace insight {
/** A Collector that reports metrics to a StatsD server.
Reference:
@@ -24,4 +25,5 @@ public:
New(IP::Endpoint const& address, std::string const& prefix, Journal journal);
};
} // namespace beast::insight
} // namespace insight
} // namespace beast

View File

@@ -70,13 +70,9 @@ hash_append(Hasher& h, beast::IP::Address const& addr) noexcept
{
using beast::hash_append;
if (addr.is_v4())
{
hash_append(h, addr.to_v4().to_bytes());
}
else if (addr.is_v6())
{
hash_append(h, addr.to_v6().to_bytes());
}
else
{
// LCOV_EXCL_START

View File

@@ -4,7 +4,8 @@
#include <boost/asio.hpp>
namespace beast::IP {
namespace beast {
namespace IP {
/** Convert to Endpoint.
The port is set to zero.
@@ -26,7 +27,8 @@ to_asio_address(Endpoint const& endpoint);
boost::asio::ip::tcp::endpoint
to_asio_endpoint(Endpoint const& endpoint);
} // namespace beast::IP
} // namespace IP
} // namespace beast
namespace beast {

View File

@@ -4,7 +4,8 @@
#include <boost/asio/ip/address_v4.hpp>
namespace beast::IP {
namespace beast {
namespace IP {
using AddressV4 = boost::asio::ip::address_v4;
@@ -22,4 +23,5 @@ is_public(AddressV4 const& addr);
char
get_class(AddressV4 const& address);
} // namespace beast::IP
} // namespace IP
} // namespace beast

View File

@@ -4,7 +4,8 @@
#include <boost/asio/ip/address_v6.hpp>
namespace beast::IP {
namespace beast {
namespace IP {
using AddressV6 = boost::asio::ip::address_v6;
@@ -16,4 +17,5 @@ is_private(AddressV6 const& addr);
bool
is_public(AddressV6 const& addr);
} // namespace beast::IP
} // namespace IP
} // namespace beast

Some files were not shown because too many files have changed in this diff Show More