selection.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2005-2018 Samuel Newbold
  2. // a set of fixed text terms separated by wildcards to match directory entries
  3. class Simple_pattern {
  4. bool only_text;
  5. std::string initial;
  6. std::string last;
  7. std::vector<std::string> terms;
  8. typedef std::vector<std::string>::size_type size_type;
  9. public:
  10. Simple_pattern(const std::string& src);
  11. bool is_only_text(void) const {return only_text;}
  12. bool isnt_contained(const Simple_pattern& competition) const;
  13. bool match(const std::string& s) const;
  14. std::string str(void) const;};
  15. // a set of unrelated Simple_pattern options, to match directory entries
  16. class Entry_pattern {
  17. std::vector<Simple_pattern> options;
  18. bool only_text;
  19. public:
  20. Entry_pattern(const std::string& src);
  21. bool is_only_text(void) const {return only_text;}
  22. bool match_with_ignore(const Entry_pattern& ignore_pattern,
  23. const std::string& s) const;
  24. bool specific_match(const std::string& s,
  25. const Simple_pattern& competition) const;
  26. std::string str(void) const;};
  27. void str_to_entry_pattern_list(const std::string& src,
  28. std::list<Entry_pattern>& res);
  29. std::string entry_pattern_list_to_str(
  30. std::list<Entry_pattern>::const_iterator start,
  31. std::list<Entry_pattern>::const_iterator end);