00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Teddy/MixIn/Options.h"
00026
00027
00028 namespace Teddy {
00029 namespace MixIn {
00030
00031
00033 Options::Options(){
00034 options = 0;
00035 }
00036
00037
00039 Options::Options( const unsigned long options ){
00040 this->options = options;
00041 }
00042
00043
00044 Options::~Options(){
00045 }
00046
00047
00049 void Options::setOptions( const unsigned long options ){
00050 this->options = options;
00051 }
00052
00053
00055 unsigned long Options::getOptions() const {
00056 return this->options;
00057 }
00058
00059
00061 void Options::enable( const unsigned long options ){
00062 this->options |= options;
00063 }
00064
00065
00067 void Options::disable( const unsigned long options ){
00068 this->options &= ~options;
00069 }
00070
00071
00073 void Options::toggle( const unsigned long options ){
00074 this->options ^= options;
00075 }
00076
00077
00078 unsigned long Options::operator &( const Options &other ){
00079 return options & other.getOptions();
00080 }
00081
00082
00083 unsigned long Options::operator |( const Options &other ){
00084 return options | other.getOptions();
00085 }
00086
00087
00088 Options &Options::operator &=( const Options &other ){
00089 options &= other.getOptions();
00090 return *this;
00091 }
00092
00093
00094 Options &Options::operator |=( const Options &other ){
00095 options |= other.getOptions();
00096 return *this;
00097 }
00098
00099
00100 Options &Options::operator ^=( const Options &other ){
00101 options ^= other.getOptions();
00102 return *this;
00103 }
00104
00105
00107 bool Options::isEnabled( const unsigned long options ){
00108 if( (this->options & options) == options ){
00109 return true;
00110 }else{
00111 return false;
00112 }
00113 }
00114
00115
00116 const char *Options::isEnabledStr( const unsigned long options ){
00117 if( isEnabled(options) ){
00118 return "enabled";
00119 }else{
00120 return "disabled";
00121 }
00122 }
00123
00124
00126 bool Options::isDisabled( const unsigned long options ){
00127 if( (this->options & options) == 0 ){
00128 return true;
00129 }else{
00130 return false;
00131 }
00132 }
00133
00134
00135 };
00136 };
00137