Back to index

unity  6.0.0
Classes | Functions
unity::dash::impl Namespace Reference

Classes

struct  LensFilter

Functions

LensFilter parse_lens_uri (std::string const &uri)
void UpdateDrawSeparators (std::list< AbstractPlacesGroup * > groups)

Class Documentation

struct unity::dash::impl::LensFilter

Definition at line 32 of file DashViewPrivate.h.

Collaboration diagram for unity::dash::impl::LensFilter:
Class Members
map< string, string > filters
string id

Function Documentation

LensFilter unity::dash::impl::parse_lens_uri ( std::string const &  uri)

Definition at line 31 of file DashViewPrivate.cpp.

{
  LensFilter filter;

  filter.id = uri;
  std::size_t pos = uri.find("?");

  // it's a real URI (with parameters)
  if (pos != std::string::npos)
  {
    // id is the uri from begining to the '?' position
    filter.id = uri.substr(0, pos);

    // the components are from '?' position to the end
    std::string components = uri.substr(++pos);

    // split components in tokens
    std::vector<std::string> tokens;
    boost::split(tokens, components, boost::is_any_of("&"));

    for (std::string const& token : tokens)
    {
      // split each token in a pair
      std::size_t equals_pos = token.find("=");

      if (equals_pos != std::string::npos)
      {
        std::string key = token.substr(0, equals_pos);
        std::string value = token.substr(equals_pos + 1);

        // check if it's a filter
        if (boost::starts_with(key, "filter_"))
        {
          filter.filters[key.substr(7)] = value;
        }
      }

    }
  }

  return filter;
}

Here is the caller graph for this function:

void unity::dash::impl::UpdateDrawSeparators ( std::list< AbstractPlacesGroup * >  groups)

Definition at line 29 of file LensViewPrivate.cpp.

{
  std::list<AbstractPlacesGroup*>::reverse_iterator rit;
  bool found_one = false;

  for (rit = groups.rbegin(); rit != groups.rend(); ++rit)
  {
    if ((*rit)->IsVisible())
    {
      (*rit)->draw_separator = found_one;
      found_one = true;
    }
  }
}

Here is the caller graph for this function: