TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Member Functions | List of all members
QJson::Parser Class Reference

Main class used to convert JSON data to QVariant objects. More...

#include <parser.h>

Public Member Functions

 Parser ()
 
QVariant parse (QIODevice *io, bool *ok=0)
 Read JSON string from the I/O Device and converts it to a QVariant object. More...
 
QVariant parse (const QByteArray &jsonData, bool *ok=0)
 This is a method provided for convenience. More...
 
QString errorString () const
 This method returns the error message. More...
 
int errorLine () const
 This method returns line number where the error occurred. More...
 
void allowSpecialNumbers (bool allowSpecialNumbers)
 Sets whether special numbers (Infinity, -Infinity, NaN) are allowed as an extension to the standard. More...
 
bool specialNumbersAllowed () const
 

Detailed Description

Main class used to convert JSON data to QVariant objects.

Definition at line 40 of file parser.h.

Constructor & Destructor Documentation

Parser::Parser ( )

Definition at line 64 of file parser.cpp.

References TTK_INIT_PRIVATE.

Member Function Documentation

void QJson::Parser::allowSpecialNumbers ( bool  allowSpecialNumbers)

Sets whether special numbers (Infinity, -Infinity, NaN) are allowed as an extension to the standard.

Parameters
allowSpecialNumbersnew value of whether special numbers are allowed
See also
specialNumbersAllowed

Definition at line 135 of file parser.cpp.

References TTK_D.

int Parser::errorLine ( ) const

This method returns line number where the error occurred.

Returns
the line number where the error occurred
See also
errorString

Definition at line 129 of file parser.cpp.

References TTK_D.

QString Parser::errorString ( ) const

This method returns the error message.

Returns
a QString object containing the error message of the last parse operation
See also
errorLine

Definition at line 123 of file parser.cpp.

References TTK_D.

Referenced by QJson::ParserRunnable::run().

QVariant Parser::parse ( QIODevice *  io,
bool *  ok = 0 
)

Read JSON string from the I/O Device and converts it to a QVariant object.

Parameters
ioInput output device
okif a conversion error occurs, *ok is set to false; otherwise *ok is set to true.
Returns
a QVariant object generated from the JSON string

Definition at line 69 of file parser.cpp.

References TTK_D.

