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

#include <ipebase.h>

Public Types

typedef void(* DebugHandler )(const char *)
 

Static Public Member Functions

static int libVersion ()
 
static void initLib (int version)
 
static void setDebug (bool debug)
 
static char pathSeparator ()
 
static String currentDirectory ()
 
static String latexDirectory ()
 
static String fontmapFile ()
 
static bool fileExists (String fname)
 
static String readFile (String fname)
 
static int runPdfLatex (String dir)
 

Detailed Description

Platform dependent methods.

Member Typedef Documentation

typedef void(* ipe::Platform::DebugHandler)(const char *)

Member Function Documentation

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::IPELIB_VERSION.

void Platform::initLib ( int  version)
static

Initialize Ipelib.

This method must be called before Ipelib is used.

It sets the LC_NUMERIC locale 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.

char Platform::pathSeparator ( )
static

Return correct path separator for this platform.

String Platform::currentDirectory ( )
static

Returns current working directory.

Returns empty string if something fails.

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::fontmapFile ( )
static

Returns filename of fontmap.

bool Platform::fileExists ( String  fname)
static

Determine whether file exists.

References ipe::String::z().

Referenced by latexDirectory().

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(), and ipe::String::z().

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

int Platform::runPdfLatex ( String  dir)
static

Runs pdflatex on file text.tex in given directory.

References ipe::Lex::getInt(), ipe::String::size(), ipe::String::substr(), and ipe::String::z().

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


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