Logo Search packages:      
Sourcecode: akonadi version File versions  Download package

int ImapParser::parseString ( const QByteArray &  data,
QByteArray &  result,
int  start = 0 
) [static]

Parse the next string in data (quoted or literal) starting from start and puts the result into result. The number of used characters is returned (this is not equal to result.length()!).

Parameters:
data Source data.
result Parsed string, quotation, literal marker, etc. are removed, 'NIL' is transformed into an empty QByteArray.
start start parsing at this index.

Definition at line 140 of file imapparser.cpp.

References parseQuotedString(), and stripLeadingSpaces().

Referenced by Akonadi::TransactionHandler::handleLine(), Akonadi::Subscribe::handleLine(), Akonadi::Store::handleLine(), Akonadi::Status::handleLine(), Akonadi::Select::handleLine(), Akonadi::SearchPersistent::handleLine(), Akonadi::Rename::handleLine(), Akonadi::Modify::handleLine(), Akonadi::Login::handleLine(), Akonadi::List::handleLine(), Akonadi::Delete::handleLine(), Akonadi::Create::handleLine(), Akonadi::Copy::handleLine(), Akonadi::ColCopy::handleLine(), Akonadi::Append::handleLine(), Akonadi::AkList::handleLine(), Akonadi::AkAppend::handleLine(), parseNextLine(), parseParenthesizedList(), and parseString().

{
  int begin = stripLeadingSpaces( data, start );
  result.clear();
  if ( begin >= data.length() )
    return data.length();

  // literal string
  // TODO: error handling
  if ( data[begin] == '{' ) {
    int end = data.indexOf( '}', begin );
    Q_ASSERT( end > begin );
    int size = data.mid( begin + 1, end - begin - 1 ).toInt();

    // strip CRLF
    begin = end + 1;
    if ( begin < data.length() && data[begin] == '\r' )
      ++begin;
    if ( begin < data.length() && data[begin] == '\n' )
      ++begin;

    end = begin + size;
    result = data.mid( begin, end - begin );
    return end;
  }

  // quoted string
  return parseQuotedString( data, result, begin );
}


Generated by  Doxygen 1.6.0   Back to index