2 * @file CompareOptions.h
4 * @brief Compare options classes and types.
11 * @brief Whether to ignore whitespace (or to ignore changes in whitespace)
14 * "abc def" is only equivalent to "abcdef" under WHITESPACE_IGNORE_ALL
16 * but "abc def" is equivalent to "abc def" under both
17 * WHITESPACE_IGNORE_CHANGE and WHITESPACE_IGNORE_ALL
19 * Also, trailing and leading whitespace is ignored for both
20 * WHITESPACE_IGNORE_CHANGE and WHITESPACE_IGNORE_ALL
22 enum WhitespaceIgnoreChoices
24 WHITESPACE_COMPARE_ALL = 0, /**< no special handling of whitespace */
25 WHITESPACE_IGNORE_CHANGE, /**< ignore changes in whitespace */
26 WHITESPACE_IGNORE_ALL, /**< ignore whitespace altogether */
31 DIFF_ALGORITHM_DEFAULT = 0,
32 DIFF_ALGORITHM_MINIMAL = 1,
33 DIFF_ALGORITHM_PATIENCE = 2,
34 DIFF_ALGORITHM_HISTOGRAM = 3,
35 DIFF_ALGORITHM_NONE = 4,
39 * @brief Patch styles.
41 * Diffutils can output patch in these formats. Normal format has original
42 * and altered lines listed in separate blocks, prefixed with \< and \>
43 * characters. Context format has context lines around difference blocks,
44 * which are prefixed with - and + characters. Unified format combines
45 * difference blocks and prefixes lines with + and - characters.
46 * @note We really use only first three types (normal + context formats).
47 * Those three types are the ones mostly used and preferred.
51 // NOTE: these values are stored in the user's Registry - don't change their value !!
52 /**< Default output style. */
53 DIFF_OUTPUT_NORMAL = OUTPUT_NORMAL,
54 /**< Output the differences with lines of context before and after (-c). */
55 DIFF_OUTPUT_CONTEXT = OUTPUT_CONTEXT,
56 /**< Output the differences in a unified context diff format (-u). */
57 DIFF_OUTPUT_UNIFIED = OUTPUT_UNIFIED,
58 // These are not used, see the comment above enum.
60 /**< Output the differences as commands suitable for `ed' (-e). */
61 DIFF_OUTPUT_ED = OUTPUT_ED,
62 /**< Output the diff as a forward ed script (-f). */
63 DIFF_OUTPUT_FORWARD_ED = OUTPUT_FORWARD_ED,
64 /**< Like -f, but output a count of changed lines in each "command" (-n). */
65 DIFF_OUTPUT_RCS = OUTPUT_RCS,
66 /**< Output merged #ifdef'd file (-D). */
67 DIFF_OUTPUT_IFDEF = OUTPUT_IFDEF,
68 /**< Output sdiff style (-y). */
69 DIFF_OUTPUT_SDIFF = OUTPUT_SDIFF,
72 /** Output html style. */
73 DIFF_OUTPUT_HTML = OUTPUT_HTML,
77 * @brief Diffutils options.
81 int nIgnoreWhitespace; /**< Ignore whitespace -option. */
82 int nDiffAlgorithm; /**< Diff algorithm -option. */
83 bool bIgnoreCase; /**< Ignore case -option. */
84 bool bIgnoreNumbers; /**< Ignore numbers -option. */
85 bool bIgnoreBlankLines; /**< Ignore blank lines -option. */
86 bool bIgnoreEol; /**< Ignore EOL differences -option. */
87 bool bFilterCommentsLines; /**< Ignore Multiline comments differences -option. */
88 bool bIndentHeuristic; /**< Ident heuristic -option */
89 bool bCompletelyBlankOutIgnoredChanges;
93 * @brief General compare options.
94 * This class has general compare options we expect every compare engine and
95 * routine to implement.
101 virtual void SetFromDiffOptions(const DIFFOPTIONS & options);
103 enum WhitespaceIgnoreChoices m_ignoreWhitespace; /**< Ignore whitespace characters */
104 bool m_bIgnoreBlankLines; /**< Ignore blank lines (both sides) */
105 bool m_bIgnoreCase; /**< Ignore case differences? */
106 bool m_bIgnoreNumbers; /**< Ignore number differences? */
107 bool m_bIgnoreEOLDifference; /**< Ignore EOL style differences? */
111 * @brief Compare options used with diffutils.
112 * This class adds some diffutils-specific compare options to general compare
113 * options class. And also methods for easy setting options and forwarding
114 * options to diffutils.
116 class DiffutilsOptions : public CompareOptions
120 explicit DiffutilsOptions(const CompareOptions& options);
121 void SetToDiffUtils();
122 void GetAsDiffOptions(DIFFOPTIONS &options) const;
123 virtual void SetFromDiffOptions(const DIFFOPTIONS & options) override;
125 DiffOutputType m_outputStyle; /**< Output style (for patch files) */
126 DiffAlgorithm m_diffAlgorithm; /** Diff algorithm */
127 int m_contextLines; /**< Number of context lines (for patch files) */
128 bool m_filterCommentsLines;/**< Ignore Multiline comments differences.*/
129 bool m_bIndentHeuristic; /**< Indent heuristic */
130 bool m_bCompletelyBlankOutIgnoredDiffereneces; /**< Completely blank out ignored differences */
134 * @brief Compare options used with Quick compare -method.
135 * This class has some Quick Compare specifics in addition to general compare
138 class QuickCompareOptions : public CompareOptions
141 QuickCompareOptions();
142 explicit QuickCompareOptions(const CompareOptions& options);
144 bool m_bStopAfterFirstDiff; /**< Optimize compare by stopping after first difference? */