00001 // 00002 // UCSD p-System cross compiler 00003 // Copyright (C) 2006 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or (at 00008 // you option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00018 // USA 00019 // 00020 00021 #ifndef LIB_EXPRESSION_SMART_POINTER_H 00022 #define LIB_EXPRESSION_SMART_POINTER_H 00023 00024 class expression; // forward 00025 00030 class expression_smart_pointer 00031 { 00032 public: 00036 virtual ~expression_smart_pointer(); 00037 00043 expression_smart_pointer(); 00044 00053 expression_smart_pointer(expression *arg); 00054 00058 expression_smart_pointer(const expression_smart_pointer &); 00059 00063 expression_smart_pointer &operator=(const expression_smart_pointer &); 00064 00074 const expression *operator->() const { return ref; } 00075 00085 expression *operator->() { return ref; } 00086 00092 void null(); 00093 00098 bool is_null() const { return (ref == 0); } 00099 00104 bool is_not_null() const { return (ref != 0); } 00105 00112 bool 00113 operator==(const expression_smart_pointer &rhs) 00114 const 00115 { 00116 return (ref == rhs.ref); 00117 } 00118 00119 private: 00124 expression *ref; 00125 }; 00126 00127 #endif // LIB_EXPRESSION_SMART_POINTER_H
1.5.1