diff options
-rw-r--r-- | Source/cmCableData.cxx | 16 | ||||
-rw-r--r-- | Source/cmCableData.h | 9 |
2 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmCableData.cxx b/Source/cmCableData.cxx index 618a708..ca9eda0 100644 --- a/Source/cmCableData.cxx +++ b/Source/cmCableData.cxx @@ -28,9 +28,11 @@ cmCableData::cmCableData(const cmCableCommand* owner, m_Indentation(0), m_Package(NULL), m_PackageNamespaceDepth(0), - m_PackageClassIndex(-1) + m_PackageClassIndex(-1), + m_OutputFileName(configurationFile), + m_OutputFile(m_OutputFileName.c_str()) { - this->OpenOutputFile(configurationFile); + this->InitializeOutputFile(); } @@ -48,20 +50,18 @@ cmCableData::~cmCableData() /** - * Open the configuration output file with the given name. This - * writes the configuration header. + * Write the configuration header to the output file. */ -void cmCableData::OpenOutputFile(const std::string& name) +void cmCableData::InitializeOutputFile() { - m_OutputFile.open(name.c_str()); - if(m_OutputFile) { this->WriteConfigurationHeader(); } else { - cmSystemTools::Error("Unable to open CABLE config file: ", name.c_str()); + cmSystemTools::Error("Unable to open CABLE config file: ", + m_OutputFileName.c_str()); } } diff --git a/Source/cmCableData.h b/Source/cmCableData.h index f3788d7..7dd5cc7 100644 --- a/Source/cmCableData.h +++ b/Source/cmCableData.h @@ -41,7 +41,7 @@ public: std::ostream& GetOutputStream() { return m_OutputFile; } - void OpenOutputFile(const std::string&); + void InitializeOutputFile(); void CloseOutputFile(); void WriteConfigurationHeader(); @@ -86,10 +86,15 @@ private: Indentation m_Indentation; /** + * The name of the output file opened as m_OutputFile. + */ + std::string m_OutputFileName; + + /** * The output file to which the configuration is written. */ std::ofstream m_OutputFile; - + /** * The stack of namespaces. */ |