summaryrefslogtreecommitdiffstats
path: root/Source/cmStateDirectory.h
blob: fe15563cbb54f387b1bc2c411d15546f861d5181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */

#ifndef cmStateDirectory_h
#define cmStateDirectory_h

#include "cmConfigure.h" // IWYU pragma: keep

#include <string>
#include <vector>

#include "cmAlgorithms.h"
#include "cmLinkedTree.h"
#include "cmListFileCache.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"

class cmStateDirectory
{
  cmStateDirectory(
    cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
    cmStateSnapshot const& snapshot);

public:
  std::string const& GetCurrentSource() const;
  void SetCurrentSource(std::string const& dir);
  std::string const& GetCurrentBinary() const;
  void SetCurrentBinary(std::string const& dir);

  std::string const& GetRelativePathTopSource() const;
  std::string const& GetRelativePathTopBinary() const;
  void SetRelativePathTopSource(const char* dir);
  void SetRelativePathTopBinary(const char* dir);

  bool ContainsBoth(std::string const& local_path,
                    std::string const& remote_path) const;

  std::string ConvertToRelPathIfNotContained(
    std::string const& local_path, std::string const& remote_path) const;

  cmStringRange GetIncludeDirectoriesEntries() const;
  cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const;
  void AppendIncludeDirectoriesEntry(std::string const& vec,
                                     cmListFileBacktrace const& lfbt);
  void PrependIncludeDirectoriesEntry(std::string const& vec,
                                      cmListFileBacktrace const& lfbt);
  void SetIncludeDirectories(std::string const& vec,
                             cmListFileBacktrace const& lfbt);
  void ClearIncludeDirectories();

  cmStringRange GetCompileDefinitionsEntries() const;
  cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const;
  void AppendCompileDefinitionsEntry(std::string const& vec,
                                     cmListFileBacktrace const& lfbt);
  void SetCompileDefinitions(std::string const& vec,
                             cmListFileBacktrace const& lfbt);
  void ClearCompileDefinitions();

  cmStringRange GetCompileOptionsEntries() const;
  cmBacktraceRange GetCompileOptionsEntryBacktraces() const;
  void AppendCompileOptionsEntry(std::string const& vec,
                                 cmListFileBacktrace const& lfbt);
  void SetCompileOptions(std::string const& vec,
                         cmListFileBacktrace const& lfbt);
  void ClearCompileOptions();

  cmStringRange GetLinkOptionsEntries() const;
  cmBacktraceRange GetLinkOptionsEntryBacktraces() const;
  void AppendLinkOptionsEntry(std::string const& vec,
                              cmListFileBacktrace const& lfbt);
  void PrependLinkDirectoriesEntry(std::string const& vec,
                                   cmListFileBacktrace const& lfbt);
  void SetLinkOptions(std::string const& vec, cmListFileBacktrace const& lfbt);
  void ClearLinkOptions();

  cmStringRange GetLinkDirectoriesEntries() const;
  cmBacktraceRange GetLinkDirectoriesEntryBacktraces() const;
  void AppendLinkDirectoriesEntry(std::string const& vec,
                                  cmListFileBacktrace const& lfbt);
  void SetLinkDirectories(std::string const& vec,
                          cmListFileBacktrace const& lfbt);
  void ClearLinkDirectories();

  void SetProperty(const std::string& prop, const char* value,
                   cmListFileBacktrace const& lfbt);
  void AppendProperty(const std::string& prop, const char* value,
                      bool asString, cmListFileBacktrace const& lfbt);
  const char* GetProperty(const std::string& prop) const;
  const char* GetProperty(const std::string& prop, bool chain) const;
  bool GetPropertyAsBool(const std::string& prop) const;
  std::vector<std::string> GetPropertyKeys() const;

  void AddNormalTargetName(std::string const& name);

private:
  void ComputeRelativePathTopSource();
  void ComputeRelativePathTopBinary();

private:
  cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
    DirectoryState;
  cmStateSnapshot Snapshot_;
  friend class cmStateSnapshot;
};

#endif