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,
38 * @brief Patch styles.
40 * Diffutils can output patch in these formats. Normal format has original
41 * and altered lines listed in separate blocks, prefixed with \< and \>
42 * characters. Context format has context lines around difference blocks,
43 * which are prefixed with - and + characters. Unified format combines
44 * difference blocks and prefixes lines with + and - characters.
45 * @note We really use only first three types (normal + context formats).
46 * Those three types are the ones mostly used and preferred.
50 // NOTE: these values are stored in the user's Registry - don't change their value !!
51 /**< Default output style. */
52 DIFF_OUTPUT_NORMAL = OUTPUT_NORMAL,
53 /**< Output the differences with lines of context before and after (-c). */
54 DIFF_OUTPUT_CONTEXT = OUTPUT_CONTEXT,
55 /**< Output the differences in a unified context diff format (-u). */
56 DIFF_OUTPUT_UNIFIED = OUTPUT_UNIFIED,
57 // These are not used, see the comment above enum.
59 /**< Output the differences as commands suitable for `ed' (-e). */
60 DIFF_OUTPUT_ED = OUTPUT_ED,
61 /**< Output the diff as a forward ed script (-f). */
62 DIFF_OUTPUT_FORWARD_ED = OUTPUT_FORWARD_ED,
63 /**< Like -f, but output a count of changed lines in each "command" (-n). */
64 DIFF_OUTPUT_RCS = OUTPUT_RCS,
65 /**< Output merged #ifdef'd file (-D). */
66 DIFF_OUTPUT_IFDEF = OUTPUT_IFDEF,
67 /**< Output sdiff style (-y). */
68 DIFF_OUTPUT_SDIFF = OUTPUT_SDIFF,
71 /** Output html style. */
72 DIFF_OUTPUT_HTML = OUTPUT_HTML,
76 * @brief Diffutils options.
80 int nIgnoreWhitespace; /**< Ignore whitespace -option. */
81 bool bIgnoreCase; /**< Ignore case -option. */
82 bool bIgnoreBlankLines; /**< Ignore blank lines -option. */
83 bool bIgnoreEol; /**< Ignore EOL differences -option. */
84 bool bFilterCommentsLines; /**< Ignore Multiline comments differences -option. */
85 int nDiffAlgorithm; /**< Diff algorithm -option. */
86 bool bIndentHeuristic; /**< Ident heuristic -option */
87 bool bCompletelyBlankOutIgnoredChanges;
91 * @brief General compare options.
92 * This class has general compare options we expect every compare engine and
93 * routine to implement.
99 CompareOptions(const CompareOptions & options);
100 virtual void SetFromDiffOptions(const DIFFOPTIONS & options);
102 enum WhitespaceIgnoreChoices m_ignoreWhitespace; /**< Ignore whitespace characters */
103 bool m_bIgnoreBlankLines; /**< Ignore blank lines (both sides) */
104 bool m_bIgnoreCase; /**< Ignore case differences? */
105 bool m_bIgnoreEOLDifference; /**< Ignore EOL style differences? */
109 * @brief Compare options used with diffutils.
110 * This class adds some diffutils-specific compare options to general compare
111 * options class. And also methods for easy setting options and forwarding
112 * options to diffutils.
114 class DiffutilsOptions : public CompareOptions
118 explicit DiffutilsOptions(const CompareOptions& options);
119 DiffutilsOptions(const DiffutilsOptions& options);
120 void SetToDiffUtils();
121 void GetAsDiffOptions(DIFFOPTIONS &options) const;
122 virtual void SetFromDiffOptions(const DIFFOPTIONS & options) override;
124 enum DiffOutputType m_outputStyle; /**< Output style (for patch files) */
125 int m_contextLines; /**< Number of context lines (for patch files) */
126 bool m_filterCommentsLines;/**< Ignore Multiline comments differences.*/
127 enum DiffAlgorithm m_diffAlgorithm; /** Diff algorithm */
128 bool m_bIndentHeuristic; /**< Indent heuristic */
129 bool m_bCompletelyBlankOutIgnoredDiffereneces; /**< Completely blank out ignored differences */
133 * @brief Compare options used with Quick compare -method.
134 * This class has some Quick Compare specifics in addition to general compare
137 class QuickCompareOptions : public CompareOptions
140 QuickCompareOptions();
141 explicit QuickCompareOptions(const CompareOptions& options);
143 bool m_bStopAfterFirstDiff; /**< Optimize compare by stopping after first difference? */