| 1 | /* |
| 2 | * %injeqt copyright begin% |
| 3 | * Copyright 2014 Rafał Malinowski ([email protected]) |
| 4 | * %injeqt copyright end% |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include <injeqt/injeqt.h> |
| 24 | |
| 25 | #include "internal.h" |
| 26 | #include "types.h" |
| 27 | |
| 28 | /** |
| 29 | * @file |
| 30 | * @brief Contains functions for extracting and checking interfaces from a type. |
| 31 | */ |
| 32 | |
| 33 | namespace injeqt { namespace internal { |
| 34 | |
| 35 | /** |
| 36 | * @brief Return list of interfaces that given type implements. |
| 37 | * @pre !for_type.is_empty() |
| 38 | * |
| 39 | * QObject meta type system supports only single inheritance. This method |
| 40 | * gets all QObject-based ancestors of for_type (including for_type itself, |
| 41 | * excluding QObject) and returns it as a types collection. If for_type |
| 42 | * object is not valid an empty collection is returned. |
| 43 | */ |
| 44 | INJEQT_INTERNAL_API types extract_interfaces(const type &for_type); |
| 45 | |
| 46 | /** |
| 47 | * @brief Return true if @p implementation implements @p interface |
| 48 | * @pre !implementation.is_empty() |
| 49 | * @pre !interface.is_empty() |
| 50 | */ |
| 51 | INJEQT_INTERNAL_API bool implements(const type &implementation, const type &interface); |
| 52 | |
| 53 | }} |