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

Command line arguments for JSON reports (--json, --json-line, --json-udp, --json-tcp). More...

#include <tsjsonOutputArgs.h>

Public Member Functions

 OutputArgs ()=default
 Default constructor.
 
virtual ~OutputArgs ()
 Virtual destructor.
 
void defineArgs (Args &args, bool use_short_opt, const UString &description, bool allow_file=true)
 Add command line option definitions in an Args.
 
bool loadArgs (DuckContext &duck, Args &args)
 Load arguments from command line.
 
bool report (const json::Value &root, json::RunningDocument &doc, Report &rep)
 Issue a JSON report according to options.
 
bool report (const json::Value &root, Report &rep)
 Issue a JSON report according to options (assuming --json is not specified for output files).
 
bool report (const json::Value &root, std::ostream &stm, Report &rep)
 Issue a JSON report according to options.
 
bool useFile () const
 Check if JSON file output option is specified.
 
bool useJSON () const
 Check if any JSON output option is specified.
 

Detailed Description

Command line arguments for JSON reports (--json, --json-line, --json-udp, --json-tcp).

Member Function Documentation

◆ defineArgs()

void ts::json::OutputArgs::defineArgs ( Args args,
bool  use_short_opt,
const UString description,
bool  allow_file = true 
)

Add command line option definitions in an Args.

Parameters
[in,out]argsCommand line arguments to update.
[in]use_short_optDefine 'j' as short option for --json. Ignored if allow_file is false.
[in]descriptionDescription of the JSON information. Also used as help text for option --json.
[in]allow_fileIf false, the option --json is not defined, only log and network options are defined.

◆ loadArgs()

bool ts::json::OutputArgs::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.

◆ useJSON()

bool ts::json::OutputArgs::useJSON ( ) const
inline

Check if any JSON output option is specified.

Returns
True if any JSON output option is specified.

◆ useFile()

bool ts::json::OutputArgs::useFile ( ) const
inline

Check if JSON file output option is specified.

Returns
True if JSON file output option is specified.

◆ report() [1/3]

bool ts::json::OutputArgs::report ( const json::Value root,
std::ostream &  stm,
Report rep 
)

Issue a JSON report according to options.

Parameters
[in]rootJSON root object.
[in]stmOutput stream when --json is specified.
[in]repLogger to report errors or output one-line JSON when --json-line is specified.
Returns
True on success, false on error.

◆ report() [2/3]

bool ts::json::OutputArgs::report ( const json::Value root,
json::RunningDocument doc,
Report rep 
)

Issue a JSON report according to options.

Parameters
[in]rootJSON root object.
[in]docOutput running document when --json is specified.
[in]repLogger to report errors or output one-line JSON when --json-line is specified.
Returns
True on success, false on error.

◆ report() [3/3]

bool ts::json::OutputArgs::report ( const json::Value root,
Report rep 
)

Issue a JSON report according to options (assuming --json is not specified for output files).

Parameters
[in]rootJSON root object.
[in]repLogger to report errors or output one-line JSON when --json-line is specified.
Returns
True on success, false on error.

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