Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::API::NotebookWriter Class Reference

#include <NotebookWriter.h>

Public Member Functions

std::string codeCell (const std::string &string_code)
 Add a code cell to the buffer of cells to write to the notebook. More...
 
std::string markdownCell (const std::string &string_text)
 Add a markdown cell to the buffer of cells to write to the notebook. More...
 
 NotebookWriter ()
 
std::string writeNotebook ()
 Create a formatted string of Json which describes a notebook. More...
 
virtual ~NotebookWriter ()=default
 

Private Member Functions

Json::Value buildNotebook ()
 Create a Json value containing the whole notebook. More...
 
void codeCell (Json::Value array_code)
 Add a code cell to the buffer of cells to write to the notebook. More...
 
void headerCode ()
 Add code cells to the buffer of cells to write to the notebook These are to import Mantid and matplotlib, and to warn the user if the version of Mantid being used does not match the version which generated the notebook. More...
 
void headerComment ()
 Add a markdown cell of information for the user to the buffer of cells to write to the notebook. More...
 
void markdownCell (Json::Value string_array)
 Add a markdown cell to the buffer of cells to write to the notebook. More...
 

Private Attributes

Json::Value m_cell_buffer
 

Detailed Description

Definition at line 22 of file NotebookWriter.h.

Constructor & Destructor Documentation

◆ NotebookWriter()

NotebookWriter::NotebookWriter ( )

Definition at line 20 of file NotebookWriter.cpp.

References headerCode(), and headerComment().

◆ ~NotebookWriter()

virtual Mantid::API::NotebookWriter::~NotebookWriter ( )
virtualdefault

Member Function Documentation

◆ buildNotebook()

Json::Value NotebookWriter::buildNotebook ( )
private

Create a Json value containing the whole notebook.

Returns
a Json value containing the whole notebook

Definition at line 147 of file NotebookWriter.cpp.

References m_cell_buffer.

Referenced by writeNotebook().

◆ codeCell() [1/2]

std::string NotebookWriter::codeCell ( const std::string &  string_code)

Add a code cell to the buffer of cells to write to the notebook.

Parameters
string_code:: string containing the python for the code cell

Definition at line 51 of file NotebookWriter.cpp.

References m_cell_buffer.

Referenced by headerCode().

◆ codeCell() [2/2]

void NotebookWriter::codeCell ( Json::Value  array_code)
private

Add a code cell to the buffer of cells to write to the notebook.

Parameters
array_code:: Json array of strings containing python code for the code cell

Definition at line 32 of file NotebookWriter.cpp.

References m_cell_buffer.

◆ headerCode()

void NotebookWriter::headerCode ( )
private

Add code cells to the buffer of cells to write to the notebook These are to import Mantid and matplotlib, and to warn the user if the version of Mantid being used does not match the version which generated the notebook.

Definition at line 129 of file NotebookWriter.cpp.

References codeCell().

Referenced by NotebookWriter().

◆ headerComment()

void NotebookWriter::headerComment ( )
private

Add a markdown cell of information for the user to the buffer of cells to write to the notebook.

Definition at line 104 of file NotebookWriter.cpp.

References markdownCell(), Mantid::Kernel::MantidVersion::releaseNotes(), and Mantid::Kernel::MantidVersion::version().

Referenced by NotebookWriter().

◆ markdownCell() [1/2]

std::string NotebookWriter::markdownCell ( const std::string &  string_text)

Add a markdown cell to the buffer of cells to write to the notebook.

Parameters
string_text:: string containing the python code for the code cell

Definition at line 88 of file NotebookWriter.cpp.

References m_cell_buffer.

Referenced by headerComment().

◆ markdownCell() [2/2]

void NotebookWriter::markdownCell ( Json::Value  string_array)
private

Add a markdown cell to the buffer of cells to write to the notebook.

Parameters
string_array:: json array of strings containing the python code for the code cell

Definition at line 72 of file NotebookWriter.cpp.

References m_cell_buffer.

◆ writeNotebook()

std::string NotebookWriter::writeNotebook ( )

Create a formatted string of Json which describes a notebook.

Returns
a formatted string of the Json which describes the whole notebook

Definition at line 173 of file NotebookWriter.cpp.

References buildNotebook().

Member Data Documentation

◆ m_cell_buffer

Json::Value Mantid::API::NotebookWriter::m_cell_buffer
private

Definition at line 40 of file NotebookWriter.h.

Referenced by buildNotebook(), codeCell(), and markdownCell().


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