Skip to content

Commit 3543385

Browse files
Apply clang-tidy fixes
1 parent 38d8292 commit 3543385

File tree

93 files changed

+362
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+362
-356
lines changed

form/core/placement.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
#include "placement.hpp"
44
#include <string>
5+
#include <utility>
56

67
using namespace form::detail::experimental;
78

89
/// Constructor with initialization
9-
Placement::Placement(std::string const& fileName,
10-
std::string const& containerName,
10+
Placement::Placement(std::string fileName,
11+
std::string containerName,
1112
int technology) :
12-
m_technology(technology), m_fileName(fileName), m_containerName(containerName)
13+
m_technology(technology), m_fileName(std::move(fileName)), m_containerName(std::move(containerName))
1314
{
1415
}
1516

1617
/// Access file name
17-
std::string const& Placement::fileName() const { return m_fileName; }
18+
auto Placement::fileName() const -> std::string const& { return m_fileName; }
1819
/// Access container name
19-
std::string const& Placement::containerName() const { return m_containerName; }
20+
auto Placement::containerName() const -> std::string const& { return m_containerName; }
2021
/// Access technology type
21-
int Placement::technology() const { return m_technology; }
22+
auto Placement::technology() const -> int { return m_technology; }

form/core/placement.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace form::detail::experimental {
1616
Placement() = default;
1717

1818
/// Constructor with initialization
19-
Placement(std::string const& fileName, std::string const& containerName, int technology);
19+
Placement(std::string fileName, std::string containerName, int technology);
2020

2121
/// Access file name
2222
std::string const& fileName() const;

form/core/token.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
#include "token.hpp"
44
#include <string>
5+
#include <utility>
56

67
using namespace form::detail::experimental;
78

89
/// Constructor with initialization
9-
Token::Token(std::string const& fileName,
10-
std::string const& containerName,
10+
Token::Token(std::string fileName,
11+
std::string containerName,
1112
int technology,
1213
int id) :
13-
m_technology(technology), m_fileName(fileName), m_containerName(containerName), m_id(id)
14+
m_technology(technology), m_fileName(std::move(fileName)), m_containerName(std::move(containerName)), m_id(id)
1415
{
1516
}
1617

1718
/// Access file name
18-
std::string const& Token::fileName() const { return m_fileName; }
19+
auto Token::fileName() const -> std::string const& { return m_fileName; }
1920
/// Access container name
20-
std::string const& Token::containerName() const { return m_containerName; }
21+
auto Token::containerName() const -> std::string const& { return m_containerName; }
2122
/// Access technology type
22-
int Token::technology() const { return m_technology; }
23+
auto Token::technology() const -> int { return m_technology; }
2324
/// Set technology type
2425
/// Access identifier/entry number
25-
int Token::id() const { return m_id; }
26+
auto Token::id() const -> int { return m_id; }

form/core/token.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ namespace form::detail::experimental {
1515
Token() = default;
1616

1717
/// Constructor with initialization
18-
Token(std::string const& fileName,
19-
std::string const& containerName,
18+
Token(std::string fileName,
19+
std::string containerName,
2020
int technology,
2121
int id = -1);
2222

form/form/config.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace form::experimental::config {
2222
m_items.emplace_back(product_name, file_name, technology);
2323
}
2424

25-
std::optional<PersistenceItem> output_item_config::findItem(std::string const& product_name) const
25+
auto output_item_config::findItem(std::string const& product_name) const -> std::optional<PersistenceItem>
2626
{
2727
for (auto const& item : m_items) {
2828
if (item.product_name == product_name) {
@@ -32,15 +32,15 @@ namespace form::experimental::config {
3232
return std::nullopt;
3333
}
3434

35-
tech_setting_config::table_t tech_setting_config::getFileTable(int const technology,
36-
std::string const& fileName) const
35+
auto tech_setting_config::getFileTable(int const technology,
36+
std::string const& fileName) const -> tech_setting_config::table_t
3737
{
3838
auto const per_tech = ::const_lookup(file_settings, technology);
3939
return ::const_lookup(per_tech, fileName);
4040
}
4141

42-
tech_setting_config::table_t tech_setting_config::getContainerTable(
43-
int const technology, std::string const& containerName) const
42+
auto tech_setting_config::getContainerTable(
43+
int const technology, std::string const& containerName) const -> tech_setting_config::table_t
4444
{
4545
auto const per_tech = ::const_lookup(container_settings, technology);
4646
return ::const_lookup(per_tech, containerName);

form/form/form.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace form::experimental {
1717
// Accept and store config
1818
form_interface::form_interface(std::shared_ptr<mock_phlex::product_type_names> tm,
1919
mock_phlex::config::parse_config const& config) :
20-
m_pers(nullptr), m_type_map(tm)
20+
m_pers(nullptr), m_type_map(std::move(tm))
2121
{
2222
// Convert phlex config to form config
2323
form::experimental::config::output_item_config output_items;

form/mock_phlex/phlex_toy_config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace mock_phlex::config {
1010
m_items.emplace_back(product_name, file_name, technology);
1111
}
1212

13-
PersistenceItem const* parse_config::findItem(std::string const& product_name) const
13+
auto parse_config::findItem(std::string const& product_name) const -> PersistenceItem const*
1414
{
1515
for (auto const& item : m_items) {
1616
if (item.product_name == product_name) {

form/mock_phlex/phlex_toy_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <memory>
55

66
namespace mock_phlex {
7-
std::shared_ptr<product_type_names> createTypeMap()
7+
auto createTypeMap() -> std::shared_ptr<product_type_names>
88
{
99
return std::make_shared<product_type_names>();
1010
}

form/persistence/persistence.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using namespace form::detail::experimental;
1919

2020
// Factory function implementation
2121
namespace form::detail::experimental {
22-
std::unique_ptr<IPersistence> createPersistence() { return std::make_unique<Persistence>(); }
22+
auto createPersistence() -> std::unique_ptr<IPersistence> { return std::make_unique<Persistence>(); }
2323
} // namespace form::detail::experimental
2424

2525
Persistence::Persistence() :
@@ -80,8 +80,8 @@ void Persistence::read(std::string const& creator,
8080
return;
8181
}
8282

83-
form::experimental::config::PersistenceItem const* Persistence::findConfigItem(
84-
std::string const& label) const
83+
auto Persistence::findConfigItem(
84+
std::string const& label) const -> form::experimental::config::PersistenceItem const*
8585
{
8686
auto const& items = m_output_items.getItems();
8787
if (label == "index")
@@ -90,13 +90,13 @@ form::experimental::config::PersistenceItem const* Persistence::findConfigItem(
9090
: &(*items
9191
.begin()); //emulate how FORM did this before Phlex PR #22. Will be fixed in a future FORM update.
9292

93-
auto it = std::find_if(
94-
items.begin(), items.end(), [&label](auto const& item) { return item.product_name == label; });
93+
auto it = std::ranges::find_if(
94+
items, [&label](auto const& item) -> auto { return item.product_name == label; });
9595

9696
return (it != items.end()) ? &(*it) : nullptr;
9797
}
9898

99-
std::string Persistence::buildFullLabel(std::string_view creator, std::string_view label) const
99+
auto Persistence::buildFullLabel(std::string_view creator, std::string_view label) const -> std::string
100100
{
101101
std::string result;
102102
result.reserve(creator.size() + 1 + label.size());
@@ -106,8 +106,8 @@ std::string Persistence::buildFullLabel(std::string_view creator, std::string_vi
106106
return result;
107107
}
108108

109-
std::unique_ptr<Placement> Persistence::getPlacement(std::string const& creator,
110-
std::string const& label)
109+
auto Persistence::getPlacement(std::string const& creator,
110+
std::string const& label) -> std::unique_ptr<Placement>
111111
{
112112
auto const* config_item = findConfigItem(label);
113113

@@ -120,9 +120,9 @@ std::unique_ptr<Placement> Persistence::getPlacement(std::string const& creator,
120120
return std::make_unique<Placement>(config_item->file_name, full_label, config_item->technology);
121121
}
122122

123-
std::unique_ptr<Token> Persistence::getToken(std::string const& creator,
123+
auto Persistence::getToken(std::string const& creator,
124124
std::string const& label,
125-
std::string const& id)
125+
std::string const& id) -> std::unique_ptr<Token>
126126
{
127127
auto const* config_item = findConfigItem(label);
128128

form/root_storage/root_tbranch_container.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void ROOT_TBranch_ContainerImp::setAttribute(std::string const& key, std::string
5252
void ROOT_TBranch_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
5353
{
5454
this->Storage_Associative_Container::setFile(file);
55-
ROOT_TFileImp* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
55+
auto* root_tfile_imp = dynamic_cast<ROOT_TFileImp*>(file.get());
5656
if (root_tfile_imp == nullptr) {
5757
throw std::runtime_error("ROOT_TBranch_ContainerImp::setFile can't attach to non-ROOT file");
5858
}
@@ -63,7 +63,7 @@ void ROOT_TBranch_ContainerImp::setFile(std::shared_ptr<IStorage_File> file)
6363
void ROOT_TBranch_ContainerImp::setParent(std::shared_ptr<IStorage_Container> parent)
6464
{
6565
this->Storage_Associative_Container::setParent(parent);
66-
ROOT_TTree_ContainerImp* root_ttree_imp = dynamic_cast<ROOT_TTree_ContainerImp*>(parent.get());
66+
auto* root_ttree_imp = dynamic_cast<ROOT_TTree_ContainerImp*>(parent.get());
6767
if (root_ttree_imp == nullptr) {
6868
throw std::runtime_error("ROOT_TBranch_ContainerImp::setParent");
6969
}
@@ -125,7 +125,7 @@ void ROOT_TBranch_ContainerImp::commit()
125125
return;
126126
}
127127

128-
bool ROOT_TBranch_ContainerImp::read(int id, void const** data, std::string& type)
128+
auto ROOT_TBranch_ContainerImp::read(int id, void const** data, std::string& type) -> bool
129129
{
130130
if (m_tfile == nullptr) {
131131
throw std::runtime_error("ROOT_TBranch_ContainerImp::read no file attached");

0 commit comments

Comments
 (0)