diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2014-02-24 22:21:12 (GMT) |
---|---|---|
committer | Nils Gladitz <nilsgladitz@gmail.com> | 2014-02-26 13:15:13 (GMT) |
commit | 6fcd835c0786182c4981f9f640849c5c91100845 (patch) | |
tree | 175f71ff77a77de6a93b348d145c0ead7df455e1 /Source/CPack/WiX/cmCPackWIXGenerator.h | |
parent | c859d176a15326cd1ef7b5c35908f28313d1be19 (diff) | |
download | CMake-6fcd835c0786182c4981f9f640849c5c91100845.zip CMake-6fcd835c0786182c4981f9f640849c5c91100845.tar.gz CMake-6fcd835c0786182c4981f9f640849c5c91100845.tar.bz2 |
CPackWIX: refactor and cleanup
Extract addtional classes and functions which are getting unsightly large.
Use some of the coding conventions more consistently.
Diffstat (limited to 'Source/CPack/WiX/cmCPackWIXGenerator.h')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.h | 103 |
1 files changed, 38 insertions, 65 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 1de4810..ee66c05 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -13,25 +13,18 @@ #ifndef cmCPackWIXGenerator_h #define cmCPackWIXGenerator_h -#include "cmWIXPatchParser.h" +#include "cmWIXPatch.h" +#include "cmWIXShortcut.h" #include <CPack/cmCPackGenerator.h> #include <string> #include <map> -struct cmWIXShortcut -{ - cmWIXShortcut() - :desktop(false) - {} - - std::string textLabel; - std::string workingDirectoryId; - bool desktop; -}; - class cmWIXSourceWriter; +class cmWIXDirectoriesSourceWriter; +class cmWIXFilesSourceWriter; +class cmWIXFeaturesSourceWriter; /** \class cmCPackWIXGenerator * \brief A generator for WIX files @@ -78,48 +71,37 @@ private: bool PackageFilesImpl(); - bool CreateWiXVariablesIncludeFile(); + void CreateWiXVariablesIncludeFile(); void CopyDefinition( - cmWIXSourceWriter &source, const std::string &name); + cmWIXSourceWriter &source, std::string const& name); void AddDefinition(cmWIXSourceWriter& source, - const std::string& name, const std::string& value); + std::string const& name, std::string const& value); bool CreateWiXSourceFiles(); - bool CreateCMakePackageRegistryEntry( - cmWIXSourceWriter& featureDefinitions); + std::string GetProgramFilesFolderId() const; - bool CreateFeatureHierarchy( - cmWIXSourceWriter& featureDefinitions); - - bool EmitFeatureForComponentGroup( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponentGroup const& group); + bool GenerateMainSourceFileFromTemplate(); - bool EmitFeatureForComponent( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponent const& component); + bool CreateFeatureHierarchy( + cmWIXFeaturesSourceWriter& featureDefinitions); bool AddComponentsToFeature( std::string const& rootPath, std::string const& featureId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, shortcut_map_t& shortcutMap); bool CreateStartMenuShortcuts( std::string const& cpackComponentName, std::string const& featureId, shortcut_map_t& shortcutMap, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions); - - void CreateUninstallShortcut( - std::string const& packageName, - cmWIXSourceWriter& fileDefinitions); + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions); void AppendUserSuppliedExtraSources(); @@ -127,60 +109,49 @@ private: bool CreateLicenseFile(); - bool RunWiXCommand(const std::string& command); + bool RunWiXCommand(std::string const& command); bool RunCandleCommand( - const std::string& sourceFile, const std::string& objectFile); + std::string const& sourceFile, std::string const& objectFile); - bool RunLightCommand(const std::string& objectFiles); + bool RunLightCommand(std::string const& objectFiles); - void AddDirectoryAndFileDefinitons(const std::string& topdir, - const std::string& directoryId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + void AddDirectoryAndFileDefinitons(std::string const& topdir, + std::string const& directoryId, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, const std::vector<std::string>& pkgExecutables, const std::vector<std::string>& desktopExecutables, shortcut_map_t& shortcutMap); - bool RequireOption(const std::string& name, std::string& value) const; + bool RequireOption(std::string const& name, std::string& value) const; std::string GetArchitecture() const; static std::string GenerateGUID(); - static std::string QuotePath(const std::string& path); + static std::string QuotePath(std::string const& path); - static std::string GetRightmostExtension(const std::string& filename); + static std::string GetRightmostExtension(std::string const& filename); - std::string PathToId(const std::string& path); + std::string PathToId(std::string const& path); - std::string CreateNewIdForPath(const std::string& path); + std::string CreateNewIdForPath(std::string const& path); static std::string CreateHashedId( - const std::string& path, const std::string& normalizedFilename); + std::string const& path, std::string const& normalizedFilename); std::string NormalizeComponentForId( - const std::string& component, size_t& replacementCount); + std::string const& component, size_t& replacementCount); static bool IsLegalIdCharacter(char c); void CollectExtensions( - const std::string& variableName, extension_set_t& extensions); + std::string const& variableName, extension_set_t& extensions); void AddCustomFlags( - const std::string& variableName, std::ostream& stream); - - void CreateStartMenuFolder(cmWIXSourceWriter& directoryDefinitions); - - void CreateDesktopFolder(cmWIXSourceWriter& directoryDefinitions); - - void LoadPatchFragments(const std::string& patchFilePath); - - void ApplyPatchFragment(const std::string& id, cmWIXSourceWriter& writer); - - void ApplyPatchElement(const cmWIXPatchElement& element, - cmWIXSourceWriter& writer); + std::string const& variableName, std::ostream& stream); std::vector<std::string> WixSources; id_map_t PathToIdMap; @@ -189,9 +160,11 @@ private: extension_set_t CandleExtensions; extension_set_t LightExtensions; - cmWIXPatchParser::fragment_map_t Fragments; - bool HasDesktopShortcuts; + + std::string CPackTopLevel; + + cmWIXPatch Patch; }; #endif |