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

Side by Side Diff: third_party/WebKit/Source/wtf/text/Base64.h

Issue 1436153002: Apply clang-format with Chromium-style without column limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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) 2006 Alexey Proskuryakov <ap@webkit.org> 2 * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 17 matching lines...) Expand all
28 #define Base64_h 28 #define Base64_h
29 29
30 #include "wtf/Vector.h" 30 #include "wtf/Vector.h"
31 #include "wtf/WTFExport.h" 31 #include "wtf/WTFExport.h"
32 #include "wtf/text/CString.h" 32 #include "wtf/text/CString.h"
33 #include "wtf/text/WTFString.h" 33 #include "wtf/text/WTFString.h"
34 34
35 namespace WTF { 35 namespace WTF {
36 36
37 enum Base64EncodePolicy { 37 enum Base64EncodePolicy {
38 Base64DoNotInsertLFs, 38 Base64DoNotInsertLFs,
39 Base64InsertLFs 39 Base64InsertLFs
40 }; 40 };
41 41
42 enum Base64DecodePolicy { 42 enum Base64DecodePolicy {
43 Base64DoNotValidatePadding, 43 Base64DoNotValidatePadding,
44 Base64ValidatePadding 44 Base64ValidatePadding
45 }; 45 };
46 46
47 WTF_EXPORT void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodeP olicy = Base64DoNotInsertLFs); 47 WTF_EXPORT void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodeP olicy = Base64DoNotInsertLFs);
48 WTF_EXPORT void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePol icy = Base64DoNotInsertLFs); 48 WTF_EXPORT void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePol icy = Base64DoNotInsertLFs);
49 WTF_EXPORT void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); 49 WTF_EXPORT void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
50 WTF_EXPORT String base64Encode(const char*, unsigned, Base64EncodePolicy = Base6 4DoNotInsertLFs); 50 WTF_EXPORT String base64Encode(const char*, unsigned, Base64EncodePolicy = Base6 4DoNotInsertLFs);
51 WTF_EXPORT String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64D oNotInsertLFs); 51 WTF_EXPORT String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64D oNotInsertLFs);
52 WTF_EXPORT String base64Encode(const Vector<unsigned char>&, Base64EncodePolicy = Base64DoNotInsertLFs); 52 WTF_EXPORT String base64Encode(const Vector<unsigned char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
53 WTF_EXPORT String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotI nsertLFs); 53 WTF_EXPORT String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotI nsertLFs);
54 54
55 WTF_EXPORT bool base64Decode(const String&, Vector<char>&, CharacterMatchFunctio nPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidatePadding) ; 55 WTF_EXPORT bool base64Decode(const String&, Vector<char>&, CharacterMatchFunctio nPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidatePadding) ;
56 WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, CharacterMatchF unctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidatePa dding); 56 WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, CharacterMatchF unctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidatePa dding);
57 WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, CharacterMatc hFunctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidate Padding); 57 WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, CharacterMatc hFunctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidate Padding);
58 WTF_EXPORT bool base64Decode(const UChar*, unsigned, Vector<char>&, CharacterMat chFunctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidat ePadding); 58 WTF_EXPORT bool base64Decode(const UChar*, unsigned, Vector<char>&, CharacterMat chFunctionPtr shouldIgnoreCharacter = 0, Base64DecodePolicy = Base64DoNotValidat ePadding);
59 59
60 // Given an encoding in either base64 or base64url, returns a normalized 60 // Given an encoding in either base64 or base64url, returns a normalized
61 // encoding in plain base64. 61 // encoding in plain base64.
62 WTF_EXPORT String normalizeToBase64(const String&); 62 WTF_EXPORT String normalizeToBase64(const String&);
63 63
64 WTF_EXPORT String base64URLEncode(const char*, unsigned, Base64EncodePolicy = Ba se64DoNotInsertLFs); 64 WTF_EXPORT String base64URLEncode(const char*, unsigned, Base64EncodePolicy = Ba se64DoNotInsertLFs);
65 65
66 inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64Encode Policy policy) 66 inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64Encode Policy policy) {
67 { 67 base64Encode(in.data(), in.size(), out, policy);
68 base64Encode(in.data(), in.size(), out, policy);
69 } 68 }
70 69
71 inline void base64Encode(const CString& in, Vector<char>& out, Base64EncodePolic y policy) 70 inline void base64Encode(const CString& in, Vector<char>& out, Base64EncodePolic y policy) {
72 { 71 base64Encode(in.data(), in.length(), out, policy);
73 base64Encode(in.data(), in.length(), out, policy);
74 } 72 }
75 73
76 inline String base64Encode(const Vector<char>& in, Base64EncodePolicy policy) 74 inline String base64Encode(const Vector<char>& in, Base64EncodePolicy policy) {
77 { 75 return base64Encode(in.data(), in.size(), policy);
78 return base64Encode(in.data(), in.size(), policy);
79 } 76 }
80 77
81 inline String base64Encode(const Vector<unsigned char>& in, Base64EncodePolicy p olicy) 78 inline String base64Encode(const Vector<unsigned char>& in, Base64EncodePolicy p olicy) {
82 { 79 return base64Encode(reinterpret_cast<const char*>(in.data()), in.size(), polic y);
83 return base64Encode(reinterpret_cast<const char*>(in.data()), in.size(), pol icy);
84 } 80 }
85 81
86 inline String base64Encode(const CString& in, Base64EncodePolicy policy) 82 inline String base64Encode(const CString& in, Base64EncodePolicy policy) {
87 { 83 return base64Encode(in.data(), in.length(), policy);
88 return base64Encode(in.data(), in.length(), policy);
89 } 84 }
90 85
91 } // namespace WTF 86 } // namespace WTF
92 87
93 using WTF::Base64EncodePolicy; 88 using WTF::Base64EncodePolicy;
94 using WTF::Base64DoNotInsertLFs; 89 using WTF::Base64DoNotInsertLFs;
95 using WTF::Base64InsertLFs; 90 using WTF::Base64InsertLFs;
96 using WTF::Base64DecodePolicy; 91 using WTF::Base64DecodePolicy;
97 using WTF::Base64DoNotValidatePadding; 92 using WTF::Base64DoNotValidatePadding;
98 using WTF::Base64ValidatePadding; 93 using WTF::Base64ValidatePadding;
99 using WTF::base64Encode; 94 using WTF::base64Encode;
100 using WTF::base64Decode; 95 using WTF::base64Decode;
101 96
102 #endif // Base64_h 97 #endif // Base64_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicStringTest.cpp ('k') | third_party/WebKit/Source/wtf/text/Base64.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698