~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to launcher/DndData.h

  • Committer: Marco Trevisan (Treviño)
  • Date: 2013-04-26 12:41:09 UTC
  • Revision ID: mail@3v1n0.net-20130426124109-t3b2shjah2omiqa2
Unity: Remove all the views, but the Shortcuts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
 
/*
3
 
* Copyright (C) 2011 Canonical Ltd
4
 
*
5
 
* This program is free software: you can redistribute it and/or modify
6
 
* it under the terms of the GNU General Public License version 3 as
7
 
* published by the Free Software Foundation.
8
 
*
9
 
* This program is distributed in the hope that it will be useful,
10
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
* GNU General Public License for more details.
13
 
*
14
 
* You should have received a copy of the GNU General Public License
15
 
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
*
17
 
* Authored by: Andrea Azzarone <azzaronea@gmail.com>
18
 
*/
19
 
 
20
 
#ifndef DNDDATA_H
21
 
#define DNDDATA_H
22
 
 
23
 
#include <map>
24
 
#include <set>
25
 
#include <string>
26
 
 
27
 
namespace unity {
28
 
 
29
 
class DndData
30
 
{
31
 
public:
32
 
  /**
33
 
   * Fills the object given a list of uris.
34
 
   **/
35
 
  void Fill(const char* uris);
36
 
  
37
 
  /**
38
 
   * Resets the object. Call this function when no longer need data
39
 
   **/
40
 
  void Reset();
41
 
  
42
 
  /**
43
 
   * Returns a std::set<std::string> with all the uris.
44
 
   **/
45
 
  std::set<std::string> const& Uris() const { return uris_; }
46
 
  
47
 
  /**
48
 
   * Returns a std::set<std::string> with all the types.
49
 
   **/
50
 
  std::set<std::string> const& Types() const { return types_; }
51
 
  
52
 
  /**
53
 
   * Returns a std::set<std::string> with all uris of a given type.
54
 
   **/
55
 
  std::set<std::string> const& UrisByType(const std::string& type) const { return types_to_uris_.find(type)->second; }
56
 
  
57
 
  /**
58
 
   * Returns a std::set<std::string> with all types of a given uri.
59
 
   **/
60
 
  std::string const& TypeByUri(const std::string& uris) { return uris_to_types_.find(uris)->second; }
61
 
 
62
 
private:
63
 
  std::set<std::string> uris_;
64
 
  std::set<std::string> types_;
65
 
  std::map<std::string, std::string> uris_to_types_;
66
 
  std::map<std::string, std::set<std::string>> types_to_uris_;
67
 
};
68
 
 
69
 
} // namespace unity
70
 
 
71
 
#endif // DNDDATA_H