Skip to content

Commit

Permalink
AppInfo - Validate Setting SourceRepo, IssueTracker, and SupportUrl
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
nlogozzo committed Jan 4, 2024
1 parent 3237b4d commit a9a4e3a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if (NOT BUILD_TESTING STREQUAL OFF)

#libaura_test Packages
find_package(GTest REQUIRED)
target_link_libraries(${PROJECT_NAME}_test PUBLIC libaura GTest::gtest_main GTest::gmock_main)
target_link_libraries(${PROJECT_NAME}_test PRIVATE GTest::gtest_main GTest::gmock_main libaura)
endif()

#libaura Install
Expand Down
3 changes: 3 additions & 0 deletions docs/aura.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,19 @@ Path: `Nickvision::Aura::AppInfo`
```
- The application source repo url.
- Ex: `"https://github.com/nickvisionapps/application"`
- Note: Calling `AppInfo::setSourceRepo(sourceRepo)` can return `false` if the `sourceRepo` param is not a valid formatted URL.
- ```
std::string IssueTracker: get, set
```
- The application issue tracker url.
- Ex: `"https://github.com/nickvisionapps/application/issues"`
- Note: Calling `AppInfo::setIssueTracker(issueTracker)` can return `false` if the `issueTracker` param is not a valid formatted URL.
- ```
std::string SupportUrl: get, set
```
- The application support url.
- Ex: `"https://github.com/nickvisionapps/application/discussions"`
- Note: Calling `AppInfo::setSupportUrl(supportUrl)` can return `false` if the `supportUrl` param is not a valid formatted URL.
- ```
std::string HtmlDocsStore: get, set
```
Expand Down
14 changes: 10 additions & 4 deletions include/appinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,22 @@ namespace Nickvision::Aura
/**
* @brief Sets the application source repo url
* @param sourceRepo The application source repo url
* @return True if the new source repo was set, else false
* @return A false return value means that the sourceRepo param was not a valid formatted URL
*/
void setSourceRepo(const std::string& sourceRepo) noexcept;
bool setSourceRepo(const std::string& sourceRepo) noexcept;
/**
* @brief Gets the application issue tracker url
* @return The application issue tracker url
*/
const std::string& getIssueTracker() const noexcept;
/**
* @brief Sets the application issue tracker url
* @param sourceRepo The application issue tracker url
* @param issueTracker The application issue tracker url
* @return True if the new issue tracker was set, else false
* @return A false return value means that the issueTracker param was not a valid formatted URL
*/
void setIssueTracker(const std::string& issueTracker) noexcept;
bool setIssueTracker(const std::string& issueTracker) noexcept;
/**
* @brief Gets the application support url
* @return The application support url
Expand All @@ -121,8 +125,10 @@ namespace Nickvision::Aura
/**
* @brief Sets the application support url
* @param supportUrl The application support url
* @return True if the new support url was set, else false
* @return A false return value means that the supportUrl param was not a valid formatted URL
*/
void setSupportUrl(const std::string& supportUrl) noexcept;
bool setSupportUrl(const std::string& supportUrl) noexcept;
/**
* @brief Gets the application html docs store url
* @return The application html docs store url
Expand Down
21 changes: 18 additions & 3 deletions src/appinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,44 @@ namespace Nickvision::Aura
return m_sourceRepo;
}

void AppInfo::setSourceRepo(const std::string& sourceRepo) noexcept
bool AppInfo::setSourceRepo(const std::string& sourceRepo) noexcept
{
if (!StringHelpers::isValidUrl(sourceRepo))
{
return false;
}
m_sourceRepo = sourceRepo;
return true;
}

const std::string& AppInfo::getIssueTracker() const noexcept
{
return m_issueTracker;
}

void AppInfo::setIssueTracker(const std::string& issueTracker) noexcept
bool AppInfo::setIssueTracker(const std::string& issueTracker) noexcept
{
if (!StringHelpers::isValidUrl(issueTracker))
{
return false;
}
m_issueTracker = issueTracker;
return true;
}

const std::string& AppInfo::getSupportUrl() const noexcept
{
return m_supportUrl;
}

void AppInfo::setSupportUrl(const std::string& supportUrl) noexcept
bool AppInfo::setSupportUrl(const std::string& supportUrl) noexcept
{
if (!StringHelpers::isValidUrl(supportUrl))
{
return false;
}
m_supportUrl = supportUrl;
return true;
}

const std::string& AppInfo::getHtmlDocsStore() const noexcept
Expand Down

0 comments on commit a9a4e3a

Please sign in to comment.