cmCableOpenNamespaceCommand.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2000 National Library of Medicine
  8. All rights reserved.
  9. See COPYRIGHT.txt for copyright details.
  10. =========================================================================*/
  11. #include "cmCableOpenNamespaceCommand.h"
  12. #include "cmCacheManager.h"
  13. // cmCableOpenNamespaceCommand
  14. bool cmCableOpenNamespaceCommand::Invoke(std::vector<std::string>& args)
  15. {
  16. if(args.size() != 1)
  17. {
  18. this->SetError("called with incorrect number of arguments");
  19. return false;
  20. }
  21. // This command needs to access the Cable data.
  22. this->SetupCableData();
  23. // The argument is the namespace name.
  24. m_NamespaceName = args[0];
  25. // Write the configuration for this command.
  26. this->WriteNamespaceHeader();
  27. // Ask the cable data to open the namespace.
  28. m_CableData->OpenNamespace(m_NamespaceName);
  29. return true;
  30. }
  31. /**
  32. * Generate a CABLE Namespace open tag.
  33. */
  34. void cmCableOpenNamespaceCommand::WriteNamespaceHeader() const
  35. {
  36. std::ostream& os = m_CableData->GetOutputStream();
  37. cmCableData::Indentation indent = m_CableData->GetIndentation();
  38. os << indent << "<Namespace name=\"" << m_NamespaceName.c_str()
  39. << "\">" << std::endl;
  40. m_CableData->Indent();
  41. }