Skip to content

Commit

Permalink
Remove redundant namespace references
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Aug 9, 2022
1 parent 1b1669c commit d3f7c95
Show file tree
Hide file tree
Showing 16 changed files with 150 additions and 150 deletions.
14 changes: 7 additions & 7 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ignition::fuel_tools::ClientConfigPrivate
public: ClientConfigPrivate()
{
std::string homePath;
ignition::common::env(IGN_HOMEDIR, homePath);
common::env(IGN_HOMEDIR, homePath);
this->cacheLocation = common::joinPaths(
homePath, ".ignition", "fuel");

Expand Down Expand Up @@ -202,9 +202,9 @@ std::string ServerConfig::AsPrettyString(const std::string &_prefix) const
ClientConfig::ClientConfig() : dataPtr(new ClientConfigPrivate)
{
std::string ignFuelPath = "";
if (ignition::common::env("IGN_FUEL_CACHE_PATH", ignFuelPath))
if (common::env("IGN_FUEL_CACHE_PATH", ignFuelPath))
{
if (!ignition::common::isDirectory(ignFuelPath))
if (!common::isDirectory(ignFuelPath))
{
ignerr << "[" << ignFuelPath << "] is not a directory" << std::endl;
return;
Expand Down Expand Up @@ -243,7 +243,7 @@ void ClientConfig::Clear()
bool ClientConfig::LoadConfig(const std::string &_file)
{
// Sanity check: Verify that the configuration file exists.
if (!ignition::common::exists(_file))
if (!common::exists(_file))
{
ignerr << "Unable to find configuration file [" << _file<< "]" << std::endl;
return false;
Expand Down Expand Up @@ -414,8 +414,8 @@ bool ClientConfig::LoadConfig(const std::string &_file)

// Default cache path.
std::string homePath;
ignition::common::env(IGN_HOMEDIR, homePath);
std::string cacheLocation = ignition::common::joinPaths(
common::env(IGN_HOMEDIR, homePath);
std::string cacheLocation = common::joinPaths(
homePath, ".ignition", "fuel");

// The user wants to overwrite the default cache path.
Expand All @@ -424,7 +424,7 @@ bool ClientConfig::LoadConfig(const std::string &_file)

// Do not overwrite the cache location if IGN_FUEL_CACHE_PATH is set.
std::string ignFuelPath = "";
if (ignition::common::env("IGN_FUEL_CACHE_PATH", ignFuelPath))
if (common::env("IGN_FUEL_CACHE_PATH", ignFuelPath))
{
ignwarn << "IGN_FUEL_CACHE_PATH is set to [" << ignFuelPath << "]. The "
<< "path in the configuration file will be ignored" << std::endl;
Expand Down
14 changes: 7 additions & 7 deletions src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ using namespace fuel_tools;
void removeFileTemp(const std::string &_path)
{
#ifndef _WIN32
EXPECT_TRUE(ignition::common::removeFile(_path));
EXPECT_TRUE(common::removeFile(_path));
#else
ignition::common::removeFile(_path);
common::removeFile(_path);
#endif
}

/////////////////////////////////////////////////
/// \brief Get home directory.
/// \return Home directory or empty string if home wasn't found.
/// \ToDo: Move this function to ignition::common::Filesystem
/// \ToDo: Move this function to common::Filesystem
std::string homePath()
{
std::string homePath;
#ifndef _WIN32
ignition::common::env("HOME", homePath);
common::env("HOME", homePath);
#else
ignition::common::env("USERPROFILE", homePath);
common::env("USERPROFILE", homePath);
#endif

return homePath;
Expand All @@ -61,7 +61,7 @@ std::string homePath()
/////////////////////////////////////////////////
/// \brief Get cache directory.
/// \return Cache directory
/// \ToDo: Move this function to ignition::common::Filesystem
/// \ToDo: Move this function to common::Filesystem
std::string cachePath()
{
#ifndef _WIN32
Expand Down Expand Up @@ -101,7 +101,7 @@ TEST(ClientConfig, CustomDefaultConfiguration)
EXPECT_EQ("https://fuel.ignitionrobotics.org",
config.Servers().front().Url().Str());

std::string defaultCacheLocation = ignition::common::joinPaths(
std::string defaultCacheLocation = common::joinPaths(
homePath(), ".ignition", "fuel");
EXPECT_EQ(defaultCacheLocation, config.CacheLocation());
}
Expand Down
12 changes: 6 additions & 6 deletions src/CollectionIdentifier_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEST(CollectionIdentifier, SetFields)
CollectionIdentifier id;
id.SetName("hello");
id.SetOwner("osrf");
ignition::fuel_tools::ServerConfig srv1;
ServerConfig srv1;
srv1.SetUrl(common::URI("https://localhost:8001/"));
id.SetServer(srv1);

Expand All @@ -45,13 +45,13 @@ TEST(CollectionIdentifier, SetFields)
/// \brief Unique Name
TEST(CollectionIdentifier, UniqueName)
{
ignition::fuel_tools::ServerConfig srv1;
ServerConfig srv1;
srv1.SetUrl(common::URI("https://localhost:8001/"));

ignition::fuel_tools::ServerConfig srv2;
ServerConfig srv2;
srv2.SetUrl(common::URI("https://localhost:8002"));

ignition::fuel_tools::ServerConfig srv3;
ServerConfig srv3;
srv3.SetUrl(common::URI("https://localhost:8003"));

CollectionIdentifier id;
Expand All @@ -75,7 +75,7 @@ TEST(CollectionIdentifier, CopyConstructorDeepCopy)
id.SetName("hello");
id.SetOwner("watermelon");

ignition::fuel_tools::ServerConfig srv;
ServerConfig srv;
srv.SetUrl(common::URI("https://localhost:8001"));
id.SetServer(srv);

Expand All @@ -96,7 +96,7 @@ TEST(CollectionIdentifier, AssignmentOperatorDeepCopy)
CollectionIdentifier id;
id.SetName("hello");
id.SetOwner("pineapple");
ignition::fuel_tools::ServerConfig srv;
ServerConfig srv;
srv.SetUrl(common::URI("https://localhost:8001"));
id.SetServer(srv);

Expand Down
50 changes: 25 additions & 25 deletions src/FuelClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Result FuelClient::ModelDetails(const ModelIdentifier &_id,
Result FuelClient::ModelDetails(const ModelIdentifier &_id,
ModelIdentifier &_model, const std::vector<std::string> &_headers) const
{
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;

auto serverUrl = _id.Server().Url().Str();
Expand Down Expand Up @@ -326,7 +326,7 @@ Result FuelClient::WorldDetails(const WorldIdentifier &_id,
if (serverUrl.empty() || _id.Owner().empty() || _id.Name().empty())
return Result(ResultType::FETCH_ERROR);

ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;

auto version = _id.Server().Version();
Expand Down Expand Up @@ -436,7 +436,7 @@ Result FuelClient::UploadModel(const std::string &_pathToModelDir,
const ModelIdentifier &_id, const std::vector<std::string> &_headers,
bool _private)
{
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;

std::multimap<std::string, std::string> form;
Expand Down Expand Up @@ -473,7 +473,7 @@ Result FuelClient::DeleteModel(const ModelIdentifier &)
}

void FuelClient::AddServerConfigParametersToHeaders(
const ignition::fuel_tools::ServerConfig &_serverConfig,
const ServerConfig &_serverConfig,
std::vector<std::string> &_headers) const
{
bool privateTokenDefined = false;
Expand All @@ -497,7 +497,7 @@ void FuelClient::AddServerConfigParametersToHeaders(
Result FuelClient::DeleteUrl(const ignition::common::URI &_uri,
const std::vector<std::string> &_headers)
{
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;

std::string server;
Expand Down Expand Up @@ -607,7 +607,7 @@ Result FuelClient::DownloadModel(const ModelIdentifier &_id,
AddServerConfigParametersToHeaders(
_id.Server(), headersIncludingServerConfig);
// Request
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;
resp = rest.Request(HttpMethod::GET, _id.Server().Url().Str(),
_id.Server().Version(), route.Str(), {},
Expand Down Expand Up @@ -660,16 +660,16 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id,

// Locate any dependencies from the input model and download them.
std::string path;
ignition::msgs::FuelMetadata meta;
if (this->CachedModel(ignition::common::URI(_id.UniqueName()), path))
msgs::FuelMetadata meta;
if (this->CachedModel(common::URI(_id.UniqueName()), path))
{
std::string metadataPath =
ignition::common::joinPaths(path, "metadata.pbtxt");
common::joinPaths(path, "metadata.pbtxt");
std::string modelConfigPath =
ignition::common::joinPaths(path, "model.config");
common::joinPaths(path, "model.config");

bool foundMetadataPath = ignition::common::exists(metadataPath);
bool foundModelConfigPath = ignition::common::exists(modelConfigPath);
bool foundMetadataPath = common::exists(metadataPath);
bool foundModelConfigPath = common::exists(modelConfigPath);

if (foundMetadataPath || foundModelConfigPath)
{
Expand All @@ -688,15 +688,15 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id,
}
else
{
if (!ignition::msgs::ConvertFuelMetadata(inputStr, meta))
if (!msgs::ConvertFuelMetadata(inputStr, meta))
{
return Result(ResultType::UPLOAD_ERROR);
}
}

for (int i = 0; i < meta.dependencies_size(); ++i)
{
ignition::common::URI dependencyURI(meta.dependencies(i).uri());
common::URI dependencyURI(meta.dependencies(i).uri());

ModelIdentifier dependencyID;
if(!this->ParseModelUrl(dependencyURI, dependencyID))
Expand Down Expand Up @@ -774,7 +774,7 @@ Result FuelClient::DownloadWorld(WorldIdentifier &_id)
_id.Server(), headersIncludingServerConfig);

// Request
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;
resp = rest.Request(HttpMethod::GET, _id.Server().Url().Str(),
_id.Server().Version(), route.Str(), {},
Expand Down Expand Up @@ -924,7 +924,7 @@ std::vector<FuelClient::ModelResult> FuelClient::DownloadModels(
Result FuelClient::DownloadWorlds(
const std::vector<WorldIdentifier> &_ids, size_t _jobs)
{
std::deque<std::future<ignition::fuel_tools::Result>> tasks;
std::deque<std::future<Result>> tasks;
// Check for finished tasks by checking if the status of their futures is
// "ready". If a task is finished, check if it succeeded and print out an
// error message if it failed. When a task is finished, it gets erased from
Expand All @@ -947,7 +947,7 @@ Result FuelClient::DownloadWorlds(
{
for (auto taskIt = finishedIt; taskIt != tasks.end(); ++taskIt)
{
ignition::fuel_tools::Result result = taskIt->get();
Result result = taskIt->get();
if (result)
{
++itemCount;
Expand Down Expand Up @@ -1354,7 +1354,7 @@ Result FuelClient::DownloadModel(const common::URI &_modelUrl,
id.SetVersion(model.Identification().Version());
}

_path = ignition::common::joinPaths(this->Config().CacheLocation(),
_path = common::joinPaths(this->Config().CacheLocation(),
id.Server().Url().Path().Str(), id.Owner(), "models", id.Name(),
id.VersionStr());

Expand Down Expand Up @@ -1474,10 +1474,10 @@ Result FuelClient::CachedModelFile(const common::URI &_fileUrl,
// Check if file exists
filePath = common::joinPaths(modelPath, filePath);

std::vector<std::string> tokens = ignition::common::split(filePath, "/");
std::vector<std::string> tokens = common::split(filePath, "/");
std::string sTemp;
for (auto s : tokens)
sTemp = ignition::common::joinPaths(sTemp, s);
sTemp = common::joinPaths(sTemp, s);
filePath = sTemp;

if (common::exists(filePath))
Expand Down Expand Up @@ -1524,19 +1524,19 @@ Result FuelClient::CachedWorldFile(const common::URI &_fileUrl,

//////////////////////////////////////////////////
Result FuelClient::PatchModel(
const ignition::fuel_tools::ModelIdentifier &_model,
const ModelIdentifier &_model,
const std::vector<std::string> &_headers)
{
return this->PatchModel(_model, _headers, "");
}

//////////////////////////////////////////////////
Result FuelClient::PatchModel(
const ignition::fuel_tools::ModelIdentifier &_model,
const ModelIdentifier &_model,
const std::vector<std::string> &_headers,
const std::string &_pathToModelDir)
{
ignition::fuel_tools::Rest rest;
Rest rest;
RestResponse resp;

auto serverUrl = _model.Server().Url().Str();
Expand Down Expand Up @@ -1603,7 +1603,7 @@ bool FuelClientPrivate::FillModelForm(const std::string &_pathToModelDir,
return false;
}

ignition::msgs::FuelMetadata meta;
msgs::FuelMetadata meta;

// Try the `metadata.pbtxt` file first since it contains more information
// than `model.config`.
Expand Down Expand Up @@ -1631,7 +1631,7 @@ bool FuelClientPrivate::FillModelForm(const std::string &_pathToModelDir,
std::string inputStr((std::istreambuf_iterator<char>(inputFile)),
std::istreambuf_iterator<char>());

if (!ignition::msgs::ConvertFuelMetadata(inputStr, meta))
if (!msgs::ConvertFuelMetadata(inputStr, meta))
{
ignerr << "Unable to convert model config[" << _pathToModelDir << "].\n";
return false;
Expand Down
Loading

0 comments on commit d3f7c95

Please sign in to comment.