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

#include <tsjsonOutputArgs.h>

Public Member Functions

 OutputArgs (Report *report)
virtual ~OutputArgs ()
void defineArgs (Args &args, bool use_short_opt, const UString &description, bool allow_file=true)
bool loadArgs (Args &args)
bool report (const json::Value &root, const fs::path &file_name, Report &rep)
bool report (const json::Value &root, json::RunningDocument &doc, Report &rep)
bool report (const json::Value &root, Report &rep)
bool report (const json::Value &root, std::ostream &stm, Report &rep)
bool useFile () const
bool useJSON () const

Detailed Description

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

Constructor & Destructor Documentation

◆ OutputArgs()

ts::json::OutputArgs::OutputArgs ( Report * report)
explicit

Constructor.

Parameters
[in]reportWhere to report errors. The report object must remain valid as long as this object exists. If report is null, log messages are discarded.

◆ ~OutputArgs()

virtual ts::json::OutputArgs::~OutputArgs ( )
virtual

Virtual destructor.

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 ( Args & args)

Load arguments from command line. Args error indicator is set in case of incorrect arguments.

Parameters
[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/4]

bool ts::json::OutputArgs::report ( const json::Value & root,
const fs::path & file_name,
Report & rep )

Issue a JSON report according to options.

Parameters
[in]rootJSON root object.
[in]file_nameOutput file name when --json is specified. If the specified file is empty or "-", use the standard output.
[in]repLogger to report errors or output one-line JSON when --json-line is specified.
Returns
True on success, false on error.

◆ report() [2/4]

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() [3/4]

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() [4/4]

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: