YAML CPP: Use explicit imports
#include "log.hpp"
#include "read.hpp"
#include "write.hpp"
-using namespace yamlcpp;
#include <kdb.hpp>
#include <kdberrors.h>
@@ -21,13 +20,23 @@ using namespace yamlcpp;
#include "yaml-cpp/yaml.h"
-using namespace ckdb;
+using std::exception;
+using std::overflow_error;
+
+using YAML::BadFile;
+using YAML::EmitterException;
+using YAML::ParserException;
+using YAML::RepresentationException;
+
+using ckdb::keyNew;
+
+using yamlcpp::yamlRead;
+using yamlcpp::yamlWrite;
// -- Functions ----------------------------------------------------------------------------------------------------------------------------
namespace
{
-
/**
* @brief This function returns a key set containing the contract of this plugin.
*
@@ -77,22 +86,22 @@ int elektraYamlcppGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key *
yamlRead (keys, parent);
status = ELEKTRA_PLUGIN_STATUS_SUCCESS;
}
- catch (YAML::ParserException const & exception)
+ catch (ParserException const & exception)
{
ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parent.getKey (), "Unable to parse file '%s'. Reason: %s",
parent.getString ().c_str (), exception.what ());
}
- catch (std::overflow_error const & exception)
+ catch (overflow_error const & exception)
{
ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file '%s'. Reason: %s",
parent.getString ().c_str (), exception.what ());
}
- catch (YAML::RepresentationException const & exception)
+ catch (RepresentationException const & exception)
{
ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file '%s'. Reason: %s",
parent.getString ().c_str (), exception.what ());
}
- catch (std::exception const & exception)
+ catch (exception const & exception)
{
ELEKTRA_SET_PLUGIN_MISBEHAVIOR_ERRORF (*parent, "Uncaught Exception: '%s'", exception.what ());
}
@@ -121,18 +130,18 @@ int elektraYamlcppSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key *
yamlWrite (keys, parent);
status = ELEKTRA_PLUGIN_STATUS_SUCCESS;
}
- catch (YAML::BadFile const & exception)
+ catch (BadFile const & exception)
{
ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to write to file '%s'. Reason: %s.", parent.getString ().c_str (),
exception.what ());
}
- catch (YAML::EmitterException const & exception)
+ catch (EmitterException const & exception)
{
ELEKTRA_SET_PLUGIN_MISBEHAVIOR_ERRORF (parent.getKey (),
"Something went wrong while emitting YAML data to file '%s'. Reason: %s.",
parent.getString ().c_str (), exception.what ());
}
- catch (std::exception const & exception)
+ catch (exception const & exception)
{
ELEKTRA_SET_PLUGIN_MISBEHAVIOR_ERRORF (*parent, "Uncaught Exception: '%s'", exception.what ());
}
