boolean.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. //
  19. // Filename: boolean.h
  20. // Author: Tom Spencer-Smith
  21. // Date: Nov 1999
  22. // Description:
  23. //
  24. //-----------------------------------------------------------------------------
  25. #if defined(_MSV_VER)
  26. #pragma once
  27. #endif
  28. #ifndef BOOLEAN_H
  29. #define BOOLEAN_H
  30. //-----------------------------------------------------------------------------
  31. class cBoolean
  32. {
  33. public:
  34. cBoolean(bool value = false) {Value = value;}
  35. bool Toggle(void) {Value = !Value; return Value;}
  36. bool Set(bool value) {Value = value; return Value;}
  37. bool Get(void) const {return Value;}
  38. bool Is_True(void) const {return Value == true;}
  39. bool Is_False(void) const {return Value == false;}
  40. private:
  41. bool Value;
  42. };
  43. //-----------------------------------------------------------------------------
  44. #endif // BOOLEAN_H