@brief Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGINGPP(..)
| 1264 | }; |
| 1265 | /// @brief Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGINGPP(..) |
| 1266 | class CommandLineArgs { |
| 1267 | public: |
| 1268 | CommandLineArgs(void) { |
| 1269 | setArgs(0, static_cast<char**>(nullptr)); |
| 1270 | } |
| 1271 | CommandLineArgs(int argc, const char** argv) { |
| 1272 | setArgs(argc, argv); |
| 1273 | } |
| 1274 | CommandLineArgs(int argc, char** argv) { |
| 1275 | setArgs(argc, argv); |
| 1276 | } |
| 1277 | virtual ~CommandLineArgs(void) {} |
| 1278 | /// @brief Sets arguments and parses them |
| 1279 | inline void setArgs(int argc, const char** argv) { |
| 1280 | setArgs(argc, const_cast<char**>(argv)); |
| 1281 | } |
| 1282 | /// @brief Sets arguments and parses them |
| 1283 | void setArgs(int argc, char** argv); |
| 1284 | /// @brief Returns true if arguments contain paramKey with a value (seperated by '=') |
| 1285 | bool hasParamWithValue(const char* paramKey) const; |
| 1286 | /// @brief Returns value of arguments |
| 1287 | /// @see hasParamWithValue(const char*) |
| 1288 | const char* getParamValue(const char* paramKey) const; |
| 1289 | /// @brief Return true if arguments has a param (not having a value) i,e without '=' |
| 1290 | bool hasParam(const char* paramKey) const; |
| 1291 | /// @brief Returns true if no params available. This exclude argv[0] |
| 1292 | bool empty(void) const; |
| 1293 | /// @brief Returns total number of arguments. This exclude argv[0] |
| 1294 | std::size_t size(void) const; |
| 1295 | friend base::type::ostream_t& operator<<(base::type::ostream_t& os, const CommandLineArgs& c); |
| 1296 | |
| 1297 | private: |
| 1298 | int m_argc; |
| 1299 | char** m_argv; |
| 1300 | std::map<std::string, std::string> m_paramsWithValue; |
| 1301 | std::vector<std::string> m_params; |
| 1302 | }; |
| 1303 | /// @brief Abstract registry (aka repository) that provides basic interface for pointer repository specified by T_Ptr type. |
| 1304 | /// |
| 1305 | /// @detail Most of the functions are virtual final methods but anything implementing this abstract class should implement |
nothing calls this directly
no outgoing calls
no test coverage detected