Skip to content

Commit

Permalink
migrate Plant module from class to functions within plant namespace c…
Browse files Browse the repository at this point in the history
  • Loading branch information
ikbalsingh committed Jun 22, 2024
1 parent 73b484d commit 933ab8e
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 175 deletions.
166 changes: 81 additions & 85 deletions include/faker-cxx/Plant.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,93 @@

#include <string_view>

namespace faker
namespace faker::plant
{
class Plant
{
public:
/**
* @brief Returns a random species of tree.
*
* @returns Species of tree.
*
* @code
* Plant::tree() // "Oak"
* @endcode
*/
static std::string_view tree();
/**
* @brief Returns a random species of tree.
*
* @returns Species of tree.
*
* @code
* Plant::tree() // "Oak"
* @endcode
*/
std::string_view tree();

/**
* @brief Returns a random species of flower.
*
* @returns Species of flower.
*
* @code
* Plant::flower() // "Rose"
* @endcode
*/
static std::string_view flower();
/**
* @brief Returns a random species of flower.
*
* @returns Species of flower.
*
* @code
* Plant::flower() // "Rose"
* @endcode
*/
std::string_view flower();

/**
* @brief Returns a random species of shrub.
*
* @returns Species of shrub.
*
* @code
* Plant::shrub() // "Azalea"
* @endcode
*/
static std::string_view shrub();
/**
* @brief Returns a random species of shrub.
*
* @returns Species of shrub.
*
* @code
* Plant::shrub() // "Azalea"
* @endcode
*/
std::string_view shrub();

/**
* @brief Returns a random species of grass.
*
* @returns Species of grass.
*
* @code
* Plant::grass() // "Kentucky Bluegrass"
* @endcode
*/
static std::string_view grass();
/**
* @brief Returns a random species of grass.
*
* @returns Species of grass.
*
* @code
* Plant::grass() // "Kentucky Bluegrass"
* @endcode
*/
std::string_view grass();

/**
* @brief Returns a random species of fern.
*
* @returns Species of fern.
*
* @code
* Plant::fern() // "Maidenhair"
* @endcode
*/
static std::string_view fern();
/**
* @brief Returns a random species of fern.
*
* @returns Species of fern.
*
* @code
* Plant::fern() // "Maidenhair"
* @endcode
*/
std::string_view fern();

/**
* @brief Returns a random species of succulent.
*
* @returns Species of succulent.
*
* @code
* Plant::succulent() // "Aloe Vera"
* @endcode
*/
static std::string_view succulent();
/**
* @brief Returns a random species of succulent.
*
* @returns Species of succulent.
*
* @code
* Plant::succulent() // "Aloe Vera"
* @endcode
*/
std::string_view succulent();

/**
* @brief Returns a random species of vine.
*
* @returns Species of vine.
*
* @code
* Plant::vine() // "Ivy"
* @endcode
*/
static std::string_view vine();
/**
* @brief Returns a random species of vine.
*
* @returns Species of vine.
*
* @code
* Plant::vine() // "Ivy"
* @endcode
*/
std::string_view vine();

/**
* @brief Returns a random type of plant.
*
* @returns Type of plant.
*
* @code
* Plant::type() // "tree"
* @endcode
*/
static std::string_view plantType();
};
/**
* @brief Returns a random type of plant.
*
* @returns Type of plant.
*
* @code
* Plant::type() // "tree"
* @endcode
*/
std::string_view plantType();
}
18 changes: 9 additions & 9 deletions src/modules/plant/Plant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
#include "faker-cxx/Helper.h"
#include "PlantData.h"

