SMACC2
Loading...
Searching...
No Matches
cl_gcalcli::CalendarEvent Struct Reference

Represents a Google Calendar event. More...

#include <types.hpp>

Collaboration diagram for cl_gcalcli::CalendarEvent:
Collaboration graph

Public Member Functions

bool isActiveNow () const
 Check if the event is currently active (ongoing)
 
bool hasStartedWithinMinutes (int minutes) const
 Check if the event has started within the last N minutes.
 
bool willStartWithinMinutes (int minutes) const
 Check if the event will start within the next N minutes.
 
bool hasEnded () const
 Check if the event has ended.
 
int minutesUntilStart () const
 Get minutes until event starts (negative if already started)
 

Public Attributes

std::string id
 
std::string title
 
std::string calendar_name
 
std::string location
 
std::string description
 
std::chrono::system_clock::time_point start_time
 
std::chrono::system_clock::time_point end_time
 
bool is_all_day = false
 

Detailed Description

Represents a Google Calendar event.

Definition at line 39 of file types.hpp.

Member Function Documentation

◆ hasEnded()

bool cl_gcalcli::CalendarEvent::hasEnded ( ) const
inline

Check if the event has ended.

Definition at line 81 of file types.hpp.

82 {
83 auto now = std::chrono::system_clock::now();
84 return now >= end_time;
85 }
std::chrono::system_clock::time_point end_time
Definition types.hpp:47

References end_time.

◆ hasStartedWithinMinutes()

bool cl_gcalcli::CalendarEvent::hasStartedWithinMinutes ( int minutes) const
inline

Check if the event has started within the last N minutes.

Definition at line 62 of file types.hpp.

63 {
64 auto now = std::chrono::system_clock::now();
65 auto window_start = start_time - std::chrono::minutes(minutes);
66 return now >= window_start && now < end_time;
67 }
std::chrono::system_clock::time_point start_time
Definition types.hpp:46

References end_time, and start_time.

◆ isActiveNow()

bool cl_gcalcli::CalendarEvent::isActiveNow ( ) const
inline

Check if the event is currently active (ongoing)

Definition at line 53 of file types.hpp.

54 {
55 auto now = std::chrono::system_clock::now();
56 return now >= start_time && now < end_time;
57 }

References end_time, and start_time.

◆ minutesUntilStart()

int cl_gcalcli::CalendarEvent::minutesUntilStart ( ) const
inline

Get minutes until event starts (negative if already started)

Definition at line 90 of file types.hpp.

91 {
92 auto now = std::chrono::system_clock::now();
93 auto diff = std::chrono::duration_cast<std::chrono::minutes>(start_time - now);
94 return static_cast<int>(diff.count());
95 }

References start_time.

◆ willStartWithinMinutes()

bool cl_gcalcli::CalendarEvent::willStartWithinMinutes ( int minutes) const
inline

Check if the event will start within the next N minutes.

Definition at line 72 of file types.hpp.

73 {
74 auto now = std::chrono::system_clock::now();
75 return now < start_time && now >= (start_time - std::chrono::minutes(minutes));
76 }

References start_time.

Member Data Documentation

◆ calendar_name

std::string cl_gcalcli::CalendarEvent::calendar_name

Definition at line 43 of file types.hpp.

◆ description

std::string cl_gcalcli::CalendarEvent::description

Definition at line 45 of file types.hpp.

◆ end_time

std::chrono::system_clock::time_point cl_gcalcli::CalendarEvent::end_time

Definition at line 47 of file types.hpp.

Referenced by hasEnded(), hasStartedWithinMinutes(), and isActiveNow().

◆ id

std::string cl_gcalcli::CalendarEvent::id

Definition at line 41 of file types.hpp.

◆ is_all_day

bool cl_gcalcli::CalendarEvent::is_all_day = false

Definition at line 48 of file types.hpp.

◆ location

std::string cl_gcalcli::CalendarEvent::location

Definition at line 44 of file types.hpp.

◆ start_time

std::chrono::system_clock::time_point cl_gcalcli::CalendarEvent::start_time

◆ title


The documentation for this struct was generated from the following file: