| 128 | */ |
| 129 | template <typename T> |
| 130 | static bool |
| 131 | load(T &container, const String &filename) |
| 132 | { |
| 133 | String line; |
| 134 | String::size_type pos; |
| 135 | |
| 136 | String path(makeConfigPath(filename)); |
| 137 | |
| 138 | AccessControlDebug("reading file %s", path.c_str()); |
| 139 | |
| 140 | std::ifstream infile; |
| 141 | infile.open(path.c_str()); |
| 142 | if (!infile.is_open()) { |
| 143 | AccessControlError("failed to load file '%s'", path.c_str()); |
| 144 | return false; |
| 145 | } |
| 146 | |
| 147 | while (std::getline(infile, line)) { |
| 148 | // Allow #-prefixed comments. |
| 149 | pos = line.find_first_of('#'); |
| 150 | if (pos != String::npos) { |
| 151 | line.resize(pos); |
| 152 | } |
| 153 | if (line.empty()) { |
| 154 | continue; |
| 155 | } |
| 156 | |
| 157 | loadLine(container, line); |
| 158 | } |
| 159 | infile.close(); |
| 160 | |
| 161 | return true; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * @brief initializes plugin configuration. |
no test coverage detected