Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmSourceFile.h
blob163611ca170e598a7c712f1f5453b1c03ff60708
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceFile.h,v $
5 Language: C++
6 <<<<<<< cmSourceFile.h
7 Date: $Date: 2008/01/30 16:21:54 $
8 Version: $Revision: 1.25 $
9 =======
10 Date: $Date: 2008-04-29 18:17:42 $
11 Version: $Revision: 1.26 $
12 >>>>>>> 1.26
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmSourceFile_h
23 #define cmSourceFile_h
25 #include "cmSourceFileLocation.h"
26 #include "cmCustomCommand.h"
27 #include "cmPropertyMap.h"
29 class cmake;
31 /** \class cmSourceFile
32 * \brief Represent a class loaded from a makefile.
34 * cmSourceFile is represents a class loaded from
35 * a makefile.
37 class cmSourceFile
39 public:
40 /**
41 * Construct with the makefile storing the source and the initial
42 * name referencing it.
44 cmSourceFile(cmMakefile* mf, const char* name);
46 ~cmSourceFile();
48 /**
49 * Get the list of the custom commands for this source file
51 cmCustomCommand* GetCustomCommand();
52 cmCustomCommand const* GetCustomCommand() const;
53 void SetCustomCommand(cmCustomCommand *cc);
55 ///! Set/Get a property of this source file
56 void SetProperty(const char *prop, const char *value);
57 void AppendProperty(const char* prop, const char* value);
58 const char *GetProperty(const char *prop) const;
59 bool GetPropertyAsBool(const char *prop) const;
61 /** Implement getting a property when called from a CMake language
62 command like get_property or get_source_file_property. */
63 const char* GetPropertyForUser(const char *prop);
65 /**
66 * The full path to the file. The non-const version of this method
67 * may attempt to locate the file on disk and finalize its location.
68 * The const version of this method may return an empty string if
69 * the non-const version has not yet been called (yes this is a
70 * horrible interface, but is necessary for backwards
71 * compatibility).
73 std::string const& GetFullPath();
74 std::string const& GetFullPath() const;
76 /**
77 * Get the information currently known about the source file
78 * location without attempting to locate the file as GetFullPath
79 * would. See cmSourceFileLocation documentation.
81 cmSourceFileLocation const& GetLocation() const;
83 /**
84 * Get the file extension of this source file.
86 std::string const& GetExtension() const;
88 /**
89 * Get the language of the compiler to use for this source file.
91 const char* GetLanguage();
92 const char* GetLanguage() const;
94 /**
95 * Return the vector that holds the list of dependencies
97 const std::vector<std::string> &GetDepends() const {return this->Depends;}
98 void AddDepend(const char* d) { this->Depends.push_back(d); }
100 // Get the properties
101 cmPropertyMap &GetProperties() { return this->Properties; };
103 // Define the properties
104 static void DefineProperties(cmake *cm);
107 * Check whether the given source file location could refer to this
108 * source.
110 bool Matches(cmSourceFileLocation const&);
112 private:
113 cmSourceFileLocation Location;
114 cmPropertyMap Properties;
115 cmCustomCommand* CustomCommand;
116 std::string Extension;
117 std::string Language;
118 std::string FullPath;
119 bool FindFullPathFailed;
121 bool FindFullPath();
122 bool TryFullPath(const char* tryPath, const char* ext);
123 void CheckExtension();
124 void CheckLanguage(std::string const& ext);
126 std::vector<std::string> Depends;
129 #endif