00001 // 00002 // Copyright (C) 2005, 2006 Free Software Foundation, Inc. 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 00017 // 00018 // 00019 00020 #ifndef GNASH_AS_PROP_FLAGS_H 00021 #define GNASH_AS_PROP_FLAGS_H 00022 00023 #ifdef HAVE_CONFIG_H 00024 #include "config.h" 00025 #endif 00026 00027 //#include "container.h" 00028 00029 namespace gnash { 00030 00032 class as_prop_flags 00033 { 00034 public: 00036 int m_flags; 00037 00039 bool m_is_protected; 00040 00042 static const int as_prop_flags_mask = 0x7; 00043 00045 as_prop_flags() : m_flags(0), m_is_protected(false) 00046 { 00047 } 00048 00050 as_prop_flags(const bool read_only, const bool dont_delete, const bool dont_enum) 00051 : 00052 m_flags(((read_only) ? 0x4 : 0) | ((dont_delete) ? 0x2 : 0) | ((dont_enum) ? 0x1 : 0)), 00053 m_is_protected(false) 00054 { 00055 } 00056 00058 as_prop_flags(const int flags) 00059 : m_flags(flags), m_is_protected(false) 00060 { 00061 } 00062 00064 bool get_read_only() const { return (((this->m_flags & 0x4)!=0)?true:false); } 00065 00067 bool get_dont_delete() const { return (((this->m_flags & 0x2)!=0)?true:false); } 00068 00070 bool get_dont_enum() const { return (((this->m_flags & 0x1)!=0)?true:false); } 00071 00073 int get_flags() const { return this->m_flags; } 00074 00076 bool get_is_protected() const { return this->m_is_protected; } 00077 00079 void set_get_is_protected(const bool is_protected) { this->m_is_protected = is_protected; } 00080 00094 bool set_flags(const int setTrue, const int setFalse = 0) 00095 { 00096 if (get_is_protected()) return false; 00097 00098 m_flags &= ~setFalse; 00099 m_flags |= setTrue; 00100 00101 return true; 00102 } 00103 }; 00104 00105 00106 00107 } // namespace gnash 00108 00109 #endif // GNASH_AS_PROP_FLAGS_H