diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-04 20:38:37 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-14 18:36:28 (GMT) |
commit | 48a9e91b02090ba263cd46ef5c33ba3d2aa873ba (patch) | |
tree | e67fd8ea4cf03b01d1db6fa077d602e9de91f41d /Source/cmState.cxx | |
parent | e7f7c2e208a62c60e4a20ef115ba47a2ff7194a1 (diff) | |
download | CMake-48a9e91b02090ba263cd46ef5c33ba3d2aa873ba.zip CMake-48a9e91b02090ba263cd46ef5c33ba3d2aa873ba.tar.gz CMake-48a9e91b02090ba263cd46ef5c33ba3d2aa873ba.tar.bz2 |
cmState: Add an accessor for Parent snapshot and a validity check.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 67a2274..82a2939 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -522,3 +522,24 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); } + +bool cmState::Snapshot::IsValid() const +{ + return this->State ? true : false; +} + +cmState::Snapshot cmState::Snapshot::GetParent() const +{ + Snapshot snapshot; + if (!this->State) + { + return snapshot; + } + PositionType parentPos = this->State->ParentPositions[this->Position]; + if (parentPos > 0) + { + snapshot = Snapshot(this->State, parentPos); + } + + return snapshot; +} |