/usr/include/Wt/EscapeOStream.h is in libwt-dev 3.3.6+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_ESCAPE_OSTREAM_H_
#define WT_ESCAPE_OSTREAM_H_
#include <Wt/WStringStream>
namespace Wt {
class WT_API EscapeOStream
{
public:
enum RuleSet { Empty = 0, HtmlAttribute = 1,
JsStringLiteralSQuote = 2, JsStringLiteralDQuote = 3,
PlainText = 4, PlainTextNewLines = 5 };
EscapeOStream();
EscapeOStream(std::ostream& sink);
EscapeOStream(WStringStream& sink);
EscapeOStream(EscapeOStream& other);
void pushEscape(RuleSet rules);
void popEscape();
#ifdef WT_TARGET_JAVA
EscapeOStream& push();
#endif // WT_TARGET_JAVA
void append(const std::string& s, const EscapeOStream& rules);
void append(const char *s, std::size_t len);
#ifndef WT_TARGET_JAVA
/*
* Should not be implemented but is needed to support the specialization
* for string literals !
*/
template <typename T>
inline EscapeOStream& operator<< (T t);
template <std::size_t N>
EscapeOStream& operator<< (const char (&s)[N]) {
append(s, N-1); return *this;
}
#endif // WT_TARGET_JAVA
EscapeOStream& operator<< (char);
EscapeOStream& operator<< (char *s);
EscapeOStream& operator<< (const std::string& s);
EscapeOStream& operator<< (int);
EscapeOStream& operator<< (long long);
EscapeOStream& operator<< (bool);
EscapeOStream& operator<< (const EscapeOStream& other);
const char *c_str(); // for default constructor, can return 0
std::string str() const; // for default constructor
bool empty() const;
void clear();
private:
WStringStream own_stream_;
WStringStream& stream_;
struct Entry {
char c;
std::string s;
};
std::vector<Entry> mixed_;
std::string special_;
const char *c_special_;
void mixRules();
void put(const char *s, const EscapeOStream& rules);
void sAppend(char c);
void sAppend(const char *s, int length);
void sAppend(const std::string& s);
std::vector<RuleSet> ruleSets_;
static const std::vector<Entry> standardSets_[6];
static const std::string standardSetsSpecial_[6];
static const Entry htmlAttributeEntries_[3];
static const Entry jsStringLiteralSQuoteEntries_[5];
static const Entry jsStringLiteralDQuoteEntries_[5];
static const Entry plainTextEntries_[3];
static const Entry plainTextNewLinesEntries_[4];
};
}
#endif // ESCAPE_OSTREAM_H_
|