Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. void hardware_ids_cmd::getWMICTable(const QString &query, const QList<QString> &columns, JSONNode &root, Error::Error &err, QString &err_args)
  2. {
  3.     QString res;
  4.     getWMICRaw(query, res, err, err_args);
  5.  
  6.     QList< std::pair<int,int> > columnDataPoints;
  7.     int currentSearchIndex = 1, currentIndex = 0;
  8.     while(currentSearchIndex < columns.size())
  9.     {
  10.         const int newIndex = res.indexOf( columns[currentSearchIndex] );
  11.         const int length = newIndex - currentIndex;
  12.         const std::pair<int,int> p( currentIndex, length );
  13.         columnDataPoints.push_back( p );
  14.         currentIndex = newIndex;
  15.     }
  16.  
  17.     // Last element
  18.     columnDataPoints.push_back( std::pair<int,int>(currentIndex, res.size() - currentIndex) );
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement