From 63532dddd46b859bd1627e2c612e255bbdbbc719 Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Fri, 8 May 2026 08:32:53 -0400 Subject: [PATCH] Reorganize --- .../scripts/levelization/results/ordering.txt | 24 ++ cmake/XrplCore.cmake | 14 +- include/xrpl/config/BasicConfig.h | 378 ++++++++++++++++++ .../BasicConfig.h => config/Constants.h} | 374 ----------------- include/xrpl/core/PerfLog.h | 2 +- include/xrpl/nodestore/Database.h | 2 +- include/xrpl/nodestore/Factory.h | 2 +- include/xrpl/server/Port.h | 2 +- .../BasicConfig.cpp => config/Config.cpp} | 3 +- src/libxrpl/nodestore/Database.cpp | 2 +- src/libxrpl/nodestore/DatabaseRotatingImp.cpp | 2 +- src/libxrpl/nodestore/ManagerImp.cpp | 2 +- .../nodestore/backend/MemoryFactory.cpp | 2 +- src/libxrpl/nodestore/backend/NuDBFactory.cpp | 2 +- src/libxrpl/nodestore/backend/NullFactory.cpp | 2 +- .../nodestore/backend/RocksDBFactory.cpp | 2 +- src/libxrpl/rdb/SociDB.cpp | 2 +- src/libxrpl/server/Port.cpp | 2 +- src/libxrpl/server/State.cpp | 2 +- src/test/app/AmendmentTable_test.cpp | 2 +- src/test/app/Batch_test.cpp | 2 +- src/test/app/FeeVote_test.cpp | 2 +- src/test/app/GRPCServerTLS_test.cpp | 2 +- src/test/app/HashRouter_test.cpp | 2 +- src/test/app/Manifest_test.cpp | 2 +- src/test/app/MultiSign_test.cpp | 2 +- src/test/app/Regression_test.cpp | 2 +- src/test/app/SHAMapStore_test.cpp | 2 +- src/test/app/TxQ_test.cpp | 2 +- src/test/app/ValidatorKeys_test.cpp | 2 +- src/test/app/ValidatorList_test.cpp | 2 +- src/test/core/Config_test.cpp | 2 +- src/test/core/SociDB_test.cpp | 2 +- src/test/jtx/Env_test.cpp | 2 +- src/test/jtx/envconfig.h | 2 +- src/test/jtx/impl/JSONRPCClient.cpp | 2 +- src/test/jtx/impl/WSClient.cpp | 2 +- src/test/jtx/impl/envconfig.cpp | 2 +- src/test/nodestore/Backend_test.cpp | 2 +- src/test/nodestore/Database_test.cpp | 2 +- src/test/nodestore/NuDBFactory_test.cpp | 2 +- src/test/nodestore/Timing_test.cpp | 2 +- src/test/overlay/cluster_test.cpp | 2 +- src/test/rpc/AmendmentBlocked_test.cpp | 2 +- src/test/rpc/Feature_test.cpp | 2 +- src/test/rpc/JSONRPC_test.cpp | 2 +- src/test/rpc/LedgerRPC_test.cpp | 2 +- src/test/rpc/ManifestRPC_test.cpp | 2 +- src/test/rpc/RPCOverload_test.cpp | 2 +- src/test/rpc/ServerInfo_test.cpp | 2 +- src/test/rpc/Simulate_test.cpp | 2 +- src/test/rpc/Subscribe_test.cpp | 2 +- src/test/rpc/ValidatorInfo_test.cpp | 2 +- src/test/rpc/ValidatorRPC_test.cpp | 2 +- src/test/server/ServerStatus_test.cpp | 2 +- src/test/server/Server_test.cpp | 2 +- src/test/shamap/common.h | 2 +- src/tests/libxrpl/helpers/TestFamily.h | 2 +- src/xrpld/app/main/Application.cpp | 2 +- src/xrpld/app/main/CollectorManager.cpp | 2 +- src/xrpld/app/main/CollectorManager.h | 2 +- src/xrpld/app/main/GRPCServer.cpp | 2 +- src/xrpld/app/main/Main.cpp | 2 +- src/xrpld/app/main/NodeIdentity.cpp | 2 +- src/xrpld/app/misc/NetworkOPs.cpp | 2 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 2 +- src/xrpld/app/misc/detail/AmendmentTable.cpp | 2 +- src/xrpld/app/misc/detail/TxQ.cpp | 2 +- src/xrpld/app/misc/detail/ValidatorKeys.cpp | 2 +- .../app/misc/detail/setup_HashRouter.cpp | 2 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 2 +- src/xrpld/app/rdb/detail/PeerFinder.cpp | 2 +- src/xrpld/core/Config.h | 2 +- src/xrpld/core/detail/Config.cpp | 2 +- src/xrpld/overlay/Cluster.h | 2 +- src/xrpld/overlay/detail/Cluster.cpp | 2 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- .../peerfinder/detail/PeerfinderManager.cpp | 2 +- src/xrpld/perflog/detail/PerfLogImp.cpp | 2 +- src/xrpld/rpc/detail/ServerHandler.cpp | 2 +- 80 files changed, 490 insertions(+), 453 deletions(-) create mode 100644 include/xrpl/config/BasicConfig.h rename include/xrpl/{basics/BasicConfig.h => config/Constants.h} (50%) rename src/libxrpl/{basics/BasicConfig.cpp => config/Config.cpp} (99%) diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index c2000d1768..d6a911f048 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -1,6 +1,8 @@ libxrpl.basics > xrpl.basics libxrpl.conditions > xrpl.basics libxrpl.conditions > xrpl.conditions +libxrpl.config > xrpl.basics +libxrpl.config > xrpl.config libxrpl.core > xrpl.basics libxrpl.core > xrpl.core libxrpl.core > xrpl.json @@ -17,6 +19,7 @@ libxrpl.ledger > xrpl.shamap libxrpl.net > xrpl.basics libxrpl.net > xrpl.net libxrpl.nodestore > xrpl.basics +libxrpl.nodestore > xrpl.config libxrpl.nodestore > xrpl.json libxrpl.nodestore > xrpl.nodestore libxrpl.nodestore > xrpl.protocol @@ -24,6 +27,7 @@ libxrpl.protocol > xrpl.basics libxrpl.protocol > xrpl.json libxrpl.protocol > xrpl.protocol libxrpl.rdb > xrpl.basics +libxrpl.rdb > xrpl.config libxrpl.rdb > xrpl.core libxrpl.rdb > xrpl.rdb libxrpl.resource > xrpl.basics @@ -31,6 +35,7 @@ libxrpl.resource > xrpl.json libxrpl.resource > xrpl.protocol libxrpl.resource > xrpl.resource libxrpl.server > xrpl.basics +libxrpl.server > xrpl.config libxrpl.server > xrpl.core libxrpl.server > xrpl.json libxrpl.server > xrpl.protocol @@ -52,6 +57,7 @@ libxrpl.tx > xrpl.tx test.app > test.jtx test.app > test.unit_test test.app > xrpl.basics +test.app > xrpl.config test.app > xrpl.core test.app > xrpld.app test.app > xrpld.consensus @@ -90,6 +96,7 @@ test.consensus > xrpl.tx test.core > test.jtx test.core > test.unit_test test.core > xrpl.basics +test.core > xrpl.config test.core > xrpl.core test.core > xrpld.core test.core > xrpl.json @@ -104,6 +111,7 @@ test.csf > xrpl.protocol test.json > test.jtx test.json > xrpl.json test.jtx > xrpl.basics +test.jtx > xrpl.config test.jtx > xrpl.core test.jtx > xrpld.app test.jtx > xrpld.core @@ -126,6 +134,7 @@ test.ledger > xrpl.protocol test.nodestore > test.jtx test.nodestore > test.unit_test test.nodestore > xrpl.basics +test.nodestore > xrpl.config test.nodestore > xrpld.core test.nodestore > xrpl.nodestore test.nodestore > xrpl.protocol @@ -133,6 +142,7 @@ test.nodestore > xrpl.rdb test.overlay > test.jtx test.overlay > test.unit_test test.overlay > xrpl.basics +test.overlay > xrpl.config test.overlay > xrpld.app test.overlay > xrpld.core test.overlay > xrpld.overlay @@ -159,6 +169,7 @@ test.resource > xrpl.basics test.resource > xrpl.resource test.rpc > test.jtx test.rpc > xrpl.basics +test.rpc > xrpl.config test.rpc > xrpl.core test.rpc > xrpld.app test.rpc > xrpld.core @@ -173,6 +184,7 @@ test.rpc > xrpl.tx test.server > test.jtx test.server > test.unit_test test.server > xrpl.basics +test.server > xrpl.config test.server > xrpld.app test.server > xrpld.core test.server > xrpl.json @@ -180,6 +192,7 @@ test.server > xrpl.protocol test.server > xrpl.server test.shamap > test.unit_test test.shamap > xrpl.basics +test.shamap > xrpl.config test.shamap > xrpl.nodestore test.shamap > xrpl.protocol test.shamap > xrpl.shamap @@ -188,6 +201,7 @@ test.toplevel > xrpl.json test.unit_test > xrpl.basics test.unit_test > xrpl.protocol tests.libxrpl > xrpl.basics +tests.libxrpl > xrpl.config tests.libxrpl > xrpl.core tests.libxrpl > xrpl.json tests.libxrpl > xrpl.ledger @@ -200,7 +214,9 @@ tests.libxrpl > xrpl.shamap tests.libxrpl > xrpl.tx xrpl.conditions > xrpl.basics xrpl.conditions > xrpl.protocol +xrpl.config > xrpl.basics xrpl.core > xrpl.basics +xrpl.core > xrpl.config xrpl.core > xrpl.json xrpl.core > xrpl.protocol xrpl.json > xrpl.basics @@ -210,6 +226,7 @@ xrpl.ledger > xrpl.server xrpl.ledger > xrpl.shamap xrpl.net > xrpl.basics xrpl.nodestore > xrpl.basics +xrpl.nodestore > xrpl.config xrpl.nodestore > xrpl.protocol xrpl.protocol > xrpl.basics xrpl.protocol > xrpl.json @@ -222,6 +239,7 @@ xrpl.resource > xrpl.basics xrpl.resource > xrpl.json xrpl.resource > xrpl.protocol xrpl.server > xrpl.basics +xrpl.server > xrpl.config xrpl.server > xrpl.core xrpl.server > xrpl.json xrpl.server > xrpl.protocol @@ -237,6 +255,7 @@ xrpl.tx > xrpl.ledger xrpl.tx > xrpl.protocol xrpld.app > test.unit_test xrpld.app > xrpl.basics +xrpld.app > xrpl.config xrpld.app > xrpl.core xrpld.app > xrpld.consensus xrpld.app > xrpld.core @@ -255,11 +274,13 @@ xrpld.consensus > xrpl.json xrpld.consensus > xrpl.ledger xrpld.consensus > xrpl.protocol xrpld.core > xrpl.basics +xrpld.core > xrpl.config xrpld.core > xrpl.core xrpld.core > xrpl.net xrpld.core > xrpl.protocol xrpld.core > xrpl.rdb xrpld.overlay > xrpl.basics +xrpld.overlay > xrpl.config xrpld.overlay > xrpl.core xrpld.overlay > xrpld.consensus xrpld.overlay > xrpld.core @@ -272,15 +293,18 @@ xrpld.overlay > xrpl.server xrpld.overlay > xrpl.shamap xrpld.overlay > xrpl.tx xrpld.peerfinder > xrpl.basics +xrpld.peerfinder > xrpl.config xrpld.peerfinder > xrpld.core xrpld.peerfinder > xrpl.protocol xrpld.peerfinder > xrpl.rdb xrpld.perflog > xrpl.basics +xrpld.perflog > xrpl.config xrpld.perflog > xrpl.core xrpld.perflog > xrpld.rpc xrpld.perflog > xrpl.json xrpld.perflog > xrpl.protocol xrpld.rpc > xrpl.basics +xrpld.rpc > xrpl.config xrpld.rpc > xrpl.core xrpld.rpc > xrpld.core xrpld.rpc > xrpl.json diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 9b1dc74049..52d7714a99 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -94,6 +94,9 @@ add_module(xrpl basics) target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast) # Level 03 +add_module(xrpl config) +target_link_libraries(xrpl.libxrpl.config PUBLIC xrpl.libxrpl.basics) + add_module(xrpl json) target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics) @@ -120,6 +123,7 @@ target_link_libraries( xrpl.libxrpl.core PUBLIC xrpl.libxrpl.basics + xrpl.libxrpl.config xrpl.libxrpl.json xrpl.libxrpl.protocol xrpl.libxrpl.protocol_autogen @@ -143,7 +147,11 @@ target_link_libraries( add_module(xrpl nodestore) target_link_libraries( xrpl.libxrpl.nodestore - PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol + PUBLIC + xrpl.libxrpl.basics + xrpl.libxrpl.config + xrpl.libxrpl.json + xrpl.libxrpl.protocol ) add_module(xrpl shamap) @@ -159,13 +167,14 @@ target_link_libraries( add_module(xrpl rdb) target_link_libraries( xrpl.libxrpl.rdb - PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core + PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.config xrpl.libxrpl.core ) add_module(xrpl server) target_link_libraries( xrpl.libxrpl.server PUBLIC + xrpl.libxrpl.config xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb @@ -210,6 +219,7 @@ target_link_modules( basics beast conditions + config core crypto git diff --git a/include/xrpl/config/BasicConfig.h b/include/xrpl/config/BasicConfig.h new file mode 100644 index 0000000000..34713aa954 --- /dev/null +++ b/include/xrpl/config/BasicConfig.h @@ -0,0 +1,378 @@ +#pragma once + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace xrpl { + +using IniFileSections = std::unordered_map>; + +//------------------------------------------------------------------------------ + +/** Holds a collection of configuration values. + A configuration file contains zero or more sections. +*/ +class Section +{ +private: + std::string name_; + std::unordered_map lookup_; + std::vector lines_; + std::vector values_; + bool hadTrailingComments_ = false; + + using const_iterator = decltype(lookup_)::const_iterator; + +public: + /** Create an empty section. */ + explicit Section(std::string name = ""); + + /** Returns the name of this section. */ + [[nodiscard]] std::string const& + name() const + { + return name_; + } + + /** Returns all the lines in the section. + This includes everything. + */ + [[nodiscard]] std::vector const& + lines() const + { + return lines_; + } + + /** Returns all the values in the section. + Values are non-empty lines which are not key/value pairs. + */ + [[nodiscard]] std::vector const& + values() const + { + return values_; + } + + /** + * Set the legacy value for this section. + */ + void + legacy(std::string value) + { + if (lines_.empty()) + { + lines_.emplace_back(std::move(value)); + } + else + { + lines_[0] = std::move(value); + } + } + + /** + * Get the legacy value for this section. + * + * @return The retrieved value. A section with an empty legacy value returns + an empty string. + */ + [[nodiscard]] std::string + legacy() const + { + if (lines_.empty()) + return ""; + if (lines_.size() > 1) + { + Throw( + "A legacy value must have exactly one line. Section: " + name_); + } + return lines_[0]; + } + + /** Set a key/value pair. + The previous value is discarded. + */ + void + set(std::string const& key, std::string const& value); + + /** Append a set of lines to this section. + Lines containing key/value pairs are added to the map, + else they are added to the values list. Everything is + added to the lines list. + */ + void + append(std::vector const& lines); + + /** Append a line to this section. */ + void + append(std::string const& line) + { + append(std::vector{line}); + } + + /** Returns `true` if a key with the given name exists. */ + [[nodiscard]] bool + exists(std::string const& name) const; + + template + [[nodiscard]] std::optional + get(std::string const& name) const + { + auto const iter = lookup_.find(name); + if (iter == lookup_.end()) + return std::nullopt; + return boost::lexical_cast(iter->second); + } + + /// Returns a value if present, else another value. + template + [[nodiscard]] T + valueOr(std::string const& name, T const& other) const + { + auto const v = get(name); + return v.has_value() ? *v : other; + } + + // indicates if trailing comments were seen + // during the appending of any lines/values + [[nodiscard]] bool + hadTrailingComments() const + { + return hadTrailingComments_; + } + + friend std::ostream& + operator<<(std::ostream&, Section const& section); + + // Returns `true` if there are no key/value pairs. + [[nodiscard]] bool + empty() const + { + return lookup_.empty(); + } + + // Returns the number of key/value pairs. + [[nodiscard]] std::size_t + size() const + { + return lookup_.size(); + } + + // For iteration of key/value pairs. + [[nodiscard]] const_iterator + begin() const + { + return lookup_.cbegin(); + } + + // For iteration of key/value pairs. + [[nodiscard]] const_iterator + cbegin() const + { + return lookup_.cbegin(); + } + + // For iteration of key/value pairs. + [[nodiscard]] const_iterator + end() const + { + return lookup_.cend(); + } + + // For iteration of key/value pairs. + [[nodiscard]] const_iterator + cend() const + { + return lookup_.cend(); + } +}; + +//------------------------------------------------------------------------------ + +/** Holds unparsed configuration information. + The raw data sections are processed with intermediate parsers specific + to each module instead of being all parsed in a central location. +*/ +class BasicConfig +{ +private: + std::unordered_map map_; + +public: + /** Returns `true` if a section with the given name exists. */ + [[nodiscard]] bool + exists(std::string const& name) const; + + /** Returns the section with the given name. + If the section does not exist, an empty section is returned. + */ + /** @{ */ + Section& + section(std::string const& name); + + [[nodiscard]] Section const& + section(std::string const& name) const; + + Section const& + operator[](std::string const& name) const + { + return section(name); + } + + Section& + operator[](std::string const& name) + { + return section(name); + } + /** @} */ + + /** Overwrite a key/value pair with a command line argument + If the section does not exist it is created. + The previous value, if any, is overwritten. + */ + void + overwrite(std::string const& section, std::string const& key, std::string const& value); + + /** Remove all the key/value pairs from the section. + */ + void + deprecatedClearSection(std::string const& section); + + /** + * Set a value that is not a key/value pair. + * + * The value is stored as the section's first value and may be retrieved + * through section::legacy. + * + * @param section Name of the section to modify. + * @param value Contents of the legacy value. + */ + void + legacy(std::string const& section, std::string value); + + /** + * Get the legacy value of a section. A section with a + * single-line value may be retrieved as a legacy value. + * + * @param sectionName Retrieve the contents of this section's + * legacy value. + * @return Contents of the legacy value. + */ + [[nodiscard]] std::string + legacy(std::string const& sectionName) const; + + friend std::ostream& + operator<<(std::ostream& ss, BasicConfig const& c); + + // indicates if trailing comments were seen + // in any loaded Sections + [[nodiscard]] bool + hadTrailingComments() const + { + return std::ranges::any_of(map_, [](auto s) { return s.second.hadTrailingComments(); }); + } + +protected: + void + build(IniFileSections const& ifs); +}; + +//------------------------------------------------------------------------------ + +/** Set a value from a configuration Section + If the named value is not found or doesn't parse as a T, + the variable is unchanged. + @return `true` if value was set. +*/ +template +bool +set(T& target, std::string const& name, Section const& section) +{ + bool foundAndValid = false; + try + { + auto const val = section.get(name); + if ((foundAndValid = val.has_value())) + target = *val; + } + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) + { + } + return foundAndValid; +} + +/** Set a value from a configuration Section + If the named value is not found or doesn't cast to T, + the variable is assigned the default. + @return `true` if the named value was found and is valid. +*/ +template +bool +set(T& target, T const& defaultValue, std::string const& name, Section const& section) +{ + bool const foundAndValid = set(target, name, section); + if (!foundAndValid) + target = defaultValue; + return foundAndValid; +} + +/** Retrieve a key/value pair from a section. + @return The value string converted to T if it exists + and can be parsed, or else defaultValue. +*/ +// NOTE This routine might be more clumsy than the previous two +template +T +get(Section const& section, std::string const& name, T const& defaultValue = T{}) +{ + try + { + return section.valueOr(name, defaultValue); + } + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) + { + } + return defaultValue; +} + +inline std::string +get(Section const& section, std::string const& name, char const* defaultValue) +{ + try + { + auto const val = section.get(name); + if (val.has_value()) + return *val; + } + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) + { + } + return defaultValue; +} + +template +bool +getIfExists(Section const& section, std::string const& name, T& v) +{ + return set(v, name, section); +} + +template <> +inline bool +getIfExists(Section const& section, std::string const& name, bool& v) +{ + int intVal = 0; + auto stat = getIfExists(section, name, intVal); + if (stat) + v = bool(intVal); + return stat; +} + +} // namespace xrpl diff --git a/include/xrpl/basics/BasicConfig.h b/include/xrpl/config/Constants.h similarity index 50% rename from include/xrpl/basics/BasicConfig.h rename to include/xrpl/config/Constants.h index b34360b85f..40a6388d61 100644 --- a/include/xrpl/basics/BasicConfig.h +++ b/include/xrpl/config/Constants.h @@ -1,381 +1,7 @@ #pragma once -#include - -#include -#include - -#include -#include -#include -#include -#include - namespace xrpl { -using IniFileSections = std::unordered_map>; - -//------------------------------------------------------------------------------ - -/** Holds a collection of configuration values. - A configuration file contains zero or more sections. -*/ -class Section -{ -private: - std::string name_; - std::unordered_map lookup_; - std::vector lines_; - std::vector values_; - bool hadTrailingComments_ = false; - - using const_iterator = decltype(lookup_)::const_iterator; - -public: - /** Create an empty section. */ - explicit Section(std::string name = ""); - - /** Returns the name of this section. */ - [[nodiscard]] std::string const& - name() const - { - return name_; - } - - /** Returns all the lines in the section. - This includes everything. - */ - [[nodiscard]] std::vector const& - lines() const - { - return lines_; - } - - /** Returns all the values in the section. - Values are non-empty lines which are not key/value pairs. - */ - [[nodiscard]] std::vector const& - values() const - { - return values_; - } - - /** - * Set the legacy value for this section. - */ - void - legacy(std::string value) - { - if (lines_.empty()) - { - lines_.emplace_back(std::move(value)); - } - else - { - lines_[0] = std::move(value); - } - } - - /** - * Get the legacy value for this section. - * - * @return The retrieved value. A section with an empty legacy value returns - an empty string. - */ - [[nodiscard]] std::string - legacy() const - { - if (lines_.empty()) - return ""; - if (lines_.size() > 1) - { - Throw( - "A legacy value must have exactly one line. Section: " + name_); - } - return lines_[0]; - } - - /** Set a key/value pair. - The previous value is discarded. - */ - void - set(std::string const& key, std::string const& value); - - /** Append a set of lines to this section. - Lines containing key/value pairs are added to the map, - else they are added to the values list. Everything is - added to the lines list. - */ - void - append(std::vector const& lines); - - /** Append a line to this section. */ - void - append(std::string const& line) - { - append(std::vector{line}); - } - - /** Returns `true` if a key with the given name exists. */ - [[nodiscard]] bool - exists(std::string const& name) const; - - template - [[nodiscard]] std::optional - get(std::string const& name) const - { - auto const iter = lookup_.find(name); - if (iter == lookup_.end()) - return std::nullopt; - return boost::lexical_cast(iter->second); - } - - /// Returns a value if present, else another value. - template - [[nodiscard]] T - valueOr(std::string const& name, T const& other) const - { - auto const v = get(name); - return v.has_value() ? *v : other; - } - - // indicates if trailing comments were seen - // during the appending of any lines/values - [[nodiscard]] bool - hadTrailingComments() const - { - return hadTrailingComments_; - } - - friend std::ostream& - operator<<(std::ostream&, Section const& section); - - // Returns `true` if there are no key/value pairs. - [[nodiscard]] bool - empty() const - { - return lookup_.empty(); - } - - // Returns the number of key/value pairs. - [[nodiscard]] std::size_t - size() const - { - return lookup_.size(); - } - - // For iteration of key/value pairs. - [[nodiscard]] const_iterator - begin() const - { - return lookup_.cbegin(); - } - - // For iteration of key/value pairs. - [[nodiscard]] const_iterator - cbegin() const - { - return lookup_.cbegin(); - } - - // For iteration of key/value pairs. - [[nodiscard]] const_iterator - end() const - { - return lookup_.cend(); - } - - // For iteration of key/value pairs. - [[nodiscard]] const_iterator - cend() const - { - return lookup_.cend(); - } -}; - -//------------------------------------------------------------------------------ - -/** Holds unparsed configuration information. - The raw data sections are processed with intermediate parsers specific - to each module instead of being all parsed in a central location. -*/ -class BasicConfig -{ -private: - std::unordered_map map_; - -public: - /** Returns `true` if a section with the given name exists. */ - [[nodiscard]] bool - exists(std::string const& name) const; - - /** Returns the section with the given name. - If the section does not exist, an empty section is returned. - */ - /** @{ */ - Section& - section(std::string const& name); - - [[nodiscard]] Section const& - section(std::string const& name) const; - - Section const& - operator[](std::string const& name) const - { - return section(name); - } - - Section& - operator[](std::string const& name) - { - return section(name); - } - /** @} */ - - /** Overwrite a key/value pair with a command line argument - If the section does not exist it is created. - The previous value, if any, is overwritten. - */ - void - overwrite(std::string const& section, std::string const& key, std::string const& value); - - /** Remove all the key/value pairs from the section. - */ - void - deprecatedClearSection(std::string const& section); - - /** - * Set a value that is not a key/value pair. - * - * The value is stored as the section's first value and may be retrieved - * through section::legacy. - * - * @param section Name of the section to modify. - * @param value Contents of the legacy value. - */ - void - legacy(std::string const& section, std::string value); - - /** - * Get the legacy value of a section. A section with a - * single-line value may be retrieved as a legacy value. - * - * @param sectionName Retrieve the contents of this section's - * legacy value. - * @return Contents of the legacy value. - */ - [[nodiscard]] std::string - legacy(std::string const& sectionName) const; - - friend std::ostream& - operator<<(std::ostream& ss, BasicConfig const& c); - - // indicates if trailing comments were seen - // in any loaded Sections - [[nodiscard]] bool - hadTrailingComments() const - { - return std::ranges::any_of(map_, [](auto s) { return s.second.hadTrailingComments(); }); - } - -protected: - void - build(IniFileSections const& ifs); -}; - -//------------------------------------------------------------------------------ - -/** Set a value from a configuration Section - If the named value is not found or doesn't parse as a T, - the variable is unchanged. - @return `true` if value was set. -*/ -template -bool -set(T& target, std::string const& name, Section const& section) -{ - bool foundAndValid = false; - try - { - auto const val = section.get(name); - if ((foundAndValid = val.has_value())) - target = *val; - } - catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) - { - } - return foundAndValid; -} - -/** Set a value from a configuration Section - If the named value is not found or doesn't cast to T, - the variable is assigned the default. - @return `true` if the named value was found and is valid. -*/ -template -bool -set(T& target, T const& defaultValue, std::string const& name, Section const& section) -{ - bool const foundAndValid = set(target, name, section); - if (!foundAndValid) - target = defaultValue; - return foundAndValid; -} - -/** Retrieve a key/value pair from a section. - @return The value string converted to T if it exists - and can be parsed, or else defaultValue. -*/ -// NOTE This routine might be more clumsy than the previous two -template -T -get(Section const& section, std::string const& name, T const& defaultValue = T{}) -{ - try - { - return section.valueOr(name, defaultValue); - } - catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) - { - } - return defaultValue; -} - -inline std::string -get(Section const& section, std::string const& name, char const* defaultValue) -{ - try - { - auto const val = section.get(name); - if (val.has_value()) - return *val; - } - catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) - { - } - return defaultValue; -} - -template -bool -getIfExists(Section const& section, std::string const& name, T& v) -{ - return set(v, name, section); -} - -template <> -inline bool -getIfExists(Section const& section, std::string const& name, bool& v) -{ - int intVal = 0; - auto stat = getIfExists(section, name, intVal); - if (stat) - v = bool(intVal); - return stat; -} - -//------------------------------------------------------------------------------ - struct Sections { static constexpr auto kAMENDMENTS = "amendments"; diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index 38318c745d..cc9c8137a8 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index ca2dde560c..3692e2d1ae 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -1,8 +1,8 @@ #pragma once -#include #include #include +#include #include #include #include diff --git a/include/xrpl/nodestore/Factory.h b/include/xrpl/nodestore/Factory.h index c40be62d21..fae10b0cd7 100644 --- a/include/xrpl/nodestore/Factory.h +++ b/include/xrpl/nodestore/Factory.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include diff --git a/include/xrpl/server/Port.h b/include/xrpl/server/Port.h index 9207e0552b..15df18fbfe 100644 --- a/include/xrpl/server/Port.h +++ b/include/xrpl/server/Port.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include diff --git a/src/libxrpl/basics/BasicConfig.cpp b/src/libxrpl/config/Config.cpp similarity index 99% rename from src/libxrpl/basics/BasicConfig.cpp rename to src/libxrpl/config/Config.cpp index c1997eb713..40effc4766 100644 --- a/src/libxrpl/basics/BasicConfig.cpp +++ b/src/libxrpl/config/Config.cpp @@ -1,6 +1,5 @@ -#include - #include +#include #include #include diff --git a/src/libxrpl/nodestore/Database.cpp b/src/libxrpl/nodestore/Database.cpp index 81cf708468..089af8e5da 100644 --- a/src/libxrpl/nodestore/Database.cpp +++ b/src/libxrpl/nodestore/Database.cpp @@ -1,12 +1,12 @@ #include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index 24b0e2de2e..ab42c83cd9 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/ManagerImp.cpp b/src/libxrpl/nodestore/ManagerImp.cpp index 4aac675d96..9d91cdcacb 100644 --- a/src/libxrpl/nodestore/ManagerImp.cpp +++ b/src/libxrpl/nodestore/ManagerImp.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/backend/MemoryFactory.cpp b/src/libxrpl/nodestore/backend/MemoryFactory.cpp index 42d6a10373..64b3c0de57 100644 --- a/src/libxrpl/nodestore/backend/MemoryFactory.cpp +++ b/src/libxrpl/nodestore/backend/MemoryFactory.cpp @@ -1,8 +1,8 @@ -#include #include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/backend/NuDBFactory.cpp b/src/libxrpl/nodestore/backend/NuDBFactory.cpp index f802b80105..723e51efa0 100644 --- a/src/libxrpl/nodestore/backend/NuDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/NuDBFactory.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/backend/NullFactory.cpp b/src/libxrpl/nodestore/backend/NullFactory.cpp index 38f35e91ff..da03f33e03 100644 --- a/src/libxrpl/nodestore/backend/NullFactory.cpp +++ b/src/libxrpl/nodestore/backend/NullFactory.cpp @@ -1,6 +1,6 @@ -#include #include #include +#include #include #include #include diff --git a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp index 47761a539e..9c70db786d 100644 --- a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp @@ -1,8 +1,8 @@ -#include #include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/rdb/SociDB.cpp b/src/libxrpl/rdb/SociDB.cpp index 0e3ffaa64a..d74f7696cd 100644 --- a/src/libxrpl/rdb/SociDB.cpp +++ b/src/libxrpl/rdb/SociDB.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include #include diff --git a/src/libxrpl/server/Port.cpp b/src/libxrpl/server/Port.cpp index c7668c9096..78768e8332 100644 --- a/src/libxrpl/server/Port.cpp +++ b/src/libxrpl/server/Port.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/libxrpl/server/State.cpp b/src/libxrpl/server/State.cpp index b9cb7c6ff2..d9793f53d0 100644 --- a/src/libxrpl/server/State.cpp +++ b/src/libxrpl/server/State.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include #include #include diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index 96a726d4f5..b908abfead 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -5,12 +5,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 30b6f9bb0d..1a1ba89f7c 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -29,11 +29,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index 8300b458b6..32fd90b952 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -4,9 +4,9 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/src/test/app/GRPCServerTLS_test.cpp b/src/test/app/GRPCServerTLS_test.cpp index afa1b26e99..e540fc3ff6 100644 --- a/src/test/app/GRPCServerTLS_test.cpp +++ b/src/test/app/GRPCServerTLS_test.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include #include diff --git a/src/test/app/HashRouter_test.cpp b/src/test/app/HashRouter_test.cpp index bf5281238c..1933780958 100644 --- a/src/test/app/HashRouter_test.cpp +++ b/src/test/app/HashRouter_test.cpp @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include #include #include diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index 03302465f9..a56878c8c2 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -3,12 +3,12 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 8ade5b7946..5d20fe71e0 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -25,10 +25,10 @@ #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index 3b24c9d41a..217a5bb9ae 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -20,12 +20,12 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index 763cb96a99..32b13ec539 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -8,10 +8,10 @@ #include #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index ecc4c6ea6f..1362c079a0 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -27,9 +27,9 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/src/test/app/ValidatorKeys_test.cpp b/src/test/app/ValidatorKeys_test.cpp index 0a5b9106c9..749f69a094 100644 --- a/src/test/app/ValidatorKeys_test.cpp +++ b/src/test/app/ValidatorKeys_test.cpp @@ -5,10 +5,10 @@ #include #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index e89da152d4..e3f8389231 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 9bbc419f7c..35d0af5ad4 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -3,9 +3,9 @@ #include -#include #include #include +#include #include // IWYU pragma: keep #include diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index 1727132ee4..765756914c 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -1,8 +1,8 @@ #include -#include #include #include +#include #include #include diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index 7950bebc02..7d2378a4d5 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -30,12 +30,12 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/jtx/envconfig.h b/src/test/jtx/envconfig.h index c757d1ad05..b50a9621f9 100644 --- a/src/test/jtx/envconfig.h +++ b/src/test/jtx/envconfig.h @@ -2,7 +2,7 @@ #include -#include +#include namespace xrpl::test { diff --git a/src/test/jtx/impl/JSONRPCClient.cpp b/src/test/jtx/impl/JSONRPCClient.cpp index a4259988c7..2e4bc5c9e7 100644 --- a/src/test/jtx/impl/JSONRPCClient.cpp +++ b/src/test/jtx/impl/JSONRPCClient.cpp @@ -4,8 +4,8 @@ #include -#include #include +#include #include #include #include diff --git a/src/test/jtx/impl/WSClient.cpp b/src/test/jtx/impl/WSClient.cpp index 681c619887..e9da70debb 100644 --- a/src/test/jtx/impl/WSClient.cpp +++ b/src/test/jtx/impl/WSClient.cpp @@ -2,8 +2,8 @@ #include -#include #include +#include #include #include #include diff --git a/src/test/jtx/impl/envconfig.cpp b/src/test/jtx/impl/envconfig.cpp index 54c185d2e2..705080cf4a 100644 --- a/src/test/jtx/impl/envconfig.cpp +++ b/src/test/jtx/impl/envconfig.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include #include diff --git a/src/test/nodestore/Backend_test.cpp b/src/test/nodestore/Backend_test.cpp index ee8012f6b6..0cafe0a506 100644 --- a/src/test/nodestore/Backend_test.cpp +++ b/src/test/nodestore/Backend_test.cpp @@ -1,11 +1,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/test/nodestore/Database_test.cpp b/src/test/nodestore/Database_test.cpp index 966c7b59bb..966fdfd0d6 100644 --- a/src/test/nodestore/Database_test.cpp +++ b/src/test/nodestore/Database_test.cpp @@ -6,12 +6,12 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/nodestore/NuDBFactory_test.cpp b/src/test/nodestore/NuDBFactory_test.cpp index 319a73cc34..85357ec95e 100644 --- a/src/test/nodestore/NuDBFactory_test.cpp +++ b/src/test/nodestore/NuDBFactory_test.cpp @@ -1,12 +1,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/nodestore/Timing_test.cpp b/src/test/nodestore/Timing_test.cpp index 362ae48579..b484ca3a9c 100644 --- a/src/test/nodestore/Timing_test.cpp +++ b/src/test/nodestore/Timing_test.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/test/overlay/cluster_test.cpp b/src/test/overlay/cluster_test.cpp index 0c164dfded..6c2114b7de 100644 --- a/src/test/overlay/cluster_test.cpp +++ b/src/test/overlay/cluster_test.cpp @@ -3,9 +3,9 @@ #include -#include #include #include +#include #include #include #include diff --git a/src/test/rpc/AmendmentBlocked_test.cpp b/src/test/rpc/AmendmentBlocked_test.cpp index ad92352ce3..b8dba90ec8 100644 --- a/src/test/rpc/AmendmentBlocked_test.cpp +++ b/src/test/rpc/AmendmentBlocked_test.cpp @@ -10,9 +10,9 @@ #include -#include #include #include +#include #include #include #include diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 2c29062896..c188ae01df 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -4,9 +4,9 @@ #include -#include #include #include +#include #include #include #include diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index 7410542e0f..509ccc0874 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -15,9 +15,9 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 9575fd4afb..7cae2ad77e 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -13,9 +13,9 @@ #include -#include #include #include +#include #include #include #include diff --git a/src/test/rpc/ManifestRPC_test.cpp b/src/test/rpc/ManifestRPC_test.cpp index 188703aa62..9f7753ea36 100644 --- a/src/test/rpc/ManifestRPC_test.cpp +++ b/src/test/rpc/ManifestRPC_test.cpp @@ -5,8 +5,8 @@ #include -#include #include +#include #include #include diff --git a/src/test/rpc/RPCOverload_test.cpp b/src/test/rpc/RPCOverload_test.cpp index 4ee8d891b0..450276a638 100644 --- a/src/test/rpc/RPCOverload_test.cpp +++ b/src/test/rpc/RPCOverload_test.cpp @@ -9,8 +9,8 @@ #include -#include #include +#include #include #include #include diff --git a/src/test/rpc/ServerInfo_test.cpp b/src/test/rpc/ServerInfo_test.cpp index b7091be8ed..9422f75f0a 100644 --- a/src/test/rpc/ServerInfo_test.cpp +++ b/src/test/rpc/ServerInfo_test.cpp @@ -4,8 +4,8 @@ #include -#include #include +#include #include #include diff --git a/src/test/rpc/Simulate_test.cpp b/src/test/rpc/Simulate_test.cpp index fc9c5fe566..69a62c91c5 100644 --- a/src/test/rpc/Simulate_test.cpp +++ b/src/test/rpc/Simulate_test.cpp @@ -15,13 +15,13 @@ #include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 9f15d45dac..5956ba7eba 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -19,11 +19,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/test/rpc/ValidatorInfo_test.cpp b/src/test/rpc/ValidatorInfo_test.cpp index d8871f4275..c140716e16 100644 --- a/src/test/rpc/ValidatorInfo_test.cpp +++ b/src/test/rpc/ValidatorInfo_test.cpp @@ -5,8 +5,8 @@ #include -#include #include +#include #include #include diff --git a/src/test/rpc/ValidatorRPC_test.cpp b/src/test/rpc/ValidatorRPC_test.cpp index c60865ef80..bffcd6657c 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -6,11 +6,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index 0db89dc7b5..52f39239e0 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -5,10 +5,10 @@ #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/server/Server_test.cpp b/src/test/server/Server_test.cpp index ad6eff5bb0..07033e77a3 100644 --- a/src/test/server/Server_test.cpp +++ b/src/test/server/Server_test.cpp @@ -5,10 +5,10 @@ #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/shamap/common.h b/src/test/shamap/common.h index 5395ec3fdb..1011d52155 100644 --- a/src/test/shamap/common.h +++ b/src/test/shamap/common.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include #include diff --git a/src/tests/libxrpl/helpers/TestFamily.h b/src/tests/libxrpl/helpers/TestFamily.h index bcc2acea1a..04bf446339 100644 --- a/src/tests/libxrpl/helpers/TestFamily.h +++ b/src/tests/libxrpl/helpers/TestFamily.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index deb640ea14..d236f6501f 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -39,7 +39,6 @@ #include #include -#include #include #include #include @@ -55,6 +54,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/CollectorManager.cpp b/src/xrpld/app/main/CollectorManager.cpp index 82ab1b84e3..2f03ac15b1 100644 --- a/src/xrpld/app/main/CollectorManager.cpp +++ b/src/xrpld/app/main/CollectorManager.cpp @@ -1,6 +1,5 @@ #include -#include #include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/main/CollectorManager.h b/src/xrpld/app/main/CollectorManager.h index e736ae57db..d07da15353 100644 --- a/src/xrpld/app/main/CollectorManager.h +++ b/src/xrpld/app/main/CollectorManager.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include namespace xrpl { diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 7fba7611e5..e55f3e1e54 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index 8b64c6b7ea..7d2485a003 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/NodeIdentity.cpp b/src/xrpld/app/main/NodeIdentity.cpp index b724351922..c7462ad9da 100644 --- a/src/xrpld/app/main/NodeIdentity.cpp +++ b/src/xrpld/app/main/NodeIdentity.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index cad28182db..832462d54e 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -54,6 +53,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 577d2e5089..6dd16a0742 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -5,13 +5,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 8289b58f99..b06b1ec211 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -1,6 +1,5 @@ #include -#include #include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index dbd8127e19..a763dc6e25 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -3,12 +3,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/ValidatorKeys.cpp b/src/xrpld/app/misc/detail/ValidatorKeys.cpp index ed86d4bffa..90c281b8fb 100644 --- a/src/xrpld/app/misc/detail/ValidatorKeys.cpp +++ b/src/xrpld/app/misc/detail/ValidatorKeys.cpp @@ -2,10 +2,10 @@ #include -#include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/setup_HashRouter.cpp b/src/xrpld/app/misc/detail/setup_HashRouter.cpp index 98da63fe88..035a130c2f 100644 --- a/src/xrpld/app/misc/detail/setup_HashRouter.cpp +++ b/src/xrpld/app/misc/detail/setup_HashRouter.cpp @@ -2,8 +2,8 @@ #include -#include #include +#include #include #include diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 7c66e94aa3..5ccf111ceb 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include #include // IWYU pragma: keep diff --git a/src/xrpld/app/rdb/detail/PeerFinder.cpp b/src/xrpld/app/rdb/detail/PeerFinder.cpp index 2481b63d2b..9452c3af99 100644 --- a/src/xrpld/app/rdb/detail/PeerFinder.cpp +++ b/src/xrpld/app/rdb/detail/PeerFinder.cpp @@ -2,11 +2,11 @@ #include -#include #include #include #include #include +#include #include #include // IWYU pragma: keep diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index 4936906a9a..2f0b91a692 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -1,9 +1,9 @@ #pragma once -#include #include #include #include +#include #include #include #include // VFALCO Breaks levelization diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index e404f0001e..6c1d94ed58 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -1,6 +1,5 @@ #include -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/overlay/Cluster.h b/src/xrpld/overlay/Cluster.h index 982f11aaae..a8c2083fbc 100644 --- a/src/xrpld/overlay/Cluster.h +++ b/src/xrpld/overlay/Cluster.h @@ -2,9 +2,9 @@ #include -#include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/Cluster.cpp b/src/xrpld/overlay/detail/Cluster.cpp index dcb40a54f5..38c77da75a 100644 --- a/src/xrpld/overlay/detail/Cluster.cpp +++ b/src/xrpld/overlay/detail/Cluster.cpp @@ -2,11 +2,11 @@ #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index db45ed49fc..5ff2505924 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/peerfinder/detail/PeerfinderManager.cpp b/src/xrpld/peerfinder/detail/PeerfinderManager.cpp index 873c18aad9..a0cf588c43 100644 --- a/src/xrpld/peerfinder/detail/PeerfinderManager.cpp +++ b/src/xrpld/peerfinder/detail/PeerfinderManager.cpp @@ -7,13 +7,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index c997b417e0..8dc2c92135 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index 8796283922..3c0f6c07e8 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include #include #include