diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-02-10 19:11:12 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-02-10 19:11:12 (GMT) |
commit | f87271d0eae52e6c670d10b53e72eed72e80bfd1 (patch) | |
tree | f5c7c2c35fd68be706db491c96422d545f409031 /Source/cmListCommand.h | |
parent | b8a33fb424aa28b710e0ec170814ac380ee057db (diff) | |
download | CMake-f87271d0eae52e6c670d10b53e72eed72e80bfd1.zip CMake-f87271d0eae52e6c670d10b53e72eed72e80bfd1.tar.gz CMake-f87271d0eae52e6c670d10b53e72eed72e80bfd1.tar.bz2 |
ENH: Add initial implementation of the list command
Diffstat (limited to 'Source/cmListCommand.h')
-rw-r--r-- | Source/cmListCommand.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h new file mode 100644 index 0000000..5df06dd --- /dev/null +++ b/Source/cmListCommand.h @@ -0,0 +1,99 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmListCommand_h +#define cmListCommand_h + +#include "cmCommand.h" + +/** \class cmListCommand + * \brief Common list operations + * + */ +class cmListCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmListCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector<std::string> const& args); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "LIST";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "List operations."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " LIST(LENGTH <list> <output variable>)\n" + " LIST(GET <list> <element index> [<element index> ...] <output variable>)\n" + " LIST(SET <list> <element> [<element> ...])\n" + " LIST(INSERT <list> <element_index> <element> [<element> ...])\n" + " LIST(REMOVE <variable> <value> [<value> ...])\n" + " LIST(REMOVE_ITEM <variable> <index> [<index> ...])\n" + " LIST(SORT <variable>)\n" + " LIST(REVERSE <variable>)\n" + "LENGTH will return a given list's length.\n" + "GET will return list of elements specified by indices from the list.\n" + "SET will append elements to the list.\n" + "INSERT will insert elements to the list to the specified location.\n" + "When specifying an index, negative value corresponds to index from the end " + "of the list.\n" + ; + } + + cmTypeMacro(cmListCommand, cmCommand); +protected: + bool HandleLengthCommand(std::vector<std::string> const& args); + bool HandleGetCommand(std::vector<std::string> const& args); + bool HandleSetCommand(std::vector<std::string> const& args); + bool HandleInsertCommand(std::vector<std::string> const& args); + bool HandleRemoveCommand(std::vector<std::string> const& args); + bool HandleRemoveItemCommand(std::vector<std::string> const& args); + + + bool GetList(std::vector<std::string>& list, const char* var); + bool GetListString(std::string& listString, const char* var); +}; + + +#endif |