ZNC
trunk
|
#include <Template.h>
Public Types | |
enum | status_t { MCS_SUCCESS = 0 , MCS_EOPEN = 1 , MCS_EWRITE = 2 , MCS_EWRITEFIL = 3 , MCS_EREADFIL = 4 } |
Status codes that can be returned by WriteToDisk() and ReadFromDisk(). More... | |
Public Member Functions | |
CTemplate () | |
CTemplate (const CString &sFileName) | |
CTemplate (const std::shared_ptr< CTemplateOptions > &Options, CTemplate *pParent=nullptr) | |
virtual | ~CTemplate () |
CTemplate (const CTemplate &other)=default | |
CTemplate & | operator= (const CTemplate &other)=default |
void | AddTagHandler (std::shared_ptr< CTemplateTagHandler > spTagHandler) |
Class for implementing custom tags in subclasses. More... | |
std::vector< std::shared_ptr< CTemplateTagHandler > > & | GetTagHandlers () |
CString | ResolveLiteral (const CString &sString) |
void | Init () |
CTemplate * | GetParent (bool bRoot) |
CString | ExpandFile (const CString &sFilename, bool bFromInc=false) |
bool | SetFile (const CString &sFileName) |
void | SetPath (const CString &sPath) |
CString | MakePath (const CString &sPath) const |
void | PrependPath (const CString &sPath, bool bIncludesOnly=false) |
void | AppendPath (const CString &sPath, bool bIncludesOnly=false) |
void | RemovePath (const CString &sPath) |
void | ClearPaths () |
bool | PrintString (CString &sRet) |
bool | Print (std::ostream &oOut) |
bool | Print (const CString &sFileName, std::ostream &oOut) |
bool | ValidIf (const CString &sArgs) |
bool | ValidExpr (const CString &sExpr) |
bool | IsTrue (const CString &sName) |
bool | HasLoop (const CString &sName) |
CString | GetValue (const CString &sName, bool bFromIf=false) |
CTemplate & | AddRow (const CString &sName) |
CTemplate * | GetRow (const CString &sName, unsigned int uIndex) |
std::vector< CTemplate * > * | GetLoop (const CString &sName) |
void | DelCurLoopContext () |
CTemplateLoopContext * | GetCurLoopContext () |
CTemplate * | GetCurTemplate () |
const CString & | GetFileName () const |
enum status_t | WriteToDisk (const CString &sPath, mode_t iMode=0644) const |
Write this map to a file. More... | |
enum status_t | ReadFromDisk (const CString &sPath) |
Read a map from a file. More... | |
virtual bool | WriteFilter (CString &sKey, CString &sValue) const |
Filter used while writing this map. More... | |
virtual bool | ReadFilter (CString &sKey, CString &sValue) const |
Filter used while reading this map. More... | |
virtual CString & | Encode (CString &sValue) const |
Encode a value so that it can safely be parsed by ReadFromDisk(). More... | |
virtual CString & | Decode (CString &sValue) const |
Undo the effects of Encode(). More... | |
Public Attributes | |
K | keys |
STL member. More... | |
T | elements |
STL member. More... | |
Static Public Attributes | |
static const MCString | EmptyMap |
A static instance of an empty map. More... | |
|
inherited |
Status codes that can be returned by WriteToDisk() and ReadFromDisk().
Enumerator | |
---|---|
MCS_SUCCESS | No errors. |
MCS_EOPEN | Opening the file failed. |
MCS_EWRITE | Writing to the file failed. |
MCS_EWRITEFIL | WriteFilter() failed. |
MCS_EREADFIL | ReadFilter() failed. |
|
inline |
|
inline |
|
inline |
|
virtual |
|
default |
|
inline |
Class for implementing custom tags in subclasses.
void CTemplate::AppendPath | ( | const CString & | sPath, |
bool | bIncludesOnly = false |
||
) |
void CTemplate::ClearPaths | ( | ) |
Undo the effects of Encode().
This is an internal function.
void CTemplate::DelCurLoopContext | ( | ) |
Encode a value so that it can safely be parsed by ReadFromDisk().
This is an internal function.
CTemplateLoopContext* CTemplate::GetCurLoopContext | ( | ) |
CTemplate* CTemplate::GetCurTemplate | ( | ) |
|
inline |
CTemplate* CTemplate::GetParent | ( | bool | bRoot | ) |
|
inline |
References GetTagHandlers().
Referenced by GetTagHandlers().
bool CTemplate::HasLoop | ( | const CString & | sName | ) |
void CTemplate::Init | ( | ) |
bool CTemplate::IsTrue | ( | const CString & | sName | ) |
void CTemplate::PrependPath | ( | const CString & | sPath, |
bool | bIncludesOnly = false |
||
) |
bool CTemplate::Print | ( | const CString & | sFileName, |
std::ostream & | oOut | ||
) |
bool CTemplate::Print | ( | std::ostream & | oOut | ) |
bool CTemplate::PrintString | ( | CString & | sRet | ) |
Filter used while reading this map.
This function is called by ReadFromDisk() for each pair that is beging read. This function has the chance to modify the data that is being read.
sKey | The key that was read. Can be modified. |
sValue | The value that was read. Can be modified. |
Read a map from a file.
sPath | The file name to read from. |
void CTemplate::RemovePath | ( | const CString & | sPath | ) |
bool CTemplate::SetFile | ( | const CString & | sFileName | ) |
void CTemplate::SetPath | ( | const CString & | sPath | ) |
bool CTemplate::ValidExpr | ( | const CString & | sExpr | ) |
bool CTemplate::ValidIf | ( | const CString & | sArgs | ) |
|
inlinevirtualinherited |
Filter used while writing this map.
This function is called by WriteToDisk() for each pair that is going to be written. This function has the chance to modify the data that will be written.
sKey | The key that will be written. Can be modified. |
sValue | The value that will be written. Can be modified. |
Write this map to a file.
sPath | The file name to write to. |
iMode | The mode for the file. |
|
inherited |
STL member.
|
staticinherited |
A static instance of an empty map.
|
inherited |
STL member.