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

Side by Side Diff: third_party/WebKit/Source/wtf/text/UTF8.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 #ifndef WTF_UTF8_h 26 #ifndef WTF_UTF8_h
27 #define WTF_UTF8_h 27 #define WTF_UTF8_h
28 28
29 #include "wtf/WTFExport.h" 29 #include "wtf/WTFExport.h"
30 #include "wtf/text/Unicode.h" 30 #include "wtf/text/Unicode.h"
31 31
32 namespace WTF { 32 namespace WTF {
33 namespace Unicode { 33 namespace Unicode {
34 34
35 typedef enum { 35 typedef enum {
36 conversionOK, // conversion successful 36 conversionOK, // conversion successful
37 sourceExhausted, // partial character in source, but hit end 37 sourceExhausted, // partial character in source, but hit end
38 targetExhausted, // insuff. room in target for conversion 38 targetExhausted, // insuff. room in target for conversion
39 sourceIllegal // source sequence is illegal/malformed 39 sourceIllegal // source sequence is illegal/malformed
40 } ConversionResult; 40 } ConversionResult;
41 41
42 // These conversion functions take a "strict" argument. When this flag is set to 42 // These conversion functions take a "strict" argument. When this flag is set to
43 // strict, both irregular sequences and isolated surrogates will cause an error. 43 // strict, both irregular sequences and isolated surrogates will cause an error.
44 // When the flag is set to lenient, both irregular sequences and isolated 44 // When the flag is set to lenient, both irregular sequences and isolated
45 // surrogates are converted. 45 // surrogates are converted.
46 // 46 //
47 // Whether the flag is strict or lenient, all illegal sequences will cause an 47 // Whether the flag is strict or lenient, all illegal sequences will cause an
48 // error return. This includes sequences such as: <F4 90 80 80>, <C0 80>, or 48 // error return. This includes sequences such as: <F4 90 80 80>, <C0 80>, or
49 // <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code must 49 // <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code must
50 // check for illegal sequences. 50 // check for illegal sequences.
51 // 51 //
52 // When the flag is set to lenient, characters over 0x10FFFF are converted to 52 // When the flag is set to lenient, characters over 0x10FFFF are converted to
53 // the replacement character; otherwise (when the flag is set to strict) they 53 // the replacement character; otherwise (when the flag is set to strict) they
54 // constitute an error. 54 // constitute an error.
55 55
56 WTF_EXPORT ConversionResult convertUTF8ToUTF16( 56 WTF_EXPORT ConversionResult convertUTF8ToUTF16(const char** sourceStart,
57 const char** sourceStart, const char* sourceEnd, 57 const char* sourceEnd,
58 UChar** targetStart, UChar* targetEnd, bool* isSourceAllASCII = 0, bool stri ct = true); 58 UChar** targetStart,
59 UChar* targetEnd,
60 bool* isSourceAllASCII = 0,
61 bool strict = true);
59 62
60 WTF_EXPORT ConversionResult convertLatin1ToUTF8( 63 WTF_EXPORT ConversionResult convertLatin1ToUTF8(const LChar** sourceStart,
61 const LChar** sourceStart, const LChar* sourceEnd, 64 const LChar* sourceEnd,
62 char** targetStart, char* targetEnd); 65 char** targetStart,
66 char* targetEnd);
63 67
64 WTF_EXPORT ConversionResult convertUTF16ToUTF8( 68 WTF_EXPORT ConversionResult convertUTF16ToUTF8(const UChar** sourceStart,
65 const UChar** sourceStart, const UChar* sourceEnd, 69 const UChar* sourceEnd,
66 char** targetStart, char* targetEnd, bool strict = true); 70 char** targetStart,
71 char* targetEnd,
72 bool strict = true);
67 73
68 WTF_EXPORT unsigned calculateStringHashAndLengthFromUTF8MaskingTop8Bits(const ch ar* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length); 74 WTF_EXPORT unsigned calculateStringHashAndLengthFromUTF8MaskingTop8Bits(
75 const char* data,
76 const char* dataEnd,
77 unsigned& dataLength,
78 unsigned& utf16Length);
69 79
70 WTF_EXPORT bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char * b, const char* bEnd); 80 WTF_EXPORT bool equalUTF16WithUTF8(const UChar* a,
71 WTF_EXPORT bool equalLatin1WithUTF8(const LChar* a, const LChar* aEnd, const cha r* b, const char* bEnd); 81 const UChar* aEnd,
82 const char* b,
83 const char* bEnd);
84 WTF_EXPORT bool equalLatin1WithUTF8(const LChar* a,
85 const LChar* aEnd,
86 const char* b,
87 const char* bEnd);
72 88
73 } // namespace Unicode 89 } // namespace Unicode
74 } // namespace WTF 90 } // namespace WTF
75 91
76 #endif // WTF_UTF8_h 92 #endif // WTF_UTF8_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextPosition.cpp ('k') | third_party/WebKit/Source/wtf/text/UTF8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698