util+build: Build optimization with regex util

Now only one class (RegexTopMatcher) is getting compiled and other
classes are implemented in header-only way.

Change-Id: I5310c2b1c9ad40366a7b159fe0cec597caca638b
diff --git a/src/util/regex/regex-backref-matcher.hpp b/src/util/regex/regex-backref-matcher.hpp
index de04b19..5ae5f35 100644
--- a/src/util/regex/regex-backref-matcher.hpp
+++ b/src/util/regex/regex-backref-matcher.hpp
@@ -5,20 +5,19 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NDN_REGEX_BACKREF_MATCHER_HPP
-#define NDN_REGEX_BACKREF_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+
+#include "../../common.hpp"
 
 #include "regex-matcher.hpp"
 
-#include <boost/enable_shared_from_this.hpp>
-
-namespace ndn
-{
+namespace ndn {
 
 class RegexBackrefMatcher : public RegexMatcher
 {
 public:
-  RegexBackrefMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager);
+  RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager);
     
   virtual ~RegexBackrefMatcher(){}
 
@@ -36,8 +35,36 @@
   int m_refNum;
 };
 
-}//ndn
+} // namespace ndn
 
-#endif
+#include "regex-pattern-list-matcher.hpp"
+
+namespace ndn {
+
+inline RegexBackrefMatcher::RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backRefManager)
+  : RegexMatcher (expr, EXPR_BACKREF, backRefManager)
+{
+  // compile();
+}
+
+inline void 
+RegexBackrefMatcher::compile()
+{
+  int lastIndex = m_expr.size() - 1;
+  if('(' == m_expr[0] && ')' == m_expr[lastIndex]){
+    // m_backRefManager->pushRef(this);
+
+    shared_ptr<RegexMatcher> matcher(new RegexPatternListMatcher(m_expr.substr(1, lastIndex - 1), m_backrefManager));
+    m_matcherList.push_back(matcher);
+  }
+  else
+    throw RegexMatcher::Error(std::string("Error: RegexBackrefMatcher.Compile(): ")
+                              + " Unrecognoized format " + m_expr);
+}
+
+
+} // namespace ndn
+
+#endif // NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP