File indexing completed on 2024-05-12 04:44:33
0001 // SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com> 0002 // SPDX-License-Identifier: BSD-2-Clause OR MIT 0003 0004 // Own headers 0005 // First the interface, which forces the header to be self-contained. 0006 #include "initializelibraryresources.h" 0007 0008 #include <qglobal.h> 0009 0010 /** @internal @file 0011 * 0012 * Provides the @ref PerceptualColor::initializeLibraryResources() function. */ 0013 0014 /** @internal 0015 * 0016 * @brief Helper function for @ref PerceptualColor::initializeTranslation(). 0017 * 0018 * <tt>Q_INIT_RESOURCE</tt> may not be used within a namespace. 0019 * Therefore exists this function which is not part of any namespace. To avoid 0020 * pollution of the global namespace, it is declared <tt>static</tt> which 0021 * gives here internal linkage, so it is not visible outside of this 0022 * compilation unit. */ 0023 static void helperInitializeLibraryResources() 0024 { 0025 // Resource initialization is necessary on some systems for static 0026 // libraries, but also recommended for dynamic libraries. For details see 0027 // https://doc.qt.io/qt-6/resources.html#using-resources-in-a-library 0028 // The argument of this macro is the name of the .qrc file (without 0029 // the .qrc suffix) just as in the corresponding CMakeLists.txt. 0030 // This macro relies on qRegisterResourceData() which checks if 0031 // the resource is yet loaded: If so, it is not loaded again. 0032 Q_INIT_RESOURCE(resourcelist); 0033 } 0034 0035 namespace PerceptualColor 0036 { 0037 0038 /** @internal 0039 * 0040 * @brief Initializes the resources of the <tt>Qt resource system</tt> that 0041 * come with this library. 0042 * 0043 * It is safe to call this function multiple times: If the resources are 0044 * yet initialized, nothing happens. 0045 * 0046 * @post The resources are initialized. */ 0047 void initializeLibraryResources() 0048 { 0049 helperInitializeLibraryResources(); 0050 } 0051 0052 } // namespace PerceptualColor