]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Moved YesNoNone to own header and implementation file.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 4 Sep 2012 11:13:13 +0000 (13:13 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 4 Sep 2012 11:13:13 +0000 (13:13 +0200)
src/Makefile.am
src/SquidConfig.h
src/YesNoNone.cc [new file with mode: 0644]
src/YesNoNone.h [new file with mode: 0644]
src/cache_cf.cc
src/structs.h
src/tests/stub_cache_cf.cc

index 4afc3dd211ac3ab9a2c766ec6bead22424bf4358..35e7aa126db82e27d218fa83c69090ede460ee92 100644 (file)
@@ -268,6 +268,8 @@ squid_SOURCES = \
        AsyncEngine.h \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        CacheDigest.h \
        CacheDigest.cc \
@@ -1145,6 +1147,7 @@ tests_testHttpReply_SOURCES=\
        log/access_log.h \
        tests/stub_access_log.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_debug.cc \
@@ -1253,6 +1256,7 @@ tests_testACLMaxUserIP_SOURCES= \
        log/access_log.h \
        tests/stub_access_log.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_debug.cc \
        tests/stub_DelayId.cc \
@@ -1365,6 +1369,8 @@ tests_testCacheManager_SOURCES = \
        cache_manager.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        CacheDigest.h \
        CacheDigest.cc \
@@ -1653,6 +1659,7 @@ tests_testDiskIO_SOURCES = \
        tests/stub_access_log.cc \
        tests/stub_acl.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_client_db.cc \
@@ -1748,6 +1755,8 @@ tests_testEvent_SOURCES = \
        CacheDigest.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        cache_manager.cc \
        carp.h \
@@ -1981,6 +1990,8 @@ tests_testEventLoop_SOURCES = \
        cache_manager.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        carp.h \
        carp.cc \
@@ -2209,6 +2220,8 @@ tests_test_http_range_SOURCES = \
        BodyPipe.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
@@ -2440,6 +2453,7 @@ tests_testHttpParser_SOURCES = \
        String.cc \
        structs.h \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_debug.cc \
@@ -2492,6 +2506,8 @@ tests_testHttpRequest_SOURCES = \
        cache_manager.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        debug.cc \
        CacheDigest.h \
@@ -2769,6 +2785,7 @@ tests_testStore_SOURCES= \
        tests/stub_access_log.cc \
        tests/stub_acl.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_client_side_request.cc \
@@ -2867,6 +2884,7 @@ tests_testString_SOURCES = \
        tests/testString.cc \
        tests/testString.h \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_debug.cc \
@@ -2980,6 +2998,7 @@ tests_testUfs_SOURCES = \
        SwapDir.cc \
        tests/stub_acl.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_helper.cc \
        cbdata.cc \
@@ -3152,6 +3171,7 @@ tests_testRock_SOURCES = \
        log/access_log.h \
        tests/stub_access_log.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        client_db.h \
@@ -3288,6 +3308,7 @@ tests_testCoss_SOURCES = \
        SwapDir.cc \
        tests/stub_acl.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_helper.cc \
        cbdata.cc \
@@ -3439,6 +3460,7 @@ tests_testNull_SOURCES = \
        SwapDir.cc \
        tests/stub_acl.cc \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_helper.cc \
        cbdata.cc \
@@ -3530,6 +3552,8 @@ tests_testURL_SOURCES = \
        BodyPipe.cc \
        cache_cf.h \
        AuthReg.h \
+       YesNoNone.h \
+       YesNoNone.cc \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
@@ -3765,6 +3789,7 @@ tests_testConfigParser_SOURCES = \
        tests/testConfigParser.cc \
        tests/testConfigParser.h \
        cache_cf.h \
+       YesNoNone.h \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_debug.cc \
index 54c62b8d3dbed2204d84cabbd80d750bd0e21cf5..88fc2054711fd7db6aebf08eadb4a25d6c6b7094 100644 (file)
@@ -39,6 +39,7 @@
 #include "ip/Address.h"
 #include "RefCount.h"
 #include "structs.h"
+#include "YesNoNone.h"
 
 class acl_access;
 class acl_deny_info_list;
diff --git a/src/YesNoNone.cc b/src/YesNoNone.cc
new file mode 100644 (file)
index 0000000..ec977a9
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+#include "YesNoNone.h"
+
+YesNoNone::operator void*() const
+{
+    assert(option != 0); // must call configure() first
+    return option > 0 ? (void*)this : NULL;
+}
+
+void
+YesNoNone::configure(bool beSet)
+{
+    option = beSet ? +1 : -1;
+}
diff --git a/src/YesNoNone.h b/src/YesNoNone.h
new file mode 100644 (file)
index 0000000..1796555
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef SQUID_YESNONONE_H_
+#define SQUID_YESNONONE_H_
+/*
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+/// Used for boolean enabled/disabled options with complex default logic.
+/// Allows Squid to compute the right default after configuration.
+/// Checks that not-yet-defined option values are not used.
+class YesNoNone
+{
+// TODO: generalize to non-boolean option types
+public:
+    YesNoNone(): option(0) {}
+
+    /// returns true iff enabled; asserts if the option has not been configured
+    operator void *() const; // TODO: use a fancy/safer version of the operator
+
+    /// enables or disables the option;
+    void configure(bool beSet);
+
+    /// whether the option was enabled or disabled, by user or Squid
+    bool configured() const { return option != 0; }
+
+private:
+    enum { optUnspecified = -1, optDisabled = 0, optEnabled = 1 };
+    int option; ///< configured value or zero
+};
+
+
+#endif /* SQUID_YESNONONE_H_ */
index c46c505ce8604ffffd70c24eaea25c9f17002e26..6810248c3fbb808afa6ff84d30b6c5ec6f9bfa36 100644 (file)
@@ -3295,18 +3295,6 @@ dump_removalpolicy(StoreEntry * entry, const char *name, RemovalPolicySettings *
     storeAppendPrintf(entry, "\n");
 }
 
-void
-YesNoNone::configure(bool beSet)
-{
-    option = beSet ? +1 : -1;
-}
-
-YesNoNone::operator void*() const
-{
-    assert(option != 0); // must call configure() first
-    return option > 0 ? (void*)this : NULL;
-}
-
 inline void
 free_YesNoNone(YesNoNone *)
 {
index 804a03a59b5aad64390f574709c0902133f765e7..26df25c2f6dcbce39ca002d1d0045beee2177039 100644 (file)
@@ -146,29 +146,6 @@ struct PortCfg;
 }
 class SwapDir;
 
-/// Used for boolean enabled/disabled options with complex default logic.
-/// Allows Squid to compute the right default after configuration.
-/// Checks that not-yet-defined option values are not used.
-class YesNoNone
-{
-// TODO: generalize to non-boolean option types
-public:
-    YesNoNone(): option(0) {}
-
-    /// returns true iff enabled; asserts if the option has not been configured
-    operator void *() const; // TODO: use a fancy/safer version of the operator
-
-    /// enables or disables the option;
-    void configure(bool beSet);
-
-    /// whether the option was enabled or disabled, by user or Squid
-    bool configured() const { return option != 0; }
-
-private:
-    enum { optUnspecified = -1, optDisabled = 0, optEnabled = 1 };
-    int option; ///< configured value or zero
-};
-
 struct SquidConfig2 {
     struct {
         int enable_purge;
index cdb3d80c3ae8ec54a5d2fe76d55a9f549591c524..699ee23e0243f8c5f7ce27025c1f234a0444edd8 100644 (file)
@@ -33,6 +33,7 @@
 #include "squid.h"
 #include "ConfigParser.h"
 #include "wordlist.h"
+#include "YesNoNone.h"
 
 #define STUB_API "cache_cf.cc"
 #include "tests/STUB.h"