FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/src/inspector/node_string.h at main · fetchapi/node · GitHub
fetchapi
/
node
Public
forked from
nodejs/node
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
src
/
inspector
/
node_string.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
108 lines (90 loc) · 3.34 KB
Breadcrumbs
node
/
src
/
inspector
/
node_string.h
Copy path
File metadata and controls
108 lines (90 loc) · 3.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
Bridges V8 Inspector generated code with the std::string used by the Node
//
Compare to V8 counterpart - deps/v8/src/inspector/string-util.h
#
ifndef
SRC_INSPECTOR_NODE_STRING_H_
#
define
SRC_INSPECTOR_NODE_STRING_H_
#
include
"
util.h
"
#
include
"
v8-inspector.h
"
#
include
<
cstring
>
#
include
<
sstream
>
#
include
<
string
>
namespace
node
{
namespace
inspector
{
namespace
protocol
{
class
Value
;
using
String = std::string;
using
StringBuilder = std::ostringstream;
using
ProtocolMessage = std::string;
namespace
StringUtil
{
//
NOLINTNEXTLINE(runtime/references) This is V8 API...
inline
void
builderAppend
(StringBuilder& builder,
char
c) {
builder.
put
(c);
}
//
NOLINTNEXTLINE(runtime/references)
inline
void
builderAppend
(StringBuilder& builder,
const
char
* value,
size_t
length) {
builder.
write
(value, length);
}
//
NOLINTNEXTLINE(runtime/references)
inline
void
builderAppend
(StringBuilder& builder,
const
char
* value) {
builderAppend
(builder, value,
std::strlen
(value));
}
//
NOLINTNEXTLINE(runtime/references)
inline
void
builderAppend
(StringBuilder& builder,
const
String& string) {
builder << string;
}
//
NOLINTNEXTLINE(runtime/references)
inline
void
builderReserve
(StringBuilder& builder,
size_t
) {
//
ostringstream does not have a counterpart
}
inline
String
substring
(
const
String& string,
size_t
start,
size_t
count) {
return
string.
substr
(start, count);
}
inline
String
fromInteger
(
int
n) {
return
std::to_string
(n);
}
inline
String
builderToString
(
const
StringBuilder& builder) {
return
builder.
str
();
}
inline
size_t
find
(
const
String& string,
const
char
* substring) {
return
string.
find
(substring);
}
String
fromDouble
(
double
d);
double
toDouble
(
const
char
* buffer,
size_t
length,
bool
* ok);
String
StringViewToUtf8
(v8_inspector::StringView view);
//
NOLINTNEXTLINE(runtime/references)
void
builderAppendQuotedString
(StringBuilder& builder,
const
std::string_view);
std::unique_ptr<Value>
parseJSON
(
const
std::string_view);
std::unique_ptr<Value>
parseJSON
(v8_inspector::StringView view);
ProtocolMessage
jsonToMessage
(String message);
ProtocolMessage
binaryToMessage
(std::vector<
uint8_t
> message);
String
fromUTF8
(
const
uint8_t
* data,
size_t
length);
String
fromUTF16
(
const
uint16_t
* data,
size_t
length);
const
uint8_t
*
CharactersUTF8
(
const
std::string_view s);
size_t
CharacterCount
(
const
std::string_view s);
//
Unimplemented. The generated code will fall back to CharactersUTF8().
inline
uint8_t
*
CharactersLatin1
(
const
std::string_view s) {
return
nullptr
;
}
inline
const
uint16_t
*
CharactersUTF16
(
const
std::string_view s) {
return
nullptr
;
}
extern
size_t
kNotFound
;
}
//
namespace StringUtil
//
A read-only sequence of uninterpreted bytes with reference-counted storage.
//
Though the templates for generating the protocol bindings reference
//
this type, js_protocol.pdl doesn't have a field of type 'binary', so
//
therefore it's unnecessary to provide an implementation here.
class
Binary
{
public:
const
uint8_t
*
data
()
const
{
UNREACHABLE
(); }
size_t
size
()
const
{
UNREACHABLE
(); }
String
toBase64
()
const
{
UNREACHABLE
(); }
static
Binary
fromBase64
(
const
std::string_view base64,
bool
* success) {
UNREACHABLE
();
}
static
Binary
fromSpan
(
const
uint8_t
* data,
size_t
size) {
UNREACHABLE
(); }
};
}
//
namespace protocol
}
//
namespace inspector
}
//
namespace node
#
endif
//
SRC_INSPECTOR_NODE_STRING_H_
Back
|
FazBrowse Home
|
New Git URL