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

Go to the source code of this file.

Typedefs

typedef PVecPath PListFile
 List of file. More...
 
typedef std::map< PString, PEnvironementPMapExtraEnv
 Vector of extra environement. More...
 
typedef std::vector< PContextPVecContext
 Vector of context. More...
 
typedef std::vector< PLatexEnvPVecLatexEnv
 Vector of env. More...
 
typedef std::vector< PLatexFuncPVecLatexFunc
 Vector of functions. More...
 
typedef std::vector< PLatexObjPVecLatexObj
 Vector of obj. More...
 
typedef std::vector< PLatexMenuPVecMenu
 Vector of PLatexMenu. More...
 
typedef std::vector< long unsigned int > PVecNumber
 Vector of section number. More...
 
typedef std::vector< PLatexObj * > PVecPtrSection
 Vector of section pointer. More...
 

Functions

void appendVecContent (std::vector< PLatexObj > &vecContent, const PLatexObj &obj)
 Append a PLatexObj in the given vector of content. More...
 
void appendVecContent (std::vector< PLatexObj > &vecContent, const std::vector< PLatexObj > &vecObj)
 Append a vector of PLatexObj in the given vector of content. More...
 
PString convertBackSlahedStr (const PString &str)
 Convert all the echaped char. More...
 
PString getSecNumberFromFileName (const PPath &fileName)
 Get the section number from its file name. More...
 
long unsigned int getSectionLevel (const PLatexObj &obj)
 Return the section level. More...
 
PString getSectionTitle (POutoutMode &outputMode, const PLatexObj &obj)
 Get the title of a part/chapter/section etc. More...
 
bool isNewLine (const PLatexObj &obj)
 Say if the PLatexObj is a newline or not. More...
 
bool isSection (const PLatexObj &obj)
 Say if the PLatexObj is a part, charpter, section, subsection or subsubsection. More...
 
bool isSectionOrSeparator (const PLatexObj &obj)
 Say if the PLatexObj is a part, charpter, section, subsection, subsubsection or a book separator. More...
 
bool isSeparator (const PLatexObj &obj)
 Say if the PLatexObj is a book separator. More...
 

Typedef Documentation

◆ PListFile

List of file.

Definition at line 23 of file platexobj_utils.h.

◆ PMapExtraEnv

typedef std::map<PString, PEnvironement> PMapExtraEnv

Vector of extra environement.

Definition at line 26 of file platexobj_utils.h.

◆ PVecContext

typedef std::vector<PContext> PVecContext

Vector of context.

Definition at line 29 of file platexobj_utils.h.

◆ PVecLatexEnv

typedef std::vector<PLatexEnv> PVecLatexEnv

Vector of env.

Definition at line 18 of file platexobj_utils.h.

◆ PVecLatexFunc

typedef std::vector<PLatexFunc> PVecLatexFunc

Vector of functions.

Definition at line 20 of file platexobj_utils.h.

◆ PVecLatexObj

typedef std::vector<PLatexObj> PVecLatexObj

Vector of obj.

Definition at line 16 of file platexobj_utils.h.

◆ PVecMenu

typedef std::vector<PLatexMenu> PVecMenu

Vector of PLatexMenu.

Definition at line 38 of file platexobj_utils.h.

◆ PVecNumber

typedef std::vector<long unsigned int> PVecNumber

Vector of section number.

Definition at line 35 of file platexobj_utils.h.

◆ PVecPtrSection

typedef std::vector<PLatexObj*> PVecPtrSection

Vector of section pointer.

Definition at line 32 of file platexobj_utils.h.

Function Documentation

◆ appendVecContent() [1/2]

void appendVecContent ( std::vector< PLatexObj > &  vecContent,
const PLatexObj obj 
)

Append a PLatexObj in the given vector of content.

Parameters
[out]vecContent: vector of content to be updated
obj: PLatexObj to be appended

Definition at line 120 of file platexobj_utils.cpp.

