aboutsummaryrefslogtreecommitdiff
path: root/brep/page
blob: b923c7f7c3083e5dd4ae51e6bee6d66d85159e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// file      : brep/page -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BREP_PAGE
#define BREP_PAGE

#include <string>
#include <cstddef>    // size_t

#include <xml/forward>

#include <brep/package>

namespace brep
{
  // Page common building blocks.
  //

  // A element default style.
  //
  struct A_STYLE
  {
    void
    operator() (xml::serializer& s) const;
  };

  // Generates paging element.
  //
  class DIV_PAGER
  {
  public:
    DIV_PAGER (std::size_t current_page,
               std::size_t item_count,
               std::size_t item_per_page,
               std::size_t page_number_count,
               const std::string& url);

    void
    operator() (xml::serializer& s) const;

  private:
    std::size_t current_page_;
    std::size_t item_count_;
    std::size_t item_per_page_;
    std::size_t page_number_count_;
    const std::string& url_;
  };

  // DIV_PAGER element default style.
  //
  struct DIV_PAGER_STYLE
  {
    void
    operator() (xml::serializer& s) const;
  };

  // Generates url element.
  //
  class DIV_URL
  {
  public:
    DIV_URL (const url& u): url_ (u) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const url& url_;
  };

  // Generates email element.
  //
  class DIV_EMAIL
  {
  public:
    DIV_EMAIL (const email& e): email_ (e) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const email& email_;
  };

  // Generates package tags element.
  //
  class DIV_TAGS
  {
  public:
    DIV_TAGS (const strings& ts): tags_ (ts) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const strings& tags_;
  };

  // Generates package version license alternatives element.
  //
  class DIV_LICENSES
  {
  public:
    DIV_LICENSES (const license_alternatives& l): license_alternatives_ (l) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const license_alternatives& license_alternatives_;
  };

  // Generates package version priority element.
  //
  class DIV_PRIORITY
  {
  public:
    DIV_PRIORITY (const priority& p): priority_ (p) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const priority& priority_;
  };

  // Generates package search element.
  //
  class FORM_SEARCH
  {
  public:
    FORM_SEARCH (const std::string& q): query_ (q) {}

    void
    operator() (xml::serializer& s) const;

  private:
    const std::string& query_;
  };
}

#endif // BREP_PAGE