2012-10-03 18:08:49 +04: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-01-04 09:47:13 +04:00
|
|
|
#include <cmsys/FStream.hxx>
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
#include <CPack/cmCPackLog.h>
|
|
|
|
|
|
|
|
/** \class cmWIXSourceWriter
|
|
|
|
* \brief Helper class to generate XML WiX source files
|
|
|
|
*/
|
|
|
|
class cmWIXSourceWriter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmWIXSourceWriter(cmCPackLog* logger,
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& filename, bool isIncludeFile = false);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
~cmWIXSourceWriter();
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
void BeginElement(std::string const& name);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
void EndElement(std::string const& name);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2015-10-12 22:53:08 +03:00
|
|
|
void AddTextNode(std::string const& text);
|
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
void AddProcessingInstruction(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& target, std::string const& content);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
void AddAttribute(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& key, std::string const& value);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2013-11-20 00:38:09 +04:00
|
|
|
void AddAttributeUnlessEmpty(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& key, std::string const& value);
|
2013-11-20 00:38:09 +04:00
|
|
|
|
2015-03-27 14:22:15 +03:00
|
|
|
static std::string CMakeEncodingToUtf8(std::string const& value);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-08-09 16:50:49 +04:00
|
|
|
protected:
|
|
|
|
cmCPackLog* Logger;
|
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
private:
|
|
|
|
enum State
|
|
|
|
{
|
|
|
|
DEFAULT,
|
|
|
|
BEGIN
|
|
|
|
};
|
|
|
|
|
|
|
|
void WriteXMLDeclaration();
|
|
|
|
|
2012-12-04 23:37:41 +04:00
|
|
|
void Indent(size_t count);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
static std::string EscapeAttributeValue(std::string const& value);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-01-04 09:47:13 +04:00
|
|
|
cmsys::ofstream File;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2013-12-20 21:12:01 +04:00
|
|
|
State State;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2013-12-20 21:12:01 +04:00
|
|
|
std::vector<std::string> Elements;
|
2013-10-23 14:14:39 +04:00
|
|
|
|
2013-12-20 21:12:01 +04:00
|
|
|
std::string SourceFilename;
|
2012-10-03 18:08:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|