cmake/Source/CPack/WiX/cmWIXSourceWriter.h

76 lines
1.8 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
2016-07-09 11:21:54 +02:00
#include <CPack/cmCPackLog.h>
2014-08-03 19:52:23 +02:00
#include <cmsys/FStream.hxx>
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
#include <string>
#include <vector>
2013-03-16 19:13:01 +02:00
/** \class cmWIXSourceWriter
* \brief Helper class to generate XML WiX source files
*/
class cmWIXSourceWriter
{
public:
2016-07-09 11:21:54 +02:00
cmWIXSourceWriter(cmCPackLog* logger, 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
2016-03-13 13:35:51 +01:00
void AddTextNode(std::string const& text);
2016-07-09 11:21:54 +02:00
void AddProcessingInstruction(std::string const& target,
std::string const& content);
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
void AddAttribute(std::string const& key, std::string const& value);
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
void AddAttributeUnlessEmpty(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:
2016-07-09 11:21:54 +02:00
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