120  {
121  if(obj.getType() == PLatexType::NONE){
122  appendVecContent(vecContent, obj.getVecContent());
123  }else{
124  vecContent.push_back(obj);
125  }
126 }
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
void appendVecContent(std::vector< PLatexObj > &vecContent, const std::vector< PLatexObj > &vecObj)
Append a vector of PLatexObj in the given vector of content.

References appendVecContent(), PLatexObj::getType(), PLatexObj::getVecContent(), and PLatexType::NONE.

+ Here is the call graph for this function:

◆ appendVecContent() [2/2]

void appendVecContent ( std::vector< PLatexObj > &  vecContent,
const std::vector< PLatexObj > &  vecObj 
)

Append a vector of PLatexObj in the given vector of content.

Parameters
[out]vecContent: vector of content to be updated
vecObj: vector of PLatexObj to be appended

Definition at line 110 of file platexobj_utils.cpp.

110  {
111  for(std::vector<PLatexObj>::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
112  vecContent.push_back(*it);
113  }
114 }

Referenced by appendVecContent(), platexobj_createItem(), platexobj_createParagraph(), platexobj_createRef(), platexobj_createTimetableBlock(), and pspeaker_texSpeaker().

+ Here is the caller graph for this function:

◆ convertBackSlahedStr()

PString convertBackSlahedStr ( const PString str)

Convert all the echaped char.

Parameters
str: string
Returns
string

Definition at line 65 of file platexobj_utils.cpp.

65  {
66  PString out(str.replace("\\n", "\n"));
67  out = out.replace("\\t", "\t");
68  out = out.replace("\\r", "\r");
69  out = out.replace("&lt;", "<");
70  out = out.replace("&gt;", ">");
71  out = out.replace("&bsol;", "\\");
72  out = out.replace("&#126;", "~");
73  out = out.replace("&amp;", "&");
74  return out;
75 }
Extends the std::string.
Definition: PString.h:16
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
Definition: PString.cpp:204

References PString::replace().

Referenced by PGenericParser::loadDirExtraParserFile().

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

◆ getSecNumberFromFileName()

PString getSecNumberFromFileName ( const PPath fileName)

Get the section number from its file name.

Parameters
fileName: input filename
Returns
corresponding section number

Definition at line 81 of file platexobj_utils.cpp.

81  {
82  if(fileName.size() <= 1lu){return fileName;}
83  long unsigned int begin(fileName.size() - 1lu);
84 
85  while(begin > 0lu && begin < fileName.size()){
86  char ch = fileName[begin];
87  if(ch == '-'){
88  break;
89  }
90  --begin;
91  }
92 
93  PString out(fileName.substr(0lu, begin));
94  return out;
95 }

Referenced by vecMenuToHtml().

+ Here is the caller graph for this function:

◆ getSectionLevel()

long unsigned int getSectionLevel ( const PLatexObj obj)

Return the section level.

Parameters
obj: PLatexObj to be checked
Returns
level of the PLatexObj

Definition at line 50 of file platexobj_utils.cpp.

50  {
51  PLatexType::PLatexType type(obj.getType());
52  if(type == PLatexType::PART){return 0lu;}
53  else if(type == PLatexType::CHAPTER){return 1lu;}
54  else if(type == PLatexType::SECTION){return 2lu;}
55  else if(type == PLatexType::SUBSECTION){return 3lu;}
56  else if(type == PLatexType::SUBSUBSECTION){return 4lu;}
57  else if(type == PLatexType::BOOKPARTSEPARATOR){return 0lu;}
58  return -1lu;
59 }
PLatexType
Type of the PLatexObj.
Definition: PLatexType.h:12
@ SUBSUBSECTION
Definition: PLatexType.h:54
@ BOOKPARTSEPARATOR
Definition: PLatexType.h:64

References PLatexType::BOOKPARTSEPARATOR, PLatexType::CHAPTER, PLatexObj::getType(), PLatexType::PART, PLatexType::SECTION, PLatexType::SUBSECTION, and PLatexType::SUBSUBSECTION.

