match.hh revision 2665
11031SN/A/* 21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 31031SN/A * All rights reserved. 41031SN/A * 51031SN/A * Redistribution and use in source and binary forms, with or without 61031SN/A * modification, are permitted provided that the following conditions are 71031SN/A * met: redistributions of source code must retain the above copyright 81031SN/A * notice, this list of conditions and the following disclaimer; 91031SN/A * redistributions in binary form must reproduce the above copyright 101031SN/A * notice, this list of conditions and the following disclaimer in the 111031SN/A * documentation and/or other materials provided with the distribution; 121031SN/A * neither the name of the copyright holders nor the names of its 131031SN/A * contributors may be used to endorse or promote products derived from 141031SN/A * this software without specific prior written permission. 151031SN/A * 161031SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171031SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181031SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191031SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201031SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211031SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221031SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231031SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241031SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251031SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261031SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 291031SN/A */ 301031SN/A 311031SN/A/* @file 321031SN/A * User Console Definitions 331031SN/A */ 341031SN/A 351031SN/A#ifndef __BASE_MATCH_HH__ 361031SN/A#define __BASE_MATCH_HH__ 371031SN/A 381031SN/A#include <string> 391031SN/A#include <vector> 401031SN/A 411031SN/Aclass ObjectMatch 421031SN/A{ 431031SN/A protected: 441031SN/A std::vector<std::vector<std::string> > tokens; 451031SN/A bool domatch(const std::string &name) const; 461031SN/A 471031SN/A public: 481031SN/A ObjectMatch(); 491031SN/A ObjectMatch(const std::string &expression); 501031SN/A void setExpression(const std::string &expression); 511031SN/A void setExpression(const std::vector<std::string> &expression); 521031SN/A bool match(const std::string &name) const 531031SN/A { 541031SN/A return tokens.empty() ? false : domatch(name); 551031SN/A } 561031SN/A}; 571031SN/A 581031SN/A#endif // __BASE_MATCH_HH__ 591031SN/A 60