1 //
2 // ArgumentParser.h: interface for the CArgumentParser class.
3 //
4 //////////////////////////////////////////////////////////////////////
5 
6 #if !defined(ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_)
7 #define ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_
8 
9 // Use this class to create parser of command line object
10 class CArgumentParser
11 {
12 public:
13 	// Call this function to specify buffer containing the command line to be parsed
14 	// Parameters:
15 	//	pchArguments - pointer to buffer containing the command line. This buffer is modified by object,
16 	//					and must not be accessed extrenaly when object is used, unless you interate it
17 	//					only once and modify only substrings returned by GetNextArgument.
18 	//
19 	// Remarks:
20 	// This object can be reused by setting the buffer multiple times.
21 	void SetArgumentList(TCHAR *pchArguments);
22 
23 	// Call this function to reset argument iteration. You don't need to call this function after call
24 	// to set SetArgumentList, because calling SetArgumentList resets iteration with new buffer.
25 	void ResetArgumentIteration();
26 
27 	// Call this function to get next argument from command line.
28 	//
29 	// Returns:
30 	//	Function returns next argument. If this is first call after calling SetArgumentList or
31 	//	ResetArgumentIteration, functions returns the first argument (The command itself ?).
32 	TCHAR * GetNextArgument();
33 	CArgumentParser();
34 	virtual ~CArgumentParser();
35 private:
36 	TCHAR *m_pchArgumentList;		// points to begin of argumet list
37 	const TCHAR *m_pchArgumentListEnd;	// points to last 0 in argument list
38 	TCHAR *m_pchArgument;
39 };
40 
41 #endif // !defined(ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_)
42