Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::RWebDisplayHandle Class Reference

Handle of created web-based display Depending from type of web display, holds handle of started browser process or other display-specific information to correctly stop and cleanup display.

Definition at line 25 of file RWebDisplayHandle.hxx.

Classes

class  BrowserCreator
 
class  ChromeCreator
 
class  Creator
 !< page content More...
 
class  FirefoxCreator
 

Public Member Functions

 RWebDisplayHandle (const std::string &url)
 constructor
 
virtual ~RWebDisplayHandle ()=default
 required virtual destructor for correct cleanup at the end
 
const std::string & GetContent () const
 get content
 
const std::string & GetUrl () const
 returns url of start web display
 
virtual bool Resize (int, int)
 resize web window - if possible
 
void SetContent (const std::string &cont)
 set content
 

Static Public Member Functions

static bool CanProduceImages (const std::string &browser="")
 Returns true if image production for specified browser kind is supported If browser not specified - use currently configured browser or try to test existing web browsers.
 
static std::unique_ptr< RWebDisplayHandleDisplay (const RWebDisplayArgs &args)
 Create web display.
 
static bool DisplayUrl (const std::string &url)
 Display provided url in configured web browser.
 
static std::string GetImageFormat (const std::string &fname)
 Detect image format There is special handling of ".screenshot.pdf" and ".screenshot.png" extensions Creation of such files relies on headless browser functionality and fully supported only by Chrome browser.
 
static bool NeedHttpServer (const RWebDisplayArgs &args)
 Check if http server required for display.
 
static bool ProduceImage (const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
 Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
 
static bool ProduceImages (const std::string &fname, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
 Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
 
static bool ProduceImages (const std::vector< std::string > &fnames, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
 Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
 
static std::vector< std::string > ProduceImagesNames (const std::string &fname, unsigned nfiles=1)
 Produce vector of file names for specified file pattern Depending from supported file forma.
 

Static Protected Member Functions

static bool CheckIfCanProduceImages (RWebDisplayArgs &args)
 Checks if configured browser can be used for image production.
 
static std::unique_ptr< Creator > & FindCreator (const std::string &name, const std::string &libname="")
 Search for specific browser creator If not found, try to add one.
 
static std::map< std::string, std::unique_ptr< Creator > > & GetMap ()
 Static holder of registered creators of web displays.
 

Private Attributes

std::string fContent
 !< URL used to launch display
 
std::string fUrl
 

#include <ROOT/RWebDisplayHandle.hxx>

Inheritance diagram for ROOT::RWebDisplayHandle:
[legend]

Constructor & Destructor Documentation

◆ RWebDisplayHandle()

ROOT::RWebDisplayHandle::RWebDisplayHandle ( const std::string &  url)
inline

constructor

Definition at line 91 of file RWebDisplayHandle.hxx.

◆ ~RWebDisplayHandle()

virtual ROOT::RWebDisplayHandle::~RWebDisplayHandle ( )
virtualdefault

required virtual destructor for correct cleanup at the end

Member Function Documentation

◆ CanProduceImages()

bool RWebDisplayHandle::CanProduceImages ( const std::string &  browser = "")
static

Returns true if image production for specified browser kind is supported If browser not specified - use currently configured browser or try to test existing web browsers.

Definition at line 895 of file RWebDisplayHandle.cxx.

◆ CheckIfCanProduceImages()

bool RWebDisplayHandle::CheckIfCanProduceImages ( RWebDisplayArgs args)
staticprotected

Checks if configured browser can be used for image production.

Definition at line 838 of file RWebDisplayHandle.cxx.

◆ Display()

std::unique_ptr< RWebDisplayHandle > RWebDisplayHandle::Display ( const RWebDisplayArgs args)
static

Create web display.

Parameters
args- defines where and how to display web window Returns RWebDisplayHandle, which holds information of running browser application Can be used fully independent from RWebWindow classes just to show any web page

Definition at line 724 of file RWebDisplayHandle.cxx.

◆ DisplayUrl()

bool RWebDisplayHandle::DisplayUrl ( const std::string &  url)
static

Display provided url in configured web browser.

Parameters
url- specified URL address like https://root.cern Browser can specified when starting root --web=firefox Returns true when browser started It is convenience method, equivalent to:
args.SetUrl(url);
args.SetStandalone(false);
auto handle = RWebDisplayHandle::Display(args);
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
void SetStandalone(bool on=true)
Set standalone mode for running browser, default on When disabled, normal browser window (or just tab...
RWebDisplayArgs & SetUrl(const std::string &url)
set window url
static std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args)
Create web display.

Definition at line 824 of file RWebDisplayHandle.cxx.

◆ FindCreator()

std::unique_ptr< RWebDisplayHandle::Creator > & RWebDisplayHandle::FindCreator ( const std::string &  name,
const std::string &  libname = "" 
)
staticprotected

Search for specific browser creator If not found, try to add one.

Parameters
name- creator name like ChromeCreator
libname- shared library name where creator could be provided

Definition at line 71 of file RWebDisplayHandle.cxx.

◆ GetContent()

const std::string & ROOT::RWebDisplayHandle::GetContent ( ) const
inline

get content

Definition at line 102 of file RWebDisplayHandle.hxx.

◆ GetImageFormat()

std::string RWebDisplayHandle::GetImageFormat ( const std::string &  fname)
static

Detect image format There is special handling of ".screenshot.pdf" and ".screenshot.png" extensions Creation of such files relies on headless browser functionality and fully supported only by Chrome browser.

Definition at line 907 of file RWebDisplayHandle.cxx.

◆ GetMap()

std::map< std::string, std::unique_ptr< RWebDisplayHandle::Creator > > & RWebDisplayHandle::GetMap ( )
staticprotected

Static holder of registered creators of web displays.

Definition at line 59 of file RWebDisplayHandle.cxx.

◆ GetUrl()

const std::string & ROOT::RWebDisplayHandle::GetUrl ( ) const
inline

returns url of start web display

Definition at line 97 of file RWebDisplayHandle.hxx.

◆ NeedHttpServer()

bool RWebDisplayHandle::NeedHttpServer ( const RWebDisplayArgs args)
static

Check if http server required for display.

Parameters
args- defines where and how to display web window

Definition at line 688 of file RWebDisplayHandle.cxx.

◆ ProduceImage()

bool RWebDisplayHandle::ProduceImage ( const std::string &  fname,
const std::string &  json,
int  width = 800,
int  height = 600,
const char *  batch_file = nullptr 
)
static

Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 940 of file RWebDisplayHandle.cxx.

◆ ProduceImages() [1/2]

bool RWebDisplayHandle::ProduceImages ( const std::string &  fname,
const std::vector< std::string > &  jsons,
const std::vector< int > &  widths,
const std::vector< int > &  heights,
const char *  batch_file = nullptr 
)
static

Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 987 of file RWebDisplayHandle.cxx.

◆ ProduceImages() [2/2]

bool RWebDisplayHandle::ProduceImages ( const std::vector< std::string > &  fnames,
const std::vector< std::string > &  jsons,
const std::vector< int > &  widths,
const std::vector< int > &  heights,
const char *  batch_file = nullptr 
)
static

Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 996 of file RWebDisplayHandle.cxx.

◆ ProduceImagesNames()

std::vector< std::string > RWebDisplayHandle::ProduceImagesNames ( const std::string &  fname,
unsigned  nfiles = 1 
)
static

Produce vector of file names for specified file pattern Depending from supported file forma.

Definition at line 950 of file RWebDisplayHandle.cxx.

◆ Resize()

virtual bool ROOT::RWebDisplayHandle::Resize ( int  ,
int   
)
inlinevirtual

resize web window - if possible

Reimplemented in ROOT::RQt5WebDisplayHandle, ROOT::RQt6WebDisplayHandle, and RCefWebDisplayHandle.

Definition at line 105 of file RWebDisplayHandle.hxx.

◆ SetContent()

void ROOT::RWebDisplayHandle::SetContent ( const std::string &  cont)
inline

set content

Definition at line 100 of file RWebDisplayHandle.hxx.

Member Data Documentation

◆ fContent

std::string ROOT::RWebDisplayHandle::fContent
private

!< URL used to launch display

Definition at line 29 of file RWebDisplayHandle.hxx.

◆ fUrl

std::string ROOT::RWebDisplayHandle::fUrl
private

Definition at line 27 of file RWebDisplayHandle.hxx.

Libraries for ROOT::RWebDisplayHandle:

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