Referenced by MusicKGQueryPlaylistRequest::downloadDetailsFinished(), MusicKWQueryPlaylistRequest::downloadDetailsFinished(), MusicWYQueryPlaylistRequest::downloadDetailsFinished(), MusicDJRadioProgramCategoryRequest::downloadDetailsFinished(), MusicMVRadioCategoryRequest::downLoadFinished(), MusicMVRadioProgramRequest::downLoadFinished(), MusicKWDownLoadTextRequest::downLoadFinished(), MusicBarrageRequest::downLoadFinished(), MusicDJRadioCategoryRequest::downLoadFinished(), MusicKGDownloadBackgroundRequest::downLoadFinished(), MusicDownloadBingSkinRequest::downLoadFinished(), MusicKGDiscoverListRequest::downLoadFinished(), MusicResourceRequest::downLoadFinished(), MusicBDTranslationRequest::downLoadFinished(), MusicBingTranslationRequest::downLoadFinished(), MusicWYTranslationRequest::downLoadFinished(), MusicYDTranslationRequest::downLoadFinished(), MusicBPDownloadBackgroundRequest::downLoadFinished(), MusicKWDownloadBackgroundRequest::downLoadFinished(), MusicWYDownLoadTextRequest::downLoadFinished(), MusicKWDiscoverListRequest::downLoadFinished(), MusicKWQueryArtistListRequest::downLoadFinished(), MusicWYDiscoverListRequest::downLoadFinished(), MusicWYQueryArtistListRequest::downLoadFinished(), MusicKGSongCommentsRequest::downLoadFinished(), MusicSongRecommendRequest::downLoadFinished(), MusicKWSongCommentsRequest::downLoadFinished(), MusicKWQueryAlbumRequest::downLoadFinished(), MusicKGQueryAlbumRequest::downLoadFinished(), MusicKWQueryArtistRequest::downLoadFinished(), MusicFMRadioSongRequest::downLoadFinished(), MusicKGQueryArtistListRequest::downLoadFinished(), MusicSongSuggestRequest::downLoadFinished(), MusicWYSongCommentsRequest::downLoadFinished(), MusicWYQueryAlbumRequest::downLoadFinished(), MusicKGQueryArtistRequest::downLoadFinished(), MusicWYQueryArtistRequest::downLoadFinished(), MusicNetworkOperator::downLoadFinished(), MusicWYQueryRequest::downLoadFinished(), MusicWYQueryToplistRequest::downLoadFinished(), MusicKWQueryMovieRequest::downLoadFinished(), MusicKGQueryMovieRequest::downLoadFinished(), MusicKWQueryRequest::downLoadFinished(), MusicKWQueryToplistRequest::downLoadFinished(), MusicKGQueryRequest::downLoadFinished(), MusicKGQueryToplistRequest::downLoadFinished(), MusicWYQueryMovieRequest::downLoadFinished(), MusicDownloadBirdSkinRequest::downLoadFinished(), MusicDJRadioProgramRequest::downLoadFinished(), MusicKGQueryPlaylistRequest::downLoadFinished(), MusicWYQueryPlaylistRequest::downLoadFinished(), MusicKWQueryPlaylistRequest::downLoadFinished(), MusicTXDownloadBackgroundRequest::downLoadFinished(), MusicSourceUpdateRequest::downLoadFinished(), MusicDJRadioProgramCategoryRequest::downLoadFinished(), MusicIdentifySongRequest::downLoadFinished(), MusicKGPlaylistCommentsRequest::downLoadFinished(), MusicKWPlaylistCommentsRequest::downLoadFinished(), MusicKWQueryArtistAlbumRequest::downLoadFinished(), MusicKGQueryArtistAlbumRequest::downLoadFinished(), MusicWYPlaylistCommentsRequest::downLoadFinished(), MusicWYQueryArtistAlbumRequest::downLoadFinished(), MusicCloudManagerTableWidget::downLoadFinished(), MusicKGQueryArtistMovieRequest::downLoadFinished(), MusicKWQueryArtistMovieRequest::downLoadFinished(), MusicWYQueryArtistMovieRequest::downLoadFinished(), MusicDownloadBirdSkinRequest::downLoadItemsFinished(), MusicKWQueryPlaylistRequest::downloadMoreDetailsFinished(), MusicWYQueryRequest::downLoadSingleFinished(), MusicKWQueryRequest::downLoadSingleFinished(), MusicKGQueryRequest::downLoadSingleFinished(), MusicUnityQueryMovieRequest::downLoadUnityFinished(), parse(), MusicWYQueryArtistMovieRequest::parseFromArtistMoviesCount(), ReqKWInterface::parseFromMovieInfo(), ReqBLInterface::parseFromMovieInfo(), MusicWYQueryMovieRequest::parseFromMovieList(), ReqWYInterface::parseFromMovieProperty(), ReqKGInterface::parseFromMovieProperty(), ReqBLInterface::parseFromMovieProperty(), ReqKGInterface::parseFromSongAlbumInfo(), ReqKGInterface::parseFromSongAlbumLrc(), MusicWYQueryMovieRequest::parseFromVideoList(), parseSongProperty(), parseSongPropertyNew(), MusicWYQueryArtistRequest::queryArtistIntro(), MusicKGQueryArtistRequest::queryArtistIntro(), MusicKWQueryArtistRequest::queryArtistIntro(), MusicKWQueryToplistRequest::queryToplistInfo(), MusicKGQueryToplistRequest::queryToplistInfo(), MusicJSPFConfigManager::readBuffer(), QJson::ParserRunnable::run(), MusicKGQueryPlaylistRequest::startToQueryInfo(), MusicKWQueryPlaylistRequest::startToQueryInfo(), MusicWYQueryPlaylistRequest::startToQueryInfo(), and MusicBingTranslationRequest::startToRequest().

QVariant Parser::parse ( const QByteArray &  jsonData,
bool *  ok = 0 
)

This is a method provided for convenience.

Parameters
jsonDatadata containing the JSON object representation
okif a conversion error occurs, *ok is set to false; otherwise *ok is set to true.
Returns
a QVariant object generated from the JSON string
See also
errorString
errorLine

Definition at line 114 of file parser.cpp.

References parse().

bool Parser::specialNumbersAllowed ( ) const
Returns
whether special numbers (Infinity, -Infinity, NaN) are allowed
See also
allowSpecialNumbers

Definition at line 141 of file parser.cpp.

References TTK_D.


The documentation for this class was generated from the following files: