cmSourceGroup.cxx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmSourceGroup.h"
  14. //----------------------------------------------------------------------------
  15. cmSourceGroup::cmSourceGroup(const char* name, const char* regex): m_Name(name)
  16. {
  17. this->SetGroupRegex(regex);
  18. }
  19. //----------------------------------------------------------------------------
  20. void cmSourceGroup::SetGroupRegex(const char* regex)
  21. {
  22. if(regex)
  23. {
  24. m_GroupRegex.compile(regex);
  25. }
  26. else
  27. {
  28. m_GroupRegex.compile("^$");
  29. }
  30. }
  31. //----------------------------------------------------------------------------
  32. void cmSourceGroup::AddGroupFile(const char* name)
  33. {
  34. m_GroupFiles.insert(name);
  35. }
  36. //----------------------------------------------------------------------------
  37. const char* cmSourceGroup::GetName() const
  38. {
  39. return m_Name.c_str();
  40. }
  41. //----------------------------------------------------------------------------
  42. bool cmSourceGroup::MatchesRegex(const char* name)
  43. {
  44. return m_GroupRegex.find(name);
  45. }
  46. //----------------------------------------------------------------------------
  47. bool cmSourceGroup::MatchesFiles(const char* name)
  48. {
  49. std::set<cmStdString>::const_iterator i = m_GroupFiles.find(name);
  50. if(i != m_GroupFiles.end())
  51. {
  52. return true;
  53. }
  54. return false;
  55. }
  56. //----------------------------------------------------------------------------
  57. void cmSourceGroup::AssignSource(const cmSourceFile* sf)
  58. {
  59. m_SourceFiles.push_back(sf);
  60. }
  61. //----------------------------------------------------------------------------
  62. const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const
  63. {
  64. return m_SourceFiles;
  65. }
  66. //----------------------------------------------------------------------------
  67. std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles()
  68. {
  69. return m_SourceFiles;
  70. }