aboutsummaryrefslogtreecommitdiff
path: root/brep/options.cli
blob: 4126f4a0f45ee04426ceffaf4695caa51b25a7a8 (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
// file      : brep/options.cli -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

include <string>;
include <cstdint>; // uint16_t

include <butl/path>;

namespace brep
{
  // Web module configuration options.
  //
  namespace options
  {
    class module
    {
      std::uint16_t verb = 0;
      butl::dir_path root = "";
    };

    class db
    {
      std::string db-host = "localhost";
      std::uint16_t db-port = 5432;
    };

    class package_search: module, db
    {
      std::uint16_t results-on-page = 10;
      std::uint16_t pages-in-pager = 10;
    };

    class package_details: module, db
    {
      std::uint16_t results-on-page = 10;
      std::uint16_t pages-in-pager = 10;
      std::uint16_t description-length = 400;
    };

    class package_version_details: module, db
    {
      std::uint16_t description-length = 400;
      std::uint16_t changes-length = 800;
    };

    class repository_details: module, db
    {
    };
  }

  // Web module HTTP request parameters.
  //
  namespace params
  {
    // Use parameters long names in the C++ code, short aliases (if present)
    // in HTTP URL.
    //
    class package_search
    {
      // Display package search result list starting from this page.
      //
      std::uint16_t page | p = 0;

      // Package search criteria.
      //
      std::string query | q = "";
    };

    class package_details
    {
      // Display package version search result list starting from this page.
      //
      std::uint16_t page | p = 0;

      // Package version search criteria.
      //
      std::string query | q = "";

      // Full page variant.
      //
      // @@ Shouldn't we use one letter alias for URL as well ?
      //    I like full. It is descriptive. q= is kind now a convention.
      //
      bool full = false;
    };

    class package_version_details
    {
      // Full page variant.
      //
      bool full = false;
    };
  }
}