namespace faker
namespace faker::plant
{
std::string_view Plant::tree()
std::string_view tree()
{
return Helper::arrayElement(trees);
}

std::string_view Plant::flower()
std::string_view flower()
{
return Helper::arrayElement(flowers);
}

std::string_view Plant::shrub()
std::string_view shrub()
{
return Helper::arrayElement(shrubs);
}

std::string_view Plant::grass()
std::string_view grass()
{
return Helper::arrayElement(grasses);
}

std::string_view Plant::fern()
std::string_view fern()
{
return Helper::arrayElement(ferns);
}

std::string_view Plant::succulent()
std::string_view succulent()
{
return Helper::arrayElement(succulents);
}

std::string_view Plant::vine()
std::string_view vine()
{
return Helper::arrayElement(vines);
}

std::string_view Plant::plantType()
std::string_view plantType()
{
return Helper::arrayElement(plantTypes);
}
Expand Down
143 changes: 71 additions & 72 deletions src/modules/plant/PlantData.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <array>
#include <string_view>

namespace faker
namespace faker::plant
{
const auto trees = std::to_array<std::string_view>({
"Oak", "Maple", "Pine", "Birch", "Willow", "Cherry Blossom",
Expand Down Expand Up @@ -112,77 +112,76 @@ const auto flowers = std::to_array<std::string_view>({
});

const auto shrubs = std::to_array<std::string_view>({
"Abelia", "Actinidia", "Aloe",
"Aralia", "Arctostaphylos", "Aronia",
"Artemisia", "Aucuba", "Berberis",
"Bougainvillea", "Brugmansia", "Buddleja",
"Buxus", "Calia", "Callicarpa",
"Callistemon", "Calluna", "Calycanthus",
"Camellia", "Caragana", "Carpenteria",
"Caryopteris", "Cassiope", "Ceanothus",
"Celastrus", "Ceratostigma", "Cercocarpus",
"Chaenomeles", "Chamaebatiaria", "Chamaedaphne",
"Chimonanthus", "Chionanthus", "Choisya",
"Cistus", "Clerodendrum", "Clethra",
"Clianthus", "Colletia", "Colutea",
"Comptonia", "Cornus", "Corylopsis",
"Cotinus", "Cotoneaster", "Cowania",
"Crataegus", "Crinodendron", "Cytisus",
"Daboecia", "Danae", "Daphne",
"Decaisnea", "Dasiphora", "Dendromecon",
"Desfontainea", "Deutzia", "Diervilla",
"Dipelta", "Dirca", "Dracaena",
"Drimys", "Dryas", "Elaeagnus",
"Embothrium", "Empetrum", "Enkianthus",
"Ephedra", "Epigaea", "Erica",
"Eriobotrya", "Escallonia", "Eucryphia",
"Euonymus", "Exochorda", "Fabiana",
"Fallugia", "Fatsia", "Forsythia",
"Fothergilla", "Franklinia", "Fremontodendron",
"Fuchsia", "Garrya", "Gaultheria",
"Gaylussacia", "Genista", "Gordonia",
"Grevillea", "Griselinia", "Hakea",
"Halesia", "Halimium", "Hamamelis",
"Hebe", "Hedera", "Helianthemum",
"Hibiscus", "Hippophae", "Hoheria",
"Holodiscus", "Hudsonia", "Hydrangea",
"Hypericum", "Hyssopus", "Ilex",
"Illicium", "Indigofera", "Itea",
"Jamesia", "Jasminum", "Juniperus",
"Kalmia", "Kerria", "Kolkwitzia",
"Lagerstroemia", "Lapageria", "Lantana",
"Lavandula", "Lavatera", "Ledum",
"Leitneria", "Lespedeza", "Leptospermum",
"Leucothoe", "Leycesteria", "Ligustrum",
"Lindera", "Linnaea", "Lonicera",
"Lupinus", "Lycium", "Magnolia",
"Mahonia", "Malpighia", "Menispermum",
"Menziesia", "Mespilus", "Microcachrys",
"Myrica", "Myricaria", "Myrtus",
"Neillia", "Nerium", "Olearia",
"Osmanthus", "Pachysandra", "Paeonia",
"Perovskia", "Philadelphus", "Phlomis",
"Photinia", "Physocarpus", "Pieris",
"Pistacia", "Pittosporum", "Plumbago",
"Polygala", "Poncirus", "Prunus",
"Purshia", "Pyracantha", "Quassia",
"Quercus", "Quillaja", "Quintinia",
"Rhamnus", "Rhododendron", "Rhus",
"Ribes", "Romneya", "Rosa",
"Rosmarinus", "Rubus", "Ruta",
"Sabia", "Salix", "Salvia",
"Sambucus", "Santolina", "Sapindus",
"Senecio", "Simmondsia", "Skimmia",
"Smilax", "Sophora", "Sorbaria",
"Spartium", "Spiraea", "Staphylea",
"Stephanandra", "Styrax", "Symphoricarpos",
"Syringa", "Tamarix", "Taxus",
"Telopea", "Thymelaea", "Thymus",
"Trochodendron", "Ulex", "Ungnadia",
"Vaccinium", "Verbena", "Viburnum",
"Vinca", "Viscum", "Weigela",
"Xanthoceras", "Xanthorhiza", "Xylosma",
"Yucca", "Zanthoxylum", "Zauschneria",
"Aralia", "Arctostaphylos", "Aronia",
"Artemisia", "Aucuba", "Berberis",
"Bougainvillea", "Brugmansia", "Buddleja",
"Buxus", "Calia", "Callicarpa",
"Callistemon", "Calluna", "Calycanthus",
"Camellia", "Caragana", "Carpenteria",
"Caryopteris", "Cassiope", "Ceanothus",
"Celastrus", "Ceratostigma", "Cercocarpus",
"Chaenomeles", "Chamaebatiaria", "Chamaedaphne",
"Chimonanthus", "Chionanthus", "Choisya",
"Cistus", "Clerodendrum", "Clethra",
"Clianthus", "Colletia", "Colutea",
"Comptonia", "Cornus", "Corylopsis",
"Cotinus", "Cotoneaster", "Cowania",
"Crataegus", "Crinodendron", "Cytisus",
"Daboecia", "Danae", "Daphne",
"Decaisnea", "Dasiphora", "Dendromecon",
"Desfontainea", "Deutzia", "Diervilla",
"Dipelta", "Dirca", "Dracaena",
"Drimys", "Dryas", "Elaeagnus",
"Embothrium", "Empetrum", "Enkianthus",
"Ephedra", "Epigaea", "Erica",
"Eriobotrya", "Escallonia", "Eucryphia",
"Euonymus", "Exochorda", "Fabiana",
"Fallugia", "Fatsia", "Forsythia",
"Fothergilla", "Franklinia", "Fremontodendron",
"Fuchsia", "Garrya", "Gaultheria",
"Gaylussacia", "Genista", "Gordonia",
"Grevillea", "Griselinia", "Hakea",
"Halesia", "Halimium", "Hamamelis",
"Hebe", "Hedera", "Helianthemum",
"Hibiscus", "Hippophae", "Hoheria",
"Holodiscus", "Hudsonia", "Hydrangea",
"Hypericum", "Hyssopus", "Ilex",
"Illicium", "Indigofera", "Itea",
"Jamesia", "Jasminum", "Juniperus",
"Kalmia", "Kerria", "Kolkwitzia",
"Lagerstroemia", "Lapageria", "Lantana",
"Lavandula", "Lavatera", "Ledum",
"Leitneria", "Lespedeza", "Leptospermum",
"Leucothoe", "Leycesteria", "Ligustrum",
"Lindera", "Linnaea", "Lonicera",
"Lupinus", "Lycium", "Magnolia",
"Mahonia", "Malpighia", "Menispermum",
"Menziesia", "Mespilus", "Microcachrys",
"Myrica", "Myricaria", "Myrtus",
"Neillia", "Nerium", "Olearia",
"Osmanthus", "Pachysandra", "Paeonia",
"Perovskia", "Philadelphus", "Phlomis",
"Photinia", "Physocarpus", "Pieris",
"Pistacia", "Pittosporum", "Plumbago",
"Polygala", "Poncirus", "Prunus",
"Purshia", "Pyracantha", "Quassia",
"Quercus", "Quillaja", "Quintinia",
"Rhamnus", "Rhododendron", "Rhus",
"Ribes", "Romneya", "Rosa",
"Rosmarinus", "Rubus", "Ruta",
"Sabia", "Salix", "Salvia",
"Sambucus", "Santolina", "Sapindus",
"Senecio", "Simmondsia", "Skimmia",
"Smilax", "Sophora", "Sorbaria",
"Spartium", "Spiraea", "Staphylea",
"Stephanandra", "Styrax", "Symphoricarpos",
"Syringa", "Tamarix", "Taxus",
"Telopea", "Thymelaea", "Thymus",
"Trochodendron", "Ulex", "Ungnadia",
"Vaccinium", "Verbena", "Viburnum",
"Vinca", "Viscum", "Weigela",
"Xanthoceras", "Xanthorhiza", "Xylosma",
"Yucca", "Zanthoxylum", "Zauschneria",
"Zenobia", "Ziziphus"
});

Expand Down
Loading

0 comments on commit 933ab8e

Please sign in to comment.