Sha256: 33558516545317fba2ea3ab130cb8d86b379e84ee4093e58ad9d2cc24031b3d4
Contents?: true
Size: 982 Bytes
Versions: 5
Compression:
Stored size: 982 Bytes
Contents
// // refract/FilterVisitor.h // librefract // // Created by Jiri Kratochvil on 10/06/16. // Copyright (c) 2015 Apiary Inc. All rights reserved. // #ifndef REFRACT_FILTERVISITOR_H #define REFRACT_FILTERVISITOR_H #include "ElementFwd.h" #include "Visitor.h" #include "Query.h" #include <vector> namespace refract { class FilterVisitor { typedef std::vector<const IElement*> Elements; Elements selected; query::Query query; public: template <typename Predicate> FilterVisitor(Predicate predicate) : query(predicate) {}; template <typename T> void operator()(const T& e){ if(query(e)) { selected.push_back(&e); } }; bool empty() const { return selected.empty(); } const Elements& elements() const { return selected; } }; }; // namespace refract #endif // #ifndef REFRACT_FILTERVISITOR_H
Version data entries
5 entries across 5 versions & 1 rubygems