Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmXMLSafe.h
blob9acc6b4ccee596105579590a45bec99e2bbcd55b
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmXMLSafe.h,v $
5 Language: C++
6 Date: $Date: 2009-02-06 14:08:02 $
7 Version: $Revision: 1.2 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmXMLSafe_h
18 #define cmXMLSafe_h
20 #include <cmsys/stl/string>
21 #include <cmsys/ios/iosfwd>
23 /** \class cmXMLSafe
24 * \brief Write strings to XML with proper escapes
26 class cmXMLSafe
28 public:
29 /** Construct with the data to be written. This assumes the data
30 will exist for the duration of this object's life. */
31 cmXMLSafe(const char* s);
32 cmXMLSafe(cmsys_stl::string const& s);
34 /** Specify whether to escape quotes too. This is needed when
35 writing the content of an attribute value. By default quotes
36 are escaped. */
37 cmXMLSafe& Quotes(bool b = true);
39 /** Get the escaped data as a string. */
40 cmsys_stl::string str();
41 private:
42 char const* Data;
43 unsigned long Size;
44 bool DoQuotes;
45 friend cmsys_ios::ostream& operator<<(cmsys_ios::ostream&,
46 cmXMLSafe const&);
49 #endif