| | |
| | | * Author: Gabriele Contini |
| | | */ |
| | | |
| | | #include "build_properties.h" |
| | | #include "licensecc_properties.h" |
| | | |
| | | #include "LocatorStrategy.hpp" |
| | | #include "LocatorFactory.hpp" |
| | |
| | | namespace license { |
| | | namespace locate { |
| | | |
| | | FUNCTION_RETURN LocatorFactory::get_active_strategies( |
| | | std::vector<std::unique_ptr<LocatorStrategy>> &strategies, |
| | | const LicenseLocation *locationHint) { |
| | | #if(FIND_LICENSE_NEAR_MODULE) |
| | | strategies.push_back( |
| | | std::unique_ptr<LocatorStrategy>( |
| | | (LocatorStrategy*) new ApplicationFolder())); |
| | | FUNCTION_RETURN LocatorFactory::get_active_strategies(std::vector<std::unique_ptr<LocatorStrategy>> &strategies, |
| | | const LicenseLocation *locationHint) { |
| | | #if (FIND_LICENSE_NEAR_MODULE) |
| | | strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new ApplicationFolder())); |
| | | #endif |
| | | #if(FIND_LICENSE_WITH_ENV_VAR) |
| | | strategies.push_back( |
| | | std::unique_ptr<LocatorStrategy>( |
| | | (LocatorStrategy*) new EnvironmentVarLocation())); |
| | | strategies.push_back( |
| | | std::unique_ptr<LocatorStrategy>( |
| | | (LocatorStrategy*) new EnvironmentVarData())); |
| | | #if (FIND_LICENSE_WITH_ENV_VAR) |
| | | strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new EnvironmentVarLocation())); |
| | | strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new EnvironmentVarData())); |
| | | #endif |
| | | if (locationHint != nullptr) { |
| | | strategies.push_back( |
| | | std::unique_ptr<LocatorStrategy>( |
| | | (LocatorStrategy*) new ExternalDefinition(locationHint))); |
| | | strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new ExternalDefinition(locationHint))); |
| | | } |
| | | return strategies.size() > 0 ? FUNC_RET_OK : FUNC_RET_NOT_AVAIL; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } // namespace locate |
| | | } // namespace license |