MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / ParseArgs

Function ParseArgs

Samples/NiBackRecorder/main.cpp:99–219  ·  view source on GitHub ↗

Parse the command line arguments

Source from the content-addressed store, hash-verified

97
98// Parse the command line arguments
99XnBool ParseArgs(int argc, char** argv, RecConfiguration& config)
100{
101 XnBool bError = FALSE;
102
103 for (int i = 1; i < argc; ++i)
104 {
105 if (xnOSStrCaseCmp(argv[i], "time") == 0)
106 {
107 // Set the time of each recording
108 if (argc > i+1)
109 {
110 config.nDumpTime = atoi(argv[i+1]);
111 if (config.nDumpTime == 0)
112 bError = TRUE;
113 i++;
114 }
115 else
116 {
117 bError = TRUE;
118 }
119 }
120 else if (xnOSStrCaseCmp(argv[i], "depth") == 0)
121 {
122 // Set depth resolution (default is QVGA)
123 if (argc > i+1)
124 {
125 if (xnOSStrCaseCmp(argv[i+1], "vga") == 0)
126 {
127 config.pDepthMode = &VGAMode;
128 ++i;
129 }
130 else if (xnOSStrCaseCmp(argv[i+1], "qvga") ==0)
131 {
132 config.pDepthMode = &QVGAMode;
133 ++i;
134 }
135 }
136 config.bRecordDepth = TRUE;
137 }
138 else if (xnOSStrCaseCmp(argv[i], "image") == 0)
139 {
140 // Set image resolution (default is QVGA)
141 if (argc > i+1)
142 {
143 if (xnOSStrCaseCmp(argv[i+1], "vga") == 0)
144 {
145 config.pImageMode = &VGAMode;
146 ++i;
147 }
148 else if (xnOSStrCaseCmp(argv[i+1], "qvga") ==0)
149 {
150 config.pImageMode = &QVGAMode;
151 ++i;
152 }
153 }
154 config.bRecordImage = TRUE;
155 }
156 else if (xnOSStrCaseCmp(argv[i], "verbose") == 0)

Callers 1

mainFunction · 0.85

Calls 3

printUsageFunction · 0.70
xnOSStrCaseCmpFunction · 0.50
xnOSStrCopyFunction · 0.50

Tested by

no test coverage detected