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/maybe-handles.h"
10 : #include "src/objects.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 :
15 : class Uri : public AllStatic {
16 : public:
17 : // ES6 section 18.2.6.2 decodeURI (encodedURI)
18 : static MaybeHandle<String> DecodeUri(Isolate* isolate, Handle<String> uri) {
19 2925 : return Decode(isolate, uri, true);
20 : }
21 :
22 : // ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent)
23 : static MaybeHandle<String> DecodeUriComponent(Isolate* isolate,
24 : Handle<String> component) {
25 2772 : return Decode(isolate, component, false);
26 : }
27 :
28 : // ES6 section 18.2.6.4 encodeURI (uri)
29 : static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) {
30 5310 : return Encode(isolate, uri, true);
31 : }
32 :
33 : // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
34 : static MaybeHandle<String> EncodeUriComponent(Isolate* isolate,
35 : Handle<String> component) {
36 151290 : return Encode(isolate, component, false);
37 : }
38 :
39 : // ES6 section B.2.1.1 escape (string)
40 : static MaybeHandle<String> Escape(Isolate* isolate, Handle<String> string);
41 :
42 : // ES6 section B.2.1.2 unescape (string)
43 : static MaybeHandle<String> Unescape(Isolate* isolate, Handle<String> string);
44 :
45 : private:
46 : static MaybeHandle<String> Decode(Isolate* isolate, Handle<String> uri,
47 : bool is_uri);
48 : static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri,
49 : bool is_uri);
50 : };
51 :
52 : } // namespace internal
53 : } // namespace v8
54 :
55 : #endif // V8_URI_H_
|