#include <ruleparser.h>
Class to evaluate in-/exclusion rules from an ASCII file. The rule parser allows e.g. for simple distillation scripts.
Scripts are always executed from top to bottom.
lines that start with + "PATTERN" mean that if the pattern matches the file(s)/directory(s) will be included lines that start with - "PATTERN" mean that if the pattern matches the file(s)/directory(s) will be included lines that contain "A" -> "B" mean that if the pattern matches the file(s)/directory(s) will be renamed "->" can be combined with "+" at the same time
any path must be surrounded by quotation marks
patterns that only contain endings do not just check the pattern, but the ending itself (so .pbxproj.user will not match ".pbxproj")
conditions can be started with if "PATTERN" or ifnot "PATTERN"
lines that are enclosed with {..} will only be executed if the condition matches
Here an example script:
Public Member Functions | |
MAXON_METHOD Result< void > | Init (const Url &ruleFile, const StringDecodingRef &strDecoding) |
MAXON_METHOD Bool | Check (const String &relativeName, String *outputName) |
Static Public Member Functions | |
static MAXON_METHOD RuleParserInterface * | Alloc (MAXON_SOURCE_LOCATION_DECLARATION) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (RuleParserInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.ruleparser") | |
|
private |
|
static |
allocator for common use.
MAXON_METHOD Result<void> Init | ( | const Url & | ruleFile, |
const StringDecodingRef & | strDecoding | ||
) |
Initializes the rule set from a file.
[in] | ruleFile | Name of the file to read the rules from. |
[in] | strDecoding | String Decoding that should be used for the char -> unichar conversion. |
MAXON_METHOD Bool Check | ( | const String & | relativeName, |
String * | outputName | ||
) |
Checks if a file matches the rule set.
[in] | relativeName | Relative name of the file, must start with "/", e.g. "/main_dev/test.cpp". |
[out] | outputName | Can be set to nullptr. If present the content is identical to relativeName or, if the rule set contained a rename operation, the modified name. |