1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "SmartAttributeEditorMatcher.h" 21 22 namespace TrenchBroom { 23 namespace View { ~SmartAttributeEditorMatcher()24 SmartAttributeEditorMatcher::~SmartAttributeEditorMatcher() {} 25 matches(const Model::AttributeName & name,const Model::AttributableNodeList & attributables) const26 bool SmartAttributeEditorMatcher::matches(const Model::AttributeName& name, const Model::AttributableNodeList& attributables) const { 27 return doMatches(name, attributables); 28 } 29 SmartAttributeEditorKeyMatcher(const Model::AttributeName & name1,const Model::AttributeName & name2,const Model::AttributeName & name3,const Model::AttributeName & name4,const Model::AttributeName & name5)30 SmartAttributeEditorKeyMatcher::SmartAttributeEditorKeyMatcher(const Model::AttributeName& name1, const Model::AttributeName& name2, const Model::AttributeName& name3, const Model::AttributeName& name4, const Model::AttributeName& name5) { 31 if (!name1.empty()) 32 m_names.insert(name1); 33 if (!name2.empty()) 34 m_names.insert(name2); 35 if (!name3.empty()) 36 m_names.insert(name3); 37 if (!name4.empty()) 38 m_names.insert(name4); 39 if (!name5.empty()) 40 m_names.insert(name5); 41 } 42 doMatches(const Model::AttributeName & name,const Model::AttributableNodeList & attributables) const43 bool SmartAttributeEditorKeyMatcher::doMatches(const Model::AttributeName& name, const Model::AttributableNodeList& attributables) const { 44 return !attributables.empty() && m_names.count(name) > 0; 45 } 46 doMatches(const Model::AttributeName & name,const Model::AttributableNodeList & attributables) const47 bool SmartAttributeEditorDefaultMatcher::doMatches(const Model::AttributeName& name, const Model::AttributableNodeList& attributables) const { 48 return true; 49 } 50 } 51 } 52