Doxygen
Loading...
Searching...
No Matches
formula.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2022 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#ifndef FORMULA_H
17
#define FORMULA_H
18
19
#include <memory>
20
#include <string>
21
22
#include "
qcstring.h
"
23
#include "
containers.h
"
24
25
class
Dir
;
26
27
/** Class representing a LaTeX formula as found in the documentation */
28
class
Formula
29
{
30
public
:
31
Formula
(
const
QCString
&
text
,
int
id
,
int
width
=-1,
int
height
=-1)
32
:
m_text
(
text
),
m_id
(
id
),
m_width
(
width
),
m_height
(
height
) {}
33
34
int
width
()
const
{
return
m_width
; }
35
int
height
()
const
{
return
m_height
; }
36
int
id
()
const
{
return
m_id
; }
37
QCString
text
()
const
{
return
m_text
; }
38
bool
isCached
()
const
{
return
m_cached
&& !
m_forceRegen
; }
39
bool
isCachedDark
()
const
{
return
m_cached
&& !
m_forceRegen
; }
40
void
setWidth
(
int
width
) {
m_width
=
width
; }
41
void
setHeight
(
int
height
) {
m_height
=
height
; }
42
43
private
:
44
friend
class
FormulaManager
;
45
void
setCached
(
bool
cached) {
m_cached
= cached;
m_forceRegen
=
m_forceRegen
|| !cached; }
46
void
setCachedDark
(
bool
cached) {
m_cachedDark
= cached;
m_forceRegen
=
m_forceRegen
|| !cached; }
47
48
QCString
m_text
;
49
int
m_id
;
50
int
m_width
;
51
int
m_height
;
52
bool
m_cached
=
false
;
53
bool
m_cachedDark
=
false
;
// dark version cached?
54
bool
m_forceRegen
=
false
;
// true if there is an inconsistency in setCache calls
55
};
56
57
/*! Manager class to handle formulas */
58
class
FormulaManager
59
{
60
public
:
61
static
FormulaManager
&
instance
();
62
63
//! @name repository functions
64
//! @{
65
void
initFromRepository
(
const
QCString
&dir);
66
void
checkRepositories
();
67
//! @}
68
69
//! @name formula functions
70
//! @{
71
void
clear
();
72
int
addFormula
(
const
std::string &formulaText,
int
width=-1,
int
height=-1);
73
const
Formula
*
findFormula
(
int
formulaId)
const
;
74
bool
hasFormulas
()
const
;
75
//! @}
76
77
//! @name generator functions
78
//! @{
79
enum class
Format
{
Bitmap
,
Vector
};
80
enum class
HighDPI
{
On
,
Off
};
81
enum class
Mode
{
Dark
,
Light
};
82
void
generateImages
(
const
QCString
&outputDir,
Format
format,
HighDPI
hd =
HighDPI::Off
);
83
//! @}
84
85
private
:
86
void
createFormulasTexFile
(
Dir
&d,
Format
format,
HighDPI
hd,
Mode
mode);
87
void
createLatexFile
(
const
QCString
&fileName,
Format
format,
Mode
mode,
IntVector
&formulasToGenerate);
88
FormulaManager
();
89
struct
Private
;
90
std::unique_ptr<Private>
p
;
91
};
92
93
#endif
Dir
Class representing a directory in the file system.
Definition
dir.h:75
Formula
Class representing a LaTeX formula as found in the documentation.
Definition
formula.h:29
Formula::isCachedDark
bool isCachedDark() const
Definition
formula.h:39
Formula::m_cached
bool m_cached
Definition
formula.h:52
Formula::width
int width() const
Definition
formula.h:34
Formula::isCached
bool isCached() const
Definition
formula.h:38
Formula::setCachedDark
void setCachedDark(bool cached)
Definition
formula.h:46
Formula::m_height
int m_height
Definition
formula.h:51
Formula::text
QCString text() const
Definition
formula.h:37
Formula::m_width
int m_width
Definition
formula.h:50
Formula::m_cachedDark
bool m_cachedDark
Definition
formula.h:53
Formula::FormulaManager
friend class FormulaManager
Definition
formula.h:44
Formula::m_text
QCString m_text
Definition
formula.h:48
Formula::setHeight
void setHeight(int height)
Definition
formula.h:41
Formula::setCached
void setCached(bool cached)
Definition
formula.h:45
Formula::height
int height() const
Definition
formula.h:35
Formula::Formula
Formula(const QCString &text, int id, int width=-1, int height=-1)
Definition
formula.h:31
Formula::setWidth
void setWidth(int width)
Definition
formula.h:40
Formula::m_forceRegen
bool m_forceRegen
Definition
formula.h:54
Formula::id
int id() const
Definition
formula.h:36
Formula::m_id
int m_id
Definition
formula.h:49
FormulaManager::createLatexFile
void createLatexFile(const QCString &fileName, Format format, Mode mode, IntVector &formulasToGenerate)
Definition
formula.cpp:184
FormulaManager::initFromRepository
void initFromRepository(const QCString &dir)
Definition
formula.cpp:60
FormulaManager::FormulaManager
FormulaManager()
Definition
formula.cpp:50
FormulaManager::addFormula
int addFormula(const std::string &formulaText, int width=-1, int height=-1)
Definition
formula.cpp:691
FormulaManager::Mode
Mode
Definition
formula.h:81
FormulaManager::Mode::Light
@ Light
Definition
formula.h:81
FormulaManager::Mode::Dark
@ Dark
Definition
formula.h:81
FormulaManager::hasFormulas
bool hasFormulas() const
Definition
formula.cpp:720
FormulaManager::clear
void clear()
Definition
formula.cpp:685
FormulaManager::checkRepositories
void checkRepositories()
Definition
formula.cpp:173
FormulaManager::findFormula
const Formula * findFormula(int formulaId) const
Definition
formula.cpp:705
FormulaManager::Format
Format
Definition
formula.h:79
FormulaManager::Format::Vector
@ Vector
Definition
formula.h:79
FormulaManager::Format::Bitmap
@ Bitmap
Definition
formula.h:79
FormulaManager::createFormulasTexFile
void createFormulasTexFile(Dir &d, Format format, HighDPI hd, Mode mode)
Definition
formula.cpp:553
FormulaManager::instance
static FormulaManager & instance()
Definition
formula.cpp:54
FormulaManager::p
std::unique_ptr< Private > p
Definition
formula.h:90
FormulaManager::HighDPI
HighDPI
Definition
formula.h:80
FormulaManager::HighDPI::On
@ On
Definition
formula.h:80
FormulaManager::HighDPI::Off
@ Off
Definition
formula.h:80
FormulaManager::generateImages
void generateImages(const QCString &outputDir, Format format, HighDPI hd=HighDPI::Off)
Definition
formula.cpp:636
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
containers.h
IntVector
std::vector< int > IntVector
Definition
containers.h:38
qcstring.h
Protection::Private
@ Private
Definition
types.h:26
src
formula.h
Generated by
1.13.0