| 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>cxx . . $ `<file>/include/injeqt/injeqt.h`/ |
| 24 | #include <injeqt/type.h>cxx . . $ `<file>/include/injeqt/type.h`/ |
| 25 | |
| 26 | #include "dependency.h"cxx . . $ `<file>/src/internal/dependency.h`/ |
| 27 | #include "internal.h"cxx . . $ `<file>/src/internal/internal.h`/ |
| 28 | #include "types-by-name.h"cxx . . $ `<file>/src/internal/types-by-name.h`/ |
| 29 | |
| 30 | /** |
| 31 | * @file |
| 32 | * @brief Contains classes and functions for representing set of Injeqt dependencies. |
| 33 | */ |
| 34 | |
| 35 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 36 | |
| 37 | /** |
| 38 | * @brief Extract type from dependency for storting purposes. |
| 39 | * @brief Identity function. |
| 40 | */ |
| 41 | inline typecxx . . $ injeqt/v1/type# type_from_dependencycxx . . $ injeqt/internal/type_from_dependency(991734e551dfabae).(const dependencycxx . . $ injeqt/internal/dependency# &d) |
| 42 | { |
| 43 | return d.required_typecxx . . $ injeqt/internal/dependency#required_type(7e9f7f4e42b3414e).(); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @brief Identity function. |
| 48 | */ |
| 49 | inline dependencycxx . . $ injeqt/internal/dependency# dependency_from_dependencycxx . . $ injeqt/internal/dependency_from_dependency(4536e646e043cb01).(const dependencycxx . . $ injeqt/internal/dependency# &d) |
| 50 | { |
| 51 | return d; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @brief Abstraction of Injeqt set of dependencies. |
| 56 | * |
| 57 | * This set is used to represent all dependencies of one class. It is not possible |
| 58 | * to store two dependnecies with the same dependency::required_type() values in it. |
| 59 | * Set is sorted by dependency::required_type() and it can be matched with other |
| 60 | * type based sets (like implementations) using match() function. |
| 61 | * |
| 62 | * The best way to create instance of this type is to call make_validated_dependencies(const type &). |
| 63 | */ |
| 64 | using dependenciescxx . . $ injeqt/internal/dependencies# = sorted_unique_vectorcxx . . $ injeqt/internal/sorted_unique_vector#<dependencycxx . . $ injeqt/internal/dependency#, dependencycxx . . $ injeqt/internal/dependency#, dependency_from_dependencycxx . . $ injeqt/internal/dependency_from_dependency(4536e646e043cb01).>; |
| 65 | |
| 66 | /** |
| 67 | * @brief Extract set of dependencies from type. |
| 68 | * @param for_type type to extract dependencies from. |
| 69 | * @pre !for_type.is_empty() |
| 70 | * @throw dependency_on_self when type depends on self. |
| 71 | * @throw dependency_on_subtype when type depends on own supertype. |
| 72 | * @throw dependency_on_subtype when type depends on own subtype. |
| 73 | * @throw invalid_setter if any tagged setter has parameter that is not a QObject-derived pointer |
| 74 | * @throw invalid_setter if any tagged setter has parameter that is a QObject pointer |
| 75 | * @throw invalid_setter if any tagged setter has other number of parameters than one |
| 76 | * |
| 77 | * This function computes and returns set of all dependencies of a given type. All slots methods tagged |
| 78 | * with INJEQT_SET are describing dependnecies. If all dependnecies are valid, there is no duplication, |
| 79 | * and type does not depends on self, subtype or supertype, a result is returned. Otherwise one of many |
| 80 | * exceptions can be thrown. |
| 81 | */ |
| 82 | INJEQT_INTERNAL_APIcxx . . $ `src/internal/internal.h:24:9`! dependenciescxx . . $ injeqt/internal/dependencies# extract_dependenciescxx . . $ injeqt/internal/extract_dependencies(c8c0e98cc48858ad).(const types_by_namecxx . . $ injeqt/internal/types_by_name# &known_types, const typecxx . . $ injeqt/v1/type# &for_type); |
| 83 | |
| 84 | }} |