impl: Add first files (untested)
This commit is contained in:
parent
dece8076c8
commit
cc8f5ebc27
46
include/utl/impl/concepts.h
Executable file
46
include/utl/impl/concepts.h
Executable file
@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* \file /utl/impl/concepts.h
|
||||
* \brief Concept support header
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_concepts_h__
|
||||
#define __utl_impl_concepts_h__
|
||||
|
||||
#include <utl/impl/version.h>
|
||||
|
||||
/*!
|
||||
* utl inner concept preprecessor flag
|
||||
* \defgroup crtp
|
||||
* \ingroup impl
|
||||
*/
|
||||
//!@{
|
||||
#if defined __cpp_concepts
|
||||
#define _utl_have_concepts (1)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* requires keyword wraper
|
||||
*/
|
||||
#if defined _utl_have_concepts
|
||||
#define _requires(_r_) requires (_r_)
|
||||
#else
|
||||
#define _requires(_r_)
|
||||
#endif
|
||||
|
||||
//!@}
|
||||
#endif /* __utl_impl_concepts_h__ */
|
48
include/utl/impl/crtp.h
Executable file
48
include/utl/impl/crtp.h
Executable file
@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* \file /utl/impl/crtp.h
|
||||
* \brief CRTP idiom support header
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_crtp_h__
|
||||
#define __utl_impl_crtp_h__
|
||||
|
||||
#include <utl/impl/version.h>
|
||||
|
||||
/*!
|
||||
* \defgroup crtp CRTP idiom support header
|
||||
* \ingroup impl
|
||||
*
|
||||
* utl supports both CRTP idiom and dynamic polymorphism. By default
|
||||
* CRTP is the preferred way. If the user need virtuals then instead of
|
||||
* CRTP type, the \ref virtual_tag can passed to base class. The rest
|
||||
* will handled by utl automatically.
|
||||
*/
|
||||
//!@{
|
||||
namespace utl {
|
||||
//! CRTP support tag type
|
||||
struct crtp_tag { };
|
||||
//! virtual support tag type
|
||||
struct virtual_tag { };
|
||||
|
||||
//! \def CRTP boilerplate lines
|
||||
#define _CRTP_IMPL(T) \
|
||||
constexpr T& impl() { return *static_cast<T*>(this); } \
|
||||
constexpr const T& impl() const { return *static_cast<const T*>(this); }
|
||||
}
|
||||
//!@}
|
||||
#endif /* __utl_impl_crtp_h__ */
|
40
include/utl/impl/version.h
Executable file
40
include/utl/impl/version.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*!
|
||||
* \file /utl/impl/version.h
|
||||
* \brief version and cpp version check
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_crtp_h__
|
||||
#define __utl_impl_crtp_h__
|
||||
|
||||
//!\defgroup version version
|
||||
//! Definitions of the utl version
|
||||
//!\ingroup impl
|
||||
|
||||
#define UTL_VERSION "0.0.0"
|
||||
#define UTL_VERSION_MAJOR 0
|
||||
#define UTL_VERSION_MINOR 0
|
||||
#define UTL_VERSION_PATCH 0
|
||||
#define UTL_VERSION_VALUE ( (UTL_VERSION_MAJOR * 10000) \
|
||||
+ (UTL_VERSION_MINOR * 100) \
|
||||
+ UTL_VERSION_PATCH)
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
#error "Sorry. uTL requires C++11"
|
||||
#endif
|
||||
|
||||
#endif /* __utl_impl_crtp_h__ */
|
Loading…
x
Reference in New Issue
Block a user