forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.h
More file actions
44 lines (33 loc) · 896 Bytes
/
query.h
File metadata and controls
44 lines (33 loc) · 896 Bytes
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
// Aseprite CSS Library
// Copyright (C) 2013 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef CSS_QUERY_H_INCLUDED
#define CSS_QUERY_H_INCLUDED
#pragma once
#include "css/rule.h"
#include "css/style.h"
#include "css/value.h"
#include <map>
namespace css {
class Query {
public:
Query() { }
// Adds more rules from the given style only if the query doesn't
// contain those rules already.
void addFromStyle(const Style* style);
const Value& operator[](const Rule& rule) const {
const Style* style = m_ruleValue[rule.name()];
if (style)
return (*style)[rule.name()];
else
return m_none;
}
private:
void addRuleValue(const std::string& ruleName, const Style* style);
Styles m_ruleValue;
Value m_none;
};
} // namespace css
#endif