File indexing completed on 2024-05-19 04:25:11
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org> 0003 * SPDX-FileCopyrightText: 2004 Cyrille Berger <cberger@cberger.net> 0004 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org> 0005 * SPDX-FileCopyrightText: 2022 L. E. Segovia <amy@amyspark.me> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #include "KoID.h" 0011 0012 KoID::TranslatedString::TranslatedString( 0013 const boost::optional<KLocalizedString> &source) 0014 : QString(!source->isEmpty() ? source->toString() : QString()) 0015 { 0016 } 0017 0018 KoID::TranslatedString::TranslatedString(const QString &value) 0019 : QString(value) 0020 { 0021 } 0022 0023 KoID::KoIDPrivate::KoIDPrivate(QString _id, const KLocalizedString &_name) 0024 : id(std::move(_id)) 0025 , name(_name) 0026 { 0027 } 0028 0029 KoID::KoIDPrivate::KoIDPrivate(QString _id, const QString &_name) 0030 : id(std::move(_id)) 0031 , name(StorageType::init_value_tag(), _name) 0032 { 0033 } 0034 0035 KoID::KoID() 0036 : m_d(new KoIDPrivate(QString(), QString())) 0037 { 0038 } 0039 0040 KoID::KoID(const QString &id, const QString &name) 0041 : m_d(new KoIDPrivate(id, name)) 0042 { 0043 } 0044 0045 KoID::KoID(const QString &id, const KLocalizedString &name) 0046 : m_d(new KoIDPrivate(id, name)) 0047 { 0048 } 0049 0050 KoID::KoID(const KoID &rhs) 0051 : m_d(rhs.m_d) 0052 { 0053 } 0054 0055 KoID &KoID::operator=(const KoID &rhs) 0056 { 0057 if (this != &rhs) { 0058 m_d = rhs.m_d; 0059 } 0060 return *this; 0061 } 0062 0063 QString KoID::id() const 0064 { 0065 return m_d->id; 0066 } 0067 0068 QString KoID::name() const 0069 { 0070 return *m_d->name; 0071 }