File indexing completed on 2024-05-12 15:59:37
0001 /* 0002 * SPDX-FileCopyrightText: 2008 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef _KO_UNIQUE_NUMBER_FOR_ID_SERVER_H_ 0008 #define _KO_UNIQUE_NUMBER_FOR_ID_SERVER_H_ 0009 0010 #include <QtGlobal> 0011 #include "kritapigment_export.h" 0012 0013 class QString; 0014 0015 /** 0016 * This class is used to provide an unique number for a given \ref QString . 0017 * This is useful for fast comparison of Ids, but the number *should* remains private 0018 * especially considering that it changes from one running instance to an other. 0019 */ 0020 class KRITAPIGMENT_EXPORT KoUniqueNumberForIdServer 0021 { 0022 public: 0023 KoUniqueNumberForIdServer(); 0024 ~KoUniqueNumberForIdServer(); 0025 0026 static KoUniqueNumberForIdServer* instance(); 0027 /** 0028 * @return an unique number for the given \p _id , for two different call to this function 0029 * with the same \p id the function will always return the same value. 0030 * 0031 * @code 0032 * KoUniqueNumberForIdServer::instance()->numberForId( "rgb" ) == KoUniqueNumberForIdServer::instance()->numberForId( "rgb" ); 0033 * KoUniqueNumberForIdServer::instance()->numberForId( "rgb" ) != KoUniqueNumberForIdServer::instance()->numberForId( "cmyk" ); 0034 * @endcode 0035 */ 0036 quint32 numberForId(const QString&); 0037 private: 0038 struct Private; 0039 Private* const d; 0040 0041 }; 0042 0043 #endif