src: Refactoring common.hpp and minimizing exposed includes
Face class has relatively large rewrite to hide internals using
Implementor pattern. As of this commit, <boost/asio.hpp> is not
automatically included whenever ndn-cxx/face.hpp is included. If it is
needed to directly work with io_service, asio.hpp should be specifically
included.
Change-Id: Ie742b851025b4e3da634eb981319df0f42937855
diff --git a/src/interest-filter.hpp b/src/interest-filter.hpp
index 4cb77af..3833e59 100644
--- a/src/interest-filter.hpp
+++ b/src/interest-filter.hpp
@@ -13,11 +13,12 @@
#ifndef NDN_INTEREST_FILTER_HPP
#define NDN_INTEREST_FILTER_HPP
-#include "util/regex/regex-pattern-list-matcher.hpp"
#include "name.hpp"
namespace ndn {
+class RegexPatternListMatcher;
+
class InterestFilter
{
public:
@@ -119,6 +120,10 @@
shared_ptr<RegexPatternListMatcher> m_regexFilter;
};
+std::ostream&
+operator<<(std::ostream& os, const InterestFilter& filter);
+
+
inline
InterestFilter::InterestFilter(const Name& prefix)
: m_prefix(prefix)
@@ -137,45 +142,6 @@
{
}
-inline
-InterestFilter::InterestFilter(const Name& prefix, const std::string& regexFilter)
- : m_prefix(prefix)
- , m_regexFilter(new RegexPatternListMatcher(regexFilter, shared_ptr<RegexBackrefManager>()))
-{
-}
-
-inline bool
-InterestFilter::doesMatch(const Name& name) const
-{
- if (name.size() < m_prefix.size())
- return false;
-
- if (hasRegexFilter()) {
- // perform prefix match and regular expression match for the remaining components
- bool isMatch = m_prefix.isPrefixOf(name);
-
- if (!isMatch)
- return false;
-
- return m_regexFilter->match(name, m_prefix.size(), name.size() - m_prefix.size());
- }
- else {
- // perform just prefix match
-
- return m_prefix.isPrefixOf(name);
- }
-}
-
-inline std::ostream&
-operator<<(std::ostream& os, const InterestFilter& filter)
-{
- os << filter.getPrefix();
- if (filter.hasRegexFilter()) {
- os << "?regex=" << filter.getRegexFilter();
- }
- return os;
-}
-
} // namespace ndn
#endif // NDN_INTEREST_FILTER_HPP