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

Go to the source code of this file.

Functions

void updateNewLine (PLatexObj &obj)
 Update the new lines to ensure there are new two following. More...
 
void updateNewLineBase (PLatexObj &obj, bool &isPrevNewLine)
 Update the new lines to ensure there are new two following. More...
 

Function Documentation

◆ updateNewLine()

void updateNewLine ( PLatexObj obj)

Update the new lines to ensure there are new two following.

Parameters
[out]obj: PLatexObj to be updated

Definition at line 37 of file update_newLine.cpp.

37  {
38  bool isPrevNewLine(false);
39  updateNewLineBase(obj, isPrevNewLine);
40 }
void updateNewLineBase(PLatexObj &obj, bool &isPrevNewLine)
Update the new lines to ensure there are new two following.

References updateNewLineBase().

Referenced by processAllFile().

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

◆ updateNewLineBase()

void updateNewLineBase ( PLatexObj obj,
bool &  isPrevNewLine 
)

Update the new lines to ensure there are new two following.

Parameters
[out]obj: PLatexObj to be updated
[out]isPrevNewLine: true if the previous PLatexObj was a new line too

Definition at line 14 of file update_newLine.cpp.

14  {
15  isPrevNewLine = isNewLine(obj);
16  PVecLatexObj & vecObj = obj.getVecContent();
17  PVecLatexObj::iterator it(vecObj.begin());
18  while(it != vecObj.end()){
19  if(isNewLine(*it)){
20  if(isPrevNewLine){ //We remove the current new line because there is one before
21  it = vecObj.erase(it);
22  }else{
23  ++it;
24  }
25  isPrevNewLine = true;
26  }else{
27  isPrevNewLine = false; //Ok for clarity but useless for computing
28  updateNewLineBase(*it, isPrevNewLine);
29  ++it;
30  }
31  }
32 }
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
bool isNewLine(const PLatexObj &obj)
Say if the PLatexObj is a newline or not.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.

References PLatexObj::getVecContent(), and isNewLine().

Referenced by updateNewLine().

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