Chaser

Untitled

Aug 7th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const QByteArray SEP = ": ";
  2. const QByteArray NEWLINE = "\r\n";
  3.  
  4. QMap<QString, QString> m_Values;
  5.  
  6. void QAmiPropertyMap::convertStr(const QByteArray &str)
  7. {    
  8.     QStringList lines = QString(str).split(NEWLINE);
  9.     for(const auto &s : lines) {
  10.         int cutAt = s.indexOf(SEP);
  11.         QByteArray key = s.left(cutAt).toLocal8Bit();
  12.         QByteArray value = s.right(s.length() - cutAt - SEP.length()).toLocal8Bit();
  13.         m_Values.insert(key, value);
  14.     }
  15. }
  16.  
  17. Elapsed time:    1468 ms
  18. One cycle:   4.893333 ms
  19. Create item:     0.022654 ms
  20. Items:      216
  21. Create count (300x216): 64800
Advertisement
Add Comment
Please, Sign In to add comment