summaryrefslogtreecommitdiff
path: root/IvyAudioMon/ParseCmdLine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'IvyAudioMon/ParseCmdLine.cpp')
-rw-r--r--IvyAudioMon/ParseCmdLine.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/IvyAudioMon/ParseCmdLine.cpp b/IvyAudioMon/ParseCmdLine.cpp
new file mode 100644
index 0000000..59a27ce
--- /dev/null
+++ b/IvyAudioMon/ParseCmdLine.cpp
@@ -0,0 +1,76 @@
+// ParseCmdLine.cpp: implementation of the ParseCmdLine class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+
+#include "ParseCmdLine.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+ParseCmdLine::ParseCmdLine()
+{
+ m_start = TRUE;
+ m_busNumber = "";
+ m_prefix = "IvyAudioMon ";
+ m_seuil = 15.0;
+ m_extent = "*.txt";
+}
+
+ParseCmdLine::~ParseCmdLine()
+{
+
+}
+
+void ParseCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
+{
+ if (bFlag)
+ {
+ ParseParamFlag(lpszParam);
+ }
+ else
+ ParseParamNotFlag(lpszParam);
+
+}
+
+void ParseCmdLine::ParseParamFlag(LPCTSTR pszParam)
+{
+
+ if (lstrcmpi(pszParam, TEXT("start")) == 0)
+ m_start = TRUE;
+ else if (lstrcmpi(pszParam, TEXT("bus")) == 0)
+ m_shellCommand = BusNumber;
+ else if (lstrcmpi(pszParam, TEXT("seuil")) == 0)
+ m_shellCommand = Seuil;
+ else if (lstrcmpi(pszParam, TEXT("prefix")) == 0)
+ m_shellCommand = Prefix;
+ else if (lstrcmpi(pszParam, TEXT("extent")) == 0)
+ m_shellCommand = Extent;
+}
+
+void ParseCmdLine::ParseParamNotFlag(LPCTSTR pszParam)
+{
+ switch ( m_shellCommand )
+ {
+ case BusNumber:
+ m_busNumber = pszParam;
+ break;
+ case Seuil:
+ m_seuil = atof(pszParam);
+ break;
+ case Prefix:
+ m_prefix = pszParam;
+ break;
+ case Extent:
+ m_extent = pszParam;
+ break;
+ }
+}