意义何在
这个东西有什么用呢 就是你在进行Win32API编程的时候,你写的 WinMain (wWinMain)函数它传入的可不是 argc 和 argv ,是一整个的 LPSTR lpCmdLine (或者LPWSTR)。
那么,怎么优雅地解析这个 lpCmdLine 呢?(支持 Unicode)
下面给出一种解决方案。
注:该库仍不完善,示例也没有覆盖到所有的可能情况,它甚至连启用 CaseInsensitive 都不支持。但是这是一个 “活跃” 的项目,所以会尽快完善。
主体介绍
主要思路:定义一个优雅的 StringList 类,通过 std::stringstream 进行参数的分割,然后就可以优雅的用 string::find 一样的代码进行参数解析了 :P
更新
V1 (2023-05-04) 仅 StringList 库部分代码 实现基础解析
V2 自己在改Bug和兼容性 没有上传
代码部分
stringlist.h
#pragma once
#include <string>
#include <sstream>
#include <vector>
namespace std {
template <typename _tcType>
class _tagStringList {
using _tagString = std::basic_string<_tcType, std::char_traits<_tcType>, std::allocator<_tcType>>;
using _tagStringStream = std::basic_stringstream<_tcType, std::char_traits<_tcType>, std::allocator<_tcType