cmCableDefineSetCommand.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #ifndef cmCableDefineSetCommand_h
  12. #define cmCableDefineSetCommand_h
  13. #include "cmStandardIncludes.h"
  14. #include "cmCableCommand.h"
  15. /** \class cmCableDefineSetCommand
  16. * \brief Define a command that adds a CABLE Set definition.
  17. *
  18. * cmCableDefineSetCommand is used to define a named CABLE Set.
  19. * The set can be referenced in other CABLE command arguments
  20. * with a '$' followed by the set name.
  21. */
  22. class cmCableDefineSetCommand : public cmCableCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmCableDefineSetCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool Invoke(std::vector<std::string>& args);
  37. /**
  38. * This determines if the command gets propagated down
  39. * to makefiles located in subdirectories.
  40. */
  41. virtual bool IsInherited()
  42. { return true; }
  43. /**
  44. * The name of the command as specified in CMakeList.txt.
  45. */
  46. virtual const char* GetName() { return "CABLE_DEFINE_SET";}
  47. /**
  48. * Succinct documentation.
  49. */
  50. virtual const char* GetTerseDocumentation()
  51. {
  52. return "Define a CABLE Set.";
  53. }
  54. /**
  55. * More documentation.
  56. */
  57. virtual const char* GetFullDocumentation()
  58. {
  59. return
  60. "CABLE_DEFINE_SET(name_of_set [[tag1]:]memeber1 [[tag2]:]member2 ...)\n"
  61. "Generates a Set definition in the CABLE configuration. The sets are\n"
  62. "referenced in other CABLE commands by a '$' immediately followed by\n"
  63. "the set name (ex. $SetName). If a the \"tag:\" syntax is not used,\n"
  64. "an attempt is made to auto-generate a meaningful tag.\n";
  65. }
  66. cmTypeMacro(cmCableDefineSetCommand, cmCableCommand);
  67. private:
  68. void WriteConfiguration() const;
  69. bool AddElement(const std::string&);
  70. bool GenerateTag(const std::string&, std::string&);
  71. private:
  72. typedef std::pair<std::string, std::string> Element;
  73. typedef std::vector<Element> Elements;
  74. /**
  75. * The name of the set.
  76. */
  77. std::string m_SetName;
  78. /**
  79. * The elements to be defined in the set (before $ expansion).
  80. */
  81. Elements m_Elements;
  82. };
  83. #endif