Advertisement
Chaser

Untitled

Aug 7th, 2012
73
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.         QStringRef key = s.leftRef(cutAt);
  12.         QStringRef value = s.rightRef(s.length() - cutAt - SEP.length());
  13.         //qDebug() << "KEY: "<< key << " VALUE: "<<value;
  14.         m_Values.insert(*key.string(), *value.string());
  15.     }
  16. }
  17.  
  18. Elapsed time:    427 ms
  19. One cycle:   1.423333 ms
  20. Create item:     0.006590 ms
  21. Items:      216
  22. Create count (300x216): 64800
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement