Форум программистов CODEBY.NET Хостинг в Беларуси — Active Technologies

Разработка бизнес сайтов

Нужны клиенты? Тогда сюда быстрее...
X   Сообщение сайта
(Сообщение закроется через 2 секунды)

Здравствуйте, гость ( Вход | Регистрация )




> Вывод кода VCL и открытых методов класса, помогите, а то чё то не то...
tenebrise
Вставить ник
сообщение 18:03:2008, 17:42
Цитата Ответить 


Новенький
*

Группа: Программист
Сообщений: 2
Регистрация: 18:03:2008
Пользователь №: 15 978



Репутация: - 0 +


нужно в один листбокс вывести текст из библиотеки Vcl, а затем в другой лист бокс вывести имя методов
с атрибутом доступа public заданного класса, но чёто там не работает
Код
procedure TForm1.Button2Click(Sender: TObject);
  var
   i,j:integer;
   s,name:string;
begin
   for i:=0 to ListBox1.count - 1 do
   begin
    name:=edit1.text+' = class(T';
    if (pos(name,ListBox1.Items[i])>0)  then
       begin
       j:=i;
       repeat
         inc(j);
       until (pos('public',ListBox1.Items[j])>0) or (pos('end',ListBox1.Items[j])>0);
       repeat
         inc(j);
         if (pos('procedure',ListBox1.Items[j])>0) then
          begin
           s:=(copy(trim(ListBox1.Items[j]),11,pos('(',ListBox1.Items[j])));
           s:=s+' procedure';

           ListBox2.Items.Add(s);
          end
           else
            if (pos('function',ListBox1.Items[j])>0) then
          begin
           s:=(copy(ListBox1.Items[j],14,pos('(',ListBox1.Items[j])));
           ListBox2.Items.Add(s);
            end
            else
             if (pos('constructor',ListBox1.Items[j])>0) then
          begin
           s:=(copy(ListBox1.Items[j],17,pos('(',ListBox1.Items[j])));
           ListBox2.Items.Add(s);
            end
            else
             if (pos('destructor',ListBox1.Items[j])>0) then
          begin
           s:=(copy(ListBox1.Items[j],16,pos('(',ListBox1.Items[j])));
           ListBox2.Items.Add(s);


            end
         else

       until (pos('private',ListBox1.Items[j])>0) or
       (pos('published',ListBox1.Items[j])>0) or
       (pos('protected',ListBox1.Items[j])>0) or
       (pos('end',ListBox1.Items[j])>0 );
      end;
    end;
end;

а выводится имя методов и еще несколько символов после, хотя я поставмил условие копировать до скобочки
Подняться вверх 
 
Сообщение #1
 
Новая тема 
Ответов (1 - 3)
sax_ol
Вставить ник
сообщение 19:03:2008, 06:28
Цитата Ответить 


==============
*****

Группа: Модеры
Сообщений: 1 740
Регистрация: 11:01:2007
Пользователь №: 8 750
Специализация: specialist



Репутация: - 27 +


Каков формат строк (всмысле покажите их) в ListBox1?
Подняться вверх 
 
Сообщение #2
tenebrise
Вставить ник
сообщение 19:03:2008, 07:43
Цитата Ответить 


Новенький
*

Группа: Программист
Сообщений: 2
Регистрация: 18:03:2008
Пользователь №: 15 978



Репутация: - 0 +


CODE
type
TOleStream = class(TStream)
private
FStream: IStream;
protected
function GetIStream: IStream;
public
constructor Create(const Stream: IStream);
function Read(var Buffer; Count: Longint): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
function Seek(Offset: Longint; Origin: Word): Longint; override;
end;

TConnectionPoints = class;

TConnectionKind = (ckSingle, ckMulti);
{$EXTERNALSYM TConnectionKind}

TConnectionPoint = class(TContainedObject, IConnectionPoint)
private
FContainer: TConnectionPoints;
FIID: TGUID;
FSinkList: TList;
FOnConnect: TConnectEvent;
FKind: TConnectionKind;
function AddSink(const Sink: IUnknown): Integer;
procedure RemoveSink(Cookie: Longint);
protected
{ IConnectionPoint }
function GetConnectionInterface(out iid: TIID): HResult; stdcall;
function GetConnectionPointContainer(
out cpc: IConnectionPointContainer): HResult; stdcall;
function Advise(const unkSink: IUnknown; out dwCookie: Longint): HResult; stdcall;
function Unadvise(dwCookie: Longint): HResult; stdcall;
function EnumConnections(out enumconn: IEnumConnections): HResult; stdcall;
public
constructor Create(Container: TConnectionPoints;
const IID: TGUID; Kind: TConnectionKind; OnConnect: TConnectEvent);
property SinkList : TList read FSinkList;
destructor Destroy; override;
end;
{$EXTERNALSYM TConnectionPoint}

TConnectionPoints = class{IConnectionPointContainer}
private
FController: Pointer; // weak ref to controller - don't keep it alive
FConnectionPoints: TList;
function GetController: IUnknown;
protected
{ IConnectionPointContainer }
function EnumConnectionPoints(
out enumconn: IEnumConnectionPoints): HResult; stdcall;
function FindConnectionPoint(const iid: TIID;
out cp: IConnectionPoint): HResult; stdcall;
public
constructor Create(const AController: IUnknown);
destructor Destroy; override;
function CreateConnectionPoint(const IID: TGUID; Kind: TConnectionKind;
OnConnect: TConnectEvent): TConnectionPoint;
property Controller: IUnknown read GetController;
end;


Сообщение отредактировал European - 19:03:2008, 08:32
Причина редактирования: Установка тегов кода
Подняться вверх 
 
Сообщение #3
sax_ol
Вставить ник
сообщение 19:03:2008, 08:44
Цитата Ответить 


==============
*****

Группа: Модеры
Сообщений: 1 740
Регистрация: 11:01:2007
Пользователь №: 8 750
Специализация: specialist



Репутация: - 27 +


tenebrise
И? "Что это было?" ©
Подняться вверх 
 
Сообщение #4


Быстрый ответ  Ответить  Новая тема 

> Быстрый ответ
Полужирный
Курсив
Подчеркнутый
Вставить изображение
Смайлики
Цитата
Код
 
 Отправлять уведомления об ответах на e-mail |  Включить смайлики |  Добавить подпись
   

 

RSS Текстовая версия Сейчас: 17:05:2008 - 07:22
с нами можно связаться по:
телефону: +375-(29)-632-60-67
e-mail:info@codeby.net