Esempio n. 1
0
void
NdnRegexComponentSetMatcher::compileSingleComponent()
{
  size_t end = extractComponent(1);

  if (expr_.size() != end)
    throw NdnRegexMatcherBase::Error("Component expr error " + expr_);
  else {
    ptr_lib::shared_ptr<NdnRegexComponentMatcher> component =
      ptr_lib::make_shared<NdnRegexComponentMatcher>
        (expr_.substr(1, end - 2), backrefManager_);

    components_.push_back(component);
  }
}
void
RegexComponentSetMatcher::compileSingleComponent()
{
  size_t end = extractComponent(1);

  if (m_expr.size() != end) {
    throw Error("Component expr error " + m_expr);
  }
  else {
    auto component = make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2),
                                                        m_backrefManager);

    m_components.insert(component);
  }
}
inline void
RegexComponentSetMatcher::compileSingleComponent()
{
  size_t end = extractComponent(1);

  if (m_expr.size() != end)
    {
      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));
    }
  else
    {
      shared_ptr<RegexComponentMatcher> component =
        make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2), m_backrefManager);

      m_components.insert(component);
    }
}
inline void
RegexComponentSetMatcher::compileMultipleComponents(size_t start, size_t lastIndex)
{
  size_t index = start;
  size_t tempIndex = start;

  while (index < lastIndex) {
    if ('<' != m_expr[index])
      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));

    tempIndex = index + 1;
    index = extractComponent(tempIndex);

    shared_ptr<RegexComponentMatcher> component =
      make_shared<RegexComponentMatcher>(m_expr.substr(tempIndex, index - tempIndex - 1),
                                         m_backrefManager);

    m_components.insert(component);
  }

  if (index != lastIndex)
    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Not sufficient expr to parse " + m_expr));
}
Esempio n. 5
0
void
NdnRegexComponentSetMatcher::compileMultipleComponents
  (size_t start, size_t lastIndex)
{
  size_t index = start;
  size_t tempIndex = start;

  while (index < lastIndex) {
    if ('<' != expr_[index])
      throw NdnRegexMatcherBase::Error("Component expr error " + expr_);

    tempIndex = index + 1;
    index = extractComponent(tempIndex);

    ptr_lib::shared_ptr<NdnRegexComponentMatcher> component =
      ptr_lib::make_shared<NdnRegexComponentMatcher>
        (expr_.substr(tempIndex, index - tempIndex - 1), backrefManager_);

    components_.push_back(component);
  }

  if (index != lastIndex)
    throw NdnRegexMatcherBase::Error("Not sufficient expr to parse " + expr_);
}