Advertisement
Guest User

Todo C++ 11 regex of key=value pairs

a guest
Jun 6th, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4. #include <regex>
  5.  
  6.  
  7. std::string LoadDocument()
  8. {
  9.     return "{   Caption = \"calc.exe\";     CommandLine = \"\"C:\\Windows\\system32\\calc.exe\" \";     CreationClassName = \"Win32_Process\";  CreationDate = \"20130606190134.584628+240\";   Handle = \"16504\";     HandleCount = 93;   KernelModeTime = \"624004\"; };";
  10. }
  11.  
  12.  
  13. void RegexPairs(const std::string& docStr, std::map<std::string, std::string>& outMap)
  14. {
  15.     //Todo
  16. }
  17.  
  18.  
  19. int main(int argc, char* argv[])
  20. {
  21.     std::string docStr = LoadDocument();
  22.  
  23.  
  24.     std::map<std::string, std::string> resultMap;
  25.  
  26.  
  27.     RegexPairs(docStr, resultMap);
  28.  
  29.  
  30.     for (auto pair : resultMap)
  31.     {
  32.         std::cout << pair.first << " = " << pair.second << std::endl;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement