ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CTemplate Class Reference

#include <Template.h>

+ Inheritance diagram for CTemplate:
+ Collaboration diagram for CTemplate:

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
 
CTemplateoperator= (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 ()
 
CTemplateGetParent (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)
 
CTemplateAddRow (const CString &sName)
 
CTemplateGetRow (const CString &sName, unsigned int uIndex)
 
std::vector< CTemplate * > * GetLoop (const CString &sName)
 
void DelCurLoopContext ()
 
CTemplateLoopContextGetCurLoopContext ()
 
CTemplateGetCurTemplate ()
 
const CStringGetFileName () 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 CStringEncode (CString &sValue) const
 Encode a value so that it can safely be parsed by ReadFromDisk(). More...
 
virtual CStringDecode (CString &sValue) const
 Undo the effects of Encode(). More...
 

Public Attributes

keys
 STL member. More...
 
elements
 STL member. More...
 

Static Public Attributes

static const MCString EmptyMap
 A static instance of an empty map. More...
 

Member Enumeration Documentation

enum MCString::status_t
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.

Constructor & Destructor Documentation

CTemplate::CTemplate ( )
inline
CTemplate::CTemplate ( const CString sFileName)
inline
CTemplate::CTemplate ( const std::shared_ptr< CTemplateOptions > &  Options,
CTemplate pParent = nullptr 
)
inline
virtual CTemplate::~CTemplate ( )
virtual
CTemplate::CTemplate ( const CTemplate other)
default

Member Function Documentation

CTemplate& CTemplate::AddRow ( const CString sName)
void CTemplate::AddTagHandler ( std::shared_ptr< CTemplateTagHandler spTagHandler)
inline

Class for implementing custom tags in subclasses.

void CTemplate::AppendPath ( const CString sPath,
bool  bIncludesOnly = false 
)
void CTemplate::ClearPaths ( )
virtual CString& MCString::Decode ( CString sValue) const
virtualinherited

Undo the effects of Encode().

This is an internal function.

void CTemplate::DelCurLoopContext ( )
virtual CString& MCString::Encode ( CString sValue) const
virtualinherited

Encode a value so that it can safely be parsed by ReadFromDisk().

This is an internal function.

CString CTemplate::ExpandFile ( const CString sFilename,
bool  bFromInc = false 
)
CTemplateLoopContext* CTemplate::GetCurLoopContext ( )
CTemplate* CTemplate::GetCurTemplate ( )
const CString& CTemplate::GetFileName ( ) const
inline
std::vector<CTemplate*>* CTemplate::GetLoop ( const CString sName)
CTemplate* CTemplate::GetParent ( bool  bRoot)
CTemplate* CTemplate::GetRow ( const CString sName,
unsigned int  uIndex 
)
std::vector<std::shared_ptr<CTemplateTagHandler> >& CTemplate::GetTagHandlers ( )
inline

References GetTagHandlers().

Referenced by GetTagHandlers().

CString CTemplate::GetValue ( const CString sName,
bool  bFromIf = false 
)
bool CTemplate::HasLoop ( const CString sName)
void CTemplate::Init ( )
bool CTemplate::IsTrue ( const CString sName)
CString CTemplate::MakePath ( const CString sPath) const
CTemplate& CTemplate::operator= ( const CTemplate other)
default
void CTemplate::PrependPath ( const CString sPath,
bool  bIncludesOnly = false 
)
bool CTemplate::Print ( std::ostream &  oOut)
bool CTemplate::Print ( const CString sFileName,
std::ostream &  oOut 
)
bool CTemplate::PrintString ( CString sRet)
virtual bool MCString::ReadFilter ( CString sKey,
CString sValue 
) const
inlinevirtualinherited

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.

Parameters
sKeyThe key that was read. Can be modified.
sValueThe value that was read. Can be modified.
Returns
true unless ReadFromDisk() should fail with MCS_EWRITEFIL.
enum status_t MCString::ReadFromDisk ( const CString sPath)
inherited

Read a map from a file.

Parameters
sPathThe file name to read from.
Returns
The result of the operation.
See Also
ReadFilter.
void CTemplate::RemovePath ( const CString sPath)
CString CTemplate::ResolveLiteral ( const CString sString)
bool CTemplate::SetFile ( const CString sFileName)
void CTemplate::SetPath ( const CString sPath)
bool CTemplate::ValidExpr ( const CString sExpr)
bool CTemplate::ValidIf ( const CString sArgs)
virtual bool MCString::WriteFilter ( CString sKey,
CString sValue 
) const
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.

Parameters
sKeyThe key that will be written. Can be modified.
sValueThe value that will be written. Can be modified.
Returns
true unless WriteToDisk() should fail with MCS_EWRITEFIL.
enum status_t MCString::WriteToDisk ( const CString sPath,
mode_t  iMode = 0644 
) const
inherited

Write this map to a file.

Parameters
sPathThe file name to write to.
iModeThe mode for the file.
Returns
The result of the operation.
See Also
WriteFilter.

Member Data Documentation

T std::map< K, T >::elements
inherited

STL member.

const MCString MCString::EmptyMap
staticinherited

A static instance of an empty map.

K std::map< K, T >::keys
inherited

STL member.


The documentation for this class was generated from the following file: