File: significant_tags.h

package info (click to toggle)
tilemaker 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 83,488 kB
  • sloc: cpp: 29,461; ansic: 12,510; makefile: 229; ruby: 77; sh: 43
file content (39 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (2)
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
#ifndef SIGNIFICANT_TAGS_H
#define SIGNIFICANT_TAGS_H

#include <string>
#include <vector>

class TagMap;
// Data structures to permit users to express filters on which nodes/ways
// to be accepted.
//
// Filters are of the shape: [~]key-name[=value-name]
//
// When a tilde is present, the filter's meaning is inverted.

struct TagFilter {
	bool accept;
	std::string key;
	std::string value;

	bool operator==(const TagFilter& other) const {
		return accept == other.accept && key == other.key && value == other.value;
	}
};

class SignificantTags {
public:
	SignificantTags();
	SignificantTags(std::vector<std::string> rawTags);
	bool filter(const TagMap& tags) const;

	static TagFilter parseFilter(std::string rawTag);
	bool enabled() const;

private:
	bool enabled_;
	std::vector<TagFilter> filters;
};

#endif