MCPcopy Create free account
hub / github.com/Haivision/srt / FillArgMap

Method FillArgMap

test/test_main.cpp:27–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25TestEnv* TestEnv::me = 0;
26
27void TestEnv::FillArgMap()
28{
29 // The rule is:
30 // - first arguments go to an empty string key
31 // - if an argument has - in the beginning, name the key
32 // - key followed by args collected in a list
33 // - double dash prevents interpreting further args as option keys
34
35 string key;
36 bool expectkey = true;
37
38 argmap[""];
39
40 for (auto& a: args)
41 {
42 if (a.size() > 1)
43 {
44 if (expectkey && a[0] == '-')
45 {
46 if (a[1] == '-')
47 expectkey = false;
48 else if (a[1] == '/')
49 key = "";
50 else
51 {
52 key = a.substr(1);
53 argmap[key]; // Make sure it exists even empty
54 }
55
56 continue;
57 }
58 }
59 argmap[key].push_back(a);
60 }
61
62 return;
63}
64
65std::string TestEnv::OptionValue(const std::string& key)
66{

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected