ubit
ucond.hpp
1 /************************************************************************
2  *
3  * ucond.hpp: Base class for the attributes of the Scene Graph
4  * Ubit GUI Toolkit - Version 6
5  * (C) 2009 | Eric Lecolinet | TELECOM ParisTech | http://www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 #ifndef _ucond_hpp_
17 #define _ucond_hpp_ 1
18 #include <ubit/udefs.hpp>
19 namespace ubit {
20 
29  class UCond {
30  public:
31  virtual ~UCond() {}
32 
33  virtual bool operator==(const UCond& c) const {return this == &c;}
34  virtual bool operator!=(const UCond& c) const {return this != &c;}
35  virtual const UCond* matches(const UCond& c) const {return this == &c ? this : 0;}
36  virtual bool verifies(const UUpdateContext&, const UElem&) const = 0;
37 
38  virtual UOn* toOn() {return null;}
39  virtual const UOn* toOn() const {return null;}
40 
41  // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42  virtual void setParentModes(UElem& parent) const {};
43  };
44 
45  /* ==================================================== ===== ======= */
46  // pose le pbm de la desctruction auto
47 
48  class UMultiCond : public UCond {
49  public:
50  UMultiCond& operator+=(const UCond& c) {return add(c);}
51  virtual UMultiCond& add(const UCond&);
52  virtual void remove(const UCond&);
53 
54  virtual const UCond* matches(const UCond& c) const;
55  virtual bool verifies(const UUpdateContext&, const UElem&) const;
56  virtual void setParentModes(UElem& parent) const;
57 
58  private:
59  typedef std::list<const UCond*> CondList;
60  CondList condlist;
61  };
62 
63 }
64 #endif
65 
Base class for Ubit conditions.
Definition: ucond.hpp:29
Definition: ucond.hpp:48
lightweight general purpose container.
Definition: uelem.hpp:44
Callback conditions.
Definition: uon.hpp:35
Definition: uupdatecontext.hpp:32
Definition: uhardfont.hpp:31