regex: move functions out of headers

Change-Id: I6a3ea61a6564195e297288d514c5a805a832e0e6
diff --git a/src/util/regex/regex-matcher.hpp b/src/util/regex/regex-matcher.hpp
index 4dcaeb4..b5838fa 100644
--- a/src/util/regex/regex-matcher.hpp
+++ b/src/util/regex/regex-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -17,8 +17,6 @@
  * <http://www.gnu.org/licenses/>.
  *
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
 #ifndef NDN_UTIL_REGEX_REGEX_MATCHER_H
@@ -26,11 +24,10 @@
 
 #include "../../common.hpp"
 #include "../../name.hpp"
+#include "regex-backref-manager.hpp"
 
 namespace ndn {
 
-class RegexBackrefManager;
-
 class RegexMatcher
 {
 public:
@@ -56,7 +53,7 @@
 
   RegexMatcher(const std::string& expr,
                const RegexExprType& type,
-               shared_ptr<RegexBackrefManager> backrefManager = shared_ptr<RegexBackrefManager>());
+               shared_ptr<RegexBackrefManager> backrefManager = nullptr);
 
   virtual
   ~RegexMatcher();
@@ -110,71 +107,4 @@
 
 } // namespace ndn
 
-#include "regex-backref-manager.hpp"
-
-namespace ndn {
-
-inline
-RegexMatcher::RegexMatcher(const std::string& expr,
-                           const RegexExprType& type,
-                           shared_ptr<RegexBackrefManager> backrefManager)
-  : m_expr(expr)
-  , m_type(type)
-  , m_backrefManager(backrefManager)
-{
-  if (!static_cast<bool>(m_backrefManager))
-    m_backrefManager = make_shared<RegexBackrefManager>();
-}
-
-inline
-RegexMatcher::~RegexMatcher()
-{
-}
-
-inline bool
-RegexMatcher::match(const Name& name, size_t offset, size_t len)
-{
-  bool result = false;
-
-  m_matchResult.clear();
-
-  if (recursiveMatch(0, name, offset, len))
-    {
-      for (size_t i = offset; i < offset + len ; i++)
-        m_matchResult.push_back(name.get(i));
-      result = true;
-    }
-  else
-    {
-      result = false;
-    }
-
-  return result;
-}
-
-inline bool
-RegexMatcher::recursiveMatch(size_t matcherNo, const Name& name, size_t offset, size_t len)
-{
-  ssize_t tried = len;
-
-  if (matcherNo >= m_matchers.size())
-    return (len == 0);
-
-  shared_ptr<RegexMatcher> matcher = m_matchers[matcherNo];
-
-  while (tried >= 0)
-    {
-      if (matcher->match(name, offset, tried) &&
-          recursiveMatch(matcherNo + 1, name, offset + tried, len - tried))
-        return true;
-      tried--;
-    }
-
-  return false;
-}
-
-
-} // namespace ndn
-
-
 #endif // NDN_UTIL_REGEX_REGEX_MATCHER_H