pike.git / lib / modules / Calendar.pmod / TimeRanges.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1:   //! module Calendar + //! + //! submodule TimeRanges    - // $Id$ -  +    #pike __REAL_VERSION__      #define zero int(0..0)      program SuperTimeRange=cSuperTimeRange;      string calendar_name() { return "TimeRanges"; }      object calendar_object=this;    - string _sprintf(int t) { return (t=='O')?calendar_name():0; } + protected string _sprintf(int t) { return t=='O' && calendar_name(); }      Calendar.Ruleset default_rules=Calendar.default_rules;      //------------------------------------------------------------------------   //! class TimeRange   //! This is the base class (usually implemented by e.g. Calendar   //! subclasses like Calendar.Second) for any time measurement and   //! calendrar information. It defines all the things you can do   //! with a time range or any time period.   //!
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:62:   //! to achieve this.   //!   //! note:   //! The size of the new object may be inexact;   //! a Month object can't comprehend seconds, for instance.       protected void create_unixtime(int unixtime,int len);    protected void create_unixtime_default(int unixtime);    protected void create_julian_day(int jd);    -  void create(mixed ...args) +  protected void create(mixed ...args)    {    if (sizeof(args)) switch (args[0])    {    case "unix":    if (sizeof(args)==2)    create_unixtime_default(args[1]);    else if (sizeof(args)>2)    create_unixtime(@args[1..]);    else break;    return;
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:937:   //! method Calendar calendar()   //! Simply gives back the calendar in use, for instance   //! Calendar.ISO or Calendar.Discordian.       object calendar()    {    return calendar_object;    }       -  string _sprintf(int t,mapping m) +  protected string _sprintf(int t,mapping m)    {    switch (t)    {    case 'O':    return "TimeRange()";    case 't':    return "Calendar."+calendar_name()+".TimeRange";    default:    return 0;    }
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:974:       constant is_supertimerange=1;       array parts;      //! method void create(array(TimeRange) parts)   //! A SuperTimeRange must have at least two parts,   //! two time ranges. Otherwise, it's either not   //! a time period at all or a normal time period.    -  void create(array(TimeRange) _parts) +  protected void create(array(TimeRange) _parts)    {    if (sizeof(_parts->is_supertimerange-({0})))    error("one part is super\n%O\n",_parts);    if (sizeof(_parts)<2)    error("SuperTimeRange: Too few time periods to constructor\n");    parts=_parts;    }       TimeRange beginning()    {
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1126:    if (a[3]>0) return 1;    if (a[3]<0) return 0;    if (!with->is_supertimerange) return 0; // always    if (sizeof(parts)<sizeof(with->parts)) return 1;    if (sizeof(parts)>sizeof(with->parts)) return 0;    for (int i=0; i<sizeof(parts); i++)    if (parts[i]>with->parts[i]) return 1;    return 0;    }    -  int __hash() +  protected int __hash()    {    return predef::`+(@map(parts,"__hash"));    }    -  string _sprintf(int t,mapping m) +  protected string _sprintf(int t,mapping m)    {    switch (t)    {    case 'O':    return "SuperTimeRange("+    map(parts,"_sprintf",'O')*", "+")";    case 't':    return "SuperTimeRange("+    map(parts,"_sprintf",'t')*", "+")";    }
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1173:         program NullTimeRange=cNullTimeRange;   protected class cNullTimeRange   {    inherit TimeRange;       constant is_nulltimerange=1;      // overload -  void create() +  protected void create()    {    }       TimeRange set_size(TimeRange|int(0..0x7fffffff) a,void|TimeRange b)    {    return this;    }       TimeRange place(TimeRange what,void|int force)    {
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1252:    this_program subtract(TimeRange with, mixed ...extra)    {    return this;    }       int(1..1) `!()    {    return 1;    }    -  string _sprintf(int t,mapping m) +  protected string _sprintf(int t,mapping m)    {    switch (t)    {    case 'O': return "NullTimeRange";    case 't': return "Calendar."+calendar_name()+".NullTimeRange";    default: return ::_sprintf(t,m);    }    }   }