// Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "stdpch.h" #include "keyword.h" //--------------------------------------------------------------------------------- // CKeywordSet //--------------------------------------------------------------------------------- void CKeywordSet::clear() { _words.clear(); } void CKeywordSet::addKeywords(const std::string &keywords) { // chunkify the input string into white-space separated words std::string word, s=keywords; while (AI_SHARE::stringToWordAndTail(s,word,s)) { if (_words.size()<32) _words.push_back(word); else nlwarning("Too many keywords for keyword set (limit to 32) - ignoring keyword: '%s'",word.c_str()); } } bool CKeywordSet::stringToMask(std::string s, CKeywordMask &result) const { bool ret = true; std::string word; while (AI_SHARE::stringToWordAndTail(s,word,s)) { //look for the keyword in the word list uint i; for (i=0;i<_words.size();++i) if (NLMISC::nlstricmp(word,_words[i])==0) { result._mask|=(1<_mask|=(1<