Referenced by addSectionInVecPtrSection(), addSeparatorInVecPtrSection(), and platexobj_orderGetSmallerLevel().

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

◆ getSectionTitle()

PString getSectionTitle ( POutoutMode outputMode,
const PLatexObj obj 
)

Get the title of a part/chapter/section etc.

Parameters
outputMode: mode used to create and remember formalae
obj: section to be used
Returns
title of the corresponding section

Definition at line 102 of file platexobj_utils.cpp.

102  {
103  return platexobj_htmlStr(outputMode, obj.getComplexTitle());
104 }
const std::vector< PLatexObj > & getComplexTitle() const
Gets the complexTitle of the PLatexObj.
Definition: PLatexObj.cpp:396
PString platexobj_htmlStr(POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography=false, bool allowText=true)

References PLatexObj::getComplexTitle(), and platexobj_htmlStr().

Referenced by createOutlineHtmlStr(), platexobj_book_createPage(), platexobj_htmlStrAllPart(), updateMenu(), updateNextPrev(), and updateParent().

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

◆ isNewLine()

bool isNewLine ( const PLatexObj obj)

Say if the PLatexObj is a newline or not.

Parameters
obj: PLatexObj to be checked
Returns
true if the obj is a newline, false otherwise

Definition at line 41 of file platexobj_utils.cpp.

41  {
42  PLatexType::PLatexType type(obj.getType());
44 }
@ AUTOSPACEPARAGRAPH
Definition: PLatexType.h:28
@ SPACEPARAGRAPH
Definition: PLatexType.h:27

References PLatexType::AUTOSPACEPARAGRAPH, PLatexObj::getType(), and PLatexType::SPACEPARAGRAPH.

Referenced by updateNewLineBase().

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

◆ isSection()

bool isSection ( const PLatexObj obj)

Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.

Parameters
obj: PLatexObj to be checked
Returns
true if the obj is a part, charpter, section, subsection or subsubsection, false otherwise

Definition at line 15 of file platexobj_utils.cpp.

15  {
16  PLatexType::PLatexType type(obj.getType());
17  return (type == PLatexType::PART || type == PLatexType::CHAPTER || type == PLatexType::SECTION || type == PLatexType::SUBSECTION || type == PLatexType::SUBSUBSECTION);
18 }

References PLatexType::CHAPTER, PLatexObj::getType(), PLatexType::PART, PLatexType::SECTION, PLatexType::SUBSECTION, and PLatexType::SUBSUBSECTION.

Referenced by createOutlineHtmlStr(), isSectionOrSeparator(), platexobj_order(), platexobj_updateFileName(), platexobj_updateLink(), platexobj_updateNumber(), updateMenu(), updateNextPrev(), updateParent(), updateSectionWip(), and updateWip().

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

◆ isSectionOrSeparator()

bool isSectionOrSeparator ( const PLatexObj obj)

Say if the PLatexObj is a part, charpter, section, subsection, subsubsection or a book separator.

Parameters
obj: PLatexObj to be checked
Returns
true if the obj is a part, charpter, section, subsection, subsubsection or a book separator, false otherwise

Definition at line 33 of file platexobj_utils.cpp.

33  {
34  return isSection(obj) || isSeparator(obj);
35 }
bool isSection(const PLatexObj &obj)
Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.
bool isSeparator(const PLatexObj &obj)
Say if the PLatexObj is a book separator.

References isSection(), and isSeparator().

Referenced by platexobj_toMenuAll().

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

◆ isSeparator()

bool isSeparator ( const PLatexObj obj)

Say if the PLatexObj is a book separator.

Parameters
obj: PLatexObj to be checked
Returns
true if the obj is a book separator, false otherwise

Definition at line 24 of file platexobj_utils.cpp.

24  {
25  PLatexType::PLatexType type(obj.getType());
26  return type == PLatexType::BOOKPARTSEPARATOR;
27 }

References PLatexType::BOOKPARTSEPARATOR, and PLatexObj::getType().

Referenced by isSectionOrSeparator(), platexobj_order(), and PFullMenu::setIsSeparator().

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