Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
|
#include <FileComparison.hpp>
Public Member Functions | |
FileComparison (std::string fileName1, std::string fileName2, bool calledCollectively=true, bool suppressOutput=false) | |
FileComparison (const FileFinder &rFileName1, const FileFinder &rFileName2, bool calledCollectively=true, bool suppressOutput=false) | |
void | SetupCommentLines () |
void | SetIgnoreCommentLines (bool ignore=true) |
void | IgnoreBlankLines (bool ignore=true) |
void | SetIgnoreLinesBeginningWith (std::string lineStart) |
void | IgnoreLinesContaining (const std::string &rIgnorableText) |
bool | CompareFiles (unsigned ignoreFirstFewLines=0, bool doTsAssert=true) |
Public Member Functions inherited from AbstractFileComparison | |
AbstractFileComparison (const FileFinder &rFileFinder1, const FileFinder &rFileFinder2, bool calledCollectively, bool suppressOutput) | |
AbstractFileComparison (std::string fileName1, std::string fileName2, bool calledCollectively, bool suppressOutput) | |
virtual | ~AbstractFileComparison () |
Private Attributes | |
bool | mIgnoreCommentLines |
bool | mIgnoreBlankLines |
std::vector< std::string > | mCommentLineStarts |
std::vector< std::string > | mIgnorableContent |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractFileComparison | |
void | ResetFiles () |
void | SkipHeaderLines (unsigned numLinesToSkip) |
Protected Attributes inherited from AbstractFileComparison | |
std::string | mFilename1 |
std::string | mFilename2 |
std::ifstream * | mpFile1 |
std::ifstream * | mpFile2 |
unsigned | mLineNum |
bool | mCalledCollectively |
bool | mSuppressOutput |
Compare files to check for any differences (in numeric and/or string values).
By default this class ignores all lines which (in both files) start with '#' or '!'.
Definition at line 49 of file FileComparison.hpp.
|
inline |
Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.
fileName1 | first file |
fileName2 | second file |
calledCollectively | if true there will be a barrier before opening files, and only master compares contents. |
suppressOutput | if true then no errors will go to TS_TRACE(). Should only be set for the test of this class. |
Definition at line 77 of file FileComparison.hpp.
References SetupCommentLines().
|
inline |
Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.
rFileName1 | first file finder |
rFileName2 | second file finder |
calledCollectively | if true there will be a barrier before opening files, and only master compares contents. |
suppressOutput | if true then no errors will go to TS_TRACE(). Should only be set for the test of this class. |
Definition at line 94 of file FileComparison.hpp.
References SetupCommentLines().
|
inline |
ignoreFirstFewLines | how many lines to ignore from the comparison |
doTsAssert | whether to throw a TS_ASSERT internally (switched off for testing only) |
Definition at line 171 of file FileComparison.hpp.
References PetscTools::AmMaster(), AbstractFileComparison::mCalledCollectively, mCommentLineStarts, AbstractFileComparison::mFilename1, AbstractFileComparison::mFilename2, mIgnorableContent, mIgnoreBlankLines, mIgnoreCommentLines, AbstractFileComparison::mLineNum, AbstractFileComparison::mpFile1, AbstractFileComparison::mpFile2, AbstractFileComparison::mSuppressOutput, AbstractFileComparison::ResetFiles(), and AbstractFileComparison::SkipHeaderLines().
|
inline |
Set whether or not we should ignore blank lines. If only one of the files being compared has a blank line, if this mode is on we just skip that line and see if the next content line matches the other file.
ignore | whether to ignore blank lines appearing only in one file |
Definition at line 137 of file FileComparison.hpp.
References mIgnoreBlankLines.
|
inline |
Add the given string to mIgnorableContent, and hence ignore differences in lines which contain that text in both files.
rIgnorableText | the text indicating lines to ignore |
Definition at line 160 of file FileComparison.hpp.
References mIgnorableContent.
|
inline |
Whether or not we should ignore lines starting with a comment symbol (the default symbols are '#' and '!', set by SetupCommentLines).
ignore | whether to ignore these lines. If set to false, existing defined comment symbols are also cleared, so that an entirely new set may be defined with SetIgnoreLinesBeginningWith. |
Definition at line 122 of file FileComparison.hpp.
References mCommentLineStarts, and mIgnoreCommentLines.
|
inline |
Set an additional line start which should be treated as a comment and ignored (and therefore switch on mIgnoreCommentLines = true).
lineStart | the beginning of a line which should be treated as a comment |
Definition at line 148 of file FileComparison.hpp.
References mCommentLineStarts, and mIgnoreCommentLines.
|
inline |
Set some line starts that define comments in the files.
These are ignored by default and when mIgnoreCommentLines is explicitly set to true.
Definition at line 107 of file FileComparison.hpp.
References mCommentLineStarts.
Referenced by FileComparison(), and FileComparison().
|
private |
A list of strings, which if found at the beginning of lines when mIgnoreCommentLines is true, differences in these lines are ignored.
Definition at line 62 of file FileComparison.hpp.
Referenced by CompareFiles(), SetIgnoreCommentLines(), SetIgnoreLinesBeginningWith(), and SetupCommentLines().
|
private |
Any lines which (in both files) contain one of these strings will be ignored.
Definition at line 65 of file FileComparison.hpp.
Referenced by CompareFiles(), and IgnoreLinesContaining().
|
private |
Whether or not we should ignore blank lines. False by default.
Definition at line 56 of file FileComparison.hpp.
Referenced by CompareFiles(), and IgnoreBlankLines().
|
private |
Whether or not we should ignore comment lines. True by default.
Definition at line 53 of file FileComparison.hpp.
Referenced by CompareFiles(), SetIgnoreCommentLines(), and SetIgnoreLinesBeginningWith().