~zhangew401/scope-aggregator/fix-empty-query-to-clickstore

« back to all changes in this revision

Viewing changes to include/scope.h

  • Committer: Gary.Wzl
  • Date: 2016-06-30 05:00:45 UTC
  • mfrom: (163.1.12 4.8-local-hints)
  • Revision ID: gary.wang@canonical.com-20160630050045-2p38uwpqgkdnge1x
Tags: 4.8
1.compile time optimization for string(QStringLiteral).
2.load the various json files once aggregator scope startup.
3.specify 'const' keyword for some variable in some cases.
4.pass by reference instead of by value if possible.
5.don't allocated memory(make_shared) based on local variable to avoid copy constructor.
6 remove duplicate obj creation.
7.fix invalid pointer for us::Category::SCPtr when look_up is called.
8.remove redundant files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <unity/scopes/QueryBase.h>
27
27
#include <unity/scopes/PreviewQueryBase.h>
28
28
 
 
29
#include <QJsonObject>
 
30
 
29
31
class AggScope : public unity::scopes::ScopeBase
30
32
{
31
33
public:
 
34
    enum class IdType {id, local_id};
 
35
 
32
36
    AggScope();
33
37
 
34
38
    virtual void start(std::string const& scope_name) override;
41
45
    virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const& q,
42
46
                                                        unity::scopes::SearchMetadata const&) override;
43
47
 
44
 
    unity::scopes::ActivationQueryBase::UPtr
45
 
    activate(unity::scopes::Result               const& result,
46
 
                   unity::scopes::ActionMetadata const& metadata)override;
 
48
    unity::scopes::ActivationQueryBase::UPtr activate(unity::scopes::Result const& result,
 
49
                                                      unity::scopes::ActionMetadata const& metadata)override;
47
50
 
48
51
    unity::scopes::ChildScopeList find_child_scopes() const override;
49
52
 
50
 
    enum class IdType {id, local_id};
51
 
 
52
53
    std::vector<std::string> get_declared_scopes(IdType) const;
53
54
    std::vector<std::string> get_declared_keywords() const;
54
 
    std::string scope_id;
55
 
 
 
55
 
 
56
    const std::string & scope_id() const;
 
57
    const std::string & lang() const;
 
58
    const std::string & country() const;
 
59
    const QJsonObject & child_root() const;
 
60
    const QJsonObject & hints_root() const;
 
61
 
 
62
private:
 
63
    std::string scope_id_;
 
64
    std::string lang_;
 
65
    std::string country_;
 
66
    QJsonObject child_root_;
 
67
    QJsonObject hints_root_;
56
68
};
57
69
#endif