cmCableCloseNamespaceCommand.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 "cmCableCloseNamespaceCommand.h"
  12. #include "cmCacheManager.h"
  13. // cmCableCloseNamespaceCommand
  14. bool cmCableCloseNamespaceCommand::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. // Ask the cable data to close the namespace.
  26. m_CableData->CloseNamespace(m_NamespaceName);
  27. // Write the configuration for this command.
  28. this->WriteNamespaceFooter();
  29. return true;
  30. }
  31. /**
  32. * Generate a CABLE Namespace close tag.
  33. */
  34. void cmCableCloseNamespaceCommand::WriteNamespaceFooter() const
  35. {
  36. m_CableData->Unindent();
  37. std::ostream& os = m_CableData->GetOutputStream();
  38. cmCableData::Indentation indent = m_CableData->GetIndentation();
  39. os << indent << "</Namespace> <!-- \"" << m_NamespaceName.c_str()
  40. << "\" -->" << std::endl;
  41. }