Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / MFC

The Diffraction Grating Calculator

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
30 Oct 2010GPL38 min read 41.3K   678   6  
An MFC Windows program related to Concave Diffraction Gratings using VTK libraries.
#ifndef DIRECTORY_H
#define DIRECTORY_H

#if _MSC_VER > 1000
#pragma warning (disable: 4786)
#pragma warning (disable: 4748)
#pragma warning (disable: 4103)
#endif /* _MSC_VER > 1000 */

#include <afx.h>
#include <afxwin.h>

#include "ObjectList.h"

class CDirectory
{
public:
	CDirectory(void);
	~CDirectory(void);

	// Retrieve files from a directory.
   // Returns a pointer to the ObjectList. Each element is a pointer to CString
	static CObjectList* GetFiles(TCHAR* szFolderPath, TCHAR* filter = _T("*.*"));
	// Add, if not already present, a back slash at the end of the path
	static CString AddBackSlash(TCHAR* szFolderPath);
	// Extract the directory from a full path
	static void ExtractDirectory(TCHAR* lpszPath, TCHAR* lpszFullPath);
	// Extract only the filename from a path
	static void ExtractFilename(TCHAR* lpszAppName, TCHAR* lpszPath);
	// Extract only the extension from a filename
	static CString ExtractExtension(TCHAR* lpszFilename);
	// Cut away the extension from a filename
	static CString CutExtension(TCHAR* lpszFilename);
	// Path creation
	static bool CreateFileOrDirFullPath(TCHAR* lpSourcePath, bool bIsDir);
	// Get the current process directory
	static CString GetApplicationDirectory();
	// Delete all files of a given kind
	static bool DeleteGivenFilesInGivenFolder(TCHAR* pczRetFileFullFolderPath, TCHAR* pczExtension);
   // Delete given file
   static bool DeleteGivenFile(TCHAR* pczRetFileFullFolderPath);
};

#endif /* ! defined(DIRECTORY_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 GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Italy Italy
Senior Software Developer in C/C++ and Oracle.
Ex-physicist holding a Ph.D. on x-ray lasers.

Comments and Discussions