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
09d556ab
Commit
09d556ab
authored
7 years ago
by
Nubben
Browse files
Options
Downloads
Patches
Plain Diff
Add browser history class
parent
cb35b9db
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/BrowsingHistory.cpp
+33
-0
33 additions, 0 deletions
src/BrowsingHistory.cpp
src/BrowsingHistory.h
+20
-0
20 additions, 0 deletions
src/BrowsingHistory.h
with
53 additions
and
0 deletions
src/BrowsingHistory.cpp
0 → 100644
+
33
−
0
View file @
09d556ab
#include
"BrowsingHistory.h"
BrowsingHistory
::
BrowsingHistory
()
:
history
(),
currentPosition
(
0
)
{}
void
BrowsingHistory
::
addEntry
(
URL
url
)
{
if
(
!
history
.
empty
())
{
++
currentPosition
;
}
if
(
currentPosition
<
history
.
size
())
{
history
.
erase
(
history
.
begin
()
+
currentPosition
,
history
.
end
());
}
history
.
push_back
(
url
);
}
URL
const
&
BrowsingHistory
::
goForward
()
{
if
(
currentPosition
<
history
.
size
())
{
++
currentPosition
;
}
return
history
[
currentPosition
];
}
URL
const
&
BrowsingHistory
::
goBack
()
{
if
(
currentPosition
>
0
)
{
--
currentPosition
;
}
return
history
[
currentPosition
];
}
std
::
vector
<
URL
>
const
&
BrowsingHistory
::
getHistory
()
const
{
return
history
;
}
This diff is collapsed.
Click to expand it.
src/BrowsingHistory.h
0 → 100644
+
20
−
0
View file @
09d556ab
#ifndef BROWSINGHISTORY_H
#define BROWSINGHISTORY_H
#include
<vector>
#include
"URL.h"
class
BrowsingHistory
{
public:
BrowsingHistory
();
void
addEntry
(
URL
url
);
URL
const
&
goForward
();
URL
const
&
goBack
();
std
::
vector
<
URL
>
const
&
getHistory
()
const
;
private:
std
::
vector
<
URL
>
history
;
unsigned
int
currentPosition
;
};
#endif
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