cmake/Source/CPack/cmCPackDragNDropGenerator.h

83 lines
2.3 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2017-07-20 19:35:53 +02:00
2017-04-14 19:02:05 +02:00
#include <sstream>
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include <stddef.h>
#include "cmCPackGenerator.h"
2016-03-13 13:35:51 +01:00
class cmGeneratedFileStream;
2021-09-14 00:13:48 +02:00
class cmXMLWriter;
2016-03-13 13:35:51 +01:00
/** \class cmCPackDragNDropGenerator
* \brief A generator for OSX drag-n-drop installs
*/
class cmCPackDragNDropGenerator : public cmCPackGenerator
{
public:
cmCPackTypeMacro(cmCPackDragNDropGenerator, cmCPackGenerator);
cmCPackDragNDropGenerator();
2018-01-26 17:06:56 +01:00
~cmCPackDragNDropGenerator() override;
protected:
2018-01-26 17:06:56 +01:00
int InitializeInternal() override;
const char* GetOutputExtension() override;
int PackageFiles() override;
bool SupportsComponentInstallation() const override;
2011-06-19 15:41:06 +03:00
2015-04-27 22:25:09 +02:00
bool CopyFile(std::ostringstream& source, std::ostringstream& target);
2016-03-13 13:35:51 +01:00
bool CreateEmptyFile(std::ostringstream& target, size_t size);
2015-04-27 22:25:09 +02:00
bool RunCommand(std::ostringstream& command, std::string* output = 0);
2016-07-09 11:21:54 +02:00
std::string GetComponentInstallDirNameSuffix(
2018-01-26 17:06:56 +01:00
const std::string& componentName) override;
2011-06-19 15:41:06 +03:00
int CreateDMG(const std::string& src_dir, const std::string& output_file);
2009-10-04 10:30:41 +03:00
2016-03-13 13:35:51 +01:00
private:
std::string slaDirectory;
bool singleLicense;
2021-09-14 00:13:48 +02:00
struct RezDict
{
std::string Name;
size_t ID;
std::vector<unsigned char> Data;
};
struct RezArray
{
std::string Key;
std::vector<RezDict> Entries;
};
struct RezDoc
{
RezArray LPic = { "LPic", {} };
RezArray Menu = { "STR#", {} };
RezArray Text = { "TEXT", {} };
RezArray RTF = { "RTF ", {} };
};
void WriteRezXML(std::string const& file, RezDoc const& rez);
void WriteRezArray(cmXMLWriter& xml, RezArray const& array);
void WriteRezDict(cmXMLWriter& xml, RezDict const& dict);
bool WriteLicense(RezDoc& rez, size_t licenseNumber,
2018-01-26 17:06:56 +01:00
std::string licenseLanguage,
const std::string& licenseFile, std::string* error);
2021-09-14 00:13:48 +02:00
void EncodeLicense(RezDict& dict, std::vector<std::string> const& lines);
void EncodeMenu(RezDict& dict, std::vector<std::string> const& lines);
bool ReadFile(std::string const& file, std::vector<std::string>& lines,
std::string* error);
2016-07-09 11:21:54 +02:00
bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
std::string* error);
};