From 145ad6c3a51d918ebe6a101d673d7e00591d8941 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 3 Dec 2010 03:13:57 +0100 Subject: [PATCH] more (trivial) cleanup and renaming --- src/lib/allocationcluster.hpp | 2 +- ...scopedholdertransfer.hpp => scoped-holder-transfer.hpp} | 6 +++--- src/lib/scoped-holder.hpp | 2 +- src/lib/scoped-ptrvect.hpp | 2 +- tests/lib/Makefile.am | 4 ++-- ...dertransfertest.cpp => scoped-holder-transfer-test.cpp} | 5 ++--- tests/lib/testdummy.hpp | 7 +++++++ .../{vectortransfertest.cpp => vector-transfer-test.cpp} | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) rename src/lib/{scopedholdertransfer.hpp => scoped-holder-transfer.hpp} (97%) rename tests/lib/{scopedholdertransfertest.cpp => scoped-holder-transfer-test.cpp} (98%) rename tests/lib/{vectortransfertest.cpp => vector-transfer-test.cpp} (99%) diff --git a/src/lib/allocationcluster.hpp b/src/lib/allocationcluster.hpp index 304405d58..1b51e9d5c 100644 --- a/src/lib/allocationcluster.hpp +++ b/src/lib/allocationcluster.hpp @@ -54,7 +54,7 @@ #include "lib/error.hpp" #include "lib/sync-classlock.hpp" #include "lib/scoped-holder.hpp" -#include "lib/scopedholdertransfer.hpp" +#include "lib/scoped-holder-transfer.hpp" diff --git a/src/lib/scopedholdertransfer.hpp b/src/lib/scoped-holder-transfer.hpp similarity index 97% rename from src/lib/scopedholdertransfer.hpp rename to src/lib/scoped-holder-transfer.hpp index 3d600e61a..e7e78c945 100644 --- a/src/lib/scopedholdertransfer.hpp +++ b/src/lib/scoped-holder-transfer.hpp @@ -1,5 +1,5 @@ /* - SCOPEDHOLDERVECTOR.hpp - using ScopedHolder within a STL vector + SCOPED-HOLDER-TRANSFER.hpp - using ScopedHolder within a STL vector Copyright (C) Lumiera.org 2008, Hermann Vosseler @@ -22,8 +22,8 @@ -#ifndef LIB_SCOPEDHOLDERVECTOR_H -#define LIB_SCOPEDHOLDERVECTOR_H +#ifndef LIB_SCOPEDHOLDER_TRANSFER_H +#define LIB_SCOPEDHOLDER_TRANSFER_H #include "lib/error.hpp" #include diff --git a/src/lib/scoped-holder.hpp b/src/lib/scoped-holder.hpp index 4e2c82627..83191970f 100644 --- a/src/lib/scoped-holder.hpp +++ b/src/lib/scoped-holder.hpp @@ -47,7 +47,7 @@ ** friend function. ** ** @see scoped-holder-test.cpp - ** @see scopedholdertransfer.hpp use in std::vector + ** @see scoped-holder-transfer.hpp use in std::vector ** @see AllocationCluster usage example ** @see scoped-ptrvect.hpp simple pointer-holding collection */ diff --git a/src/lib/scoped-ptrvect.hpp b/src/lib/scoped-ptrvect.hpp index d21e2333a..fa7515c6b 100644 --- a/src/lib/scoped-ptrvect.hpp +++ b/src/lib/scoped-ptrvect.hpp @@ -171,7 +171,7 @@ namespace lib { private: - /** @internal element access, including null check */ + /** @internal element access, including range and null check */ T* get (size_type i) { diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index f8661006b..f6930f20b 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -84,7 +84,7 @@ test_lib_SOURCES = \ $(testlib_srcdir)/sanitised-identifier-test.cpp \ $(testlib_srcdir)/scoped-holder-test.cpp \ $(testlib_srcdir)/scoped-ptrvect-test.cpp \ - $(testlib_srcdir)/scopedholdertransfertest.cpp \ + $(testlib_srcdir)/scoped-holder-transfer-test.cpp \ $(testlib_srcdir)/singleton-subclass-test.cpp \ $(testlib_srcdir)/singleton-test.cpp \ $(testlib_srcdir)/singletontestmocktest.cpp \ @@ -106,7 +106,7 @@ test_lib_SOURCES = \ $(testlib_srcdir)/typed-allocation-manager-test.cpp \ $(testlib_srcdir)/typed-counter-test.cpp \ $(testlib_srcdir)/util-foreach-test.cpp \ - $(testlib_srcdir)/vectortransfertest.cpp \ + $(testlib_srcdir)/vector-transfer-test.cpp \ $(testlib_srcdir)/visitingtoolconcept.cpp \ $(testlib_srcdir)/visitingtoolextendedtest.cpp \ $(testlib_srcdir)/visitingtooltest.cpp diff --git a/tests/lib/scopedholdertransfertest.cpp b/tests/lib/scoped-holder-transfer-test.cpp similarity index 98% rename from tests/lib/scopedholdertransfertest.cpp rename to tests/lib/scoped-holder-transfer-test.cpp index c47cd2a76..ace319736 100644 --- a/tests/lib/scopedholdertransfertest.cpp +++ b/tests/lib/scoped-holder-transfer-test.cpp @@ -26,7 +26,7 @@ #include "lib/util.hpp" #include "lib/scoped-holder.hpp" -#include "lib/scopedholdertransfer.hpp" +#include "lib/scoped-holder-transfer.hpp" #include "testdummy.hpp" #include @@ -68,8 +68,7 @@ namespace lib { if (throw_in_transfer) throw to.getVal(); - to.setVal (from.getVal()); - from.setVal(0); + swap (from,to); } }; diff --git a/tests/lib/testdummy.hpp b/tests/lib/testdummy.hpp index afa810f79..605a92fc7 100644 --- a/tests/lib/testdummy.hpp +++ b/tests/lib/testdummy.hpp @@ -23,6 +23,7 @@ #include +#include namespace lib { @@ -63,6 +64,12 @@ namespace test{ val_ = newVal; } + friend void + swap (Dummy& dum1, Dummy& dum2) ///< checksum neutral + { + std::swap(dum1.val_, dum2.val_); + } + private: void init() diff --git a/tests/lib/vectortransfertest.cpp b/tests/lib/vector-transfer-test.cpp similarity index 99% rename from tests/lib/vectortransfertest.cpp rename to tests/lib/vector-transfer-test.cpp index f165f2ece..c011f56c4 100644 --- a/tests/lib/vectortransfertest.cpp +++ b/tests/lib/vector-transfer-test.cpp @@ -24,7 +24,7 @@ #include "lib/test/run.hpp" -#include "lib/scopedholdertransfer.hpp" +#include "lib/scoped-holder-transfer.hpp" #include "testdummy.hpp" #include