summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallGenerator.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-16 14:39:56 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-16 14:39:56 (GMT)
commite67f5138b80b3b04844f3f5c0a3c69796266f9e6 (patch)
tree918dfffdd191602494e888ce72e3afaf797fbe9f /Source/cmInstallGenerator.h
parente30835345abd1d05891c383506cadbc08ec51ccf (diff)
downloadCMake-e67f5138b80b3b04844f3f5c0a3c69796266f9e6.zip
CMake-e67f5138b80b3b04844f3f5c0a3c69796266f9e6.tar.gz
CMake-e67f5138b80b3b04844f3f5c0a3c69796266f9e6.tar.bz2
ENH: Refactor cmInstallGenerator for re-use
A new cmScriptGenerator base class factors out the non-install-specific part of cmInstallGenerator. This will be useful for other generators that want per-configuration functionality.
Diffstat (limited to 'Source/cmInstallGenerator.h')
-rw-r--r--Source/cmInstallGenerator.h47
1 files changed, 3 insertions, 44 deletions
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 904bb2b..a6da119 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -17,41 +17,15 @@
#ifndef cmInstallGenerator_h
#define cmInstallGenerator_h
-#include "cmStandardIncludes.h"
+#include "cmScriptGenerator.h"
class cmLocalGenerator;
-class cmInstallGeneratorIndent
-{
-public:
- cmInstallGeneratorIndent(): Level(0) {}
- cmInstallGeneratorIndent(int level): Level(level) {}
- void Write(std::ostream& os) const
- {
- for(int i=0; i < this->Level; ++i)
- {
- os << " ";
- }
- }
- cmInstallGeneratorIndent Next(int step = 2) const
- {
- return cmInstallGeneratorIndent(this->Level + step);
- }
-private:
- int Level;
-};
-inline std::ostream& operator<<(std::ostream& os,
- cmInstallGeneratorIndent const& indent)
-{
- indent.Write(os);
- return os;
-}
-
/** \class cmInstallGenerator
* \brief Support class for generating install scripts.
*
*/
-class cmInstallGenerator
+class cmInstallGenerator: public cmScriptGenerator
{
public:
cmInstallGenerator(const char* destination,
@@ -59,9 +33,6 @@ public:
const char* component);
virtual ~cmInstallGenerator();
- void Generate(std::ostream& os, const char* config,
- std::vector<std::string> const& configurationTypes);
-
void AddInstallRule(
std::ostream& os, int type,
std::vector<std::string> const& files,
@@ -71,13 +42,11 @@ public:
const char* permissions_dir = 0,
const char* rename = 0,
const char* literal_args = 0,
- cmInstallGeneratorIndent const& indent = cmInstallGeneratorIndent()
+ Indent const& indent = Indent()
);
const char* GetDestination() const
{ return this->Destination.c_str(); }
- const std::vector<std::string>& GetConfigurations() const
- { return this->Configurations; }
/** Get the install destination as it should appear in the
installation script. */
@@ -87,23 +56,13 @@ public:
bool InstallsForConfig(const char*);
protected:
- typedef cmInstallGeneratorIndent Indent;
virtual void GenerateScript(std::ostream& os);
- virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
- virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
- std::string CreateConfigTest(const char* config);
- std::string CreateConfigTest(std::vector<std::string> const& configs);
std::string CreateComponentTest(const char* component);
// Information shared by most generator types.
std::string Destination;
- std::vector<std::string> const Configurations;
std::string Component;
-
- // Information used during generation.
- const char* ConfigurationName;
- std::vector<std::string> const* ConfigurationTypes;
};
#endif