]> git.lyx.org Git - lyx.git/blobdiff - src/debug.cpp
cosmetics
[lyx.git] / src / debug.cpp
index 2e532fc7ece072aaac54b6f703927d962cb6f682..f7e812a5f98400ee4535a1299f97f4b36051a95e 100644 (file)
 #include <iostream>
 #include <iomanip>
 
+using std::setw;
+using std::string;
+using std::ostream;
+
 
 namespace lyx {
 
@@ -27,20 +31,16 @@ using support::ascii_lowercase;
 using support::bformat;
 using support::isStrInt;
 
-using std::setw;
-using std::string;
-using std::ostream;
-
 namespace {
 
-struct error_item {
+struct ErrorItem {
        Debug::type level;
        char const * name;
        char const * desc;
 };
 
 
-error_item errorTags[] = {
+ErrorItem errorTags[] = {
        { Debug::NONE,      "none",      N_("No debugging message")},
        { Debug::INFO,      "info",      N_("General information")},
        { Debug::INIT,      "init",      N_("Program initialisation")},
@@ -72,17 +72,17 @@ error_item errorTags[] = {
 };
 
 
-int const numErrorTags = sizeof(errorTags)/sizeof(error_item);
+int const numErrorTags = sizeof(errorTags)/sizeof(errorTags[0]);
 
 } // namespace anon
 
 
-lyx_debug_trait::type lyx_debug_trait::value(string const & val)
+Debug::type Debug::value(string const & val)
 {
        type l = Debug::NONE;
-       string v(val);
+       string v = val;
        while (!v.empty()) {
-               string::size_type const st = v.find(',');
+               size_t const st = v.find(',');
                string const tmp(ascii_lowercase(v.substr(0, st)));
                if (tmp.empty())
                        break;
@@ -103,10 +103,10 @@ lyx_debug_trait::type lyx_debug_trait::value(string const & val)
 }
 
 
-void lyx_debug_trait::showLevel(ostream & os, lyx_debug_trait::type level)
+void Debug::showLevel(ostream & os, Debug::type level)
 {
        // Show what features are traced
-       for (int i = 0; i < numErrorTags ; ++i) {
+       for (int i = 0; i != numErrorTags; ++i) {
                if (errorTags[i].level != Debug::ANY
                    && errorTags[i].level != Debug::NONE
                    && errorTags[i].level & level) {
@@ -121,9 +121,9 @@ void lyx_debug_trait::showLevel(ostream & os, lyx_debug_trait::type level)
 }
 
 
-void lyx_debug_trait::showTags(ostream & os)
+void Debug::showTags(ostream & os)
 {
-       for (int i = 0; i < numErrorTags ; ++i)
+       for (int i = 0; i != numErrorTags ; ++i)
                os << setw(10) << static_cast<unsigned int>(errorTags[i].level)
                   << setw(13) << errorTags[i].name
                   << "  " << to_utf8(_(errorTags[i].desc)) << '\n';