Make a few members of ParseTree private, and make the internal methods protected
This commit is contained in:
parent
54aa4105b8
commit
525aa0db88
@ -48,23 +48,26 @@ namespace StandardComponents {
|
|||||||
|
|
||||||
#define IS_PARSECOMPONENT IS(ParseComponent)
|
#define IS_PARSECOMPONENT IS(ParseComponent)
|
||||||
class ParseTree {
|
class ParseTree {
|
||||||
IS_PARSECOMPONENT
|
|
||||||
void addComponent(const T& component) const {
|
|
||||||
subComponents.emplace_back(new T(component));
|
|
||||||
}; IS_PARSECOMPONENT void addAllComponents(const initializer_list<T>& components) const {
|
|
||||||
subComponents.reserve(components.size());
|
|
||||||
for (const T& comp: components) addComponent<T>(comp);
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
mutable vector<unique_ptr<ParseComponent>> subComponents;
|
mutable vector<unique_ptr<ParseComponent>> subComponents;
|
||||||
using array_type = decltype(subComponents);
|
using array_type = decltype(subComponents);
|
||||||
using iterator = array_type::iterator;
|
using iterator = array_type::iterator;
|
||||||
using const_iterator = array_type::const_iterator;
|
using constant_iterator = array_type::const_iterator;
|
||||||
|
protected:
|
||||||
|
IS_PARSECOMPONENT
|
||||||
|
void addComponent(const T& component) const
|
||||||
|
{ subComponents.emplace_back(new T(component)); };
|
||||||
|
IS_PARSECOMPONENT
|
||||||
|
void addAllComponents(
|
||||||
|
const initializer_list<T>& components
|
||||||
|
) const {
|
||||||
|
subComponents.reserve(components.size());
|
||||||
|
for (const T& current: components) addComponent<T>(current);
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
inline iterator begin() const noexcept { return subComponents.begin(); }
|
inline iterator begin() const noexcept { return subComponents.begin(); }
|
||||||
inline const_iterator cbegin() const noexcept { return subComponents.cbegin(); }
|
inline constant_iterator cbegin() const noexcept { return subComponents.cbegin(); }
|
||||||
inline iterator end() const noexcept { return subComponents.end(); }
|
inline iterator end() const noexcept { return subComponents.end(); }
|
||||||
inline const_iterator cend() const noexcept { return subComponents.cend(); }
|
inline constant_iterator cend() const noexcept { return subComponents.cend(); }
|
||||||
IS_PARSECOMPONENT
|
IS_PARSECOMPONENT
|
||||||
vector<T*> findById() const {
|
vector<T*> findById() const {
|
||||||
vector<T*> filteredComponents;
|
vector<T*> filteredComponents;
|
||||||
|
Loading…
Reference in New Issue
Block a user