Ipelib: ipe::Platform Class Reference

Ipelib

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Static Public Member Functions | List of all members
ipe::Platform Class Reference
Ipe Base

`#include <ipebase.h>`

## Public Types
using | DebugHandler = void(*)(const char *)

## Static Public Member Functions
static FILE * | fopen (const char *fname, const char *mode)
static int | libVersion ()
static void | initLib (int version)
static void | setDebug (bool debug)
static String | currentDirectory ()
static String | latexDirectory ()
static String | latexPath ()
static bool | fileExists (String fname)
static bool | listDirectory (String path, std::vector< String > &files)
static String | readFile (String fname)
static int | runLatex (String dir, LatexType engine) noexcept
static double | toDouble (String s)

## Detailed Description

Platform dependent methods.

## Member Typedef Documentation

using ipe::Platform::DebugHandler = void (*)(const char *)

## Member Function Documentation

static FILE* ipe::Platform::fopen | ( | const char * | fname,
|  | const char * | mode
| ) |  |
| inlinestatic

Referenced by ipe::Document::exportPages(), ipe::Document::exportView(), ipe::Document::load(), readFile(), ipe::Bitmap::readJpeg(), ipe::Bitmap::readPNG(), ipe::Document::runLatex(), runLatex(), and ipe::Document::save().

int Platform::libVersion | ( |  | ) |
| static

Return the Ipelib version.

This is available as a function so that one can verify what version of Ipelib one has actually linked with (as opposed to the header files used during compilation).

References ipe::Repository::cleanup(), ipe::String::empty(), ipe::String::getLine(), ipe::IPELIB_VERSION, readFile(), ipe::String::size(), and ipe::String::z().

void Platform::initLib | ( | int | version | ) |
| static

Initialize Ipelib.

This method must be called before Ipelib is used.

It creates a LC_NUMERIC locale set to 'C', which is necessary for correct loading and saving of Ipe objects. The method also checks that the correct version of Ipelib is loaded, and aborts with an error message if the version is not correct. Also enables ipeDebug messages if environment variable IPEDEBUG is defined. (You can override this using setDebug).

References ipe::IPELIB_VERSION.

void Platform::setDebug | ( | bool | debug | ) |
| static

Enable or disable display of ipeDebug messages.

String Platform::currentDirectory | ( |  | ) |
| static

Returns current working directory.

Returns empty string if something fails.

References fileExists(), ipe::String::left(), ipe::String::rfind(), and ipe::String::z().

String Platform::latexDirectory | ( |  | ) |
| static

Returns directory for running Latex.

The directory is created if it does not exist. Returns an empty string if the directory cannot be found or cannot be created. The directory returned ends in the path separator.

References fileExists(), ipe::String::left(), ipe::String::right(), ipe::String::size(), and ipe::String::z().

Referenced by ipe::Document::runLatex().

String Platform::latexPath | ( |  | ) |
| static

Return path for the directory containing pdflatex and xelatex.

If empty means look on PATH.

Referenced by runLatex().

bool Platform::fileExists | ( | String | fname | ) |
| static

Determine whether file exists.

References ipe::String::z().

Referenced by currentDirectory(), and latexDirectory().

bool Platform::listDirectory | ( | String | path,
|  | std::vector< String > & | files
| ) |  |
| static

List all files in directory.

Return true if successful, false on error.

References ipe::String::z().

String Platform::readFile | ( | String | fname | ) |
| static

Read entire file into string.

Returns an empty string if file cannot be found or read. There is no way to distinguish an empty file from this.

References ipe::String::append(), fopen(), and ipe::String::z().

Referenced by libVersion(), ipe::Bitmap::readJpeg(), and ipe::Document::runLatex().

int Platform::runLatex | ( | String | dir,
|  | LatexType | engine
| ) |  |
| staticnoexcept

Runs latex on file text.tex in given directory.

References ipe::String::empty(), fopen(), latexPath(), ipe::Luatex, ipe::String::String(), ipe::String::substr(), ipe::Xetex, and ipe::String::z().

Referenced by ipe::Document::runLatex().

double Platform::toDouble | ( | String | s | ) |
| static

References ipe::String::z().

Referenced by ipe::Lex::getDouble(), ipe::PdfParser::getObject(), and ipe::PdfParser::getToken().

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

- ipebase.h
- ipeplatform.cpp