Click here to Skip to main content
12,505,881 members (51,460 online)
Click here to Skip to main content

Stats

302.9K views
4.7K downloads
103 bookmarked
Posted

Fast regular expressions

, 29 Oct 2000
Compiles a regular expression into a fast automaton.
#if !defined(AFX_DLGREGDEFINITIONS_H__8929AD41_A417_11D4_8FAF_AACD637B1045__INCLUDED_)
#define AFX_DLGREGDEFINITIONS_H__8929AD41_A417_11D4_8FAF_AACD637B1045__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgRegDefinitions.h : header file
//
#pragma warning(disable:4786)
#pragma warning(disable:4503)
#include <utility>
#include <vector>
using namespace std;
#include "RexInterface.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgRegDefinitions dialog


class CDlgRegDefinitions : public CDialog
{
// Construction
public:
    struct CLock{
    CLock(bool& r):m_r(r),m_bKeep(true)
    {
        if(!m_r){
            m_bKeep= false;
            m_r= true;
        }else{
            m_bKeep= true;
        }
    }
    operator bool(){return !m_bKeep;}
    ~CLock(){if(!m_bKeep){m_r=false;}} 
    
    bool&   m_r;
    bool    m_bKeep;
    };

	CDlgRegDefinitions(vector< pair<CString,CString> > vecDefs,
        CWnd* pParent = NULL);   // standard constructor
    
    vector< pair<CString,CString> > m_vecDefs;
// Dialog Data
	//{{AFX_DATA(CDlgRegDefinitions)
	enum { IDD = IDD_DIALOG_REGDEFS };
	CListCtrl	m_lstDefs;
	CString	m_name;
	CString	m_expr;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDlgRegDefinitions)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
    REXI_Search m_rs;
    bool        m_bIsLocked;
    void        ChangeSelectedListItem(int nInd,CString& rVal);
	// Generated message map functions
	//{{AFX_MSG(CDlgRegDefinitions)
	virtual BOOL OnInitDialog();
	afx_msg void OnChangeEditExpr();
	afx_msg void OnChangeEditName();
	afx_msg void OnItemchangedListDefs(NMHDR* pNMHDR, LRESULT* pResult);
	virtual void OnOK();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGREGDEFINITIONS_H__8929AD41_A417_11D4_8FAF_AACD637B1045__INCLUDED_)

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

Share

About the Author

Martin Holzherr
Switzerland Switzerland
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160927.1 | Last Updated 30 Oct 2000
Article Copyright 2000 by Martin Holzherr
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid