KCDDB

lookup.cpp
1/*
2 SPDX-FileCopyrightText: 2002 Rik Hemsley (rikkus) <rik@kde.org>
3 SPDX-FileCopyrightText: 2002 Benjamin Meyer <ben-devel@meyerhome.net>
4 SPDX-FileCopyrightText: 2002 Nadeem Hasan <nhasan@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "lookup.h"
10
11
12namespace KCDDB
13{
14 Lookup::Lookup()
15 : CDDB()
16 {
17 }
18
19 Lookup::~Lookup()
20 {
21 // Empty.
22 }
23
24 Result
25 Lookup::parseQuery( const QString & line )
26 {
27 uint serverStatus = statusCode( line );
28
29 if ( 200 == serverStatus )
30 {
31 QStringList tokenList = line.split( QLatin1Char( ' ' ), Qt::SkipEmptyParts );
32 matchList_.append( qMakePair( tokenList[ 1 ], tokenList[ 2 ] ) );
33 return Success;
34 }
35 else if ( ( 211 == serverStatus ) || ( 210 == serverStatus ) )
36 {
37 return MultipleRecordFound;
38 }
39 else if ( 202 == serverStatus )
40 {
41 return NoRecordFound;
42 }
43
44 return ServerError;
45 }
46
47 void
48 Lookup::parseExtraMatch( const QString & line )
49 {
50 QStringList tokenList = line.split( QLatin1Char( ' ' ), Qt::SkipEmptyParts );
51 matchList_.append( qMakePair( tokenList[ 0 ], tokenList[ 1 ] ) );
52 }
53
54 Result
55 Lookup::parseRead( const QString & line )
56 {
57 uint serverStatus = statusCode( line );
58
59 if ( 210 != serverStatus )
60 return ServerError;
61
62 return Success;
63 }
64
65 CDInfoList
66 Lookup::lookupResponse() const
67 {
68 return cdInfoList_;
69 }
70
71}
72
73// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
void append(QList< T > &&value)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
SkipEmptyParts
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:58 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.