Back to index

unity  6.0.0
Public Types | Public Member Functions | Protected Member Functions | Private Attributes
unity::debug::Introspectable Class Reference

#include <Introspectable.h>

Inheritance diagram for unity::debug::Introspectable:
Inheritance graph
[legend]
Collaboration diagram for unity::debug::Introspectable:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 Introspectable ()
virtual ~Introspectable ()
GVariant * Introspect ()
virtual std::string GetName () const =0
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual void AddProperties (GVariantBuilder *builder)=0
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

Protected Member Functions

virtual std::string GetChildsName () const
 Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Private Attributes

std::list< Introspectable * > _children
std::list< Introspectable * > _parents
guint64 _id

Detailed Description

Definition at line 31 of file Introspectable.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

Definition at line 27 of file Introspectable.cpp.

{
  static guint64 unique_id=0;
  _id = unique_id++;
}

Definition at line 33 of file Introspectable.cpp.

{
  for (auto parent : _parents)
    parent->_children.remove(this);
  for (auto child : _children)
    child->_parents.remove(this);
}

Member Function Documentation

Definition at line 78 of file Introspectable.cpp.

{
  _children.push_back(child);
  child->_parents.push_back(this);
}

Here is the caller graph for this function:

virtual void unity::debug::Introspectable::AddProperties ( GVariantBuilder *  builder) [pure virtual]
std::string unity::debug::Introspectable::GetChildsName ( ) const [protected, virtual]

Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Definition at line 92 of file Introspectable.cpp.

{
  return "Children";
}

Here is the caller graph for this function:

Reimplemented in unity::hud::View, unity::launcher::LauncherModel, unity::QuicklistView, and unity::dash::ResultView.

Definition at line 41 of file Introspectable.cpp.

{
  return _children;
}

Here is the caller graph for this function:

Definition at line 97 of file Introspectable.cpp.

{
  return _id;
}

Here is the caller graph for this function:

virtual std::string unity::debug::Introspectable::GetName ( ) const [pure virtual]

Implemented in unity::WindowButton, unity::launcher::LauncherIcon, unity::UnityScreen, WindowManager, unity::launcher::Launcher, unity::dash::DashView, unity::dash::LensView, unity::switcher::Controller, unity::SearchBar, unity::launcher::BamfLauncherIcon, unity::QuicklistMenuItem, unity::PanelIndicatorEntryView, unity::launcher::LauncherModel, unity::switcher::SwitcherModel, unity::PlacesGroup, unity::hud::View, unity::launcher::Controller, unity::dash::FilterExpanderLabel, unity::PanelIndicatorsView, unity::dash::LensBar, unity::QuicklistView, unity::switcher::SwitcherView, unity::PanelView, unity::LauncherEntryRemote, unity::hud::Controller, unity::IconTexture, unity::hud::HudButton, unity::PanelMenuView, unity::WindowButtons, unity::dash::Controller, unity::dash::ResultView, unity::shortcut::View, unity::shortcut::Controller, unity::dash::FilterBar, unity::ui::UnityWindowView, unity::launcher::MockLauncherIcon, unity::panel::Controller, unity::PanelTitlebarGrabArea, unity::SearchBarSpinner, unity::dash::LensBarIcon, unity::PanelTray, unity::Tooltip, unity::launcher::BFBLauncherIcon, unity::launcher::DesktopLauncherIcon, unity::launcher::SimpleLauncherIcon, unity::launcher::TrashLauncherIcon, unity::launcher::HudLauncherIcon, unity::launcher::DeviceLauncherIcon, unity::launcher::SoftwareCenterLauncherIcon, unity::hud::Icon, unity::launcher::SingleMonitorLauncherIcon, unity::launcher::SpacerLauncherIcon, unity::debug::ResultWrapper, and MockIntrospectable.

Here is the caller graph for this function:

Definition at line 47 of file Introspectable.cpp.

{
  GVariantBuilder  builder;
  GVariantBuilder  child_builder;
  gint             n_children = 0;

  g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
  g_variant_builder_add(&builder, "{sv}", "id", g_variant_new_uint64(_id));

  AddProperties(&builder);

  g_variant_builder_init(&child_builder, G_VARIANT_TYPE("as"));

  auto children = GetIntrospectableChildren();
  for (auto it = children.begin(); it != children.end(); it++)
  {
    if ((*it)->GetName() != "")
    {
      g_variant_builder_add(&child_builder, "s", (*it)->GetName().c_str());
      n_children++;
    }
  }

  GVariant* child_results = g_variant_builder_end(&child_builder);

  if (n_children > 0)
    g_variant_builder_add(&builder, "{sv}", GetChildsName().c_str(), child_results);
  return g_variant_builder_end(&builder);
}

Here is the call graph for this function:

Definition at line 85 of file Introspectable.cpp.

{
  _children.remove(child);
  child->_parents.remove(this);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 62 of file Introspectable.h.

Definition at line 64 of file Introspectable.h.

Definition at line 63 of file Introspectable.h.


The documentation for this class was generated from the following files: