TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::TablePatchXML Class Reference

Implementation of on-the-fly table patching using XML. More...

#include <tsTablePatchXML.h>

Public Member Functions

 TablePatchXML (DuckContext &duck)
 Constructor.
 
void addPatchFileName (const UString &filename)
 Add a file name in the list of patch files.
 
void addPatchFileNames (const UStringList &filenames)
 Add file names in the list of patch files.
 
void addPatchFileNames (const UStringVector &filenames)
 Add file names in the list of patch files.
 
bool applyPatches (BinaryTable &table) const
 Apply the XML patch files to a binary table.
 
bool applyPatches (SectionPtr &section) const
 Apply the XML patch files to a binary section.
 
void applyPatches (xml::Document &doc) const
 Apply the XML patch files to an XML document.
 
void clear ()
 Clear all previously loaded patch files, clear list of patch files.
 
void defineArgs (Args &args)
 Add command line option definitions in an Args.
 
bool hasPatchFiles () const
 Check if there is some patch to apply.
 
bool loadArgs (DuckContext &duck, Args &args)
 Load arguments from command line.
 
bool loadPatchFiles (const xml::Tweaks &tweaks=xml::Tweaks())
 Load (or reload) the XML patch files.
 

Detailed Description

Implementation of on-the-fly table patching using XML.

This class is typically used to handle --patch-xml command line options.

Constructor & Destructor Documentation

◆ TablePatchXML()

ts::TablePatchXML::TablePatchXML ( DuckContext duck)
inline

Constructor.

Parameters
[in,out]duckTSDuck execution context.

Member Function Documentation

◆ defineArgs()

void ts::TablePatchXML::defineArgs ( Args args)

Add command line option definitions in an Args.

Parameters
[in,out]argsCommand line arguments to update.

◆ loadArgs()

bool ts::TablePatchXML::loadArgs ( DuckContext duck,
Args args 
)

Load arguments from command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]duckTSDuck execution context.
[in,out]argsCommand line arguments.
Returns
True on success, false on error in argument line.

◆ hasPatchFiles()

bool ts::TablePatchXML::hasPatchFiles ( ) const
inline

Check if there is some patch to apply.

When false, no patch file was specified or loaded.

Returns
True if there is some patch to apply.

◆ addPatchFileName()

void ts::TablePatchXML::addPatchFileName ( const UString filename)

Add a file name in the list of patch files.

The file is not yet loaded.

Parameters
[in]filenameName of an XML patch file.

◆ addPatchFileNames() [1/2]

void ts::TablePatchXML::addPatchFileNames ( const UStringVector filenames)

Add file names in the list of patch files.

The files are not yet loaded.

Parameters
[in]filenamesNames of XML patch files. If a file name starts with "<?xml", this is considered as "inline XML content".

◆ addPatchFileNames() [2/2]

void ts::TablePatchXML::addPatchFileNames ( const UStringList filenames)

Add file names in the list of patch files.

The files are not yet loaded.

Parameters
[in]filenamesNames of XML patch files. If a file name starts with "<?xml", this is considered as "inline XML content".

◆ loadPatchFiles()

bool ts::TablePatchXML::loadPatchFiles ( const xml::Tweaks tweaks = xml::Tweaks())

Load (or reload) the XML patch files.

Parameters
[in]tweaksXML tweaks to load in the documents.
Returns
True on success, false some error occurred in the input files.

◆ applyPatches() [1/3]

void ts::TablePatchXML::applyPatches ( xml::Document doc) const

Apply the XML patch files to an XML document.

Parameters
[in,out]docThe XML document to patch.

◆ applyPatches() [2/3]

bool ts::TablePatchXML::applyPatches ( BinaryTable table) const

Apply the XML patch files to a binary table.

Parameters
[in,out]tableThe binary table to patch.
Returns
True on success, false if the binary table or the patched XML is invalid. If the patch file deletes the table, then the returned value if true and the table is marked as invalid.

◆ applyPatches() [3/3]

bool ts::TablePatchXML::applyPatches ( SectionPtr section) const

Apply the XML patch files to a binary section.

This is a special processing since XML files are supposed to represent complete tables. The section is considered as section 0/0 of a complete table. The patch is applied on that table and the first section of the patched table is returned. Specific parts of the section are preserved, such as section number or last section number.

Parameters
[in,out]sectionSafe pointer to the section to patch. The pointer is modified, pointing to a new section content.
Returns
True on success, false if the binary section or the patched XML is invalid. If the patch file deletes the table, then the returned value if true and section is null.

The documentation for this class was generated from the following file: