[an error occurred while processing this directive]
RTTI +
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Kenat 13 января 2006 г. 16:50
В ответ на: Специалисты по C++. Поясните про динамическую идентификацию типа, введённую в последний стандарт на C++ отправлено Доктор ТуамОсес 13 января 2006 г. 16:20

Runtime type identification (RTTI) lets you write portable code that can determine the actual type of a data object at runtime even when the code has access only to a pointer or reference to that object. This makes it possible, for example, to convert a pointer to a virtual base class into a pointer to the derived type of the actual object. Use the dynamic_cast operator to make runtime casts.

The RTTI mechanism also lets you check whether an object is of some particular type and whether two objects are of the same type. You can do this with typeid operator, which determines the actual type of its argument and returns a reference to an object of type const type_info, which describes that type.

You can also use a type name as the argument to typeid, and typeid will return a reference to a const type_info object for that type. The class type_info provides an operator== and an operator!= that you can use to determine whether two objects are of the same type. Class type_info also provides a member function name that returns a pointer to a character string that holds the name of the type.



void __fastcall TOrderViewForm::actFilterUpdate(TObject *Sender)
{
PFilterField filterField = NULL ;
int i;
TAction *Action;

if ( (Action = dynamic_cast(Sender)) != NULL ) {
switch ( Action->Tag ) {
case 1: // Add
if ( //filterField == NULL &&
ApplicationForm->cbOperator->ItemIndex > 0 &&
ApplicationForm->cbFieldName->ItemIndex > 0)
{
if (SQLOperatorArray[ApplicationForm->cbOperator->ItemIndex-1].LastDelimiter('%') >0)
{
if (ApplicationForm->edValue->Text.Length()>0) Action->Enabled = true;
else Action->Enabled = false;
}//if (SQLOperatorArray[ApplicationForm->cbOperator->ItemIndex-1].LastDelimiter('%') >0)
else Action->Enabled = true;
}//if ( filterField == NULL ...
else Action->Enabled = false;
break;


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 
NoIX ключ Запомнить

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание

E-mail: info@telesys.ru