FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
EmmyLuaCodeStyle/CodeFormatServer/src/CodeFormatServer.cpp at master · Endll/EmmyLuaCodeStyle · GitHub
Endll
EmmyLuaCodeStyle
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
EmmyLuaCodeStyle
/
CodeFormatServer
/
src
/
CodeFormatServer.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (31 loc) · 980 Bytes
Breadcrumbs
EmmyLuaCodeStyle
/
CodeFormatServer
/
src
/
CodeFormatServer.cpp
Copy path
File metadata and controls
35 lines (31 loc) · 980 Bytes
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
#
include
<
asio.hpp
>
#
include
"
CodeFormatServer/LanguageClient.h
"
#
include
"
CodeFormatServer/Session/SocketIOSession.h
"
#
include
"
CodeFormatServer/Session/StandardIOSession.h
"
//
https://stackoverflow.com/questions/1598985/c-read-binary-stdin
#
ifdef
_WIN32
#
include
<
io.h
>
#
include
<
fcntl.h
>
#
define
SET_BINARY_MODE
() _setmode(_fileno(stdin), _O_BINARY);\
_setmode
(_fileno(stdout), _O_BINARY)
#
else
#
define
SET_BINARY_MODE
() (
void
)
0
#
endif
using
namespace
asio
::ip
;
int
main
(
int
argc,
char
** argv)
{
auto
& ioc =
LanguageClient::GetInstance
().
GetIOContext
();
if
(argc >
1
)
{
int
port =
std::stoi
(argv[
1
]);
tcp::acceptor
acceptor
(ioc,
tcp::endpoint
(
tcp::v4
(), port));
auto
socket = acceptor.
accept
();
LanguageClient::GetInstance
().
SetSession
(std::make_shared<SocketIOSession>(
std::move
(socket)));
}
else
{
SET_BINARY_MODE
();
LanguageClient::GetInstance
().
SetSession
(std::make_shared<StandardIOSession>());
}
return
LanguageClient::GetInstance
().
Run
();
}
Back
|
FazBrowse Home
|
New Git URL