Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const QByteArray SEP = ": ";
- const QByteArray NEWLINE = "\r\n";
- QMap<QString, QString> m_Values;
- void QAmiPropertyMap::convertStr(const QByteArray &str)
- {
- int indexNL = -NEWLINE.count();
- while(indexNL != -1) {
- indexNL += NEWLINE.count();
- int currStart = indexNL;
- indexNL = str.indexOf(NEWLINE, indexNL+1);
- QByteArray s = str.mid(currStart, indexNL - currStart);
- //qDebug() << s;
- int cutAt = s.indexOf(SEP);
- if(cutAt == -1)
- cutAt = s.count() -1;
- QByteArray key = s.left(cutAt);
- QByteArray value = s.right(s.length() - cutAt - SEP.length());
- //qDebug("KEY: %15s\tVALUE: %15s\tCUTAT: %d", key.constData(), value.constData(), cutAt);
- m_Values.insert(key, value);
- }
- }
- Elapsed time: 519 ms
- One cycle: 1.730000 ms
- Create item: 0.008009 ms
- Items: 216
- Create count (300x216): 64800
Advertisement
Add Comment
Please, Sign In to add comment