Back to index

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

Wrap a result object from UnityCore and present it's properties to the introspectable tree. More...

#include <IntrospectableWrappers.h>

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

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 ResultWrapper (const dash::Result &result)
std::string GetName () const
void AddProperties (GVariantBuilder *builder)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
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::string uri_
std::string name_
std::string icon_hint_
std::string mime_type_

Detailed Description

Wrap a result object from UnityCore and present it's properties to the introspectable tree.

Definition at line 35 of file IntrospectableWrappers.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

Definition at line 28 of file IntrospectableWrappers.cpp.

  : uri_(result.uri),
  name_(result.name),
  icon_hint_(result.icon_hint),
  mime_type_(result.mimetype)
  {
  }

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:

void unity::debug::ResultWrapper::AddProperties ( GVariantBuilder *  builder) [virtual]

Implements unity::debug::Introspectable.

Definition at line 41 of file IntrospectableWrappers.cpp.

  {
    unity::variant::BuilderWrapper(builder)
      .add("uri", uri_)
      .add("name", name_)
      .add("icon_hint", icon_hint_)
      .add("mimetype", mime_type_);
  }

Here is the call graph for this function:

std::string unity::debug::Introspectable::GetChildsName ( ) const [protected, virtual, inherited]

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:

guint64 unity::debug::Introspectable::GetIntrospectionId ( ) const [inherited]

Definition at line 97 of file Introspectable.cpp.

{
  return _id;
}

Here is the caller graph for this function:

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

Implements unity::debug::Introspectable.

Definition at line 36 of file IntrospectableWrappers.cpp.

  {
    return "Result";
  }
GVariant * unity::debug::Introspectable::Introspect ( ) [inherited]

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 44 of file IntrospectableWrappers.h.

Definition at line 45 of file IntrospectableWrappers.h.

std::string unity::debug::ResultWrapper::name_ [private]

Definition at line 43 of file IntrospectableWrappers.h.

std::string unity::debug::ResultWrapper::uri_ [private]

Definition at line 42 of file IntrospectableWrappers.h.


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