Skip to content

Commit

Permalink
added plant module
Browse files Browse the repository at this point in the history
  • Loading branch information
sjadhav07 committed Jun 9, 2024
1 parent 804d46a commit 9e571e0
Show file tree
Hide file tree
Showing 6 changed files with 950 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ set(FAKER_SOURCES
src/modules/person/PersonData.cpp
src/modules/phone/Phone.cpp
src/modules/phone/PhoneData.cpp
src/modules/plant/Plant.cpp
src/modules/plant/PlantData.cpp
src/modules/science/Science.cpp
src/modules/science/ScienceData.cpp
src/modules/sport/Sport.cpp
Expand Down
98 changes: 98 additions & 0 deletions include/faker-cxx/Plant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#pragma once

#include <string_view>

namespace faker
{
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 flower.
*
* @returns Species of flower.
*
* @code
* Plant::flower() // "Rose"
* @endcode
*/
static 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 grass.
*
* @returns Species of grass.
*
* @code
* Plant::grass() // "Kentucky Bluegrass"
* @endcode
*/
static 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 succulent.
*
* @returns Species of succulent.
*
* @code
* Plant::succulent() // "Aloe Vera"
* @endcode
*/
static 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 type of plant.
*
* @returns Type of plant.
*
* @code
* Plant::type() // "tree"
* @endcode
*/
static std::string_view type();
};
}
49 changes: 49 additions & 0 deletions src/modules/plant/Plant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "faker-cxx/Plant.h"

#include <string_view>

#include "PlantData.h"
#include "faker-cxx/Helper.h"

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

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

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

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

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

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

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

std::string_view Plant::type()
{
return Helper::arrayElement(types);
}
}
Loading

0 comments on commit 9e571e0

Please sign in to comment.