File indexing completed on 2024-04-28 15:39:51

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #include "DragItemInfo.h"
0006 
0007 CategoryListView::DragItemInfo::DragItemInfo(const QString &parent, const QString &child)
0008     : m_parent(parent)
0009     , m_child(child)
0010 {
0011 }
0012 
0013 QString CategoryListView::DragItemInfo::parent() const
0014 {
0015     return m_parent;
0016 }
0017 
0018 QString CategoryListView::DragItemInfo::child() const
0019 {
0020     return m_child;
0021 }
0022 
0023 bool CategoryListView::DragItemInfo::operator<(const DragItemInfo &other) const
0024 {
0025     return m_parent < other.m_parent || (m_parent == other.m_parent && m_child < other.m_child);
0026 }
0027 
0028 CategoryListView::DragItemInfo::DragItemInfo()
0029 {
0030 }
0031 
0032 QDataStream &CategoryListView::operator<<(QDataStream &stream, const DragItemInfo &info)
0033 {
0034     stream << info.parent() << info.child();
0035     return stream;
0036 }
0037 
0038 QDataStream &CategoryListView::operator>>(QDataStream &stream, DragItemInfo &info)
0039 {
0040     QString str;
0041     stream >> str;
0042     info.setParent(str);
0043     stream >> str;
0044     info.setChild(str);
0045     return stream;
0046 }
0047 
0048 void CategoryListView::DragItemInfo::setParent(const QString &str)
0049 {
0050     m_parent = str;
0051 }
0052 
0053 void CategoryListView::DragItemInfo::setChild(const QString &str)
0054 {
0055     m_child = str;
0056 }
0057 // vi:expandtab:tabstop=4 shiftwidth=4: