Class DCalendar

Inherits from:
Object
Conforms to:
DDatable, DTextable
Declared in:
DCalendar.h

Class Hierarchy

    Object
      |
      +---DCalendar

Class Description

The calendar class implements a number of methods for generating calendars.

Example:
#include <stdio.h>
#include "ofc/DCalendar.h"

int main(int argc, char *argv[])
{
  DCalendar *cal1 = [DCalendar alloc];
  DCalendar *cal2 = [DCalendar new  ];
  DText     *str;

  [cal1 init :2008];                // Init with year 2008

  str = [cal1 toText];              // Generate a year calendar of 2008

  printf("%s\n", [str cstring]);    // Print the calendar

  [str free];

  [cal2 year  :2008];               // Set with year and month
  [cal2 month :1   ];

  str = [cal2 toText];              // Generate a month calendar of jan. 2008

  printf("%s\n", [str cstring]);    // Print the calendar

  [str free];
                                    // Some general calendar methods
  printf("2008 is a %s year\n",          ([DCalendar isLeapYear :2008] ? "leap" : "normal"));
  printf("Leap years in 2000-2008:%d\n",  [DCalendar leapYears :2000 :2008]);
  printf("Days in Month (2008-02):%d\n",  [DCalendar daysInMonth :2008 :2]);
  printf("Day in week (2008-02-29):%d\n", [DCalendar weekDay :2008 :2 :29]);  // Friday

  [cal1 free];                      // Cleanup
  [cal2 free];

  return 0;
}
Last modified:
19-Jul-2008 (DCalendar.h)

Instance Variables

private int _year
the year for the calendar
private int _month
the month for the calendar (or DCL_ALL_MONTHS)

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0