PhoenixLecture  2.0.0
Set of tools to make lectures
update_newLine.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 
8 #include "update_newLine.h"
9 
11 
14 void updateNewLineBase(PLatexObj & obj, bool & isPrevNewLine){
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 }
33 
35 
38  bool isPrevNewLine(false);
39  updateNewLineBase(obj, isPrevNewLine);
40 }
41 
42 
Describe a latex object.
Definition: PLatexObj.h:40
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.
void updateNewLineBase(PLatexObj &obj, bool &isPrevNewLine)
Update the new lines to ensure there are new two following.
void updateNewLine(PLatexObj &obj)
Update the new lines to ensure there are new two following.