diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-08-16 15:20:18 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-08-16 15:20:18 (GMT) |
commit | 7b5a8762c6d5f7915db99e2344d169d14a4fda65 (patch) | |
tree | 4c5294710e7c720afde51e8e7170a39895d17c41 /Source/cmSourceFile.cxx | |
parent | f7b1a90256a3e7d94cbb58b595eee5190e8958ba (diff) | |
download | CMake-7b5a8762c6d5f7915db99e2344d169d14a4fda65.zip CMake-7b5a8762c6d5f7915db99e2344d169d14a4fda65.tar.gz CMake-7b5a8762c6d5f7915db99e2344d169d14a4fda65.tar.bz2 |
modified how source files store properties
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r-- | Source/cmSourceFile.cxx | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 43ebf52..a6305b9 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -28,7 +28,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, const std::vector<std::string>& sourceExts, const std::vector<std::string>& headerExts) { - m_HeaderFileOnly = true; + this->SetProperty("HEADER_FILE_ONLY","1"); m_SourceName = name; std::string pathname = dir; @@ -68,10 +68,11 @@ void cmSourceFile::SetName(const char* name, const char* dir, } // See if the file is a header file - if(std::find( headerExts.begin(), headerExts.end(), m_SourceExtension ) == headerExts.end()) - m_HeaderFileOnly = false; - else - m_HeaderFileOnly = true; + if(std::find( headerExts.begin(), headerExts.end(), m_SourceExtension ) == + headerExts.end()) + { + this->SetProperty("HEADER_FILE_ONLY","0"); + } m_FullPath = hname; return; } @@ -86,7 +87,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, if(cmSystemTools::FileExists(hname.c_str())) { m_SourceExtension = *ext; - m_HeaderFileOnly = false; + this->SetProperty("HEADER_FILE_ONLY","0"); m_FullPath = hname; return; } @@ -128,7 +129,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, void cmSourceFile::SetName(const char* name, const char* dir, const char *ext, bool hfo) { - m_HeaderFileOnly = hfo; + this->SetProperty("HEADER_FILE_ONLY",(hfo ? "1" : "0")); m_SourceName = name; std::string pathname = dir; if(pathname != "") @@ -149,24 +150,38 @@ void cmSourceFile::SetName(const char* name, const char* dir, const char *ext, void cmSourceFile::Print() const { - if(m_AbstractClass) - { - std::cerr << "Abstract "; - } - else + std::cerr << "m_FullPath: " << m_FullPath << "\n"; + std::cerr << "m_SourceName: " << m_SourceName << std::endl; + std::cerr << "m_SourceExtension: " << m_SourceExtension << "\n"; +} + +void cmSourceFile::SetProperty(const char* prop, const char* value) +{ + if (!prop) { - std::cerr << "Concrete "; + return; } - if(m_HeaderFileOnly) + m_Properties[prop] = value; +} + +const char *cmSourceFile::GetProperty(const char* prop) const +{ + std::map<cmStdString,cmStdString>::const_iterator i = + m_Properties.find(prop); + if (i != m_Properties.end()) { - std::cerr << "Header file "; + return i->second.c_str(); } - else + return 0; +} + +bool cmSourceFile::GetPropertyAsBool(const char* prop) const +{ + std::map<cmStdString,cmStdString>::const_iterator i = + m_Properties.find(prop); + if (i != m_Properties.end()) { - std::cerr << "CXX file "; + return cmSystemTools::IsOn(i->second.c_str()); } - std::cerr << "m_CompileFlags: " << m_CompileFlags << "\n"; - std::cerr << "m_FullPath: " << m_FullPath << "\n"; - std::cerr << "m_SourceName: " << m_SourceName << std::endl; - std::cerr << "m_SourceExtension: " << m_SourceExtension << "\n"; + return false; } |