aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-05-30 17:46:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-05-30 17:49:42 +0300
commita66efed44af2f9bc917d265ca7640ded40683f05 (patch)
tree8b034529c8a16d9eb9cce9b9bab0e21212823b85
parentc46d9c4b40d340470d1a9d30be9761f6334ab4d3 (diff)
Don't print classes derived from hidden on build configuration classes page
-rw-r--r--mod/build-config-module.cxx33
-rw-r--r--mod/build-config-module.hxx9
-rw-r--r--mod/mod-build-configs.cxx12
3 files changed, 34 insertions, 20 deletions
diff --git a/mod/build-config-module.cxx b/mod/build-config-module.cxx
index 97c9f9e..1f4ad42 100644
--- a/mod/build-config-module.cxx
+++ b/mod/build-config-module.cxx
@@ -148,26 +148,35 @@ namespace brep
}
bool build_config_module::
- belongs (const build_target_config& cfg, const char* cls) const
+ derived (const string& c, const char* bc) const
{
+ if (c == bc)
+ return true;
+
+ // Go through base classes.
+ //
const map<string, string>& im (target_conf_->class_inheritance_map);
- for (const string& c: cfg.classes)
+ for (auto i (im.find (c)); i != im.end (); )
{
- if (c == cls)
+ const string& base (i->second);
+
+ if (base == bc)
return true;
- // Go through base classes.
- //
- for (auto i (im.find (c)); i != im.end (); )
- {
- const string& base (i->second);
+ i = im.find (base);
+ }
- if (base == cls)
- return true;
+ return false;
+ }
- i = im.find (base);
- }
+ bool build_config_module::
+ belongs (const build_target_config& cfg, const char* cls) const
+ {
+ for (const string& c: cfg.classes)
+ {
+ if (derived (c, cls))
+ return true;
}
return false;
diff --git a/mod/build-config-module.hxx b/mod/build-config-module.hxx
index c1630b0..bbbe952 100644
--- a/mod/build-config-module.hxx
+++ b/mod/build-config-module.hxx
@@ -54,15 +54,20 @@ namespace brep
default_all_ucs);
}
+ // Return true if a class is derived from the base class, recursively.
+ //
+ bool
+ derived (const string&, const char* base_class) const;
+
// Check if the configuration belongs to the specified class.
//
bool
belongs (const build_target_config&, const char*) const;
bool
- belongs (const build_target_config& cfg, const string& cls) const
+ belongs (const build_target_config& cfg, const string& classes) const
{
- return belongs (cfg, cls.c_str ());
+ return belongs (cfg, classes.c_str ());
}
// Target/configuration/toolchain combination that, in particular, can be
diff --git a/mod/mod-build-configs.cxx b/mod/mod-build-configs.cxx
index 0ac4615..ce79edb 100644
--- a/mod/mod-build-configs.cxx
+++ b/mod/mod-build-configs.cxx
@@ -125,19 +125,19 @@ handle (request& rq, response& rs)
s << DIV(ID="filter-heading") << "Build Configuration Classes" << ~DIV
<< P(ID="filter");
+ bool printed (false);
for (auto b (cls.begin ()), i (b), e (cls.end ()); i != e; ++i)
{
- // Skip the 'hidden' class.
+ // Skip the hidden classes.
//
const string& c (*i);
- if (c != "hidden")
+ if (!derived (c, "hidden"))
{
- // Note that here we rely on the fact that the first class in the list
- // can never be 'hidden' (is always 'all').
- //
- if (i != b)
+ if (printed)
s << ' ';
+ else
+ printed = true;
print_class_name (c, c == selected_class);