Enclose cpp file into namespace
MODIFY
src/vcpkglib.cpp
src/vcpkglib.cpp
#include "Paragraphs.h"
#include "metrics.h"
-using namespace vcpkg;
-
+namespace vcpkg
+{
static StatusParagraphs load_current_database(const fs::path& vcpkg_dir_status_file, const fs::path& vcpkg_dir_status_file_old)
{
if (!fs::exists(vcpkg_dir_status_file))
@@ -31,7 +31,7 @@ static StatusParagraphs load_current_database(const fs::path& vcpkg_dir_status_f
return StatusParagraphs(std::move(status_pghs));
}
-StatusParagraphs vcpkg::database_load_check(const vcpkg_paths& paths)
+ StatusParagraphs database_load_check(const vcpkg_paths& paths)
{
auto updates_dir = paths.vcpkg_dir_updates;
@@ -90,7 +90,7 @@ StatusParagraphs vcpkg::database_load_check(const vcpkg_paths& paths)
return current_status_db;
}
-void vcpkg::write_update(const vcpkg_paths& paths, const StatusParagraph& p)
+ void write_update(const vcpkg_paths& paths, const StatusParagraph& p)
{
static int update_id = 0;
auto my_update_id = update_id++;
@@ -170,7 +170,7 @@ static void upgrade_to_slash_terminated_sorted_format(std::vector<std::string>*
fs::rename(updated_listfile_path, listfile_path);
}
-std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db)
+ std::vector<StatusParagraph_and_associated_files> get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db)
{
std::vector<StatusParagraph_and_associated_files> installed_files;
@@ -201,7 +201,7 @@ std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(con
return installed_files;
}
-expected<SourceParagraph> vcpkg::try_load_port(const fs::path& path)
+ expected<SourceParagraph> try_load_port(const fs::path& path)
{
try
{
@@ -209,14 +209,12 @@ expected<SourceParagraph> vcpkg::try_load_port(const fs::path& path)
Checks::check_exit(pghs.size() == 1, "Invalid control file at %s\\CONTROL", path.string());
return SourceParagraph(pghs[0]);
}
- catch (std::runtime_error const&)
- {
- }
+ catch (std::runtime_error const&) { }
return std::errc::no_such_file_or_directory;
}
-expected<BinaryParagraph> vcpkg::try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec)
+ expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec)
{
const fs::path path = paths.package_dir(spec) / "CONTROL";
@@ -228,11 +226,10 @@ expected<BinaryParagraph> vcpkg::try_load_cached_package(const vcpkg_paths& path
{
pghs = Paragraphs::parse_paragraphs(*control_contents);
}
- catch (std::runtime_error)
- {
- }
+ catch (std::runtime_error) { }
Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", path.string());
return BinaryParagraph(pghs[0]);
}
return control_contents_maybe.error_code();
}
+}

Enclose cpp file into namespace