libqalculate  3.1.0 About: libqalculate is a library for qalculate (desktop calculator).  Fossies Dox: libqalculate-3.1.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)

### Some Fossies usage hints in advance:

1. To see the Doxygen generated documentation please click on one of the items in the "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies libqalculate-3.1.0.tar.gz contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).
Index

# Introduction

libqalculate is math libary for expression evaluation with units, variables and functions support and CAS functionality.

The main parts of the library is the almighty Calculator class, the MathStructure class for mathematical expressions and classes for objects in an expression, mostly of the class Numbers and sub classes of ExpressionItem.

A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.), and calculate (and output) an expression as follows:

new Calculator();
cout << CALCULATOR->calculateAndPrint("1 + 1", 2000) << endl;

In the above example, the calculation is terminated after two seconds (2000 ms), if it is not finished before then. Applications using localized numbers should first call Calculalor::unlocalizeExpression() on the expression.

A less simple application might calculate and output the expression separately.

CALCULATOR->calculate(&mstruct, unlocalizeExpression("1 + 1"), 2000, eo);

More complex usage mainly involves manipulating objects of the MathStructure class directly.

To display the resulting expression use Calculator::print() as follows:

string result_str = CALCULATOR->print(result, 2000, po);

Alternatively MathStructure::format() followed by MathStructure::print() can be used, whithout the possiblity to specify a time limit.

Central to the flexiblity of libqalculate is the many options passed to evaluating and display functions with EvaluationOptions and PrintOptions.

# Using the library

libqalculate uses pkg-config.

For a simple program use pkg-config on the command line:

c++ pkg-config --cflags --libs libqalculate hello.c -o hello

If the program uses autoconf, put the following in configure.ac:

PKG_CHECK_MODULES(QALCULATE, [
libqalculate >= 1.0.0
])
AC_SUBST(QALCULATE_CFLAGS)
AC_SUBST(QALCULATE_LIBS)
EvaluationOptions
Options for calculation.
Definition: includes.h:647
Calculator
The almighty calculator class.
Definition: Calculator.h:213
CALCULATOR
#define CALCULATOR
Definition: includes.h:718
PrintOptions
Options for formatting and display of mathematical structures/results.
Definition: includes.h:388
mstruct
MathStructure * mstruct
Definition: qalc.cc:41
MathStructure
A structure representing a mathematical value/expression/result.
Definition: MathStructure.h:143