Открытые члены | Открытые атрибуты | Защищенные члены | Защищенные данные | Закрытые члены

Класс nitro::XMLTag

Класс представляющий xml тэг. Подробнее...

#include <loaders/xml.h>

Производные классы:nitro::XMLFile.

Граф связей класса nitro::XMLTag:
Collaboration graph
[см. легенду]

Полный список членов класса

Открытые члены

 XMLTag (void)
 XMLTag (const XMLTag &XMLTag)
void AddAttribute (const char *AttributeName, const char *AttributeValue)
void AddTag (const char *TagName)
void AddTag (const XMLTag &XMLTag)
bool AttributeExists (const char *AttributeName) const
bool TagExists (char *TagName) const
void DeleteTag (std::size_t TagCursor)
void DeleteTag (const char *TagName)
float GetAttribute_float (const char *AttributeName) const
bool GetAttribute_bool (const char *AttributeName) const
int GetAttribute_int (const char *AttributeName) const
const char * GetAttribute_string (const char *AttributeName) const
int GetTagCursor (const char *TagName) const
std::size_t CountOfChildTags (void) const
std::size_t CountOfAttributes (void) const
const char * GetAttributeName (std::size_t AttributeCursor) const
XMLTagoperator[] (const char *TagName) const
XMLTagoperator[] (const int TagCursor) const
XMLTagoperator[] (const std::size_t TagCursor) const
XMLTagGetTag (std::size_t TagCursor)
XMLTagGetTag (const char *AttributeName, const char *AttributeValue)
XMLTagLastTag (void)
void MoveTag (std::size_t TagCursor, XMLTag &DestTag)
void SaveXML (nitro::FileAbstraction &File, char *TabSpace) const
void SetName (const std::string &Name)
void SetAttribute (const char *AttributeName, const char *AttributeValue)
void Release (void)
virtual ~XMLTag ()

Открытые атрибуты

std::string Name

Защищенные члены

int ProcessAttributes (std::vector< std::string > &Lexemmas, std::size_t &i)
bool IsClosingTag (std::vector< std::string > &Lexemmas, std::size_t &i)
void SaveXMLToANSIString (std::string &Str, char *TabSpace)
void LoadXML (std::vector< std::string > &Lexemmas, std::size_t &i, std::list< nitro::BinaryData > &CDATA, std::list< nitro::BinaryData >::iterator &j)

Защищенные данные

std::vector< XMLTag * > Tags
std::vector< std::string > Attributes
std::vector< std::string > Values
nitro::BinaryData InnerData

Закрытые члены

XMLTag operator= (const XMLTag &)

Подробное описание

Класс представляющий xml тэг.

Этот класс содержит основные функции для работы с атрибутами xml файлов (чтение/запись/удаление/добавление).

См. определение в файле xml.h строка 59


Конструктор(ы)

nitro::XMLTag::XMLTag ( void   ) 

Конструктор по умолчанию.

Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Default constructor.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 89

Используется в AddTag(), LoadXML() и XMLTag().

        {
        }

nitro::XMLTag::XMLTag ( const XMLTag XMLTag  ) 

Конструктор копирования.

Аргументы:
XMLTag - Тэг, по которому будем конструировать *this.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 93

Перекрестные ссылки Attributes, nitro::exception::code(), Name, Tags, Values, nitro::exception::what() и XMLTag().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Tag.Tags.size() ; i++ )
                        {
                                Tags.push_back( new XMLTag( * Tag.Tags[ i ] ) );
                        }

                        Name = Tag.Name;

                        std::copy( Tag.Attributes.begin() , Tag.Attributes.end() , std::back_inserter( Attributes ) );
                        std::copy( Tag.Values.begin() , Tag.Values.end() , std::back_inserter( Values ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::XMLTag( const XMLTag & XMLTag )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::XMLTag( const XMLTag & XMLTag )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

nitro::XMLTag::~XMLTag (  )  [virtual]

Деструктор (виртуальный).

Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 198

Перекрестные ссылки Release().

        {
                try
                {
                        Release();
                }
                catch( ... )
                {
                }
        }

Граф вызовов:


Методы

void nitro::XMLTag::AddAttribute ( const char *  AttributeName,
const char *  AttributeValue 
)

Функция добавляет атрибут к тэгу.

Аргументы:
AttributeName - имя атрибута
AttributeValue - значение атрибута
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Функция добавляет атрибут к тэгу.
Аргументы:
AttributeName - имя атрибута
AttributeValue - значение атрибута
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 233

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

        {
                try
                {
                        Attributes.push_back( std::string( AttributeName ) );
                        Values.push_back( std::string( AttributeValue ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddAttribute( const char * AttributeName , const char * AttributeValue )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddAttribute( const char * AttributeName , const char * AttributeValue )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::AddTag ( const char *  TagName  ) 

Функция добавляет тэг с одним атрибутом.

Аргументы:
TagName - имя тэга.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Функция добавляет тэг с одним атрибутом.
Аргументы:
TagName - имя тэга.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 250

Перекрестные ссылки nitro::exception::code(), Tags, nitro::exception::what() и XMLTag().

        {
                try
                {
                        Tags.push_back( new XMLTag() );
                        Tags.back()->Name = TagName;
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddTag( const char * TagName )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddTag( const char * TagName )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::AddTag ( const XMLTag XMLTag  ) 

Функция добавления тэга

Аргументы:
XMLTag - тэг, по которому будем конструировать новый тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Функция добавления тэга
Аргументы:
XMLTag - тэг, по которому будем конструировать новый тэг.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 267

Перекрестные ссылки nitro::exception::code(), Tags, nitro::exception::what() и XMLTag().

        {
                try
                {
                        Tags.push_back( new XMLTag( Tag ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddTag( const XMLTag & XMLTag )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::AddTag( const XMLTag & XMLTag )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

bool nitro::XMLTag::AttributeExists ( const char *  AttributeName  )  const

Функция проверяет существование атрибута.

Аргументы:
AttributeName - Название атрибута.
Возвращает:
true если атрибут существует, иначе false.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Функция проверяет существование атрибута.
Аргументы:
AttributeName - Название атрибута.
Возвращает:
true если атрибут существует, иначе false.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 283

Перекрестные ссылки Attributes, nitro::exception::code() и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( AttributeName == Attributes[ i ] )
                                {
                                        return( true );
                                }
                        }
                        return( false );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::AttributeExists( const char * AttributeName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::AttributeExists( const char * AttributeName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

std::size_t nitro::XMLTag::CountOfAttributes ( void   )  const

Функция возвращает количество атрибутов.

Возвращает:
Количество атрибутов.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 52

Перекрестные ссылки Attributes, nitro::exception::code() и nitro::exception::what().

        {
                try
                {
                        return( Attributes.size() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::CountOfAttributes( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::CountOfAttributes( void )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

std::size_t nitro::XMLTag::CountOfChildTags ( void   )  const

Функция возвращает количество вложенных тэгов.

Возвращает:
Количество вложенных тэгов.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 36

Перекрестные ссылки nitro::exception::code(), Tags и nitro::exception::what().

Используется в nitro::MVC::Create().

        {
                try
                {
                        return( Tags.size() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::CountOfChildTags( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::CountOfChildTags( void )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::DeleteTag ( std::size_t  TagCursor  ) 

Функция удаления тэга.

Аргументы:
TagCursor - курсор удаляемого тэга.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Tag's cursor.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 329

Перекрестные ссылки nitro::exception::code(), Tags и nitro::exception::what().

        {
                try
                {
                        Tags[ TagCursor ]->Release();
                        Tags.erase( Tags.begin() + TagCursor );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::DeleteTag( std::size_t TagCursor )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::DeleteTag( std::size_t TagCursor )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::DeleteTag ( const char *  TagName  ) 

Функция удаляет тэги с именем TagName.

Аргументы:
TagName - имя тэга.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Tag's name.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.
bool nitro::XMLTag::GetAttribute_bool ( const char *  AttributeName  )  const

Получение значения атрибута.

Аргументы:
AttributeName -

См. определение в файле xml.cpp строка 883

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( Attributes[ i ] == AttributeName )
                                {
                                        return( std::string( "true" ) == Values[ i ] );
                                }
                        }

                        throw( nitro::exception( ( std::string( "Attribute \"" ) + AttributeName + "\" was not found" ).c_str() , 1 ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_bool( const char * AttributeName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_bool( const char * AttributeName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

float nitro::XMLTag::GetAttribute_float ( const char *  AttributeName  )  const

Получение значения атрибута.

Аргументы:
AttributeName -

См. определение в файле xml.cpp строка 859

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( Attributes[ i ] == AttributeName )
                                {
                                        return( ( float )atof( Values[ i ].c_str() ) );
                                }
                        }

                        throw( nitro::exception( ( std::string( "Attribute \"" ) + AttributeName + "\" was not found" ).c_str() , 1 ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_float( const char * AttributeName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_float( const char * AttributeName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

int nitro::XMLTag::GetAttribute_int ( const char *  AttributeName  )  const

Получение значения атрибута.

Аргументы:
AttributeName -

См. определение в файле xml.cpp строка 835

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( Attributes[ i ] == AttributeName )
                                {
                                        return( atoi( Values[ i ].c_str() ) );
                                }
                        }

                        throw( nitro::exception( ( std::string( "Attribute \"" ) + AttributeName + "\" was not found" ).c_str() , 1 ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_int( const char * AttributeName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_int( const char * AttributeName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

const char * nitro::XMLTag::GetAttribute_string ( const char *  AttributeName  )  const

Получение значения атрибута.

Аргументы:
AttributeName -

См. определение в файле xml.cpp строка 907

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

Используется в nitro::MVC::Create().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( Attributes[ i ] == AttributeName )
                                {
                                        return( Values[ i ].c_str() );
                                }
                        }

                        throw( nitro::exception( ( std::string( "Attribute \"" ) + AttributeName + "\" was not found" ).c_str() , 1 ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_string( const char * AttributeName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttribute_string( const char * AttributeName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

const char * nitro::XMLTag::GetAttributeName ( std::size_t  AttributeCursor  )  const

Функция получения имени атрибута.

Аргументы:
AttributeCursor - Курсор атрибута.
Возвращает:
Имя атрибута.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 68

Перекрестные ссылки Attributes, nitro::exception::code() и nitro::exception::what().

        {
                try
                {
                        if( Attributes.size() >= AttributeCursor )
                        {
                                throw( nitro::exception( "Illegal attribute's cursor" , 1 ) );
                        }
                        
                        return( Attributes[ AttributeCursor ].c_str() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttributeName( std::size_t AttributeCursor )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetAttributeName( std::size_t AttributeCursor )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag & nitro::XMLTag::GetTag ( std::size_t  TagCursor  ) 

Функция получения тэга по курсору.

Аргументы:
TagCursor - курсор тэга.
Возвращает:
Тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 418

Перекрестные ссылки nitro::exception::code() и nitro::exception::what().

        {
                try
                {
                        return( ( * this )[ TagCursor ] );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetTag( std::size_t TagCursor )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::GetTag( std::size_t TagCursor )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag& nitro::XMLTag::GetTag ( const char *  AttributeName,
const char *  AttributeValue 
)

Функция получения тэга, у которого атрибут AttributeName со значением AttributeValue.

Аргументы:
AttributeName - название атрибута по которому будем искать.
AttributeValue - значение атрибута по которому будем искать.
Возвращает:
Тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.
int nitro::XMLTag::GetTagCursor ( const char *  TagName  )  const

Функция получения курсора тэга по имени тэга.

Аргументы:
TagName - имя тэга.
Возвращает:
Курсор тэга.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Tag's name.
Возвращает:
Tag's cursor.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.
bool nitro::XMLTag::IsClosingTag ( std::vector< std::string > &  Lexemmas,
std::size_t &  i 
) [protected]

См. определение в файле xml.cpp строка 981

Перекрестные ссылки nitro::exception::code(), nitro::IsTagName(), Name и nitro::exception::what().

Используется в LoadXML().

        {
                try
                {
                        if( i + 3 < Lexemmas.size() )
                        {
                                if( Lexemmas[ i ] == "<" && Lexemmas[ i + 1 ] == "/" && Lexemmas[ i + 2 ] == Name && Lexemmas[ i + 3 ] == ">" )
                                {
                                        i += 4;
                                        return( true );
                                }
                                else
                                {
                                        if( Lexemmas[ i ] == "<" && IsTagName( Lexemmas[ i + 1 ] ) )
                                        {
                                                return( false );
                                        }
                                        else
                                        {
                                                throw( nitro::exception( std::string( "Bad XML structure #" ) + Lexemmas[ i ] + "#" + Lexemmas[ i + 1 ] , 1 ) );
                                        }
                                }
                        }
                        return( false );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::IsClosingTag( std::vector< std::string > & Lexemmas , std::size_t & i )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::IsClosingTag( std::vector< std::string > & Lexemmas , std::size_t & i )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag & nitro::XMLTag::LastTag ( void   ) 

Функция возвращает последний тэг.

Возвращает:
последний тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 346

Перекрестные ссылки nitro::exception::code(), Tags и nitro::exception::what().

        {
                try
                {
                        return( *( Tags.back() ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::LastTag( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::LastTag( void )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::LoadXML ( std::vector< std::string > &  Lexemmas,
std::size_t &  i,
std::list< nitro::BinaryData > &  CDATA,
std::list< nitro::BinaryData >::iterator &  j 
) [protected]

Функция загрузки XML файла.

Аргументы:
Lexemmas - Распарсенный XML файл.
i - Курсор в массиве Lexemmas.
CDATA - Список объектов с бинарными данными XMLя.
j - Итератор в списке CDATA.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 1127

Перекрестные ссылки nitro::exception::code(), IsClosingTag(), nitro::IsTagName(), Name, ProcessAttributes(), Tags, nitro::exception::what() и XMLTag().

        {
                try
                {
                        if( IsClosingTag( Lexemmas , i ) )
                        {
                                return;
                        }
                        if( Lexemmas[ i ] == "<" )
                        {
                                if( i + 1 < Lexemmas.size() )
                                {
                                        if( IsTagName( Lexemmas[ i + 1 ] ) )
                                        {
                                                Name = Lexemmas[ i + 1 ];
                                                i += 2;
                                                if( !ProcessAttributes( Lexemmas , i ) )
                                                {
                                                        return;
                                                }
                                        }
                                        else
                                        {
                                                throw( nitro::exception( "Bad XML structure" , 1 ) );
                                        }
                                }
                        }
                        else
                        {
                                throw( nitro::exception( "Bad XML structure" , 1 ) );
                        }
                        
                        if( IsClosingTag( Lexemmas , i ) )
                        {
                                return;
                        }

                        for( ; i < Lexemmas.size() ; )
                        {
                                Tags.push_back( new XMLTag() );

                                if( Lexemmas[ i ] == "<![CDATA[" )
                                {
                                        Tags.back()->InnerData.AppendData( j->GetBuffer() , j->GetBufferLength() );
                                        Tags.back()->Name = "cdata";
                                        j++;
                                        i++;

                                        continue;
                                }

                                Tags.back()->LoadXML( Lexemmas , i , CDATA , j );
                                if( IsClosingTag( Lexemmas , i ) )
                                {
                                        return;
                                }
                        }
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::LoadXML( std::vector< std::string > & Lexemmas , std::size_t & i , std::list< nitro::BinaryData > & CDATA , std::list< nitro::BinaryData >::iterator & j )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::LoadXML( std::vector< std::string > & Lexemmas , std::size_t & i , std::list< nitro::BinaryData > & CDATA , std::list< nitro::BinaryData >::iterator & j )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::MoveTag ( std::size_t  TagCursor,
XMLTag DestTag 
)

Функция перемещения тэга.

Аргументы:
TagCursor - курсор тэга.
DestTag - Корневой таг куда будет перемещен тэг с курсором TagCursor.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 362

Перекрестные ссылки nitro::exception::code(), Tags и nitro::exception::what().

        {
                try
                {
                        DestTag.Tags.push_back( Tags[ TagCursor ] );
                        Tags.erase( Tags.begin() + TagCursor );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::MoveTag( std::size_t TagCursor , XMLTag &DestTag )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::MoveTag( std::size_t TagCursor , XMLTag &DestTag )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag nitro::XMLTag::operator= ( const XMLTag  )  [inline, private]

Закрытый оператор присваивания.

Автор:
Dodonov A.A.

См. определение в файле xml.h строка 874

{return(*this);}

XMLTag & nitro::XMLTag::operator[] ( const char *  TagName  )  const

Оператор выборки тэга по названию.

Аргументы:
TagName - Название тэга.
Возвращает:
Тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 209

Перекрестные ссылки nitro::exception::code(), Name, Tags и nitro::exception::what().

        {
                try
                {
                        std::string                     TagName( TagName );
                        for( std::size_t i( 0 ) ; i < Tags.size() ; i++ )
                        {
                                if( TagName == Tags[ i ]->Name )
                                {
                                        return( * Tags[ i ] );
                                }
                        }
                        throw( nitro::exception( std::string( "Tag " ) + TagName + " was not found" , 1 ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( const char * TagName )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( const char * TagName )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag & nitro::XMLTag::operator[] ( const std::size_t  TagCursor  )  const

Оператор выборки тэга по курсору.

Аргументы:
TagCursor - Курсор тэга.
Возвращает:
Тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 395

Перекрестные ссылки nitro::exception::code(), nitro::Converters::itoa(), Tags и nitro::exception::what().

        {
                try
                {
                        if( Tags.size() <= TagCursor )
                        {
                                std::string             StrTagCursor;
                                nitro::Converters::itoa( ( int )TagCursor , StrTagCursor );
                                throw( nitro::exception( std::string ( "Tag with cursor " ) + StrTagCursor + " was not found" , 1 ) );
                        }

                        return( * Tags[ TagCursor ] );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( std::size_t TagCursor )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( std::size_t TagCursor )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

XMLTag & nitro::XMLTag::operator[] ( const int  TagCursor  )  const

Оператор выборки тэга по курсору.

Аргументы:
TagCursor - Курсор тэга.
Возвращает:
Тэг.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 379

Перекрестные ссылки nitro::exception::code() и nitro::exception::what().

        {
                try
                {
                        return( ( * this )[ ( std::size_t )TagCursor ] );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( std::size_t TagCursor )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::operator[] ( std::size_t TagCursor )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

int nitro::XMLTag::ProcessAttributes ( std::vector< std::string > &  Lexemmas,
std::size_t &  i 
) [protected]

См. определение в файле xml.cpp строка 931

Перекрестные ссылки Attributes, nitro::exception::code(), nitro::IsTagName(), Values и nitro::exception::what().

Используется в LoadXML().

        {
                try
                {
                        for( ; i < Lexemmas.size() ;  )
                        {
                                // additing attribute
                                if( i + 4 < Lexemmas.size() )
                                {
                                        if( IsTagName( Lexemmas[ i ] ) && Lexemmas[ i + 1 ] == "=" 
                                                && Lexemmas[ i + 2 ] == "\"" && Lexemmas[ i + 4 ] == "\"" )
                                        {
                                                Attributes.push_back( Lexemmas[ i ] );
                                                Values.push_back( Lexemmas[ i + 3 ] );

                                                i += 5;
                                                goto end;
                                        }
                                }
                                // closing tag was not found
                                if( i + 1 < Lexemmas.size() )
                                {
                                        if( Lexemmas[ i ] == "/" && Lexemmas[ i + 1 ] == ">" )
                                        {
                                                i += 2;
                                                return( 0 );
                                        }
                                }
                                // there must be closing tag
                                if( Lexemmas[ i ] == ">" )
                                {
                                        i += 1;
                                        return( 1 );
                                }

                                throw( nitro::exception( "Bad XML structure" , 1 ) );
                end:;
                        }
                        return( 2 );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::ProcessAttributes( std::vector< std::string > & Lexemmas , std::size_t & i )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::ProcessAttributes( std::vector< std::string > & Lexemmas , std::size_t & i )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::Release ( void   ) 

Удаляем всю память которую выделил объект.

Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 177

Перекрестные ссылки nitro::exception::code(), Tags и nitro::exception::what().

Используется в nitro::XMLFile::~XMLFile() и ~XMLTag().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Tags.size() ; i++ )
                        {
                                Tags[ i ]->Release();
                        }

                        Tags.clear();
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::Release( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::Release( void )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::SaveXML ( nitro::FileAbstraction File,
char *  TabSpace 
) const

Функция сохранения XML в файл.

Аргументы:
File - Файловый поток.
TabSpace - Строка для форматирования сохраняемого XML.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 672

Перекрестные ссылки Attributes, nitro::exception::code(), Name, Tags, Values, nitro::exception::what() и nitro::FileAbstraction::Write().

        {
                try
                {
                        std::string             str;
                        char                    new_TabSpace[ 2048 ];
                        str = TabSpace;
                        str += "<";
                        str += Name;

                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                str += " ";
                                str += Attributes[ i ];
                                str += "=";
                                str += "\"";
                                str += Values[ i ];
                                str += "\"";
                        }

                        if( !Tags.size() )
                        {
                                str += " /";
                                str += ">\n";

                                File.Write( str.c_str() , str.length() );
                        }
                        else
                        {
                                str += ">\n";
                                File.Write( str.c_str() , str.length() );

                                strcpy( new_TabSpace , TabSpace );
                                strcat( new_TabSpace , "\t" );

                                for( std::size_t i( 0 ) ; i < Tags.size() ; i++ )
                                {
                                        Tags[ i ]->SaveXML( File , new_TabSpace );
                                }

                                str = TabSpace;
                                str += "<";
                                str += "/";
                                str += Name;
                                str += ">\n";

                                File.Write( str.c_str() , str.length() );
                        }
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::SaveXML( nitro::FileAbstraction & File , char * TabSpace )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::SaveXML( nitro::FileAbstraction & File , char * TabSpace )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::SaveXMLToANSIString ( std::string &  Str,
char *  TabSpace 
) [protected]

Функция выполняет сериализацию XMLя.

Аргументы:
Str - Строка с сериализованным XMLем.
TabSpace - строка с отступами.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А. Функция выполняет сериализацию XMLя.
Аргументы:
Str - Строка с сериализованным XMLем.
TabSpace - строка с отступами.
Исключения:
nitro::exception An exception of that type is thrown if ahy error occured.
Автор:
Dodonov A.A.

См. определение в файле xml.cpp строка 1071

Перекрестные ссылки Attributes, nitro::exception::code(), Name, Tags, Values и nitro::exception::what().

        {
                try
                {
                        char                    new_TabSpace[ 2048 ];
                        Str += "\r\n";
                        Str += TabSpace;
                        Str += "<";
                        Str += Name;

                        if( Attributes.size() )
                        {
                                Str += " ";
                                for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                                {
                                        Str += Attributes[ i ];
                                        Str += " ";
                                        Str += "=";
                                        Str += " ";
                                        Str += "\"";
                                        Str += Values[ i ];
                                        Str += "\"";
                                }
                        }
                        else
                        {
                                Str += "/";
                        }

                        Str += ">";

                        strcpy( new_TabSpace , TabSpace );
                        strcat( new_TabSpace , "\t" );

                        for( std::size_t i( 0 ) ; i < Tags.size() ; i++ )
                        {
                                Tags[ i ]->SaveXMLToANSIString( Str , new_TabSpace );
                        }

                        Str += "\r\n";
                        Str += TabSpace;
                        Str += "<";
                        Str += "/";
                        Str += Name;
                        Str += ">";
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::SaveXMLToANSIString( std::string & Str , char * TabSpace )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::SaveXMLToANSIString( std::string & Str , char * TabSpace )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::SetAttribute ( const char *  AttributeName,
const char *  AttributeValue 
)

Функция установки значения атрибута.

Аргументы:
AttributeName - имя устанавливаемого атрибута.
AttributeValue -новое значение атрибута.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 747

Перекрестные ссылки Attributes, nitro::exception::code(), Values и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Attributes.size() ; i++ )
                        {
                                if( Attributes[ i ] == AttributeName )
                                {
                                        Values[ i ] = AttributeValue;
                                        return;
                                }
                        }
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::SetAttribute( const char * AttributeName , const char * AttributeValue )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::SetAttribute( const char * AttributeName , const char * AttributeValue )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

void nitro::XMLTag::SetName ( const std::string &  Name  ) 

Функция установки названия тэга.

Аргументы:
Name - Название тэга.
Исключения:
nitro::exception Кидает исключение этого типа при возникновении ошибки.
Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 731

Перекрестные ссылки nitro::exception::code(), Name и nitro::exception::what().

        {
                try
                {
                        Name = NewName.c_str();
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::SetName( const std::string & Name )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::SetName( const std::string & Name )::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:

bool nitro::XMLTag::TagExists ( char *  TagName  )  const

Кидает исключение этого типа при возникновении ошибки.

Автор:
Додонов А.А.

См. определение в файле xml.cpp строка 306

Перекрестные ссылки nitro::exception::code(), Name, Tags и nitro::exception::what().

        {
                try
                {
                        for( std::size_t i( 0 ) ; i < Tags.size() ; i++ )
                        {
                                if( Tags[ i ]->Name == TagName )
                                {
                                        return( true );
                                }
                        }
                        return( false );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "XMLTag::TagExists( char * TagName ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "XMLTag::TagExists( char * TagName ) const::An error occured" ) , 1 ) );
                }
        }

Граф вызовов:


Данные класса

std::vector< std::string > nitro::XMLTag::Attributes [protected]

Имена атрибутов тэга.

Автор:
Додонов А.А.

См. определение в файле xml.h строка 732

Используется в AddAttribute(), AttributeExists(), CountOfAttributes(), GetAttribute_bool(), GetAttribute_float(), GetAttribute_int(), GetAttribute_string(), GetAttributeName(), ProcessAttributes(), SaveXML(), SaveXMLToANSIString(), SetAttribute() и XMLTag().

Текст внутри тэга, например <tag>some text</tag> здесь 'some text' будет внутренним текстом.

Автор:
Додонов А.А.

См. определение в файле xml.h строка 756

std::string nitro::XMLTag::Name

Имя тэга.

Автор:
Додонов А.А.

См. определение в файле xml.h строка 110

Используется в IsClosingTag(), LoadXML(), operator[](), SaveXML(), SaveXMLToANSIString(), SetName(), TagExists() и XMLTag().

std::vector< XMLTag * > nitro::XMLTag::Tags [protected]

Набор вложенных тэгов.

Автор:
Додонов А.А.

См. определение в файле xml.h строка 720

Используется в AddTag(), CountOfChildTags(), DeleteTag(), LastTag(), LoadXML(), MoveTag(), operator[](), Release(), SaveXML(), SaveXMLToANSIString(), TagExists() и XMLTag().

std::vector< std::string > nitro::XMLTag::Values [protected]

Значения атрибутов тэга.

Автор:
Додонов А.А.

См. определение в файле xml.h строка 744

Используется в AddAttribute(), GetAttribute_bool(), GetAttribute_float(), GetAttribute_int(), GetAttribute_string(), ProcessAttributes(), SaveXML(), SaveXMLToANSIString(), SetAttribute() и XMLTag().


Объявления и описания членов классов находятся в файлах:

Generated by  doxygen 1.6.1