From 99d57b3c8cc84f40dee02036cc6c3e12510aa08c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Dec 2007 10:12:19 -0500 Subject: [PATCH] ENH: Added cmSourceFile::GetLocation method to get a read-only reference to the Location ivar. This partially addresses issue #6137. --- Source/cmSourceFile.cxx | 6 ++++++ Source/cmSourceFile.h | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 549ff28c8..a68543581 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -75,6 +75,12 @@ const char* cmSourceFile::GetLanguage() const return 0; } +//---------------------------------------------------------------------------- +cmSourceFileLocation const& cmSourceFile::GetLocation() const +{ + return this->Location; +} + //---------------------------------------------------------------------------- std::string const& cmSourceFile::GetFullPath() { diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 47f31ebd4..9ad6f3e2b 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -53,11 +53,23 @@ public: bool GetPropertyAsBool(const char *prop) const; /** - * The full path to the file. + * The full path to the file. The non-const version of this method + * may attempt to locate the file on disk and finalize its location. + * The const version of this method may return an empty string if + * the non-const version has not yet been called (yes this is a + * horrible interface, but is necessary for backwards + * compatibility). */ std::string const& GetFullPath(); std::string const& GetFullPath() const; + /** + * Get the information currently known about the source file + * location without attempting to locate the file as GetFullPath + * would. See cmSourceFileLocation documentation. + */ + cmSourceFileLocation const& GetLocation() const; + /** * Get the file extension of this source file. */