17 #ifndef ZNC_TEMPLATE_H
18 #define ZNC_TEMPLATE_H
20 #include <znc/zncconfig.h>
45 return HandleVar(Tmpl, sName, sArgs, sOutput);
78 bool bReverse, std::vector<CTemplate*>* pRows)
79 : m_bReverse(bReverse),
83 m_uFilePosition(uFilePos),
97 if (m_uRowIndex == 0) {
100 return --m_uRowIndex;
111 std::vector<CTemplate*>*
GetRows() {
return m_pvRows; }
122 unsigned int m_uRowIndex;
125 std::vector<CTemplate*>*
136 m_sFileName(sFileName),
141 m_vspTagHandlers() {}
143 CTemplate(
const std::shared_ptr<CTemplateOptions>& Options,
151 m_spOptions(Options),
152 m_vspTagHandlers() {}
161 m_vspTagHandlers.push_back(spTagHandler);
169 return m_vspTagHandlers;
209 std::list<std::pair<CString, bool>> m_lsbPaths;
210 std::map<CString, std::vector<CTemplate*>> m_mvLoops;
211 std::vector<CTemplateLoopContext*> m_vLoopContexts;
212 std::shared_ptr<CTemplateOptions> m_spOptions;
213 std::vector<std::shared_ptr<CTemplateTagHandler>> m_vspTagHandlers;
String class that is used inside ZNC.
Definition: ZNCString.h:68
EEscape
Definition: ZNCString.h:70
Definition: Template.h:75
unsigned int DecRowIndex()
Definition: Template.h:96
size_t GetRowCount()
Definition: Template.h:110
CTemplateLoopContext(const CTemplateLoopContext &)=default
unsigned int IncRowIndex()
Definition: Template.h:95
unsigned long GetFilePosition() const
Definition: Template.h:108
CTemplateLoopContext(unsigned long uFilePos, const CString &sLoopName, bool bReverse, std::vector< CTemplate * > *pRows)
Definition: Template.h:77
const CString & GetName() const
Definition: Template.h:107
CTemplateLoopContext & operator=(const CTemplateLoopContext &)=default
CTemplate * GetNextRow()
Definition: Template.h:112
virtual ~CTemplateLoopContext()
Definition: Template.h:86
std::vector< CTemplate * > * GetRows()
Definition: Template.h:111
CTemplate * GetCurRow()
Definition: Template.h:113
void SetName(const CString &s)
Definition: Template.h:93
CTemplate * GetRow(unsigned int uIndex)
unsigned int GetRowIndex() const
Definition: Template.h:109
void SetFilePosition(unsigned int u)
Definition: Template.h:102
bool HasData() const
Definition: Template.h:106
void SetRowIndex(unsigned int u)
Definition: Template.h:94
void SetHasData(bool b=true)
Definition: Template.h:92
CString GetValue(const CString &sName, bool bFromIf=false)
Definition: Template.h:57
CTemplateOptions()
Definition: Template.h:59
void Parse(const CString &sLine)
CString::EEscape GetEscapeTo() const
Definition: Template.h:68
CString::EEscape GetEscapeFrom() const
Definition: Template.h:67
virtual ~CTemplateOptions()
Definition: Template.h:62
Definition: Template.h:28
virtual ~CTemplateTagHandler()
Definition: Template.h:31
virtual bool HandleIf(CTemplate &Tmpl, const CString &sName, const CString &sArgs, CString &sOutput)
Definition: Template.h:43
virtual bool HandleVar(CTemplate &Tmpl, const CString &sName, const CString &sArgs, CString &sOutput)
Definition: Template.h:33
virtual bool HandleTag(CTemplate &Tmpl, const CString &sName, const CString &sArgs, CString &sOutput)
Definition: Template.h:38
CTemplateTagHandler()
Definition: Template.h:30
virtual bool HandleValue(CTemplate &Tmpl, CString &sValue, const MCString &msOptions)
Definition: Template.h:48
Definition: Template.h:129
CTemplate & operator=(const CTemplate &other)=default
void AddTagHandler(std::shared_ptr< CTemplateTagHandler > spTagHandler)
Class for implementing custom tags in subclasses.
Definition: Template.h:160
CTemplate * GetRow(const CString &sName, unsigned int uIndex)
CTemplateLoopContext * GetCurLoopContext()
std::vector< CTemplate * > * GetLoop(const CString &sName)
std::vector< std::shared_ptr< CTemplateTagHandler > > & GetTagHandlers()
Definition: Template.h:164
CString ExpandFile(const CString &sFilename, bool bFromInc=false)
bool Print(std::ostream &oOut)
const CString & GetFileName() const
Definition: Template.h:204
void SetPath(const CString &sPath)
bool PrintString(CString &sRet)
bool Print(const CString &sFileName, std::ostream &oOut)
void PrependPath(const CString &sPath, bool bIncludesOnly=false)
CString ResolveLiteral(const CString &sString)
bool ValidExpr(const CString &sExpr)
CTemplate(const std::shared_ptr< CTemplateOptions > &Options, CTemplate *pParent=nullptr)
Definition: Template.h:143
CTemplate * GetCurTemplate()
CTemplate(const CTemplate &other)=default
CTemplate & AddRow(const CString &sName)
CTemplate()
Definition: Template.h:131
bool IsTrue(const CString &sName)
CString MakePath(const CString &sPath) const
bool HasLoop(const CString &sName)
bool SetFile(const CString &sFileName)
CTemplate * GetParent(bool bRoot)
CTemplate(const CString &sFileName)
Definition: Template.h:133
void AppendPath(const CString &sPath, bool bIncludesOnly=false)
CString GetValue(const CString &sName, bool bFromIf=false)
void RemovePath(const CString &sPath)
bool ValidIf(const CString &sArgs)
A dictionary for strings.
Definition: ZNCString.h:595