File: units.hpp

package info (click to toggle)
polybar 3.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,108 kB
  • sloc: cpp: 30,424; python: 3,750; sh: 284; makefile: 83
file content (34 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (3)
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
#pragma once

#include <cassert>
#include <cmath>
#include <stdexcept>
#include <string>

#include "components/types.hpp"
#include "utils/string.hpp"

POLYBAR_NS

namespace units_utils {
  int point_to_pixel(double point, double dpi);

  int extent_to_pixel(const extent_val size, double dpi);
  unsigned extent_to_pixel_nonnegative(const extent_val size, double dpi);

  extent_type parse_extent_unit(const string& str);
  extent_val parse_extent(const string& str);

  string extent_to_string(extent_val extent);

  int percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi);
  unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi);

  spacing_type parse_spacing_unit(const string& str);
  spacing_val parse_spacing(const string& str);

  extent_val spacing_to_extent(spacing_val spacing);

} // namespace units_utils

POLYBAR_NS_END