Click here to Skip to main content
15,884,388 members
Articles / Desktop Programming / MFC

XBitArray - a non-MFC C++ class to manipulate bits in a bit array.

Rate me:
Please Sign up or sign in to vote.
4.74/5 (26 votes)
10 Feb 2004CPOL5 min read 71.3K   1K   37  
XBitArray provides functions to set, test, and find bits in an array of bytes.
// XBitArrayTestDlg.h : header file
//

#ifndef XBITARRAYTESTDLG_H
#define XBITARRAYTESTDLG_H

#include "XListbox.h"
#include "XBitArray.h"

/////////////////////////////////////////////////////////////////////////////
// CXBitArrayTestDlg dialog

class CXBitArrayTestDlg : public CDialog
{
// Construction
public:
	CXBitArrayTestDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CXBitArrayTestDlg)
	enum { IDD = IDD_XBITARRAYTEST_DIALOG };
	CXListBox	m_List;
	//}}AFX_DATA

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

// Implementation
protected:
	void CreateBitFile(LPCTSTR lpszFile, DWORD dwSizeBytes, BOOL bit_value);
	int RunTest(CXBitArray& bit, int testnumber);
	int RunTest2(CXBitArray& bit, int testnumber);
	int RunTest3(int testnumber);
	int RunTest4(int testnumber);
	int RunTest5(int testnumber);

	HICON m_hIcon;
	int m_nErrors;

	// Generated message map functions
	//{{AFX_MSG(CXBitArrayTestDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnTest();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif //XBITARRAYTESTDLG_H

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Hans Dietrich Software
United States United States
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.

Recently, I have moved to Los Angeles where I am doing consulting and development work.

For consulting and custom software development, please see www.hdsoft.org.






Comments and Discussions