summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsangwan.kwon <sangwan.kwon@samsung.com>2016-08-05 10:56:23 +0900
committersangwan.kwon <sangwan.kwon@samsung.com>2016-08-05 14:16:46 +0900
commit59cbdedd8df2c593edafdee2a202e0ad4a67e9cb (patch)
tree3f0f6e38ceab41ce2ff94f26f5597baf745170b5
parentc099987a6147925b201ebfb3ad623a16e7dd7a02 (diff)
downloadcert-svc-59cbdedd8df2c593edafdee2a202e0ad4a67e9cb.tar.gz
cert-svc-59cbdedd8df2c593edafdee2a202e0ad4a67e9cb.tar.bz2
cert-svc-59cbdedd8df2c593edafdee2a202e0ad4a67e9cb.zip
Replace noncopyable class to delete keyword
[AS-IS] * Noncopyable class still technically allow to copy by members and friends. [TO-BE] * Replace to delete keyword on C++11 Change-Id: I987996d86ba2f05dae7352acf505fc8db292e955 Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/dpl/include/dpl/binary_queue.h9
-rw-r--r--tests/dpl/include/dpl/noncopyable.h37
-rw-r--r--tests/dpl/include/dpl/scoped_resource.h20
-rw-r--r--tests/dpl/include/dpl/test/test_results_collector.h12
-rw-r--r--tests/dpl/include/dpl/test/test_runner_child.h9
-rw-r--r--tests/dpl/src/noncopyable.cpp31
-rw-r--r--vcore/CMakeLists.txt1
-rw-r--r--vcore/dpl/core/include/dpl/noncopyable.h37
-rw-r--r--vcore/dpl/core/src/noncopyable.cpp31
-rw-r--r--vcore/dpl/log/include/dpl/log/log.h8
-rw-r--r--vcore/vcore/CertificateIdentifier.h16
-rw-r--r--vcore/vcore/CertificateLoader.cpp1
-rw-r--r--vcore/vcore/CertificateLoader.h23
-rw-r--r--vcore/vcore/CryptoInit.h8
-rw-r--r--vcore/vcore/ReferenceValidator.h10
-rw-r--r--vcore/vcore/XmlsecAdapter.h16
17 files changed, 78 insertions, 192 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a49d84e..c0c4c30 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,7 +32,6 @@ SET(DPL_TEST_SOURCES
${TEST_DIR}/dpl/src/colors.cpp
${TEST_DIR}/dpl/src/errno_string.cpp
${TEST_DIR}/dpl/src/exception.cpp
- ${TEST_DIR}/dpl/src/noncopyable.cpp
${TEST_DIR}/dpl/src/singleton.cpp
${TEST_DIR}/dpl/src/test_results_collector.cpp
${TEST_DIR}/dpl/src/test_runner.cpp
diff --git a/tests/dpl/include/dpl/binary_queue.h b/tests/dpl/include/dpl/binary_queue.h
index 66501b8..12019be 100644
--- a/tests/dpl/include/dpl/binary_queue.h
+++ b/tests/dpl/include/dpl/binary_queue.h
@@ -24,7 +24,6 @@
#include <dpl/abstract_input_output.h>
#include <dpl/exception.h>
-#include <dpl/noncopyable.h>
#include <memory>
#include <list>
@@ -67,8 +66,7 @@ public:
};
private:
- struct Bucket :
- private Noncopyable {
+ struct Bucket {
const void *buffer;
const void *ptr;
size_t size;
@@ -82,6 +80,11 @@ private:
BufferDeleter deleter,
void *userParam);
virtual ~Bucket();
+
+ Bucket(const Bucket &) = delete;
+ Bucket &operator=(const Bucket &) = delete;
+ Bucket(Bucket &&) = delete;
+ Bucket &operator=(const Bucket &&) = delete;
};
typedef std::list<Bucket *> BucketList;
diff --git a/tests/dpl/include/dpl/noncopyable.h b/tests/dpl/include/dpl/noncopyable.h
deleted file mode 100644
index 7f951dd..0000000
--- a/tests/dpl/include/dpl/noncopyable.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file noncopyable
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of noncopyable
- */
-#ifndef DPL_NONCOPYABLE_H
-#define DPL_NONCOPYABLE_H
-
-namespace VcoreDPL {
-class Noncopyable {
-private:
- Noncopyable(const Noncopyable &);
- const Noncopyable &operator=(const Noncopyable &);
-
-public:
- Noncopyable();
- virtual ~Noncopyable();
-};
-} // namespace VcoreDPL
-
-#endif // DPL_NONCOPYABLE_H
diff --git a/tests/dpl/include/dpl/scoped_resource.h b/tests/dpl/include/dpl/scoped_resource.h
index 22172f3..882d415 100644
--- a/tests/dpl/include/dpl/scoped_resource.h
+++ b/tests/dpl/include/dpl/scoped_resource.h
@@ -22,27 +22,25 @@
#ifndef DPL_SCOPED_RESOURCE_H
#define DPL_SCOPED_RESOURCE_H
-#include <dpl/noncopyable.h>
-
namespace VcoreDPL {
+
template<typename ClassPolicy>
-class ScopedResource :
- private Noncopyable {
+class ScopedResource {
public:
typedef typename ClassPolicy::Type ValueType;
typedef ScopedResource<ClassPolicy> ThisType;
-protected:
- ValueType m_value;
-
-public:
explicit ScopedResource(ValueType value) : m_value(value) { }
-
~ScopedResource()
{
ClassPolicy::Destroy(m_value);
}
+ ScopedResource(const ScopedResource &) = delete;
+ ScopedResource &operator=(const ScopedResource &) = delete;
+ ScopedResource(ScopedResource &&) = delete;
+ ScopedResource &operator=(ScopedResource &&) = delete;
+
ValueType Get() const
{
return m_value;
@@ -73,6 +71,10 @@ public:
{
return m_value == ClassPolicy::NullValue();
}
+
+protected:
+ ValueType m_value;
+
};
} // namespace VcoreDPL
diff --git a/tests/dpl/include/dpl/test/test_results_collector.h b/tests/dpl/include/dpl/test/test_results_collector.h
index 0140a1e..9656333 100644
--- a/tests/dpl/include/dpl/test/test_results_collector.h
+++ b/tests/dpl/include/dpl/test/test_results_collector.h
@@ -23,7 +23,6 @@
#ifndef DPL_TEST_RESULTS_COLLECTOR_H
#define DPL_TEST_RESULTS_COLLECTOR_H
-#include <dpl/noncopyable.h>
#include <dpl/availability.h>
#include <vector>
#include <list>
@@ -37,8 +36,7 @@ class TestResultsCollectorBase;
typedef std::shared_ptr<TestResultsCollectorBase>
TestResultsCollectorBasePtr;
-class TestResultsCollectorBase :
- private VcoreDPL::Noncopyable {
+class TestResultsCollectorBase {
public:
typedef TestResultsCollectorBase *(*CollectorConstructorFunc)();
typedef std::list<std::string> TestCaseIdList;
@@ -51,7 +49,13 @@ public:
};
};
- virtual ~TestResultsCollectorBase() {}
+ TestResultsCollectorBase() = default;
+ virtual ~TestResultsCollectorBase() = default;
+
+ TestResultsCollectorBase(const TestResultsCollectorBase &) = delete;
+ TestResultsCollectorBase &operator=(const TestResultsCollectorBase &) = delete;
+ TestResultsCollectorBase(TestResultsCollectorBase &&) = delete;
+ TestResultsCollectorBase &operator=(TestResultsCollectorBase &&) = delete;
virtual bool Configure()
{
diff --git a/tests/dpl/include/dpl/test/test_runner_child.h b/tests/dpl/include/dpl/test/test_runner_child.h
index ab360f2..4627e96 100644
--- a/tests/dpl/include/dpl/test/test_runner_child.h
+++ b/tests/dpl/include/dpl/test/test_runner_child.h
@@ -27,7 +27,7 @@
namespace VcoreDPL {
namespace Test {
-class PipeWrapper : VcoreDPL::Noncopyable {
+class PipeWrapper {
public:
enum Usage {
READONLY,
@@ -41,12 +41,17 @@ public:
};
PipeWrapper();
+ virtual ~PipeWrapper();
+
+ PipeWrapper (const PipeWrapper &) = delete;
+ PipeWrapper &operator=(const PipeWrapper &) = delete;
+ PipeWrapper (PipeWrapper &&) = delete;
+ PipeWrapper &operator=(PipeWrapper &&) = delete;
bool isReady();
void setUsage(Usage usage);
- virtual ~PipeWrapper();
Status send(int code, std::string &message);
diff --git a/tests/dpl/src/noncopyable.cpp b/tests/dpl/src/noncopyable.cpp
deleted file mode 100644
index 74fc9af..0000000
--- a/tests/dpl/src/noncopyable.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file noncopyable.cpp
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of noncopyable
- */
-#include <stddef.h>
-#include <dpl/noncopyable.h>
-
-namespace VcoreDPL {
-Noncopyable::Noncopyable()
-{}
-
-Noncopyable::~Noncopyable()
-{}
-} // namespace VcoreDPL
diff --git a/vcore/CMakeLists.txt b/vcore/CMakeLists.txt
index eeef0d6..7b5dbfb 100644
--- a/vcore/CMakeLists.txt
+++ b/vcore/CMakeLists.txt
@@ -22,7 +22,6 @@ SET(VCORE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(VCORE_SOURCES
${VCORE_DIR}/dpl/core/src/assert.cpp
${VCORE_DIR}/dpl/core/src/exception.cpp
- ${VCORE_DIR}/dpl/core/src/noncopyable.cpp
${VCORE_DIR}/dpl/core/src/singleton.cpp
${VCORE_DIR}/dpl/core/src/colors.cpp
diff --git a/vcore/dpl/core/include/dpl/noncopyable.h b/vcore/dpl/core/include/dpl/noncopyable.h
deleted file mode 100644
index 7f951dd..0000000
--- a/vcore/dpl/core/include/dpl/noncopyable.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file noncopyable
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of noncopyable
- */
-#ifndef DPL_NONCOPYABLE_H
-#define DPL_NONCOPYABLE_H
-
-namespace VcoreDPL {
-class Noncopyable {
-private:
- Noncopyable(const Noncopyable &);
- const Noncopyable &operator=(const Noncopyable &);
-
-public:
- Noncopyable();
- virtual ~Noncopyable();
-};
-} // namespace VcoreDPL
-
-#endif // DPL_NONCOPYABLE_H
diff --git a/vcore/dpl/core/src/noncopyable.cpp b/vcore/dpl/core/src/noncopyable.cpp
deleted file mode 100644
index 74fc9af..0000000
--- a/vcore/dpl/core/src/noncopyable.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file noncopyable.cpp
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of noncopyable
- */
-#include <stddef.h>
-#include <dpl/noncopyable.h>
-
-namespace VcoreDPL {
-Noncopyable::Noncopyable()
-{}
-
-Noncopyable::~Noncopyable()
-{}
-} // namespace VcoreDPL
diff --git a/vcore/dpl/log/include/dpl/log/log.h b/vcore/dpl/log/include/dpl/log/log.h
index e23c722..07cac3d 100644
--- a/vcore/dpl/log/include/dpl/log/log.h
+++ b/vcore/dpl/log/include/dpl/log/log.h
@@ -28,7 +28,6 @@
#include <string>
#include <dpl/singleton.h>
-#include <dpl/noncopyable.h>
#include <dpl/log/abstract_log_provider.h>
@@ -40,11 +39,16 @@ namespace Log {
* To switch logs into old style, export
* DPL_USE_OLD_STYLE_LOGS before application start
*/
-class LogSystem : private Noncopyable {
+class LogSystem {
public:
LogSystem();
virtual ~LogSystem();
+ LogSystem(const LogSystem &) = delete;
+ LogSystem &operator=(const LogSystem &) = delete;
+ LogSystem(LogSystem &&) = delete;
+ LogSystem &operator=(LogSystem &&) = delete;
+
AbstractLogProvider::LogLevel GetLogLevel() const
{
return m_level;
diff --git a/vcore/vcore/CertificateIdentifier.h b/vcore/vcore/CertificateIdentifier.h
index 6fe9806..adf05c7 100644
--- a/vcore/vcore/CertificateIdentifier.h
+++ b/vcore/vcore/CertificateIdentifier.h
@@ -25,22 +25,22 @@
_WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_CERTIFICATEIDENTIFICATOR_H_
#include <map>
-#include <dpl/noncopyable.h>
#include <vcore/Certificate.h>
#include <vcore/CertStoreType.h>
namespace ValidationCore {
-class CertificateIdentifier : public VcoreDPL::Noncopyable {
+class CertificateIdentifier {
public:
typedef std::map<Certificate::Fingerprint, CertStoreId::Set> FingerPrintMap;
- CertificateIdentifier()
- {
- }
- ~CertificateIdentifier()
- {
- }
+ CertificateIdentifier() = default;
+ ~CertificateIdentifier() = default;
+
+ CertificateIdentifier(const CertificateIdentifier &) = delete;
+ CertificateIdentifier &operator=(const CertificateIdentifier &) = delete;
+ CertificateIdentifier(CertificateIdentifier &&) = delete;
+ CertificateIdentifier &operator=(CertificateIdentifier &&) = delete;
void add(const Certificate::Fingerprint &fingerprint,
CertStoreId::Type domain)
diff --git a/vcore/vcore/CertificateLoader.cpp b/vcore/vcore/CertificateLoader.cpp
index dd01d41..40c82b1 100644
--- a/vcore/vcore/CertificateLoader.cpp
+++ b/vcore/vcore/CertificateLoader.cpp
@@ -16,7 +16,6 @@
#include <dpl/assert.h>
#include <openssl/x509v3.h>
#include <dpl/log/log.h>
-#include <dpl/noncopyable.h>
#include <openssl/ecdsa.h>
#include <openssl/evp.h>
diff --git a/vcore/vcore/CertificateLoader.h b/vcore/vcore/CertificateLoader.h
index ef42e0b..d87ed7b 100644
--- a/vcore/vcore/CertificateLoader.h
+++ b/vcore/vcore/CertificateLoader.h
@@ -19,20 +19,25 @@
#include <string>
#include <string.h>
-#include <dpl/noncopyable.h>
#include <openssl/ssl.h>
#include <vcore/Certificate.h>
namespace ValidationCore {
-class CertificateLoader : public VcoreDPL::Noncopyable {
+class CertificateLoader {
public:
+ CertificateLoader() = default;
+ virtual ~CertificateLoader() = default;
+
+ CertificateLoader(const CertificateLoader &) = delete;
+ CertificateLoader &operator=(const CertificateLoader &) = delete;
+ CertificateLoader(CertificateLoader &&) = delete;
+ CertificateLoader &operator=(CertificateLoader &&) = delete;
+
class CertificateLoaderComparator {
public:
virtual bool compare(X509 *x509cert) = 0;
- virtual ~CertificateLoaderComparator()
- {
- }
+ virtual ~CertificateLoaderComparator() = default;
};
enum CertificateLoaderResult {
@@ -44,14 +49,6 @@ public:
UNKNOWN_ERROR
};
- CertificateLoader()
- {
- }
-
- virtual ~CertificateLoader()
- {
- }
-
CertificateLoaderResult loadCertificate(const std::string &storage,
CertificateLoaderComparator *cmp);
diff --git a/vcore/vcore/CryptoInit.h b/vcore/vcore/CryptoInit.h
index 7a2130f..05f8c62 100644
--- a/vcore/vcore/CryptoInit.h
+++ b/vcore/vcore/CryptoInit.h
@@ -21,15 +21,19 @@
*/
#pragma once
-#include <dpl/noncopyable.h>
#include <dpl/singleton.h>
namespace ValidationCore {
-class CryptoInit : public VcoreDPL::Noncopyable {
+class CryptoInit {
public:
CryptoInit();
virtual ~CryptoInit();
+
+ CryptoInit(const CryptoInit &) = delete;
+ CryptoInit &operator=(const CryptoInit &) = delete;
+ CryptoInit(CryptoInit &&) = delete;
+ CryptoInit &operator=(CryptoInit &&) = delete;
};
typedef VcoreDPL::Singleton<CryptoInit> CryptoInitSingleton;
diff --git a/vcore/vcore/ReferenceValidator.h b/vcore/vcore/ReferenceValidator.h
index 2fa025d..450e224 100644
--- a/vcore/vcore/ReferenceValidator.h
+++ b/vcore/vcore/ReferenceValidator.h
@@ -23,13 +23,11 @@
#ifndef _VALIDATION_CORE_REFERENCEVALIDATOR_H_
#define _VALIDATION_CORE_REFERENCEVALIDATOR_H_
-#include <dpl/noncopyable.h>
-
#include <vcore/SignatureData.h>
namespace ValidationCore {
-class ReferenceValidator : VcoreDPL::Noncopyable {
+class ReferenceValidator {
public:
enum Result {
NO_ERROR = 0,
@@ -44,9 +42,13 @@ public:
};
ReferenceValidator(const std::string &dirpath);
-
virtual ~ReferenceValidator();
+ ReferenceValidator(const ReferenceValidator &) = delete;
+ ReferenceValidator &operator=(const ReferenceValidator &) = delete;
+ ReferenceValidator(ReferenceValidator &&) = delete;
+ ReferenceValidator &operator=(ReferenceValidator &&) = delete;
+
Result checkReferences(const SignatureData &signatureData);
Result checkOutbound(const std::string &linkPath, const std::string &appPath);
diff --git a/vcore/vcore/XmlsecAdapter.h b/vcore/vcore/XmlsecAdapter.h
index b03f3c2..0a0a522 100644
--- a/vcore/vcore/XmlsecAdapter.h
+++ b/vcore/vcore/XmlsecAdapter.h
@@ -27,15 +27,23 @@
#include <xmlsec/keysmngr.h>
#include <dpl/exception.h>
-#include <dpl/noncopyable.h>
#include <dpl/singleton.h>
#include <vcore/Certificate.h>
#include <vcore/SignatureData.h>
namespace ValidationCore {
-class XmlSec : public VcoreDPL::Noncopyable {
+class XmlSec {
+
public:
+ XmlSec();
+ virtual ~XmlSec();
+
+ XmlSec(const XmlSec &) = delete;
+ XmlSec &operator=(const XmlSec &) = delete;
+ XmlSec(XmlSec &&) = delete;
+ XmlSec &operator=(XmlSec &&) = delete;
+
struct XmlSecContext {
/* You _must_ set one of the value: certificatePath or certificate. */
XmlSecContext()
@@ -98,10 +106,6 @@ public:
void validateNoHash(XmlSecContext &context);
void validatePartialHash(XmlSecContext &context, const std::list<std::string> &targetUri);
-protected:
- XmlSec();
- ~XmlSec();
-
private:
enum class ValidateMode : int {
NORMAL,