Шаблонизатор. Подробнее...
#include <utilities/template_engine.h>
Открытые члены | |
| void | LoadTemplateFromFile (const char *FilePath) |
| ALIAS_FUNCTION_1 (LoadTemplateFromFile, aliasLoadTemplateFromFile, const char *) | |
| void | LoadTemplateFromFile (const std::string &FilePath) |
| void | SetVariable (const char *VariableName, const char *VariableValue) |
| ALIAS_FUNCTION_2 (SetVariable, aliasSetVariable, const char *, const char *) | |
| void | SetVariable (const std::string &VariableName, const std::string &VariableValue) |
| template<class Iter > | |
| void | SetVariables (const Iter &IterBegin, const Iter &IterEnd) |
| const nitro::BinaryData & | GetTemplate (void) const |
| virtual | ~TemplateEngine (void) |
Закрытые данные | |
| BinaryData | TemplateData |
Шаблонизатор.
См. определение в файле template_engine.h строка 47
| nitro::TemplateEngine::~TemplateEngine | ( | void | ) | [virtual] |
Деструктор (виртуальный).
См. определение в файле template_engine.cpp строка 93
{
try
{
}
catch( ... )
{
}
}
| nitro::TemplateEngine::ALIAS_FUNCTION_1 | ( | LoadTemplateFromFile | , | |
| aliasLoadTemplateFromFile | , | |||
| const char * | ||||
| ) |
| nitro::TemplateEngine::ALIAS_FUNCTION_2 | ( | SetVariable | , | |
| aliasSetVariable | , | |||
| const char * | , | |||
| const char * | ||||
| ) |
| const nitro::BinaryData & nitro::TemplateEngine::GetTemplate | ( | void | ) | const |
Функция предоставляет доступ к шаблону.
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.cpp строка 45
Перекрестные ссылки nitro::exception::code(), TemplateData и nitro::exception::what().
{
try
{
return( TemplateData );
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::TemplateEngine::GetTemplate( void )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::TemplateEngine::GetTemplate( void )::An error occured" ) , 0 ) );
}
}

| void nitro::TemplateEngine::LoadTemplateFromFile | ( | const char * | FilePath | ) |
Функция загрузки шаблона из файла.
| FilePath | - Путь к шаблону. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.cpp строка 10
Перекрестные ссылки nitro::exception::code(), nitro::File::LoadBinDataFromFile(), TemplateData и nitro::exception::what().
Используется в LoadTemplateFromFile().
{
try
{
nitro::File::LoadBinDataFromFile( TemplateData , FilePath );
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::LoadTemplateFromFile( const char * FilePath )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::LoadTemplateFromFile( const char * FilePath )::An error occured" ) , 0 ) );
}
}

| void nitro::TemplateEngine::LoadTemplateFromFile | ( | const std::string & | FilePath | ) |
Функция загрузки шаблона из файла.
| FilePath | - Путь к шаблону. |
| nitro::exception | Кидает исключение с описанием ошибки. |
| FilePath | - Путь к шаблону. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.cpp строка 61
Перекрестные ссылки nitro::exception::code(), LoadTemplateFromFile() и nitro::exception::what().
{
try
{
LoadTemplateFromFile( FilePath.c_str() );
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::LoadTemplateFromFile( const std::string & FilePath )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::LoadTemplateFromFile( const std::string & FilePath )::An error occured" ) , 0 ) );
}
}

| void nitro::TemplateEngine::SetVariable | ( | const char * | VariableName, | |
| const char * | VariableValue | |||
| ) |
Функция подстановки значения переменной.
| VariableName | - Название переменной. | |
| VariableValue | - Значение переменной. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.cpp строка 26
Перекрестные ссылки nitro::exception::code(), nitro::BinaryData::GetFirstOccurance(), nitro::BinaryData::ReplaceBuffer(), TemplateData и nitro::exception::what().
Используется в SetVariable() и SetVariables().
{
try
{
for( int OccurancePos( 0 ) ; ( OccurancePos = nitro::BinaryData::GetFirstOccurance( TemplateData , ( std::string( "{" ) + VariableName + std::string( "}" ) ).c_str() , strlen( VariableName ) ) ) != -1 ; )
{
nitro::BinaryData::ReplaceBuffer( TemplateData , OccurancePos , strlen( VariableName ) + 2 , VariableValue , strlen( VariableValue ) );
}
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariable( const char * VariableName , const char * VariableValue )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariable( const char * VariableName , const char * VariableValue )::An error occured" ) , 0 ) );
}
}

| void nitro::TemplateEngine::SetVariable | ( | const std::string & | VariableName, | |
| const std::string & | VariableValue | |||
| ) |
Функция подстановки значения переменной.
| VariableName | - Название переменной. | |
| VariableValue | - Значение переменной. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.cpp строка 77
Перекрестные ссылки nitro::exception::code(), SetVariable() и nitro::exception::what().
{
try
{
SetVariable( VariableName.c_str() , VariableValue.c_str() );
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariable( const std::string & VariableName , const std::string & VariableValue )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariable( const std::string & VariableName , const std::string & VariableValue )::An error occured" ) , 0 ) );
}
}

| void nitro::TemplateEngine::SetVariables | ( | const Iter & | IterBegin, | |
| const Iter & | IterEnd | |||
| ) |
Функция подстановки значения переменных.
| IterBegin | - Начало последовательности с данными. | |
| IterEnd | - Конец последовательности с данными. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле template_engine.h строка 214
Перекрестные ссылки nitro::exception::code(), SetVariable() и nitro::exception::what().
{
try
{
for( Iter i( IterBegin ) ; i != IterEnd ; i++ )
{
SetVariable( i->first , i->second );
}
}
catch( nitro::exception e )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariables( const Iter & IterBegin , const Iter & IterEnd )::" ) + e.what() , e.code() ) );
}
catch( ... )
{
throw( nitro::exception( std::string( "TemplateEngine::SetVariables( const Iter & IterBegin , const Iter & IterEnd )::An error occured" ) , 1 ) );
}
}

Шаблон.
См. определение в файле template_engine.h строка 211
Используется в GetTemplate(), LoadTemplateFromFile() и SetVariable().
1.6.1