]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/YesNoNone.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_YESNONONE_H_
10 #define SQUID_YESNONONE_H_
12 /// Used for boolean enabled/disabled options with complex default logic.
13 /// Allows Squid to compute the right default after configuration.
14 /// Checks that not-yet-defined option values are not used.
17 // TODO: generalize to non-boolean option types
19 YesNoNone(): option(0) {}
21 /// returns true iff enabled; asserts if the option has not been configured
22 operator void *() const; // TODO: use a fancy/safer version of the operator
24 /// enables or disables the option;
25 void configure(bool beSet
);
27 /// whether the option was enabled or disabled, by user or Squid
28 bool configured() const { return option
!= 0; }
31 enum { optUnspecified
= -1, optDisabled
= 0, optEnabled
= 1 };
32 int option
; ///< configured value or zero
35 #endif /* SQUID_YESNONONE_H_ */