blob: 3c41bd111f7314b035b82dc171794ac0b08c194b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// --------------------------------------------------------------------------
//
// File
// Name: ExcludeList.h
// Purpose: General purpose exclusion list
// Created: 28/1/04
//
// --------------------------------------------------------------------------
#ifndef EXCLUDELIST__H
#define EXCLUDELIST__H
#include <string>
#include <set>
#include <vector>
// avoid including regex.h in lots of places
#ifndef EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED
typedef int regex_t;
#endif
class Archive;
// --------------------------------------------------------------------------
//
// Class
// Name: ExcludeList
// Purpose: General purpose exclusion list
// Created: 28/1/04
//
// --------------------------------------------------------------------------
class ExcludeList
{
public:
ExcludeList();
~ExcludeList();
void Deserialize(Archive & rArchive);
void Serialize(Archive & rArchive) const;
void AddDefiniteEntries(const std::string &rEntries);
void AddRegexEntries(const std::string &rEntries);
// Add exceptions to the exclusions (takes ownership)
void SetAlwaysIncludeList(ExcludeList *pAlwaysInclude);
// Test function
bool IsExcluded(const std::string &rTest) const;
// Mainly for tests
unsigned int SizeOfDefiniteList() const {return mDefinite.size();}
unsigned int SizeOfRegexList() const
#ifdef HAVE_REGEX_SUPPORT
{return mRegex.size();}
#else
{return 0;}
#endif
private:
std::set<std::string> mDefinite;
#ifdef HAVE_REGEX_SUPPORT
std::vector<regex_t *> mRegex;
std::vector<std::string> mRegexStr; // save original regular expression string-based source for Serialize
#endif
#ifdef WIN32
std::string ReplaceSlashesDefinite(const std::string& input) const;
std::string ReplaceSlashesRegex (const std::string& input) const;
#endif
// For exceptions to the excludes
ExcludeList *mpAlwaysInclude;
};
#endif // EXCLUDELIST__H
|