00001 /* 00002 00003 Copyright (C) 2006-2007 by Peter Dimov. 00004 00005 This file is part of Calitko (http://www.calitko.org). 00006 00007 Calitko is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 Calitko is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Calitko; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 00021 */ 00022 00023 #include "Qt.h" 00024 #include "BDecoder.h" 00025 #include "BItem.h" 00026 #include "BInt.h" 00027 #include "BString.h" 00028 #include "BList.h" 00029 #include "BDictionary.h" 00030 #include "BErrorItem.h" 00031 #include "Imports.cpp" 00032 00034 00039 BDecoder::BDecoder (const QByteArray &rawData) 00040 : binaryReader (new BinaryReader (rawData, BinaryReader::LittleEndian)) 00041 { 00042 } 00043 00045 00048 BDecoder::~BDecoder() 00049 { 00050 } 00051 00053 00058 auto_ptr <BItem> BDecoder::readNext() 00059 { 00060 return BItem::readItem (*binaryReader); 00061 } 00062 00064 00066 bool BDecoder::hasReadPassEnd() const 00067 { 00068 return binaryReader->hasReadPastEnd(); 00069 } 00070 00072 00074 bool BDecoder::hasReadAll() const 00075 { 00076 return binaryReader->hasReadAll(); 00077 } 00078 00080 00082 bool BDecoder::hasReadAllCorrectly() const 00083 { 00084 return hasReadAll() && !hasReadPassEnd(); 00085 }