1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4 
5 #include "cmConfigure.h" // IWYU pragma: keep
6 
7 #include <iosfwd>
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 #include "cmCTestGlobalVC.h"
13 
14 class cmCTest;
15 
16 /** \class cmCTestP4
17  * \brief Interaction with the Perforce command-line tool
18  *
19  */
20 class cmCTestP4 : public cmCTestGlobalVC
21 {
22 public:
23   /** Construct with a CTest instance and update log stream.  */
24   cmCTestP4(cmCTest* ctest, std::ostream& log);
25 
26   ~cmCTestP4() override;
27 
28 private:
29   std::vector<std::string> ChangeLists;
30 
31   struct User
32   {
33     std::string UserName;
34     std::string Name;
35     std::string EMail;
36     std::string AccessTime;
37 
UserUser38     User()
39       : UserName()
40       , Name()
41       , EMail()
42       , AccessTime()
43     {
44     }
45   };
46   std::map<std::string, User> Users;
47   std::vector<std::string> P4Options;
48 
49   User GetUserData(const std::string& username);
50   void SetP4Options(std::vector<char const*>& options);
51 
52   std::string GetWorkingRevision();
53   bool NoteOldRevision() override;
54   bool NoteNewRevision() override;
55   bool UpdateImpl() override;
56   bool UpdateCustom(const std::string& custom);
57 
58   bool LoadRevisions() override;
59   bool LoadModifications() override;
60 
61   class ChangesParser;
62   class DescribeParser;
63   class DiffParser;
64   // Parsing helper classes.
65   class IdentifyParser;
66   class UserParser;
67 
68   friend class IdentifyParser;
69   friend class ChangesParser;
70   friend class UserParser;
71   friend class DescribeParser;
72   friend class DiffParser;
73 };
74