cmake/Source/CPack/WiX/cmWIXSourceWriter.h

74 lines
1.7 KiB
C
Raw Normal View History

2013-03-16 19:13:01 +02:00
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXSourceWriter_h
#define cmWIXSourceWriter_h
#include <vector>
#include <string>
2014-08-03 19:52:23 +02:00
#include <cmsys/FStream.hxx>
2013-03-16 19:13:01 +02:00
#include <CPack/cmCPackLog.h>
/** \class cmWIXSourceWriter
* \brief Helper class to generate XML WiX source files
*/
class cmWIXSourceWriter
{
public:
cmWIXSourceWriter(cmCPackLog* logger,
2015-04-27 22:25:09 +02:00
std::string const& filename, bool isIncludeFile = false);
2013-03-16 19:13:01 +02:00
~cmWIXSourceWriter();
2015-04-27 22:25:09 +02:00
void BeginElement(std::string const& name);
2013-03-16 19:13:01 +02:00
2015-04-27 22:25:09 +02:00
void EndElement(std::string const& name);
2013-03-16 19:13:01 +02:00
void AddProcessingInstruction(
2015-04-27 22:25:09 +02:00
std::string const& target, std::string const& content);
2013-03-16 19:13:01 +02:00
void AddAttribute(
2015-04-27 22:25:09 +02:00
std::string const& key, std::string const& value);
2013-03-16 19:13:01 +02:00
2014-08-03 19:52:23 +02:00
void AddAttributeUnlessEmpty(
2015-04-27 22:25:09 +02:00
std::string const& key, std::string const& value);
2014-08-03 19:52:23 +02:00
2015-08-17 11:37:30 +02:00
static std::string CMakeEncodingToUtf8(std::string const& value);
2015-04-27 22:25:09 +02:00
protected:
cmCPackLog* Logger;
2013-03-16 19:13:01 +02:00
private:
enum State
{
DEFAULT,
BEGIN
};
void WriteXMLDeclaration();
void Indent(size_t count);
2015-04-27 22:25:09 +02:00
static std::string EscapeAttributeValue(std::string const& value);
2013-03-16 19:13:01 +02:00
2014-08-03 19:52:23 +02:00
cmsys::ofstream File;
State State;
2013-03-16 19:13:01 +02:00
2014-08-03 19:52:23 +02:00
std::vector<std::string> Elements;
2013-03-16 19:13:01 +02:00
2014-08-03 19:52:23 +02:00
std::string SourceFilename;
2013-03-16 19:13:01 +02:00
};
#endif