Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmSourceGroup.h
blob062c5a5ba03e52ce92bb763bbada70ead7db3de0
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceGroup.h,v $
5 Language: C++
6 Date: $Date: 2006/03/15 16:02:07 $
7 Version: $Revision: 1.19 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmSourceGroup_h
18 #define cmSourceGroup_h
20 #include "cmStandardIncludes.h"
21 #include <cmsys/RegularExpression.hxx>
23 class cmSourceFile;
25 /** \class cmSourceGroup
26 * \brief Hold a group of sources as specified by a SOURCE_GROUP command.
28 * cmSourceGroup holds a regular expression and a list of files. When
29 * local generators are about to generate the rules for a target's
30 * files, the set of source groups is consulted to group files
31 * together. A file is placed into the last source group that lists
32 * the file by name. If no group lists the file, it is placed into
33 * the last group whose regex matches it.
35 class cmSourceGroup
37 public:
38 cmSourceGroup(const char* name, const char* regex);
39 ~cmSourceGroup() {}
41 /**
42 * Set the regular expression for this group.
44 void SetGroupRegex(const char* regex);
46 /**
47 * Add a file name to the explicit list of files for this group.
49 void AddGroupFile(const char* name);
51 /**
52 * Add child to this sourcegroup
54 void AddChild(cmSourceGroup child);
56 /**
57 * Looks up child and returns it
59 cmSourceGroup *lookupChild(const char *name);
61 /**
62 * Get the name of this group.
64 const char* GetName() const;
66 /**
67 * Check if the given name matches this group's regex.
69 bool MatchesRegex(const char* name);
71 /**
72 * Check if the given name matches this group's explicit file list.
74 bool MatchesFiles(const char* name);
76 /**
77 * Check if the given name matches this group's explicit file list
78 * in children.
80 cmSourceGroup *MatchChildrenFiles(const char *name);
82 /**
83 * Check if the given name matches this group's regex in children.
85 cmSourceGroup *MatchChildrenRegex(const char *name);
87 /**
88 * Assign the given source file to this group. Used only by
89 * generators.
91 void AssignSource(const cmSourceFile* sf);
93 /**
94 * Get the list of the source files that have been assigned to this
95 * source group.
97 const std::vector<const cmSourceFile*>& GetSourceFiles() const;
98 std::vector<const cmSourceFile*>& GetSourceFiles();
100 std::vector<cmSourceGroup> GetGroupChildren() const;
101 private:
103 * The name of the source group.
105 std::string Name;
108 * The regular expression matching the files in the group.
110 cmsys::RegularExpression GroupRegex;
113 * Set of file names explicitly added to this group.
115 std::set<cmStdString> GroupFiles;
118 * Vector of all source files that have been assigned to
119 * this group.
121 std::vector<const cmSourceFile*> SourceFiles;
123 std::vector<cmSourceGroup> GroupChildren;
126 #endif