48{
51
52 try
53 {
54 for (int i = 1; i < argc; i++)
55 {
56 const char *cp = argv[i];
57
58 if (!strcmp(cp, "-h") || !strcmp(cp, "--help"))
59 {
61 return EXIT_SUCCESS;
62 }
63 else
64 {
66 {
67 Oks::error_msg(
"oks_dump") <<
"\tCan not load file \"" << cp <<
"\", exiting...\n";
68 return EXIT_FAILURE;
69 }
70 }
71 }
72
74 {
75 Oks::error_msg(
"oks_dump") <<
"\tAt least one oks file have to be provided, exiting...\n";
76 return EXIT_FAILURE;
77 }
78 }
79 catch (oks::exception &ex)
80 {
81 std::cerr << "Caught oks exception:\n" << ex << std::endl;
82 return EXIT_FAILURE;
83 }
84 catch (std::exception &e)
85 {
86 std::cerr << "Caught standard C++ exception: " << e.what() << std::endl;
87 return EXIT_FAILURE;
88 }
89 catch (...)
90 {
91 std::cerr << "Caught unknown exception" << std::endl;
92 return EXIT_FAILURE;
93 }
94
95 std::cout << "Processed schema files:\n";
97 std::cout << i.second->get_short_file_name() << std::endl;
98
99 for (
const auto i : kernel.
classes())
100 {
101 bool printed(false);
102
103 if (i.second->get_description().empty())
104 {
106 printed = true;
107 }
108
109 if (const std::list<OksAttribute*> *attrs = i.second->direct_attributes())
110 for (const auto &j : *attrs)
111
112 if (j->get_description().empty())
113 {
114 if (!printed)
115 {
117 printed = true;
118 }
119 std::cout << " - attribute \"" << j->get_name() << "\" has no description\n";
120 }
121
122 if (const std::list<OksRelationship*> *rels = i.second->direct_relationships())
123 for (const auto &j : *rels)
124 if (j->get_description().empty())
125 {
126 if (!printed)
127 {
129 printed = true;
130 }
131 std::cout << " - relationship \"" << j->get_name() << "\" has no description\n";
132 }
133 }
134
135 return EXIT_SUCCESS;
136}
Provides interface to the OKS kernel.
OksFile * load_file(const std::string &name, bool bind=true)
Load OKS database file.
const OksClass::Map & classes() const
Get classes.
void set_silence_mode(const bool b)
Set status of silence mode. To switch 'On'/'Off' use the method's parameter:
const OksFile::Map & schema_files() const
Get all schema files.
static std::ostream & error_msg(const char *)
static void report_class(const OksClass *c, bool no_description)
static void printUsage(std::ostream &s)