Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Fast regular expressions

, 29 Oct 2000
Compiles a regular expression into a fast automaton.
// RexSearchView.cpp : Implementierung der Klasse CRexSearchView
//

#include "stdafx.h"
#include "RexSearch.h"

#include "RexSearchDoc.h"
#include "RexSearchView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView

IMPLEMENT_DYNCREATE(CRexSearchView, CEditView)

BEGIN_MESSAGE_MAP(CRexSearchView, CEditView)
	//{{AFX_MSG_MAP(CRexSearchView)
		// HINWEIS - Hier werden Mapping-Makros vom Klassen-Assistenten eingef�gt und entfernt.
		//    Innerhalb dieser generierten Quelltextabschnitte NICHTS VER�NDERN!
	//}}AFX_MSG_MAP
	// Standard-Druckbefehle
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView Konstruktion/Destruktion

CRexSearchView::CRexSearchView()
{
	// ZU ERLEDIGEN: Hier Code zur Konstruktion einf�gen,

}

CRexSearchView::~CRexSearchView()
{
}

void    CRexSearchView::ShowFile(CString strPath,long lPos,int nLen)
{
    m_strPathName= strPath;
    CFile oFile;
    if( oFile.Open(m_strPathName,CFile::modeRead) ){
        CString str;
        oFile.Read(str.GetBufferSetLength(oFile.GetLength()+1),oFile.GetLength());
        str.SetAt(oFile.GetLength(),'\0');
        int nMinPos= max(lPos-16000,0);
        int nMaxPos= min(lPos+16000,oFile.GetLength());
        GetEditCtrl().SetWindowText(str.Mid(nMinPos,nMaxPos-nMinPos));
        GetEditCtrl().SetSel(lPos-nMinPos, lPos+nLen-nMinPos);
    }
}

BOOL CRexSearchView::PreCreateWindow(CREATESTRUCT& cs)
{
	// ZU ERLEDIGEN: �ndern Sie hier die Fensterklasse oder das Erscheinungsbild, indem Sie
	//  CREATESTRUCT cs modifizieren.

	BOOL bPreCreated = CEditView::PreCreateWindow(cs);
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Automatischen Wortumbruch aktivieren

	return bPreCreated;
}

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView Zeichnen

void CRexSearchView::OnDraw(CDC* pDC)
{
	CRexSearchDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// ZU ERLEDIGEN: Hier Code zum Zeichnen der urspr�nglichen Daten hinzuf�gen
}

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView Drucken

BOOL CRexSearchView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// Standard-CEditView-Vorbereitung
	return CEditView::OnPreparePrinting(pInfo);
}

void CRexSearchView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Standard-CEditView Beginn des Druckens.
	CEditView::OnBeginPrinting(pDC, pInfo);
}

void CRexSearchView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Standard-CEditView Ende des Druckens
	CEditView::OnEndPrinting(pDC, pInfo);
}

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView Diagnose

#ifdef _DEBUG
void CRexSearchView::AssertValid() const
{
	CEditView::AssertValid();
}

void CRexSearchView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

CRexSearchDoc* CRexSearchView::GetDocument() // Die endg�ltige (nicht zur Fehlersuche kompilierte) Version ist Inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRexSearchDoc)));
	return (CRexSearchDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CRexSearchView Nachrichten-Handler

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Martin Holzherr

Switzerland Switzerland
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 30 Oct 2000
Article Copyright 2000 by Martin Holzherr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid