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>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include <CPack/cmCPackLog.h>
|
|
|
|
|
|
|
|
/** \class cmWIXSourceWriter
|
|
|
|
* \brief Helper class to generate XML WiX source files
|
|
|
|
*/
|
|
|
|
class cmWIXSourceWriter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmWIXSourceWriter(cmCPackLog* logger,
|
|
|
|
const std::string& filename, bool isIncludeFile = false);
|
|
|
|
|
|
|
|
~cmWIXSourceWriter();
|
|
|
|
|
|
|
|
void BeginElement(const std::string& name);
|
|
|
|
|
2013-10-23 14:14:39 +04:00
|
|
|
void EndElement(const std::string& name);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
void AddProcessingInstruction(
|
|
|
|
const std::string& target, const std::string& content);
|
|
|
|
|
|
|
|
void AddAttribute(
|
|
|
|
const std::string& key, const std::string& value);
|
|
|
|
|
|
|
|
static std::string WindowsCodepageToUtf8(const std::string& value);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
static std::string EscapeAttributeValue(const std::string& value);
|
|
|
|
|
2012-12-04 23:37:41 +04:00
|
|
|
cmCPackLog* Logger;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2012-12-04 23:37:41 +04:00
|
|
|
std::ofstream file;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
State state;
|
|
|
|
|
2012-12-04 23:37:41 +04:00
|
|
|
std::vector<std::string> elements;
|
2013-10-23 14:14:39 +04:00
|
|
|
|
|
|
|
std::string sourceFilename;
|
2012-10-03 18:08:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|