Skip to content

Commit

Permalink
reverting some of the clang format change becuase it seems to have a …
Browse files Browse the repository at this point in the history
…wider impact
  • Loading branch information
AsherGlick committed Sep 30, 2023
1 parent 3e38ff4 commit fba6894
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion xml_converter/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand Down
15 changes: 5 additions & 10 deletions xml_converter/src/string_hierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ bool StringHierarchy::in_hierarchy(
return true;
}



////////////////////////////////////////////////////////////////////////////////
// in_hierarchy
//
Expand All @@ -39,8 +37,7 @@ bool StringHierarchy::in_hierarchy(
// ambiguity between the vector and string overloads of the function.
////////////////////////////////////////////////////////////////////////////////
bool StringHierarchy::in_hierarchy(
const std::initializer_list<std::string> input
) const {
const std::initializer_list<std::string> input) const {
std::vector<std::string> vec;
vec.insert(vec.end(), input.begin(), input.end());
return this->in_hierarchy(vec);
Expand Down Expand Up @@ -78,7 +75,7 @@ bool StringHierarchy::_in_hierarchy(
//
// A helper function to grab a sub hierarchy one level down from the top.
////////////////////////////////////////////////////////////////////////////////
const StringHierarchy* StringHierarchy::sub_hierarchy(
const StringHierarchy *StringHierarchy::sub_hierarchy(
const std::string &node) const {
if (this->all_children_included) {
return this;
Expand All @@ -91,31 +88,29 @@ const StringHierarchy* StringHierarchy::sub_hierarchy(
return &(iterator->second);
}


////////////////////////////////////////////////////////////////////////////////
// sub_hierarchy
//
// An explicit version of sub_hierarchy that takes an initalizer list to
// prevent ambiguity between the vector and string overloads of the function.
////////////////////////////////////////////////////////////////////////////////
const StringHierarchy* StringHierarchy::sub_hierarchy(
const StringHierarchy *StringHierarchy::sub_hierarchy(
const std::initializer_list<std::string> input) const {
std::vector<std::string> vec;
vec.insert(vec.end(), input.begin(), input.end());
return this->sub_hierarchy(vec);
}


////////////////////////////////////////////////////////////////////////////////
// sub_hierarchy
//
// Get a subtree of the StringHierarchy in order to avoid needing to query the
// entire hierarchy in the case where the use case is traversing down a tree
// anyways and does not want to keep track of the parent's values.
////////////////////////////////////////////////////////////////////////////////
const StringHierarchy* StringHierarchy::sub_hierarchy(
const StringHierarchy *StringHierarchy::sub_hierarchy(
const std::vector<std::string> &path) const {
const StringHierarchy* sub_hierarchy = this;
const StringHierarchy *sub_hierarchy = this;
for (size_t i = 0; i < path.size(); i++) {
sub_hierarchy = sub_hierarchy->sub_hierarchy(path[i]);
// Escape before segfaulting.
Expand Down
6 changes: 3 additions & 3 deletions xml_converter/src/string_hierarchy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class StringHierarchy {
bool in_hierarchy(
const std::initializer_list<std::string>) const;

const StringHierarchy* sub_hierarchy(
const StringHierarchy *sub_hierarchy(
const std::string &node) const;

const StringHierarchy* sub_hierarchy(
const StringHierarchy *sub_hierarchy(
const std::initializer_list<std::string> input) const;

const StringHierarchy* sub_hierarchy(
const StringHierarchy *sub_hierarchy(
const std::vector<std::string> &path) const;

void add_path(
Expand Down

0 comments on commit fba6894

Please sign in to comment.