• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdemultimedia API Reference
  • KDE Home
  • Contact Us
 

libkcddb

  • sources
  • kde-4.14
  • kdemultimedia
  • libkcddb
  • libkcddb
lookup.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 Rik Hemsley (rikkus) <rik@kde.org>
3  Copyright (C) 2002 Benjamin Meyer <ben-devel@meyerhome.net>
4  CopyRight (C) 2002 Nadeem Hasan <nhasan@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "lookup.h"
23 
24 #include <kdebug.h>
25 
26 namespace KCDDB
27 {
28  Lookup::Lookup()
29  : CDDB()
30  {
31  }
32 
33  Lookup::~Lookup()
34  {
35  // Empty.
36  }
37 
38  Result
39  Lookup::parseQuery( const QString & line )
40  {
41  uint serverStatus = statusCode( line );
42 
43  if ( 200 == serverStatus )
44  {
45  QStringList tokenList = line.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
46  matchList_.append( qMakePair( tokenList[ 1 ], tokenList[ 2 ] ) );
47  return Success;
48  }
49  else if ( ( 211 == serverStatus ) || ( 210 == serverStatus ) )
50  {
51  return MultipleRecordFound;
52  }
53  else if ( 202 == serverStatus )
54  {
55  return NoRecordFound;
56  }
57 
58  return ServerError;
59  }
60 
61  void
62  Lookup::parseExtraMatch( const QString & line )
63  {
64  QStringList tokenList = line.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
65  matchList_.append( qMakePair( tokenList[ 0 ], tokenList[ 1 ] ) );
66  }
67 
68  Result
69  Lookup::parseRead( const QString & line )
70  {
71  uint serverStatus = statusCode( line );
72 
73  if ( 210 != serverStatus )
74  return ServerError;
75 
76  return Success;
77  }
78 
79  CDInfoList
80  Lookup::lookupResponse() const
81  {
82  return cdInfoList_;
83  }
84 
85 }
86 
87 // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
KCDDB::Lookup::cdInfoList_
CDInfoList cdInfoList_
Definition: lookup.h:60
KCDDB::Lookup::Lookup
Lookup()
Definition: lookup.cpp:28
KCDDB::NoRecordFound
Definition: kcddb.h:43
lookup.h
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
KCDDB::CDDB::statusCode
static uint statusCode(const QString &)
Definition: cddb.cpp:104
KCDDB::Lookup::~Lookup
virtual ~Lookup()
Definition: lookup.cpp:33
KCDDB::Lookup::matchList_
CDDBMatchList matchList_
Definition: lookup.h:61
KCDDB::Lookup::lookupResponse
CDInfoList lookupResponse() const
Definition: lookup.cpp:80
QList::append
void append(const T &value)
KCDDB::Success
Definition: kcddb.h:39
KCDDB::Lookup::parseQuery
Result parseQuery(const QString &)
Definition: lookup.cpp:39
KCDDB::ServerError
Definition: kcddb.h:40
QString
QList
KCDDB::MultipleRecordFound
Definition: kcddb.h:44
QStringList
QLatin1Char
KCDDB::Result
Result
Definition: kcddb.h:37
KCDDB::CDDB
Definition: cddb.h:33
KCDDB::Lookup::parseRead
Result parseRead(const QString &)
Definition: lookup.cpp:69
KCDDB::Lookup::parseExtraMatch
void parseExtraMatch(const QString &)
Definition: lookup.cpp:62
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:28:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkcddb

Skip menu "libkcddb"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdemultimedia API Reference

Skip menu "kdemultimedia API Reference"
  • libkcddb
  • libkcompactdisc

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal