Skip to content

A mod of original argstream to support both char and wchar_t string

License

Notifications You must be signed in to change notification settings

LevskiWeng/argstream

Repository files navigation

argstream

The purpose of this mod of argstream is to extend argstream and support both char and wchar_t string, and add some useful extension such as argstream::copyrigh() and argstream::example()

Usage

#include "argstream.h"
int _tmain(int argc, _TCHAR* argv[])
{
	argstream::argstream<_TCHAR> as(argc, argv);
	argstream::TSTR<_TCHAR>::type filePath(_T("C:\\default_file.name"));
	int size;
	as >> argstream::copyright(_T("CopyRight (c) 2015. Levski Weng <[email protected]>. All rights reserved."));
	as >> argstream::parameter(
		_T('f'), //short parameter name
		_T("file"), //long parameter name
		filePath, //variable stores the value
		_T("Full path of file "), //description in argstream::usage()
		false) //the parameter is not mandatory
	   >> argstream::paramater(_T('s'), // another parameter
		_T("size"),
		size,
		_T("File size "),
		true); //the parameter is mandatory
	as >> argstream::help<_TCHAR>(); //Add help parameter
	as >> argstream::example(_T("example command line"), _T("Description of the example"));
	as >> argstream::example(_T("example command line 2"), _T("Description of the example 2"));
#ifdef UNICODE
	std::wcout << as.usage();
#else
	std::cout << as.usage();
#endif
	as.defaultErrorHandling();

	//TODO: Write your code here

	return 0;
}

For more usage examples, please refer to the unit test file test.cpp. Hope this mod is useful for you :-)

About

A mod of original argstream to support both char and wchar_t string

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published