PhoenixLecture  2.0.0
Set of tools to make lectures
updateFigureNumber.h File Reference
#include "platexobj_utils.h"
+ Include dependency graph for updateFigureNumber.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void updateFigureNumber (PLatexObj &obj)
 Update all the figure number of the given PLatexObj. More...
 
void updateFigureNumberCaption (PLatexObj &obj, const PString &prefix, size_t &figNumber)
 Update all the figure number of the given PLatexObj. More...
 
void updateFigureNumberFig (PLatexObj &obj, PLatexType::PLatexType figType, const PString &prefix, size_t &figNumber)
 Update all the figure number of the given PLatexObj. More...
 

Function Documentation

◆ updateFigureNumber()

void updateFigureNumber ( PLatexObj obj)

Update all the figure number of the given PLatexObj.

Parameters
[out]obj: PLatexObj where the figure number have to be updated

Definition at line 66 of file updateFigureNumber.cpp.

66  {
67  size_t figNumber(1lu);
68  updateFigureNumberFig(obj, PLatexType::FIGURE, "Figure", figNumber);
69  size_t tabNumber(1lu);
70  updateFigureNumberFig(obj, PLatexType::TABLE, "Table", tabNumber);
71 }
void updateFigureNumberFig(PLatexObj &obj, PLatexType::PLatexType figType, const PString &prefix, size_t &figNumber)
Update all the figure number of the given PLatexObj.

References PLatexType::FIGURE, PLatexType::TABLE, and updateFigureNumberFig().

Referenced by processAllFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFigureNumberCaption()

void updateFigureNumberCaption ( PLatexObj obj,
const PString prefix,
size_t &  figNumber 
)

Update all the figure number of the given PLatexObj.

Parameters
[out]obj: PLatexObj where the figure number have to be updated
prefix: prefix of the table or figure
[out]figNumber: figure number of the current figure

Definition at line 15 of file updateFigureNumber.cpp.

15  {
16  if(obj.getType() == PLatexType::CAPTION){ //We find a caption
17  //We update it
18  PLatexObj objFigNumber;
19  objFigNumber.setType(PLatexType::TEXTBF);
20  //TODO : update set name to setVecContent when TEXTBF backend will use also vecContent
21  objFigNumber.setName(prefix+ " " + valueToString(figNumber) + " : ");
22 
23  obj.setName(valueToString(figNumber));
24 
25  PVecLatexObj vecUpdateObj;
26  vecUpdateObj.push_back(objFigNumber);
27 
28  PVecLatexObj & vecObj = obj.getVecContent(); //Content of the current caption
29  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
30  vecUpdateObj.push_back(*it);
31  }
32  obj.setVecContent(vecUpdateObj); //Update the content of CAPTION
33  ++figNumber; //Update the figure number
34  }else{
35  PVecLatexObj & vecObj = obj.getVecContent();
36  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
37  updateFigureNumberCaption(*it, prefix, figNumber);
38  }
39  }
40 }
Describe a latex object.
Definition: PLatexObj.h:40
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
void setVecContent(const std::vector< PLatexObj > &vecContent)
Sets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:186
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298
void setName(const PString &name)
Sets the name of the PLatexObj.
Definition: PLatexObj.cpp:144
void setType(const PLatexType::PLatexType &type)
Sets the type of the PLatexObj.
Definition: PLatexObj.cpp:130
std::string valueToString(const T &val)
Convert a type into a string.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
void updateFigureNumberCaption(PLatexObj &obj, const PString &prefix, size_t &figNumber)
Update all the figure number of the given PLatexObj.

References PLatexType::CAPTION, PLatexObj::getType(), PLatexObj::getVecContent(), PLatexObj::setName(), PLatexObj::setType(), PLatexObj::setVecContent(), PLatexType::TEXTBF, and valueToString().

Referenced by updateFigureNumberFig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFigureNumberFig()

void updateFigureNumberFig ( PLatexObj obj,
PLatexType::PLatexType  figType,
const PString prefix,
size_t &  figNumber 
)

Update all the figure number of the given PLatexObj.

Parameters
[out]obj: PLatexObj where the figure number have to be updated
[out]figType: type of the figure to take account (FIGURE, TABLE)
prefix: prefix of the table or figure
[out]figNumber: figure number of the current figure

Definition at line 48 of file updateFigureNumber.cpp.

48  {
49  if(obj.getType() == figType){ //We find a figure
50  //Searching for a caption in the figure, and update it
51  PVecLatexObj & vecObj = obj.getVecContent();
52  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
53  updateFigureNumberCaption(*it, prefix, figNumber);
54  }
55  }else{
56  PVecLatexObj & vecObj = obj.getVecContent();
57  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
58  updateFigureNumberFig(*it, figType, prefix, figNumber);
59  }
60  }
61 }

References PLatexObj::getType(), PLatexObj::getVecContent(), and updateFigureNumberCaption().

Referenced by updateFigureNumber().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: