mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Formatted includes/services/curated_data
This commit is contained in:
@@ -25,26 +25,26 @@ using SurnamesByCountryMap = std::unordered_map<std::string, SurnameList>;
|
|||||||
* brewery/user generation.
|
* brewery/user generation.
|
||||||
*/
|
*/
|
||||||
class ICuratedDataService {
|
class ICuratedDataService {
|
||||||
public:
|
public:
|
||||||
ICuratedDataService() = default;
|
ICuratedDataService() = default;
|
||||||
virtual ~ICuratedDataService() = default;
|
virtual ~ICuratedDataService() = default;
|
||||||
|
|
||||||
ICuratedDataService(const ICuratedDataService&) = delete;
|
ICuratedDataService(const ICuratedDataService&) = delete;
|
||||||
ICuratedDataService& operator=(const ICuratedDataService&) = delete;
|
ICuratedDataService& operator=(const ICuratedDataService&) = delete;
|
||||||
ICuratedDataService(ICuratedDataService&&) = delete;
|
ICuratedDataService(ICuratedDataService&&) = delete;
|
||||||
ICuratedDataService& operator=(ICuratedDataService&&) = delete;
|
ICuratedDataService& operator=(ICuratedDataService&&) = delete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads all curated location records.
|
* @brief Loads all curated location records.
|
||||||
*/
|
*/
|
||||||
virtual const LocationsList& LoadLocations() = 0;
|
virtual const LocationsList& LoadLocations() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads all curated persona records.
|
* @brief Loads all curated persona records.
|
||||||
*/
|
*/
|
||||||
virtual const PersonasList& LoadPersonas() = 0;
|
virtual const PersonasList& LoadPersonas() = 0;
|
||||||
virtual const ForenamesByCountryMap& LoadForenamesByCountry() = 0;
|
virtual const ForenamesByCountryMap& LoadForenamesByCountry() = 0;
|
||||||
virtual const SurnamesByCountryMap& LoadSurnamesByCountry() = 0;
|
virtual const SurnamesByCountryMap& LoadSurnamesByCountry() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_CURATED_DATA_CURATED_DATA_SERVICE_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_CURATED_DATA_CURATED_DATA_SERVICE_H_
|
||||||
|
|||||||
@@ -16,48 +16,48 @@
|
|||||||
* CuratedJsonDataService.
|
* CuratedJsonDataService.
|
||||||
*/
|
*/
|
||||||
struct CuratedDataFilePaths {
|
struct CuratedDataFilePaths {
|
||||||
std::filesystem::path locations_path;
|
std::filesystem::path locations_path;
|
||||||
std::filesystem::path personas_path;
|
std::filesystem::path personas_path;
|
||||||
std::filesystem::path forenames_path;
|
std::filesystem::path forenames_path;
|
||||||
std::filesystem::path surnames_path;
|
std::filesystem::path surnames_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads curated location, persona, and name data from JSON files.
|
* @brief Loads curated location, persona, and name data from JSON files.
|
||||||
*/
|
*/
|
||||||
class CuratedJsonDataService final : public ICuratedDataService {
|
class CuratedJsonDataService final : public ICuratedDataService {
|
||||||
struct cache {
|
struct cache {
|
||||||
LocationsList locations;
|
LocationsList locations;
|
||||||
PersonasList personas;
|
PersonasList personas;
|
||||||
ForenamesByCountryMap forenames_by_country;
|
ForenamesByCountryMap forenames_by_country;
|
||||||
SurnamesByCountryMap surnames_by_country;
|
SurnamesByCountryMap surnames_by_country;
|
||||||
|
|
||||||
cache() = default;
|
cache() = default;
|
||||||
~cache() = default;
|
~cache() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
CuratedDataFilePaths filepaths_;
|
CuratedDataFilePaths filepaths_;
|
||||||
cache cache_;
|
cache cache_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CuratedJsonDataService(CuratedDataFilePaths filepaths);
|
explicit CuratedJsonDataService(CuratedDataFilePaths filepaths);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses a JSON array file and returns all location records.
|
* @brief Parses a JSON array file and returns all location records.
|
||||||
*/
|
*/
|
||||||
const LocationsList& LoadLocations() override;
|
const LocationsList& LoadLocations() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses a JSON array file and returns all persona records.
|
* @brief Parses a JSON array file and returns all persona records.
|
||||||
*/
|
*/
|
||||||
const PersonasList& LoadPersonas() override;
|
const PersonasList& LoadPersonas() override;
|
||||||
|
|
||||||
const ForenamesByCountryMap& LoadForenamesByCountry() override;
|
const ForenamesByCountryMap& LoadForenamesByCountry() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses a JSON file and returns all the forenames per country.
|
* @brief Parses a JSON file and returns all the forenames per country.
|
||||||
*/
|
*/
|
||||||
const SurnamesByCountryMap& LoadSurnamesByCountry() override;
|
const SurnamesByCountryMap& LoadSurnamesByCountry() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_JSON_HANDLING_JSON_LOADER_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_JSON_HANDLING_JSON_LOADER_H_
|
||||||
|
|||||||
@@ -17,22 +17,22 @@
|
|||||||
* place of the JSON fixture files used by JsonLoader.
|
* place of the JSON fixture files used by JsonLoader.
|
||||||
*/
|
*/
|
||||||
class MockCuratedDataService final : public ICuratedDataService {
|
class MockCuratedDataService final : public ICuratedDataService {
|
||||||
public:
|
public:
|
||||||
MockCuratedDataService();
|
MockCuratedDataService();
|
||||||
|
|
||||||
const LocationsList& LoadLocations() override;
|
const LocationsList& LoadLocations() override;
|
||||||
|
|
||||||
const PersonasList& LoadPersonas() override;
|
const PersonasList& LoadPersonas() override;
|
||||||
|
|
||||||
const ForenamesByCountryMap& LoadForenamesByCountry() override;
|
const ForenamesByCountryMap& LoadForenamesByCountry() override;
|
||||||
|
|
||||||
const SurnamesByCountryMap& LoadSurnamesByCountry() override;
|
const SurnamesByCountryMap& LoadSurnamesByCountry() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LocationsList locations_;
|
LocationsList locations_;
|
||||||
PersonasList personas_;
|
PersonasList personas_;
|
||||||
ForenamesByCountryMap forenames_by_country_;
|
ForenamesByCountryMap forenames_by_country_;
|
||||||
SurnamesByCountryMap surnames_by_country_;
|
SurnamesByCountryMap surnames_by_country_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_CURATED_DATA_MOCK_CURATED_DATA_SERVICE_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_CURATED_DATA_MOCK_CURATED_DATA_SERVICE_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user