# HG changeset patch # User Sebastien Jodogne # Date 1415635550 -3600 # Node ID 2255e66da7267478dbe51a6f65ccc567afb85382 # Parent 9b9026560a5f93f27d134edd4c80316bf98625da getting rid of the dependency against Boost in the SQLite C++ wrapper diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/Connection.h --- a/Core/SQLite/Connection.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/Connection.h Mon Nov 10 17:05:50 2014 +0100 @@ -41,7 +41,6 @@ #include "IScalarFunction.h" #include -#include #include struct sqlite3; @@ -53,7 +52,7 @@ { namespace SQLite { - class Connection : boost::noncopyable + class Connection : NonCopyable { friend class Statement; friend class Transaction; diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/FunctionContext.h --- a/Core/SQLite/FunctionContext.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/FunctionContext.h Mon Nov 10 17:05:50 2014 +0100 @@ -34,8 +34,6 @@ #pragma once -#include - #include "Statement.h" struct sqlite3_context; @@ -45,7 +43,7 @@ { namespace SQLite { - class FunctionContext : public boost::noncopyable + class FunctionContext : public NonCopyable { friend class Connection; diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/IScalarFunction.h --- a/Core/SQLite/IScalarFunction.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/IScalarFunction.h Mon Nov 10 17:05:50 2014 +0100 @@ -34,13 +34,14 @@ #pragma once +#include "NonCopyable.h" #include "FunctionContext.h" namespace Orthanc { namespace SQLite { - class IScalarFunction : public boost::noncopyable + class IScalarFunction : public NonCopyable { public: virtual ~IScalarFunction() diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/NonCopyable.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Core/SQLite/NonCopyable.h Mon Nov 10 17:05:50 2014 +0100 @@ -0,0 +1,60 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * + * Copyright (C) 2012-2014 Sebastien Jodogne , + * Medical Physics Department, CHU of Liege, Belgium + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc., the name of the CHU of Liege, + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + **/ + + +#pragma once + +namespace Orthanc +{ + namespace SQLite + { + // This class mimics "boost::noncopyable" + class NonCopyable + { + private: + NonCopyable(const NonCopyable&); + + NonCopyable& operator= (const NonCopyable&); + + protected: + NonCopyable() + { + } + + ~NonCopyable() + { + } + }; + } +} diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/Statement.cpp --- a/Core/SQLite/Statement.cpp Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/Statement.cpp Mon Nov 10 17:05:50 2014 +0100 @@ -43,9 +43,10 @@ #include "Statement.h" #include "Connection.h" -#include #include #include +#include +#include namespace Orthanc { @@ -56,7 +57,9 @@ bool succeeded = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); if (!succeeded) { - throw OrthancSQLiteException("SQLite error code " + boost::lexical_cast(err)); + char buffer[128]; + snprintf(buffer, sizeof(buffer) - 1, "SQLite error code %d", err); + throw OrthancSQLiteException(buffer); } return err; @@ -71,7 +74,9 @@ } else if (err != SQLITE_OK) { - throw OrthancSQLiteException("SQLite error code " + boost::lexical_cast(err)); + char buffer[128]; + snprintf(buffer, sizeof(buffer) - 1, "SQLite error code %d", err); + throw OrthancSQLiteException(buffer); } } diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/Statement.h --- a/Core/SQLite/Statement.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/Statement.h Mon Nov 10 17:05:50 2014 +0100 @@ -37,13 +37,13 @@ #pragma once +#include "NonCopyable.h" #include "OrthancSQLiteException.h" #include "StatementId.h" #include "StatementReference.h" #include #include -#include #if ORTHANC_BUILD_UNIT_TESTS == 1 #include @@ -69,7 +69,7 @@ COLUMN_TYPE_NULL = 5 }; - class Statement : public boost::noncopyable + class Statement : public NonCopyable { friend class Connection; diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/StatementReference.h --- a/Core/SQLite/StatementReference.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/StatementReference.h Mon Nov 10 17:05:50 2014 +0100 @@ -37,7 +37,8 @@ #pragma once -#include +#include "NonCopyable.h" + #include #include #include @@ -49,7 +50,7 @@ { namespace SQLite { - class StatementReference : boost::noncopyable + class StatementReference : NonCopyable { private: StatementReference* root_; // Only used for non-root nodes diff -r 9b9026560a5f -r 2255e66da726 Core/SQLite/Transaction.h --- a/Core/SQLite/Transaction.h Mon Nov 10 16:33:51 2014 +0100 +++ b/Core/SQLite/Transaction.h Mon Nov 10 17:05:50 2014 +0100 @@ -43,7 +43,7 @@ { namespace SQLite { - class Transaction : public boost::noncopyable + class Transaction : public NonCopyable { private: Connection& connection_;