PhoenixLecture  2.0.0
Set of tools to make lectures
update_wip.cpp File Reference
#include "update_wip.h"
+ Include dependency graph for update_wip.cpp:

Go to the source code of this file.

Functions

bool updateSectionWip (PLatexObj &obj)
 Update the wip of a obj and say if there was a WIP inside or not. More...
 
bool updateVecContent (const PVecLatexObj &vecContent)
 Check in a vector of latex objects if there is a wip. More...
 
void updateWip (PLatexObj &obj)
 Update the Part/Chapter/Section/etc if they contains a work in progress. More...
 

Function Documentation

◆ updateSectionWip()

bool updateSectionWip ( PLatexObj obj)

Update the wip of a obj and say if there was a WIP inside or not.

Parameters
[out]obj: PLatexObj to be updated
Returns
true if the section contains a wip

Definition at line 30 of file update_wip.cpp.

30  {
31  bool hasWip(false);
32  PVecLatexObj & vecObj = obj.getVecContent();
33  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
34  if(isSection(*it)){
35  hasWip |= updateSectionWip(*it);
36  }else if(it->getType() == PLatexType::WORK_IN_PROGRESS){
37  hasWip = true;
38  }else{
39  if(it->getVecContent().size() != 0lu){ //If the content contains sub latex
40  hasWip |= updateVecContent(it->getVecContent());
41  }
42  }
43  }
44  if(isSection(obj)){
45  obj.setIsWorkInProgress(hasWip);
46  if(hasWip){
47  PLatexObj wipObj;
48  wipObj.setType(PLatexType::TEXT);
49  wipObj.setText(" (WIP)");
50  obj.getComplexTitle().push_back(wipObj);
51  }
52  }
53  return hasWip;
54 }
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 setIsWorkInProgress(bool isWorkInProgress)
Sets the isWorkInProgress of the PLatexObj.
Definition: PLatexObj.cpp:263
const std::vector< PLatexObj > & getComplexTitle() const
Gets the complexTitle of the PLatexObj.
Definition: PLatexObj.cpp:396
void setType(const PLatexType::PLatexType &type)
Sets the type of the PLatexObj.
Definition: PLatexObj.cpp:130
void setText(const PString &text)
Sets the text of the PLatexObj.
Definition: PLatexObj.cpp:137
@ WORK_IN_PROGRESS
Definition: PLatexType.h:32
bool isSection(const PLatexObj &obj)
Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
bool updateVecContent(const PVecLatexObj &vecContent)
Check in a vector of latex objects if there is a wip.
Definition: update_wip.cpp:14
bool updateSectionWip(PLatexObj &obj)
Update the wip of a obj and say if there was a WIP inside or not.
Definition: update_wip.cpp:30

References PLatexObj::getComplexTitle(), PLatexObj::getVecContent(), isSection(), PLatexObj::setIsWorkInProgress(), PLatexObj::setText(), PLatexObj::setType(), PLatexType::TEXT, updateVecContent(), and PLatexType::WORK_IN_PROGRESS.

Referenced by updateWip().

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

◆ updateVecContent()

bool updateVecContent ( const PVecLatexObj vecContent)

Check in a vector of latex objects if there is a wip.

Parameters
vecContent: vector of latex objects
Returns
true if the vector of content contains a wip

Definition at line 14 of file update_wip.cpp.

14  {
15  bool hasWip(false);
16  for(PVecLatexObj::const_iterator it(vecContent.begin()); it != vecContent.end(); ++it){
17  if(it->getType() == PLatexType::WORK_IN_PROGRESS){
18  hasWip = true;
19  }else if(it->getVecContent().size() != 0lu){
20  hasWip |= updateVecContent(it->getVecContent());
21  }
22  }
23  return hasWip;
24 }

References PLatexType::WORK_IN_PROGRESS.

Referenced by updateSectionWip().

+ Here is the caller graph for this function:

◆ updateWip()

void updateWip ( PLatexObj obj)

Update the Part/Chapter/Section/etc if they contains a work in progress.

Parameters
[out]obj: PLatexObj to be updated

Definition at line 59 of file update_wip.cpp.

59  {
60  PVecLatexObj & vecObj = obj.getVecContent();
61  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
62  if(isSection(*it)){
63  updateSectionWip(*it);
64  }
65  }
66 }

References PLatexObj::getVecContent(), isSection(), and updateSectionWip().

Referenced by processAllFile().

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