MCPcopy Create free account
hub / github.com/Kistler-Group/sdbus-cpp / main

Function main

tools/xml2cpp-codegen/xml2cpp.cpp:70–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70int main(int argc, char **argv)
71{
72 const char* programName = argv[0];
73 argv++;
74 argc--;
75
76 const char* proxy = nullptr;
77 const char* adaptor = nullptr;
78 const char* xmlFile = nullptr;
79 bool verbose = false;
80
81 while (argc > 0)
82 {
83 if (!strncmp(*argv, "--proxy=", 8))
84 {
85 if (proxy != nullptr)
86 {
87 std::cerr << "Multiple occurrencies of --proxy is not allowed" << endl;
88 usage(std::cerr, programName);
89 return 1;
90 }
91 proxy = *argv + 8;
92 }
93 else if (!strncmp(*argv, "--adaptor=", 10) || !strncmp(*argv, "--adapter=", 10))
94 {
95 if (adaptor != nullptr)
96 {
97 std::cerr << "Multiple occurrencies of --adaptor is not allowed" << endl;
98 usage(std::cerr, programName);
99 return 1;
100 }
101 adaptor = *argv + 10;
102 }
103 else if (!strcmp(*argv, "--help") || !strcmp(*argv, "-h"))
104 {
105 usage(std::cout, programName);
106 return 0;
107 }
108 else if (!strcmp(*argv, "--version") || !strcmp(*argv, "-v"))
109 {
110 std::cout << "Version: " << SDBUS_XML2CPP_VERSION << std::endl;
111 return 0;
112 }
113 else if (!strcmp(*argv, "--verbose"))
114 {
115 verbose = true;
116 }
117 else if (**argv == '-')
118 {
119 std::cerr << "Unknown option " << *argv << endl;
120 usage(std::cerr, programName);
121 return 1;
122 }
123 else
124 {
125 if (xmlFile != nullptr)
126 {
127 std::cerr << "More than one input file specified: " << *argv << endl;

Callers

nothing calls this directly

Calls 3

usageFunction · 0.85
whatMethod · 0.80
transformXmlToFileMethod · 0.80

Tested by

no test coverage detected