EstruturaDeDados
Carregando...
Procurando...
Nenhuma entrada encontrada
include
hours.hpp
Ir para a documentação deste ficheiro.
1
#pragma once
2
3
#include <string>
4
11
class
Hours
{
12
public
:
16
Hours
();
17
24
Hours
(
int
h,
int
m,
int
s);
25
32
void
set_time
(
int
h,
int
m,
int
s);
33
38
int
get_hours
()
const
;
39
44
int
get_minutes
()
const
;
45
50
int
get_seconds
()
const
;
51
56
int
to_seconds
()
const
;
57
62
double
to_minutes
()
const
;
63
68
double
to_hours
()
const
;
69
74
std::string
to_string
()
const
;
75
79
bool
operator==
(
const
Hours
& other)
const
;
80
bool
operator!=
(
const
Hours
& other)
const
;
81
bool
operator>
(
const
Hours
& other)
const
;
82
bool
operator<
(
const
Hours
& other)
const
;
83
bool
operator>=
(
const
Hours
& other)
const
;
84
bool
operator<=
(
const
Hours
& other)
const
;
85
91
Hours
operator+
(
const
Hours
& other)
const
;
92
98
Hours
operator-
(
const
Hours
& other)
const
;
99
100
private
:
101
int
hours;
102
int
minutes;
103
int
seconds;
104
111
void
normalize();
112
};
Hours
Classe que representa uma quantidade de tempo no formato HH:MM:SS.
Definição
hours.hpp:11
Hours::to_string
std::string to_string() const
Retorna o tempo formatado como string "HH:MM:SS".
Hours::Hours
Hours()
Construtor padrão que inicializa o tempo como 00:00:00.
Hours::to_seconds
int to_seconds() const
Retorna o total de segundos desde 00:00:00.
Hours::operator<
bool operator<(const Hours &other) const
Hours::get_hours
int get_hours() const
Obtém a quantidade de horas.
Hours::operator+
Hours operator+(const Hours &other) const
Sobrecarga do operador + para somar dois tempos.
Hours::operator-
Hours operator-(const Hours &other) const
Sobrecarga do operador - para subtrair dois tempos.
Hours::to_minutes
double to_minutes() const
Retorna o total de minutos desde 00:00:00.
Hours::set_time
void set_time(int h, int m, int s)
Define um novo tempo.
Hours::operator>=
bool operator>=(const Hours &other) const
Hours::Hours
Hours(int h, int m, int s)
Construtor que inicializa o tempo com valores específicos.
Hours::to_hours
double to_hours() const
Retorna o total de horas desde 00:00:00.
Hours::get_seconds
int get_seconds() const
Obtém a quantidade de segundos.
Hours::operator>
bool operator>(const Hours &other) const
Hours::get_minutes
int get_minutes() const
Obtém a quantidade de minutos.
Hours::operator<=
bool operator<=(const Hours &other) const
Hours::operator!=
bool operator!=(const Hours &other) const
Hours::operator==
bool operator==(const Hours &other) const
Operadores de comparação entre dois objetos Hours.
Gerado por
1.12.0