bool Message::isComplete() { // if the length hasn't been read or the buffer has some reading to do if(!msgHasReadLength || bytesLeftToRead()) { return false; } return true; }
qint64 Packet::readData(char* dest, qint64 maxSize) { // we're either reading what is left from the current position or what was asked to be read qint64 numBytesToRead = std::min(bytesLeftToRead(), maxSize); if (numBytesToRead > 0) { int currentPosition = pos(); // read out the data memcpy(dest, _payloadStart + currentPosition, numBytesToRead); } return numBytesToRead; }