<commit_before>#ifndef HEXT_MATCH_PATTERN_H
#define HEXT_MATCH_PATTERN_H

#include <string>
#include <iostream>
#include <utility>
#include <memory>

#include <gumbo.h>

#include "hext/pattern/attr-test.h"


namespace hext {


/// A MatchResult contains a bool deciding whether the match was successful,
/// and, if applicable, the GumboAttribute that was matched.
typedef std::pair<bool, const GumboAttribute *> MatchResult;

/// MatchPattern is an abstract base for all patterns that are used to check
/// whether an html-node is matched by a rule. Rules have MatchPatterns.
class MatchPattern
{
public:
  explicit MatchPattern(std::unique_ptr<AttrTest> attribute_test);
  virtual MatchResult matches(const GumboNode * node) const = 0;
  virtual void print(std::ostream& out = std::cout) const = 0;
  virtual ~MatchPattern();

protected:
  const std::unique_ptr<AttrTest> test_;
};


} // namespace hext


#endif // HEXT_MATCH_PATTERN_H
<commit_msg>cdtors are declared first<commit_after>#ifndef HEXT_MATCH_PATTERN_H
#define HEXT_MATCH_PATTERN_H

#include <string>
#include <iostream>
#include <utility>
#include <memory>

#include <gumbo.h>

#include "hext/pattern/attr-test.h"


namespace hext {


/// A MatchResult contains a bool deciding whether the match was successful,
/// and, if applicable, the GumboAttribute that was matched.
typedef std::pair<bool, const GumboAttribute *> MatchResult;

/// MatchPattern is an abstract base for all patterns that are used to check
/// whether an html-node is matched by a rule. Rules have MatchPatterns.
class MatchPattern
{
public:
  explicit MatchPattern(std::unique_ptr<AttrTest> attribute_test);
  virtual ~MatchPattern();
  virtual MatchResult matches(const GumboNode * node) const = 0;
  virtual void print(std::ostream& out = std::cout) const = 0;

protected:
  const std::unique_ptr<AttrTest> test_;
};


} // namespace hext


#endif // HEXT_MATCH_PATTERN_H

{'fraction_non_alphanumeric': 0.1013584117032393, 'fraction_numerical': 0.0020898641588296763, 'mean_word_length': 4.947204968944099, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5980094', 'n_tokens_mistral': 620, 'n_tokens_neox': 585, 'n_words': 195}