MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / main

Function main

DAEValidator/library/src/DAEValidatorLibrary.cpp:26–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 const char* help = "--help";
25
26 int main(int argc, char* argv[])
27 {
28 auto start = chrono::high_resolution_clock::now();
29
30 // Parse arguments
31 ArgumentParser argparse(argc, argv);
32 argparse.addArgument().hint("path").help("Path to COLLADA document or directory to parse. If 'path' is a directory it is parsed for files with .DAE extension.");
33 argparse.addArgument(checkSchemaAuto).help("Regular XML schema validation.");
34 argparse.addArgument(checkSchema).numParameters(1).hint(0, "schema_path").help("Validate against arbitrary XML schema.");
35 argparse.addArgument(checkUniqueIds).help("Check that ids in documents are unique.");
36 argparse.addArgument(checkUniqueSids).help("Check that sids in documents are unique in their scope.");
37 argparse.addArgument(checkLinks).help("Check that URIs refer to valid files and/or elements.");
38 argparse.addArgument(recursive).help("Recursively parse directories. Ignored if 'path' is not a directory.");
39 argparse.addArgument(quiet).help("If set, no output is sent to standard out/err.");
40 argparse.addArgument(help).help("Display help.");
41
42 bool argparse_ok = argparse.parseArguments();
43
44 if (argparse.findArgument(help)) {
45 cout << argparse.usage() << endl;
46 return 0;
47 }
48
49 if (!argparse_ok) {
50 cerr << argparse.getParseError() << endl;
51 cout << argparse.usage() << endl;
52 return 1;
53 }
54
55 bool muted = argparse.findArgument(quiet);
56 Log log(muted);
57
58 string path = Path::GetAbsolutePath(argparse.findArgument(0).getValue<string>());
59
60 list<string> daePaths;
61 if (Path::IsDirectory(path))
62 {
63 cout << "Listing COLLADA files..." << endl;
64 daePaths = Path::ListDaes(path, argparse.findArgument(recursive));
65 }
66 else
67 {
68 daePaths.push_back(path);
69 }
70
71 if (daePaths.size() == 0)
72 {
73 cout << "No DAE found." << endl;
74 return 0;
75 }
76
77 DaeValidator validator(daePaths);
78 int result = 0;
79
80 if (!argparse.findArgument(checkSchemaAuto) &&
81 !argparse.findArgument(checkUniqueIds) &&
82 !argparse.findArgument(checkUniqueSids) &&
83 !argparse.findArgument(checkSchema) &&

Callers

nothing calls this directly

Calls 10

parseArgumentsMethod · 0.80
usageMethod · 0.80
getParseErrorMethod · 0.80
checkAllMethod · 0.80
checkSchemaMethod · 0.80
checkUniqueIdsMethod · 0.80
checkUniqueSidsMethod · 0.80
checkLinksMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected