1    	// @(#)root/tree:$Id$
2    	// Author: Rene Brun   14/04/97
3    	
4    	/*************************************************************************
5    	 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
6    	 * All rights reserved.                                                  *
7    	 *                                                                       *
8    	 * For the licensing terms see $ROOTSYS/LICENSE.                         *
9    	 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
10   	 *************************************************************************/
11   	
12   	#ifndef ROOT_TCut
13   	#define ROOT_TCut
14   	
15   	//////////////////////////////////////////////////////////////////////////
16   	//                                                                      //
17   	// TCut                                                                 //
18   	//                                                                      //
19   	// A specialized string object used in TTree selections.                //
20   	//                                                                      //
21   	//////////////////////////////////////////////////////////////////////////
22   	
23   	#ifndef ROOT_TNamed
24   	#include "TNamed.h"
25   	#endif
26   	
27   	class TCut : public TNamed {
28   	private:
29   	   // Prevent meaningless operator (which otherwise can be reached via
30   	   // the conversion to 'const char*'
31   	   Bool_t operator<(const TCut &rhs); // Intentional left unimplemented
32   	   Bool_t operator<=(const TCut &rhs); // Intentional left unimplemented
33   	   Bool_t operator>(const TCut &rhs); // Intentional left unimplemented
34   	   Bool_t operator>=(const TCut &rhs); // Intentional left unimplemented
35   	public:
36   	   TCut();
37   	   TCut(const char *title);
38   	   TCut(const char *name, const char *title);
39   	   TCut(const TCut &cut);
40   	   virtual ~TCut();
41   	
42   	   // Assignment
43   	   TCut&    operator=(const char *rhs);
44   	   TCut&    operator=(const TCut &rhs);
45   	   TCut&    operator+=(const char *rhs);
46   	   TCut&    operator+=(const TCut &rhs);
47   	   TCut&    operator*=(const char *rhs);
48   	   TCut&    operator*=(const TCut &rhs);
49   	   
50   	   // Comparison
51   	   Bool_t   operator==(const char *rhs) const;
52   	   Bool_t   operator==(const TCut &rhs) const;
53   	   Bool_t   operator!=(const char *rhs) const;
54   	   Bool_t   operator!=(const TCut &rhs) const;
55   	   
56   	   friend TCut operator+(const TCut &lhs, const char *rhs);
57   	   friend TCut operator+(const char *lhs, const TCut &rhs);
58   	   friend TCut operator+(const TCut &lhs, const TCut &rhs);
59   	   friend TCut operator*(const TCut &lhs, const char *rhs);
60   	   friend TCut operator*(const char *lhs, const TCut &rhs);
61   	   friend TCut operator*(const TCut &lhs, const TCut &rhs);
62   	// Preventing warnings with -Weffc++ in GCC since the overloading of the && and || operators was a design choice.
63   	#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
64   	#pragma GCC diagnostic push
65   	#pragma GCC diagnostic ignored "-Weffc++"
66   	#endif
67   	   friend TCut operator&&(const TCut &lhs, const char *rhs);
68   	   friend TCut operator&&(const char *lhs, const TCut &rhs);
69   	   friend TCut operator&&(const TCut &lhs, const TCut &rhs);
70   	   friend TCut operator||(const TCut &lhs, const char *rhs);
71   	   friend TCut operator||(const char *lhs, const TCut &rhs);
72   	   friend TCut operator||(const TCut &lhs, const TCut &rhs);
73   	#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
74   	#pragma GCC diagnostic pop
75   	#endif
76   	   friend TCut operator!(const TCut &rhs);
77   	
78   	   // Type conversion
79   	   operator const char*() const { return GetTitle(); }
80   	
81   	   ClassDef(TCut,1)  //A specialized string object used for TTree selections
82   	};
83   	
84   	// Declarations.
85   	TCut operator+(const TCut &lhs, const char *rhs);
86   	TCut operator+(const char *lhs, const TCut &rhs);
87   	TCut operator+(const TCut &lhs, const TCut &rhs);
88   	TCut operator*(const TCut &lhs, const char *rhs);
89   	TCut operator*(const char *lhs, const TCut &rhs);
90   	TCut operator*(const TCut &lhs, const TCut &rhs);
91   	// Preventing warnings with -Weffc++ in GCC since the overloading of the && and || operators was a design choice.
92   	#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
93   	#pragma GCC diagnostic push
94   	#pragma GCC diagnostic ignored "-Weffc++"
95   	#endif
96   	TCut operator&&(const TCut &lhs, const char *rhs);
97   	TCut operator&&(const char *lhs, const TCut &rhs);
98   	TCut operator&&(const TCut &lhs, const TCut &rhs);
99   	TCut operator||(const TCut &lhs, const char *rhs);
100  	TCut operator||(const char *lhs, const TCut &rhs);
101  	TCut operator||(const TCut &lhs, const TCut &rhs);
102  	#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
103  	#pragma GCC diagnostic pop
104  	#endif
105  	TCut operator!(const TCut &rhs);
106  	
107  	#endif
108