1 /*
2  * ModSecurity, http://www.modsecurity.org/
3  * Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
4  *
5  * You may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * If any of the files related to licensing are missing or if you have any
11  * other questions related to licensing please contact Trustwave Holdings, Inc.
12  * directly using the email address security@modsecurity.org.
13  *
14  */
15 
16 #ifndef SRC_OPERATORS_PM_FROM_FILE_H_
17 #define SRC_OPERATORS_PM_FROM_FILE_H_
18 
19 #include <string>
20 #include <memory>
21 #include <utility>
22 
23 #include "src/operators/pm.h"
24 
25 
26 namespace modsecurity {
27 namespace operators {
28 
29 
30 class PmFromFile : public Pm {
31  public:
32     /** @ingroup ModSecurity_Operator */
PmFromFile(std::unique_ptr<RunTimeString> param)33     explicit PmFromFile(std::unique_ptr<RunTimeString> param)
34         : Pm("PmFromFile", std::move(param)) { }
PmFromFile(const std::string & n,std::unique_ptr<RunTimeString> param)35     explicit PmFromFile(const std::string &n, std::unique_ptr<RunTimeString> param)
36         : Pm(n, std::move(param)) { }
37 
38     bool init(const std::string &file, std::string *error) override;
39 
40 private:
41     static bool isComment(const std::string &s);
42 };
43 
44 
45 }  // namespace operators
46 }  // namespace modsecurity
47 
48 
49 #endif  // SRC_OPERATORS_PM_FROM_FILE_H_
50