1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceGroup.h,v $
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>
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.
38 cmSourceGroup(const char* name
, const char* regex
);
42 * Set the regular expression for this group.
44 void SetGroupRegex(const char* regex
);
47 * Add a file name to the explicit list of files for this group.
49 void AddGroupFile(const char* name
);
52 * Add child to this sourcegroup
54 void AddChild(cmSourceGroup child
);
57 * Looks up child and returns it
59 cmSourceGroup
*lookupChild(const char *name
);
62 * Get the name of this group.
64 const char* GetName() const;
67 * Check if the given name matches this group's regex.
69 bool MatchesRegex(const char* name
);
72 * Check if the given name matches this group's explicit file list.
74 bool MatchesFiles(const char* name
);
77 * Check if the given name matches this group's explicit file list
80 cmSourceGroup
*MatchChildrenFiles(const char *name
);
83 * Check if the given name matches this group's regex in children.
85 cmSourceGroup
*MatchChildrenRegex(const char *name
);
88 * Assign the given source file to this group. Used only by
91 void AssignSource(const cmSourceFile
* sf
);
94 * Get the list of the source files that have been assigned to this
97 const std::vector
<const cmSourceFile
*>& GetSourceFiles() const;
98 std::vector
<const cmSourceFile
*>& GetSourceFiles();
100 std::vector
<cmSourceGroup
> GetGroupChildren() const;
103 * The name of the source group.
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
121 std::vector
<const cmSourceFile
*> SourceFiles
;
123 std::vector
<cmSourceGroup
> GroupChildren
;