Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CalendarPage Class Reference
Creates a calendar for a specified Month and Year. More...
#include <CalendarPage.h>
Public Member Functions | |
| CalendarPage (uint8_t Month=1, uint16_t Year=2018) | |
| Constructor for the CalendarPage class. | |
| void | Compute (uint8_t Month, uint16_t Year) |
| Compute the CalendarPage information, when recurring usage is needed. | |
| int | DayMapEntries () |
| Get the number of entries in the DayMap, to limit iterators. | |
Data Fields | |
| uint8_t | DayMap [CALENDAR_DATA_MAP_SIZE] |
| The CalendarPage information, expressed as an accessible array. | |
Detailed Description
Creates a calendar for a specified Month and Year.
This class is a simple CalendarPage creator. For a specified Month and Year, it will create a DayMap, which is a simple array of entries that can be easily transformed into a traditional CalendarPage.
This code was pieced together with various online code samples, none of which had any evidence of a coyright statement.
CalendarPage c; c.Compute(3, 2018); for (int i=0; i<c.DayMapEntries(); i++) { if (c.DayMap[i] == 0) printf("%4s", ""); else printf("%4d", c.DayMap[i]); } printf("\n");
Definition at line 32 of file CalendarPage.h.
Constructor & Destructor Documentation
| CalendarPage | ( | uint8_t | Month = 1, |
| uint16_t | Year = 2018 |
||
| ) |
Constructor for the CalendarPage class.
For a single instance, the constructor may be provided with a Month and Year. For recurring usage, this is generally not done, and instead the Compute method is called with the parameters.
CalendarPage c(3, 2018); for (int i=0; i<c.DayMapEntries(); i++) { if (c.DayMap[i] == 0) printf("%4s", ""); else printf("%4d", c.DayMap[i]); } printf("\n");
- Parameters:
-
[in] Month is optional and defaults to 1 (January). [in] Year is optional and defaults to 2018.
Definition at line 6 of file CalendarPage.cpp.
Member Function Documentation
| void Compute | ( | uint8_t | Month, |
| uint16_t | Year | ||
| ) |
Compute the CalendarPage information, when recurring usage is needed.
This API can be used when more than a single CalendarPage is needed. Alternately, if the constructor has no options, this API is used to select the Month and Year.
- Note:
- Erroneous parameters may cause unpredictable results.
CalendarPage c; c.Compute(3, 2018); for (int i=0; i<c.DayMapEntries(); i++) { if (c.DayMap[i] == 0) printf("%4s", ""); else printf("%4d", c.DayMap[i]); } printf("\n");
- Parameters:
-
[in] Month defines the month of interest; e.g. 1 = January, ... [in] Year defines the year of interest; e.g. 2018
- Returns:
- true if it computed the CalendarPage information.
Definition at line 24 of file CalendarPage.cpp.
| int DayMapEntries | ( | ) |
Get the number of entries in the DayMap, to limit iterators.
Definition at line 105 of file CalendarPage.h.
Field Documentation
| uint8_t DayMap[CALENDAR_DATA_MAP_SIZE] |
The CalendarPage information, expressed as an accessible array.
- There are DayMapEntries() in the Array index 0 to n-1.
- Each entry has either 0, or the day number in it.
The information format is best represented in the following visual.
/// DayMap[] array indices | DayMap populated
/// 0 1 2 3 4 5 6 | 0 0 0 0 0 0 1
/// 7 8 9 10 11 12 13 | 2 3 4 5 6 7 8
/// 14 15 16 17 18 19 20 | 9 10 11 12 13 14 15
/// 21 22 23 24 25 26 27 | 16 17 18 19 20 21 22
/// 28 29 30 31 32 33 34 | 23 24 25 26 27 28 29
/// 35 36 | 30 31
/// Definition at line 101 of file CalendarPage.h.
Generated on Fri Jul 15 2022 18:58:41 by
1.7.2