diff options
author | Brad King <brad.king@kitware.com> | 2001-03-01 21:47:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2001-03-01 21:47:05 (GMT) |
commit | dc72655414eb8a611524b6480dad92d46b08fecb (patch) | |
tree | eae01169b53d5e67156e5562ed53b4e447947658 /Source/cmCableInstantiateCommand.cxx | |
parent | af30fe67458fd26054696ce018f7ae6faaebcca4 (diff) | |
download | CMake-dc72655414eb8a611524b6480dad92d46b08fecb.zip CMake-dc72655414eb8a611524b6480dad92d46b08fecb.tar.gz CMake-dc72655414eb8a611524b6480dad92d46b08fecb.tar.bz2 |
ENH: Change to new CABLE command architecture. CABLE configuration code is now generated on the first pass, during the Invoke() calls.
Diffstat (limited to 'Source/cmCableInstantiateCommand.cxx')
-rw-r--r-- | Source/cmCableInstantiateCommand.cxx | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/Source/cmCableInstantiateCommand.cxx b/Source/cmCableInstantiateCommand.cxx index 705c313..629e6da 100644 --- a/Source/cmCableInstantiateCommand.cxx +++ b/Source/cmCableInstantiateCommand.cxx @@ -16,96 +16,24 @@ #include "cmCableInstantiateCommand.h" #include "cmCacheManager.h" -#include "cmCableDefineSetCommand.h" #include "cmRegularExpression.h" -// cmCableInstantiateCommand -bool cmCableInstantiateCommand::Invoke(std::vector<std::string>& args) -{ - if(args.size() < 2) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - - // This command instance needs to use the cmCableData instance. - this->SetupCableData(); - - // The output file must be opened in the output directory. - std::string file = m_Makefile->GetStartOutputDirectory(); - - // The first argument is the file into which the configuration code is to be - // written. - std::vector<std::string>::const_iterator arg = args.begin(); - - // Concatenate the file name onto the path. - file += "/" + *arg++; - - // Get the OutputFile corresponding to this file name. - m_OutputFile = m_CableData->GetOutputFile(file, this); - - // The rest of the arguments are the elements to be placed in the set. - for(; arg != args.end(); ++arg) - { - m_Elements.push_back(*arg); - } - - return true; -} - - -void cmCableInstantiateCommand::FinalPass() -{ - // If this command is the first to reference its output file, write the - // header information. - if(m_OutputFile->FirstReferencingCommandIs(this)) - { - this->WriteConfigurationHeader(m_OutputFile->GetStream()); - - // Need to write out the Set definitions. - // Look through the vector of commands from the makefile. - const std::vector<cmCommand*>& usedCommands = - m_Makefile->GetUsedCommands(); - for(std::vector<cmCommand*>::const_iterator commandIter = - usedCommands.begin(); - commandIter != usedCommands.end(); ++commandIter) - { - // If this command is a cmCableDefineSetCommand, ask it to write its - // configuration code to the output file. - cmCableDefineSetCommand* command = - cmCableDefineSetCommand::SafeDownCast(*commandIter); - if(command) - { - command->WriteConfiguration(m_OutputFile->GetStream()); - } - } - } - - // Write the instantiation block's code. - this->WriteConfiguration(m_OutputFile->GetStream()); - - // If this command is the last to reference its output file, write the - // footer information. - if(m_OutputFile->LastReferencingCommandIs(this)) - { - this->WriteConfigurationFooter(m_OutputFile->GetStream()); - } -} - /** * Write the CABLE configuration code to define this InstantiationSet. */ -void cmCableInstantiateCommand::WriteConfiguration(std::ostream& os) const +void cmCableInstantiateCommand::WriteConfiguration() const { + std::ostream& os = m_CableData->GetOutputStream(); + cmCableData::Indentation indent = m_CableData->GetIndentation(); + cmRegularExpression needCdataBlock("[&<>]"); - os << std::endl - << " <InstantiationSet>" << std::endl; - for(Elements::const_iterator e = m_Elements.begin(); - e != m_Elements.end(); ++e) + os << indent << "<InstantiationSet>" << std::endl; + for(Entries::const_iterator e = m_Entries.begin(); + e != m_Entries.end(); ++e) { - os << " <Element>"; + os << indent << " <Element>"; if(needCdataBlock.find(e->c_str())) { os << "<![CDATA[" << e->c_str() << "]]>"; @@ -116,5 +44,5 @@ void cmCableInstantiateCommand::WriteConfiguration(std::ostream& os) const } os << "</Element>" << std::endl; } - os << " </InstantiationSet>" << std::endl; + os << indent << "</InstantiationSet>" << std::endl; } |