Project rules

nRules returns number of rules in the project or -1 for error.
C/C++/C#
int nRules(PRJ_HANDLE handle)
Returns >=0 in success or -1 otherwise.

GetRule returns handle of the specified rule.
C/C++/C#
RULE_HANDLE GetRule(PRJ_HANDLE handle, int idx)
'idx' is zero based index of the rule to be returned.
Returns handle in success or 0 otherwise.

SetRule replaces existing project's rule by specified.
C/C++/C#
int SetRule(PRJ_HANDLE handle, int idx, RULE_HANDLE rule)
'idx' is zero based index of the rule to be replaced.
Returns
0 for success
-1 for invalid project handle
-2 for not allocated project handle
-4 for invalid rule index 'idx'.

COM object offers "Rule" integer property for described functions. You should not use "SetRule" and "GetRule" functions directly in this case.

AddRule appends new rule to specified project.
C/C++/C#
int AddRule(PRJ_HANDLE handle, RULE_HANDLE rule)

'rule' is a handle of rule that will be added to the project.
Returns
0 for success
-1 for invalid project handle
-2 for not allocated project handle.

RemoveRule removes rule from the project by index.
C/C++/C#
int RemoveRule(PRJ_HANDLE handle,int idx)
'idx' is zero based index of the rule to be removed.
Returns 0 in success, -1 for invalid handle or -2 for invalid rule index.