news download themes documentation links










ClientPattern.hh

00001 // ClientPattern.hh for Fluxbox Window Manager
00002 // Copyright (c) 2002 Xavier Brouckaert
00003 // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00004 //                and Simon Bowden    (rathnor at users.sourceforge.net)
00005 //
00006 // Permission is hereby granted, free of charge, to any person obtaining a
00007 // copy of this software and associated documentation files (the "Software"),
00008 // to deal in the Software without restriction, including without limitation
00009 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00010 // and/or sell copies of the Software, and to permit persons to whom the
00011 // Software is furnished to do so, subject to the following conditions:
00012 //
00013 // The above copyright notice and this permission notice shall be included in
00014 // all copies or substantial portions of the Software.
00015 //
00016 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00019 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00021 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00022 // DEALINGS IN THE SOFTWARE.
00023 
00024 // $Id: ClientPattern.hh,v 1.2 2003/06/13 12:02:00 fluxgen Exp $
00025 
00026 #ifndef CLIENTPATTERN_HH
00027 #define CLIENTPATTERN_HH
00028 
00029 #include "RegExp.hh"
00030 #include "NotCopyable.hh"
00031 
00032 #include <string>
00033 #include <list>
00034 
00035 class WinClient;
00036 
00041 class ClientPattern:private FbTk::NotCopyable {
00042 public:
00043     ClientPattern();
00049     explicit ClientPattern(const char * str);
00050 
00051     ~ClientPattern();
00052 
00054     std::string toString() const;
00055 
00056     enum WinProperty { TITLE, CLASS, NAME };
00057 
00059     bool match(const WinClient &win) const;
00060 
00067     bool addTerm(const std::string &str, WinProperty prop);
00068 
00069     inline void addMatch() { ++m_nummatches; }
00070     inline void delMatch() { --m_nummatches; }
00071 
00072     inline bool operator == (const WinClient &win) const {
00073         return match(win);
00074     }
00075 
00080     inline int error() const { return m_terms.empty() ? m_matchlimit : 0; }
00081 
00082     std::string getProperty(WinProperty prop, const WinClient &winclient) const;
00083 
00084 private:
00091     struct Term {
00092         Term(const std::string &regstr, bool full_match) :regexp(regstr, full_match){};
00093         std::string orig;
00094         RegExp regexp;
00095         WinProperty prop;
00096     };
00097 
00098 
00099     typedef std::list<Term *> Terms;
00100 
00101     Terms m_terms; 
00102 
00103     int m_matchlimit, m_nummatches;
00104 };
00105 
00106 #endif // CLIENTPATTERN_HH

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA