| 1892 | /// @detail This class makes use of base::utils::Str. |
| 1893 | /// You should not need this unless you are working on some tool for Easylogging++ |
| 1894 | class Parser : base::StaticClass { |
| 1895 | public: |
| 1896 | /// @brief Parses configuration from file. |
| 1897 | /// @param configurationFile Full path to configuration file |
| 1898 | /// @param sender Sender configurations pointer. Usually 'this' is used from calling class |
| 1899 | /// @param base Configurations to base new configuration repository off. This value is used when you want to use |
| 1900 | /// existing Configurations to base all the values and then set rest of configuration via configuration file. |
| 1901 | /// @return True if successfully parsed, false otherwise. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you |
| 1902 | /// do not proceed without successful parse. |
| 1903 | static bool parseFromFile(const std::string& configurationFile, Configurations* sender, |
| 1904 | Configurations* base = nullptr); |
| 1905 | |
| 1906 | /// @brief Parse configurations from configuration string. |
| 1907 | /// |
| 1908 | /// @detail This configuration string has same syntax as configuration file contents. Make sure all the necessary |
| 1909 | /// new line characters are provided. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you |
| 1910 | /// do not proceed without successful parse (This is recommended) |
| 1911 | /// @param configurationsString the configuration in plain text format |
| 1912 | /// @param sender Sender configurations pointer. Usually 'this' is used from calling class |
| 1913 | /// @param base Configurations to base new configuration repository off. This value is used when you want to use |
| 1914 | /// existing Configurations to base all the values and then set rest of configuration via configuration text. |
| 1915 | /// @return True if successfully parsed, false otherwise. |
| 1916 | static bool parseFromText(const std::string& configurationsString, Configurations* sender, |
| 1917 | Configurations* base = nullptr); |
| 1918 | |
| 1919 | private: |
| 1920 | friend class el::Loggers; |
| 1921 | static void ignoreComments(std::string* line); |
| 1922 | static bool isLevel(const std::string& line); |
| 1923 | static bool isComment(const std::string& line); |
| 1924 | static inline bool isConfig(const std::string& line); |
| 1925 | static bool parseLine(std::string* line, std::string* currConfigStr, std::string* currLevelStr, Level* currLevel, |
| 1926 | Configurations* conf); |
| 1927 | }; |
| 1928 | |
| 1929 | private: |
| 1930 | std::string m_configurationFile; |
nothing calls this directly
no outgoing calls
no test coverage detected