| Title: | Compare and Verify File Contents |
|---|---|
| Description: | Extendable 'R6' file comparison classes, including a 'shiny' app for combining the comparison functionality into a file comparison application. The package idea originates from pharma companies' drug development processes, where statisticians and statistical programmers need to review and compare different versions of the same outputs and datasets. The package implementation itself is not tied to any specific industry and can be used in any context for easy file comparisons between different file version sets. |
| Authors: | Juha Javanainen [aut, cre], Tiina Kirsilä [ctb], Anna Wiksten [ctb] |
| Maintainer: | Juha Javanainen <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.2.2 |
| Built: | 2026-06-07 12:42:23 UTC |
| Source: | https://github.com/ejuhjav/verifyr2 |
BinaryFileComparator.R
BinaryFileComparator.R
Fallback comparator for binary files without any specific definied comparator.
verifyr2::FileComparator -> BinaryFileComparator
verifyr2::FileComparator$initialize()verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_details_supported()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()vrf_contents()
Method for getting the single file contents for the comparison. This method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents with the rows matching the omit string excluded. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn not be called directly by the user.
BinaryFileComparator$vrf_contents(file, config, omit)
filefile for which to get the contents
configconfiguration values
omitstring pattern to omit from the comparison
vrf_contents_inner()
Method for getting the inner part for the file contents query. The method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents with the rows matching the omit string excluded. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn not be called directly by the user.
BinaryFileComparator$vrf_contents_inner(contents, config, omit)
contentsfile contents
configconfiguration values
omitstring pattern to omit from the comparison
vrf_summary_inner()
Method for comparing the inner part for the details query. The method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents processed for empty spaces and omit terms if applicable. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn not be called directly by the user.
BinaryFileComparator$vrf_summary_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
BinaryFileComparator$vrf_details_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
clone()
The objects of this class are cloneable with this method.
BinaryFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.bin' file2 <- 'my_file2.bin' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.bin' file2 <- 'my_file2.bin' comparator <- BinaryFileComparator$new(file1, file2)# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.bin' file2 <- 'my_file2.bin' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.bin' file2 <- 'my_file2.bin' comparator <- BinaryFileComparator$new(file1, file2)
Config.R
Config.R
Class for manging the library configuration options. Creates the default configuration without any source file, populates partial or missing config elements, stores the config file to local machine, and provides easy access methods for setting and getting config values.
schemaconfiguration schema
configcurrent configuration data
pathconfiguration json file path
new()
Constructor for initializing the configuration. Checks the local machine for existing configuration file is load_config = TRUE. Ensures that all the project configuration values are included.
Config$new(load_config = TRUE, config_path = NULL)
load_configload configuration from local machine if available
config_pathlocation of the used/stored configuration json file
get_schema_item()
Method for getting schema item based on configuration key. Configuration item children are separated with a dot in the key notation.
Config$get_schema_item(key)
keyconfiguration property key for which to get the schema item
get()
Method for getting configuration value based on configuration key. Configuration item children are separated with a dot in the key notation.
Config$get(key)
keyconfiguration property key for which to get the value
set()
Method for setting configuration value based on configuration key. Configuration item children are separated with a dot in the key notation.
Config$set(key, value)
keyconfiguration property key for which to get the value
valuevalue to set for the specified configuration key
save()
Method for saving the current configuration data into local machine.
Config$save()
get_default_config()
Helper method for getting configuration default values. These default values will be used in the configuration in case the configuration properties are not present previously.
Config$get_default_config()
get_default_schema()
Method for getting the full configuration schema. Apart from the configuration data, the schema contains property descriptions as well as all possible values for the configuration properties.
Config$get_default_schema()
clone()
The objects of this class are cloneable with this method.
Config$clone(deep = FALSE)
deepWhether to make a deep clone.
# Creates the configuration instance. Checks automatically if there is # a previously stored configuration json file available for usage. Note # that you don't need to explicitly define the config file path for the # Config instance - by default the config file will be searched from and # written in user-specific configuration directory for the package. path <- tempfile(fileext = ".json") config <- Config$new(config_path = path) # Getting and setting configuration values value <- config$get("defailts.mode") config$set("details.mode", "full") # Saving the current configuration to local machine (to tmp folder with # the given explicit file path in initialization). config$save()# Creates the configuration instance. Checks automatically if there is # a previously stored configuration json file available for usage. Note # that you don't need to explicitly define the config file path for the # Config instance - by default the config file will be searched from and # written in user-specific configuration directory for the package. path <- tempfile(fileext = ".json") config <- Config$new(config_path = path) # Getting and setting configuration values value <- config$get("defailts.mode") config$set("details.mode", "full") # Saving the current configuration to local machine (to tmp folder with # the given explicit file path in initialization). config$save()
Factory method for creating comparator instance based on the given two files.
create_comparator(file1, file2)create_comparator(file1, file2)
file1 |
first file to compare |
file2 |
second file to compare |
# instantiating the compared files file1 <- "file1.rtf" file2 <- "file2.rtf" # instantiating the configuration config <- Config$new() # instantiating a new comparator instance for every comparison: comparator <- verifyr2::create_comparator(file1, file2) # calling the summary and details comparison methods comparator$vrf_summary(config = config) comparator$vrf_details(config = config)# instantiating the compared files file1 <- "file1.rtf" file2 <- "file2.rtf" # instantiating the configuration config <- Config$new() # instantiating a new comparator instance for every comparison: comparator <- verifyr2::create_comparator(file1, file2) # calling the summary and details comparison methods comparator$vrf_summary(config = config) comparator$vrf_details(config = config)
Debugger.R
Debugger.R
Class for managing the library debugging. Tracks the debugged method execution times and prints out the full debugging information only when the main debugging instance is stopped.
stacklocal property for storing debugging labels and start times
new()
Constructor for initializing the Debugger instance.
Debugger$new()
open_debug()
Method for opening new debug instance to the current debugging stack. Stores also the start time for execution time calculation.
Debugger$open_debug(label)
labeldebugging message
add_debug()
Method for adding a new debug string under the currently open debug instance.
Debugger$add_debug(label)
labeldebugging message
close_debug()
Method for closing a debug instance from the current debugging stack. If the stopped debug instance is the main level one, the whole debug data is printed out to console. If the stopped debug instance is not the main level one, calculates the execution time of current debug instance and updates the stack data.
Debugger$close_debug()
print_debug_tree()
Recursive method for printing out the current debug stack items and recursively all the item children. This method is called for the whole stack once the topmost debug instance is stopped.
Debugger$print_debug_tree(entry, depth = 0)
entrycurrent debug level being processed for printing
depthcurrent processing depth for printing indentation
clone()
The objects of this class are cloneable with this method.
Debugger$clone(deep = FALSE)
deepWhether to make a deep clone.
# Creates a debugger instance. debugger <- Debugger$new() # Opening and closing debugs in multileveled function calls. function1 <- function() { debugger$open_debug("function1") function2() debuger$close_debug() } function2 <- function() { debugger$open_debug("function2") Sys.sleep(1) debugger$close_debug() } # This will produce the following printout to the console after the # function1 finishes # # - 'function1' (execution time 7 ms) # - 'function2' (execution time 5 ms)# Creates a debugger instance. debugger <- Debugger$new() # Opening and closing debugs in multileveled function calls. function1 <- function() { debugger$open_debug("function1") function2() debuger$close_debug() } function2 <- function() { debugger$open_debug("function2") Sys.sleep(1) debugger$close_debug() } # This will produce the following printout to the console after the # function1 finishes # # - 'function1' (execution time 7 ms) # - 'function2' (execution time 5 ms)
FileComparator.R
FileComparator.R
Comparator 'abstract' class containing the generic comparison methods and handling for high level checks (like file existence). This class should never be instantiated - doing that and calling the comparison methods will lead to error.
file1file1
file2file2
file1_contents_listfile1 contents
file2_contents_listfile2 contents
summary_comparisonsummary comparison result
details_comparisondetails comparison result
debuggerdebugger instance
new()
Initialize a FileComparator instance
FileComparator$new(file1 = NULL, file2 = NULL)
file1First file to compare.
file2Second file to compare.
vrf_summary()
Method for comparing the file summary information. This method is intended to be implemented only this class level. For comparator specific rules, the internal method vrf_summary_inner should be customized on lower levels instead.
FileComparator$vrf_summary(config, omit = NULL)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details()
Method for comparing the file details information. This method is intended to be implemented only this class level. For comparator specific rules, the internal method vrf_summary_inner should be customized on lower levels instead.
FileComparator$vrf_details(config, omit = NULL)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_summary_inner()
"Abstract" method for comparing the inner part for the summary. This method has to be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
FileComparator$vrf_summary_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_inner()
"Abstract" method for comparing the inner part for the detailsThis method has to be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
FileComparator$vrf_details_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_supported()
Inherited method for indicating whether detailed comparison is available with the current comparator. Returns an empty string if the comparator is is supported, otherwise a string that will be concatenated with the summary string.
FileComparator$vrf_details_supported(config)
configconfiguration values
vrf_option_value()
Method for getting specific value from the config In the initial version, returns 'NA' if null con is passed.
FileComparator$vrf_option_value(config, key)
configconfiguration values
keykey to search from the parameters
vrf_open_debug()
Wrapper method for the opening a new debugging instance with Debugger class if debugging is enabled in config class. Creates the used debugger instance if needed.
FileComparator$vrf_open_debug(message, config)
messagemessage to debug to console
configconfiguration values
vrf_add_debug()
Wrapper method for the adding a new debugging message with Debugger class.
FileComparator$vrf_add_debug(message)
messagemessage to debug to console
vrf_add_debug_files()
Special method for adding the compared files into debugger stack.
FileComparator$vrf_add_debug_files()
vrf_close_debug()
Wrapper method for the stopping (closing) current debugging instance with Debugger class.
FileComparator$vrf_close_debug()
clone()
The objects of this class are cloneable with this method.
FileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
ImgFileComparator.R
ImgFileComparator.R
Specialiced comparator for image file (jpg, jpef, png) comparison. This comparator contains the custom handling for handling only img content part for the comparison.
verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> ImgFileComparator
image1_rawextracted raw data for image1.
image2_rawextracted raw data for image2.
verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()verifyr2::BinaryFileComparator$vrf_contents()verifyr2::BinaryFileComparator$vrf_contents_inner()verifyr2::BinaryFileComparator$vrf_summary_inner()new()
Initialize a ImgFileComparator instance
ImgFileComparator$new(file1 = NULL, file2 = NULL, raw1 = NULL, raw2 = NULL)
file1First file to compare.
file2Second file to compare.
raw1First image in raw format to compare.
raw2Second image in raw format to compare.
vrf_details_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
ImgFileComparator$vrf_details_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_inner_from_raw()
Internal method for comparing the earlier populated raw image contents in details and generating the difference highlight image in case differences are found.
ImgFileComparator$vrf_details_inner_from_raw(config)
configconfiguration values
vrf_details_inner_from_files()
Method for comparing the inner part for the details query with the file names as the base arguments. This is a part of a group of image processing functions that work with different image abstractions (file, image, raw image). These methods are intended to improve the performance so that best suiting method version can be used depending on what data is available from the earlier method calls to the same comparator instance.
ImgFileComparator$vrf_details_inner_from_files(config)
configconfiguration values
vrf_details_supported()
Inherited method for indicating whether detailed comparison is available with the current comparator. Returns an empty string if the comparator is is supported, otherwise a string that will be concatenated with the summary string.
ImgFileComparator$vrf_details_supported(config)
configconfiguration values
vrf_render_image_diff()
Method for rendering image differences as HTML.
ImgFileComparator$vrf_render_image_diff(image1, image2, image3)
image1first image as base64 decoded string
image2second image as base64 decoded string
image3differences image as base64 decoded string
clone()
The objects of this class are cloneable with this method.
ImgFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.jpg' file2 <- 'my_file2.jpg' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.png' file2 <- 'my_file2.png' comparator <- ImgFileComparator$new(file1, file2) # This comparator has also second explicit creation method that is used # by the library for processing embedded image contents. image1_raw <- 'raw hex vector data' image2_raw <- 'raw hex vector data' comparator <- ImgFileComparator$new(NULL, NULL, image1_raw, image2_raw)# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.jpg' file2 <- 'my_file2.jpg' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.png' file2 <- 'my_file2.png' comparator <- ImgFileComparator$new(file1, file2) # This comparator has also second explicit creation method that is used # by the library for processing embedded image contents. image1_raw <- 'raw hex vector data' image2_raw <- 'raw hex vector data' comparator <- ImgFileComparator$new(NULL, NULL, image1_raw, image2_raw)
list_files List single file row based on the explicit parameter
files. This is a conveniency function for building same structure list for
direct two file comparison case.
list_files(file1, file2)list_files(file1, file2)
file1 |
character, giving the the full file path of the first file |
file2 |
character, giving the the full file path of the second file |
Returns a tibble, selected_files with 2 columns file1,
file2
path1 <- "/extdata/base_files/file2_additional_rows.rtf" file1 <- paste0(fs::path_package(path1, package = "verifyr2")) path2 <- "/extdata/compare_files/file3_changed_rows.rtf" file2 <- paste0(fs::path_package(path2, package = "verifyr2")) verifyr2::list_files(file1, file2)path1 <- "/extdata/base_files/file2_additional_rows.rtf" file1 <- paste0(fs::path_package(path1, package = "verifyr2")) path2 <- "/extdata/compare_files/file3_changed_rows.rtf" file2 <- paste0(fs::path_package(path2, package = "verifyr2")) verifyr2::list_files(file1, file2)
list_folder_files List files that exist in two folders with a specific
name pattern
list_folder_files(folder1, folder2, pattern = NULL)list_folder_files(folder1, folder2, pattern = NULL)
folder1 |
character, giving the the full file path and name of the folder where first files are stored (required) |
folder2 |
character, giving the the full file path and name of the folder where second new files are stored (required) |
pattern |
character, limit the files to be listed to contain a specific pattern (optional) |
Returns a tibble, selected_files with 2 columns file1,
file2
folder1 <- paste0(fs::path_package("/extdata/base_files/", package = "verifyr2")) folder2 <- paste0(fs::path_package("/extdata/compare_files/", package = "verifyr2")) verifyr2::list_folder_files(folder1, folder2, "base")folder1 <- paste0(fs::path_package("/extdata/base_files/", package = "verifyr2")) folder2 <- paste0(fs::path_package("/extdata/compare_files/", package = "verifyr2")) verifyr2::list_folder_files(folder1, folder2, "base")
PdfFileComparator.R
PdfFileComparator.R
Specialiced comparator for PDF file comparison. This comparator contains the custom handling for handling only PDF content part for the comparison.
verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> verifyr2::TxtFileComparator -> PdfFileComparator
verifyr2::FileComparator$initialize()verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()verifyr2::TxtFileComparator$vrf_contents_inner()verifyr2::TxtFileComparator$vrf_details_inner()verifyr2::TxtFileComparator$vrf_summary_inner()vrf_contents()
Method for getting the single file contents for the comparison. The method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents with the rows matching the omit string excluded. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
PdfFileComparator$vrf_contents(file, config, omit)
filefile for which to get the contents
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_supported()
Inherited method for indicating whether detailed comparison is available with the current comparator. Returns an empty string if the comparator is is supported, otherwise a string that will be concatenated with the summary string.
PdfFileComparator$vrf_details_supported(config)
configconfiguration values
clone()
The objects of this class are cloneable with this method.
PdfFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.pdf' file2 <- 'my_file2.pdf' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.pdf' file2 <- 'my_file2.pdf' comparator <- PdfFileComparator$new(file1, file2)# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.pdf' file2 <- 'my_file2.pdf' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.pdf' file2 <- 'my_file2.pdf' comparator <- PdfFileComparator$new(file1, file2)
RtfFileComparator.R
RtfFileComparator.R
Specialiced comparator for RTF file comparison. This comparator contains the custom handling for handling only RTF content part for the comparison.
verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> verifyr2::TxtFileComparator -> verifyr2::TxtWithImagesFileComparator -> RtfFileComparator
verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()verifyr2::TxtFileComparator$vrf_contents_inner()verifyr2::TxtFileComparator$vrf_details_supported()verifyr2::TxtWithImagesFileComparator$hex2raw()verifyr2::TxtWithImagesFileComparator$initialize()verifyr2::TxtWithImagesFileComparator$vrf_details_inner()verifyr2::TxtWithImagesFileComparator$vrf_summary_inner()vrf_contents()
Method for getting the single file contents for the comparison. The method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents with the rows matching the omit string excluded. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
For RtfComparator, only the RTF file content part is returned for comparison.
RtfFileComparator$vrf_contents(file, config, omit)
filefile for which to get the contents
configconfiguration values
omitstring pattern to omit from the comparison
vrf_images()
"Abstract" method for getting the raw image hex vector array from the given source file.
RtfFileComparator$vrf_images(file, config)
filefile for which to get the embedded image details
configconfiguration values
safe_read_rtf()
RTF content reading method with some fallback options to fix simple file content issues.
RtfFileComparator$safe_read_rtf(file)
filefile for which to get the embedded image details
clone()
The objects of this class are cloneable with this method.
RtfFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.rtf' file2 <- 'my_file2.rtf' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.rtf' file2 <- 'my_file2.rft' comparator <- RtfFileComparator$new(file1, file2)# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.rtf' file2 <- 'my_file2.rtf' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.rtf' file2 <- 'my_file2.rft' comparator <- RtfFileComparator$new(file1, file2)
verifyr2::run_example returns simple Shiny App where user can see how
the verifyr2 functions work
run_example(debug = FALSE)run_example(debug = FALSE)
debug |
option to override debug configuration (TRUE only) |
TextFileComparator.R
TextFileComparator.R
Fallback comparator for text files without any specific definied comparator. This comparator contains the methods for doing basic comparisons on raw text contents.
verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> TxtFileComparator
verifyr2::FileComparator$initialize()verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()verifyr2::BinaryFileComparator$vrf_contents()vrf_summary_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
TxtFileComparator$vrf_summary_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
TxtFileComparator$vrf_details_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_contents_inner()
Method for getting the inner part for the file contents query. The method returns the file contents in two separate vectors inside a list. The first vector is the file contents and the second one is the file contents processed for empty spaces and omit terms if applicable. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
TxtFileComparator$vrf_contents_inner(contents, config, omit)
contentsfile contents
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_supported()
Inherited method for indicating whether detailed comparison is available with the current comparator. Returns an empty string if the comparator is is supported, otherwise a string that will be concatenated with the summary string.
TxtFileComparator$vrf_details_supported(config)
configconfiguration values
clone()
The objects of this class are cloneable with this method.
TxtFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.
# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.txt' file2 <- 'my_file2.txt' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.lst' file2 <- 'my_file2.lst' comparator <- TxtFileComparator$new(file1, file2)# The normal way for creating a comparator would be to call the generic # factory method verifyr2::create_comparator that will automatically create # the correct comparator instance based on the file types. file1 <- 'my_file1.txt' file2 <- 'my_file2.txt' comparator <- verifyr2::create_comparator(file1, file2) # If needed, an explicit comparator can be created as well. file1 <- 'my_file1.lst' file2 <- 'my_file2.lst' comparator <- TxtFileComparator$new(file1, file2)
TxtWithImageFileComparator.R
TxtWithImageFileComparator.R
"Abstract" comparator for txt based comparator classes that can additionally contain embedded images. This abstraction level contains generic logic for handling embedded images and storing the related data.
verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> verifyr2::TxtFileComparator -> TxtWithImagesFileComparator
file1_images_rawlocal property for storing image1 raw data
file2_images_rawlocal property for storing image2 raw data
verifyr2::FileComparator$vrf_add_debug()verifyr2::FileComparator$vrf_add_debug_files()verifyr2::FileComparator$vrf_close_debug()verifyr2::FileComparator$vrf_details()verifyr2::FileComparator$vrf_open_debug()verifyr2::FileComparator$vrf_option_value()verifyr2::FileComparator$vrf_summary()verifyr2::BinaryFileComparator$vrf_contents()verifyr2::TxtFileComparator$vrf_contents_inner()verifyr2::TxtFileComparator$vrf_details_supported()new()
Initialize a TxtWithImagesFileComparator instance
TxtWithImagesFileComparator$new(file1 = NULL, file2 = NULL)
file1First file to compare.
file2Second file to compare.
vrf_summary_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
TxtWithImagesFileComparator$vrf_summary_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_details_inner()
Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.
TxtWithImagesFileComparator$vrf_details_inner(config, omit)
configconfiguration values
omitstring pattern to omit from the comparison
vrf_images()
"Abstract" method for getting the raw image hex vector array from the given source file.
TxtWithImagesFileComparator$vrf_images(file)
filefile for which to get the embedded image details
hex2raw()
Internal helper method for converting a hex string to raw vector.
TxtWithImagesFileComparator$hex2raw(hex_string)
hex_stringhexadecimal string to be converted to raw vector
clone()
The objects of this class are cloneable with this method.
TxtWithImagesFileComparator$clone(deep = FALSE)
deepWhether to make a deep clone.