Line data Source code
1 : // Copyright 2016 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_URI_H_
6 : #define V8_URI_H_
7 :
8 : #include "src/allocation.h"
9 : #include "src/objects.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 : class Uri : public AllStatic {
15 : public:
16 : // ES6 section 18.2.6.2 decodeURI (encodedURI)
17 : static MaybeHandle<String> DecodeUri(Isolate* isolate, Handle<String> uri) {
18 4600 : return Decode(isolate, uri, true);
19 : }
20 :
21 : // ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent)
22 : static MaybeHandle<String> DecodeUriComponent(Isolate* isolate,
23 : Handle<String> component) {
24 4390 : return Decode(isolate, component, false);
25 : }
26 :
27 : // ES6 section 18.2.6.4 encodeURI (uri)
28 : static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) {
29 8301 : return Encode(isolate, uri, true);
30 : }
31 :
32 : // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
33 : static MaybeHandle<String> EncodeUriComponent(Isolate* isolate,
34 : Handle<String> component) {
35 98721 : return Encode(isolate, component, false);
36 : }
37 :
38 : // ES6 section B.2.1.1 escape (string)
39 : static MaybeHandle<String> Escape(Isolate* isolate, Handle<String> string);
40 :
41 : // ES6 section B.2.1.2 unescape (string)
42 : static MaybeHandle<String> Unescape(Isolate* isolate, Handle<String> string);
43 :
44 : private:
45 : static MaybeHandle<String> Decode(Isolate* isolate, Handle<String> uri,
46 : bool is_uri);
47 : static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri,
48 : bool is_uri);
49 : };
50 :
51 : } // namespace internal
52 : } // namespace v8
53 :
54 : #endif // V8_URI_H_
|