Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
4b4be89d
Commit
4b4be89d
authored
Jul 04, 2018
by
Simon Spannagel
Browse files
Clipboard persistent storage: throw if key doesn't exist, allow querying
parent
06f749ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/clipboard/Clipboard.cpp
View file @
4b4be89d
#include "Clipboard.hpp"
#include "exceptions.h"
#include "objects/Object.hpp"
using
namespace
corryvreckan
;
...
...
@@ -24,7 +25,15 @@ Objects* Clipboard::get(std::string name, std::string type) {
}
double
Clipboard
::
get_persistent
(
std
::
string
name
)
{
return
m_persistent_data
[
name
];
try
{
return
m_persistent_data
.
at
(
name
);
}
catch
(
std
::
out_of_range
&
)
{
throw
MissingDataError
(
"Key "
+
name
+
" not available on clipboard"
);
}
}
bool
Clipboard
::
has_persistent
(
std
::
string
name
)
{
return
m_persistent_data
.
find
(
name
)
!=
m_persistent_data
.
end
();
}
void
Clipboard
::
clear
()
{
...
...
src/core/clipboard/Clipboard.hpp
View file @
4b4be89d
...
...
@@ -75,9 +75,17 @@ namespace corryvreckan {
* @brief Retrieve variable from the persistent clipboard storage
* @param name Name of the variable
* @return Stored value from the persistent clipboard storage
* @throws MissingKeyError in case the key is not found.
*/
double
get_persistent
(
std
::
string
name
);
/**
* @brief Check if variable exists on the persistent clipboard storage
* @param name Name of the variable
* @return True if value exists, false if it does not exist.
*/
bool
has_persistent
(
std
::
string
name
);
/**
* @brief Clear the event storage of the clipboard
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment