summaryrefslogtreecommitdiffstats
path: root/Source/cmCableDefineSetCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCableDefineSetCommand.cxx')
-rw-r--r--Source/cmCableDefineSetCommand.cxx56
1 files changed, 56 insertions, 0 deletions
diff --git a/Source/cmCableDefineSetCommand.cxx b/Source/cmCableDefineSetCommand.cxx
new file mode 100644
index 0000000..e1f1377
--- /dev/null
+++ b/Source/cmCableDefineSetCommand.cxx
@@ -0,0 +1,56 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+
+ Copyright (c) 2000 National Library of Medicine
+ All rights reserved.
+
+ See COPYRIGHT.txt for copyright details.
+
+=========================================================================*/
+#include "cmCabilDefineSetCommand.h"
+#include "cmCacheManager.h"
+
+
+// cmCabilDefineSetCommand
+bool cmCabilDefineSetCommand::Invoke(std::vector<std::string>& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ std::vector<std::string>::const_iterator arg = args.begin();
+
+ // The first argument is the name of the set.
+ m_SetName = *arg++;
+
+ // 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;
+}
+
+
+/**
+ * Write the CABIL configuration code to define this Set.
+ */
+void cmCabilDefineSetCommand::WriteConfiguration(std::ostream& os) const
+{
+ os << " <Set name=\"" << m_SetName.c_str() << "\">" << std::endl;
+ for(Elements::const_iterator e = m_Elements.begin();
+ e != m_Elements.end(); ++e)
+ {
+ os << " <Element>" << e->c_str() << "</Element>" << std::endl;
+ }
+ os << " </Set>" << std::endl;
+}