PhoenixLecture  2.0.0
Set of tools to make lectures
platexobj_updateFileName.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 #include "convertToString.h"
9 
10 
12 
15  if(!isSection(obj) && obj.getType() != PLatexType::FILE){return;}
16 
17  if(obj.getType() != PLatexType::FILE){
18  PString fileName("");
19  PVecNumber & vecNumber = obj.getVecSecNumber();
20  for(PVecNumber::iterator it(vecNumber.begin()); it != vecNumber.end(); ++it){
21  fileName += valueToString(*it) + "-";
22  }
23  fileName += valueToString(obj.getId());
24  fileName += ".html";
25  obj.setLink(fileName);
26  }
27  PVecLatexObj & vecContent = obj.getVecContent();
28  if(vecContent.size() != 0lu){
29  for(PVecLatexObj::iterator it(vecContent.begin()); it != vecContent.end(); ++it){
31  }
32  }
33 }
34 
36 
39 void platexobj_updateLink(PLatexObj & obj, const PPath & htmlFile){
40  if(isSection(obj)){
41  PVecLatexObj & vecObj = obj.getVecContent();
42  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
43  platexobj_updateLink(*it, obj.getLink());
44  }
45  }else{
46  if(obj.getType() != PLatexType::FILE){
47  obj.setLink(htmlFile + PPath("#" + valueToString(obj.getId())));
48  }
49  PVecLatexObj & vecObj = obj.getVecContent();
50  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
51  platexobj_updateLink(*it, htmlFile);
52  }
53  }
54 }
55 
57 
60  PPath tmp("index.html");
61  platexobj_updateLink(obj, tmp);
62 }
63 
Describe a latex object.
Definition: PLatexObj.h:40
void setLink(const PString &link)
Sets the link of the PLatexObj.
Definition: PLatexObj.cpp:165
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298
const PString & getLink() const
Gets the link of the PLatexObj.
Definition: PLatexObj.cpp:368
const std::vector< long unsigned int > & getVecSecNumber() const
Gets the vecSecNumber of the PLatexObj.
Definition: PLatexObj.cpp:438
long unsigned int getId() const
Gets the id of the PLatexObj.
Definition: PLatexObj.cpp:284
Path of a directory or a file.
Definition: PPath.h:17
Extends the std::string.
Definition: PString.h:16
std::string valueToString(const T &val)
Convert a type into a string.
void platexobj_updateLink(PLatexObj &obj, const PPath &htmlFile)
Update the html link.
void platexobj_updateFileName(PLatexObj &obj)
Update the fileName of the PLatexObj part,chapter,section,subsection,subsubsection.
bool isSection(const PLatexObj &obj)
Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.
std::vector< long unsigned int > PVecNumber
Vector of section number.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.