Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netrunner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sharinigma
netrunner
Commits
d992e7e2
Commit
d992e7e2
authored
7 years ago
by
Nubben
Browse files
Options
Downloads
Patches
Plain Diff
Use logging instead of cout in main
parent
61d19a56
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cr
+1
-1
1 addition, 1 deletion
cr
src/main.cpp
+8
-6
8 additions, 6 deletions
src/main.cpp
with
9 additions
and
7 deletions
cr
+
1
−
1
View file @
d992e7e2
...
...
@@ -2,4 +2,4 @@
physicalCpuCount
=
$(
[[
$(
uname
)
=
'Darwin'
]]
&&
sysctl
-n
hw.physicalcpu_max
||
lscpu
-p
| egrep
-v
'^#'
|
sort
-u
-t
,
-k
2,4 |
wc
-l
)
make
-j
$physicalCpuCount
&&
./netrunner http://motherfuckingwebsite.com/
make
-j
$physicalCpuCount
&&
./netrunner http://motherfuckingwebsite.com/
-log
debug
This diff is collapsed.
Click to expand it.
src/main.cpp
+
8
−
6
View file @
d992e7e2
...
...
@@ -11,6 +11,7 @@
#include
"WebResource.h"
#include
"CommandLineParams.h"
#include
"URL.h"
#include
"Log.h"
const
std
::
unique_ptr
<
Window
>
window
=
std
::
make_unique
<
Window
>
();
URL
currentURL
;
...
...
@@ -20,7 +21,7 @@ bool setWindowContent(URL const& url);
bool
setWindowContent
(
URL
const
&
url
)
{
WebResource
res
=
getWebResource
(
url
);
if
(
res
.
resourceType
==
ResourceType
::
INVALID
)
{
std
::
cout
<<
"Invalid resource type: "
<<
res
.
raw
<<
std
::
endl
;
logError
()
<<
"Invalid resource type: "
<<
res
.
raw
<<
std
::
endl
;
return
false
;
}
...
...
@@ -28,15 +29,15 @@ bool setWindowContent(URL const& url) {
const
std
::
clock_t
begin
=
clock
();
std
::
shared_ptr
<
Node
>
rootNode
=
parser
.
parse
(
res
.
raw
);
const
std
::
clock_t
end
=
clock
();
std
::
cout
<<
"Parsed document in: "
<<
std
::
fixed
<<
((
static_cast
<
double
>
(
end
-
begin
))
/
CLOCKS_PER_SEC
)
<<
std
::
scientific
<<
" seconds"
<<
std
::
endl
;
logDebug
()
<<
"Parsed document in: "
<<
std
::
fixed
<<
((
static_cast
<
double
>
(
end
-
begin
))
/
CLOCKS_PER_SEC
)
<<
std
::
scientific
<<
" seconds"
<<
std
::
endl
;
window
->
setDOM
(
rootNode
);
return
true
;
}
void
navTo
(
std
::
string
url
)
{
std
::
cout
<<
"navTo("
<<
url
<<
")"
<<
std
::
endl
;
logDebug
()
<<
"navTo("
<<
url
<<
")"
<<
std
::
endl
;
currentURL
=
currentURL
.
merge
(
URL
(
url
));
std
::
cout
<<
"go to: "
<<
currentURL
<<
std
::
endl
;
logDebug
()
<<
"go to: "
<<
currentURL
<<
std
::
endl
;
setWindowContent
(
currentURL
);
}
...
...
@@ -45,14 +46,15 @@ int main(int argc, char *argv[]) {
std
::
cout
<<
"./netrunner <url|file.html>"
<<
std
::
endl
;
return
1
;
}
initCLParams
(
argc
,
argv
);
std
::
cout
<<
"/g/ntr - NetRunner build "
<<
__DATE__
<<
std
::
endl
;
initCLParams
(
argc
,
argv
);
std
::
string
url
=
getCLParamByIndex
(
1
);
if
(
url
[
0
]
==
'/'
)
{
url
=
"file://"
+
url
;
}
currentURL
=
URL
(
url
);
std
::
cout
<<
"loading ["
<<
currentURL
<<
"]"
<<
std
::
endl
;
logDebug
()
<<
"loading ["
<<
currentURL
<<
"]"
<<
std
::
endl
;
if
(
!
setWindowContent
(
currentURL
))
{
return
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment