gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commandline.cpp (555B)


      1 #include"commandline.h"
      2 
      3 namespace baseLib
      4 {
      5 	CommandLine::CommandLine(const int _argc, char* _argv[])
      6 	{
      7 		std::string currentArg;
      8 
      9 		for (int i = 1; i < _argc; ++i)
     10 		{
     11 			std::string arg(_argv[i]);
     12 			if (arg.empty())
     13 				continue;
     14 
     15 			if (arg[0] == '-')
     16 			{
     17 				if (!currentArg.empty())
     18 					add(currentArg);
     19 
     20 				currentArg = arg.substr(1);
     21 			}
     22 			else
     23 			{
     24 				if (!currentArg.empty())
     25 				{
     26 					add(currentArg, arg);
     27 					currentArg.clear();
     28 				}
     29 				else
     30 				{
     31 					add(arg);
     32 				}
     33 			}
     34 		}
     35 
     36 		if (!currentArg.empty())
     37 			add(currentArg);
     38 	}
     39 }