1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceGroup.h,v $
6 Date: $Date: 2008-05-16 20:56:41 $
7 Version: $Revision: 1.20 $
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>
25 class cmSourceGroupInternals
;
27 /** \class cmSourceGroup
28 * \brief Hold a group of sources as specified by a SOURCE_GROUP command.
30 * cmSourceGroup holds a regular expression and a list of files. When
31 * local generators are about to generate the rules for a target's
32 * files, the set of source groups is consulted to group files
33 * together. A file is placed into the last source group that lists
34 * the file by name. If no group lists the file, it is placed into
35 * the last group whose regex matches it.
40 cmSourceGroup(const char* name
, const char* regex
);
41 cmSourceGroup(cmSourceGroup
const& r
);
43 cmSourceGroup
& operator=(cmSourceGroup
const&);
46 * Set the regular expression for this group.
48 void SetGroupRegex(const char* regex
);
51 * Add a file name to the explicit list of files for this group.
53 void AddGroupFile(const char* name
);
56 * Add child to this sourcegroup
58 void AddChild(cmSourceGroup child
);
61 * Looks up child and returns it
63 cmSourceGroup
*lookupChild(const char *name
);
66 * Get the name of this group.
68 const char* GetName() const;
71 * Check if the given name matches this group's regex.
73 bool MatchesRegex(const char* name
);
76 * Check if the given name matches this group's explicit file list.
78 bool MatchesFiles(const char* name
);
81 * Check if the given name matches this group's explicit file list
84 cmSourceGroup
*MatchChildrenFiles(const char *name
);
87 * Check if the given name matches this group's regex in children.
89 cmSourceGroup
*MatchChildrenRegex(const char *name
);
92 * Assign the given source file to this group. Used only by
95 void AssignSource(const cmSourceFile
* sf
);
98 * Get the list of the source files that have been assigned to this
101 const std::vector
<const cmSourceFile
*>& GetSourceFiles() const;
102 std::vector
<const cmSourceFile
*>& GetSourceFiles();
104 std::vector
<cmSourceGroup
> const& GetGroupChildren() const;
107 * The name of the source group.
112 * The regular expression matching the files in the group.
114 cmsys::RegularExpression GroupRegex
;
117 * Set of file names explicitly added to this group.
119 std::set
<cmStdString
> GroupFiles
;
122 * Vector of all source files that have been assigned to
125 std::vector
<const cmSourceFile
*> SourceFiles
;
127 cmSourceGroupInternals
* Internal
;