Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: third_party/WebKit/Source/wtf/text/TextCodec.h

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/TextCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/TextCodec.h
diff --git a/third_party/WebKit/Source/wtf/text/TextCodec.h b/third_party/WebKit/Source/wtf/text/TextCodec.h
index 27e312858bd7bfe9743e3c32e96927c96b1946b3..950056c4c969399c325ab778a8248b9f61f71dbc 100644
--- a/third_party/WebKit/Source/wtf/text/TextCodec.h
+++ b/third_party/WebKit/Source/wtf/text/TextCodec.h
@@ -40,66 +40,77 @@ class TextEncoding;
// Specifies what will happen when a character is encountered that is
// not encodable in the character set.
enum UnencodableHandling {
- // Substitutes the replacement character "?".
- QuestionMarksForUnencodables,
+ // Substitutes the replacement character "?".
+ QuestionMarksForUnencodables,
- // Encodes the character as an XML entity. For example, U+06DE
- // would be "۞" (0x6DE = 1758 in octal).
- EntitiesForUnencodables,
+ // Encodes the character as an XML entity. For example, U+06DE
+ // would be "۞" (0x6DE = 1758 in octal).
+ EntitiesForUnencodables,
- // Encodes the character as en entity as above, but escaped
- // non-alphanumeric characters. This is used in URLs.
- // For example, U+6DE would be "%26%231758%3B".
- URLEncodedEntitiesForUnencodables
+ // Encodes the character as en entity as above, but escaped
+ // non-alphanumeric characters. This is used in URLs.
+ // For example, U+6DE would be "%26%231758%3B".
+ URLEncodedEntitiesForUnencodables
};
typedef char UnencodableReplacementArray[32];
enum FlushBehavior {
- // More bytes are coming, don't flush the codec.
- DoNotFlush = 0,
+ // More bytes are coming, don't flush the codec.
+ DoNotFlush = 0,
- // A fetch has hit EOF. Some codecs handle fetches differently, for compat reasons.
- FetchEOF,
+ // A fetch has hit EOF. Some codecs handle fetches differently, for compat reasons.
+ FetchEOF,
- // Do a full flush of the codec.
- DataEOF
+ // Do a full flush of the codec.
+ DataEOF
};
static_assert(!DoNotFlush, "DoNotFlush should be falsy");
static_assert(FetchEOF, "FetchEOF should be truthy");
static_assert(DataEOF, "DataEOF should be truthy");
-
class TextCodec {
- WTF_MAKE_NONCOPYABLE(TextCodec); USING_FAST_MALLOC(TextCodec);
-public:
- TextCodec() { }
- virtual ~TextCodec();
-
- String decode(const char* str, size_t length, FlushBehavior flush = DoNotFlush)
- {
- bool ignored;
- return decode(str, length, flush, false, ignored);
- }
-
- virtual String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) = 0;
- virtual CString encode(const UChar*, size_t length, UnencodableHandling) = 0;
- virtual CString encode(const LChar*, size_t length, UnencodableHandling) = 0;
-
- // Fills a null-terminated string representation of the given
- // unencodable character into the given replacement buffer.
- // The length of the string (not including the null) will be returned.
- static int getUnencodableReplacement(unsigned codePoint, UnencodableHandling, UnencodableReplacementArray);
+ WTF_MAKE_NONCOPYABLE(TextCodec);
+ USING_FAST_MALLOC(TextCodec);
+
+ public:
+ TextCodec() {}
+ virtual ~TextCodec();
+
+ String decode(const char* str,
+ size_t length,
+ FlushBehavior flush = DoNotFlush) {
+ bool ignored;
+ return decode(str, length, flush, false, ignored);
+ }
+
+ virtual String decode(const char*,
+ size_t length,
+ FlushBehavior,
+ bool stopOnError,
+ bool& sawError) = 0;
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling) = 0;
+ virtual CString encode(const LChar*, size_t length, UnencodableHandling) = 0;
+
+ // Fills a null-terminated string representation of the given
+ // unencodable character into the given replacement buffer.
+ // The length of the string (not including the null) will be returned.
+ static int getUnencodableReplacement(unsigned codePoint,
+ UnencodableHandling,
+ UnencodableReplacementArray);
};
typedef void (*EncodingNameRegistrar)(const char* alias, const char* name);
-typedef PassOwnPtr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData);
-typedef void (*TextCodecRegistrar)(const char* name, NewTextCodecFunction, const void* additionalData);
+typedef PassOwnPtr<TextCodec> (
+ *NewTextCodecFunction)(const TextEncoding&, const void* additionalData);
+typedef void (*TextCodecRegistrar)(const char* name,
+ NewTextCodecFunction,
+ const void* additionalData);
-} // namespace WTF
+} // namespace WTF
using WTF::TextCodec;
-#endif // TextCodec_h
+#endif // TextCodec_h
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/TextCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698