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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1:   //! module Calendar    - // $Id: TimeRanges.pmod,v 1.34 2008/02/07 01:39:53 mast Exp $ + // $Id: TimeRanges.pmod,v 1.35 2008/06/28 16:36:54 nilsson Exp $      #pike __REAL_VERSION__      #define zero int(0..0)      program SuperTimeRange=cSuperTimeRange;      string calendar_name() { return "TimeRanges"; }      object calendar_object=this;
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:58:   //! transferred to the new object, so this method   //! can't be used to convert between timezones   //! or languges - use <ref>set_timezone</ref>,   //! <ref>set_language</ref> or <ref>set_ruleset</ref>   //! to achieve this.   //!   //! note:   //! The size of the new object may be inexact;   //! a Month object can't comprehend seconds, for instance.    -  static void create_unixtime(int unixtime,int len); -  static void create_unixtime_default(int unixtime); -  static void create_julian_day(int jd); +  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)    {    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..]);
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:116:    return;    }    break;    }       error("%O.%O: Illegal parameters %O,%O,%O...\n",    function_object(this_program),    this_program,@args,0,0,0);    }    -  static void convert_from(TimeRange other) +  protected void convert_from(TimeRange other)    {   // inheriting class must take care of size    if (other->unix_time) {    rules = other->ruleset();    create_unixtime_default(other->unix_time());    } else if (other->julian_day) {    rules = other->ruleset();    create_julian_day(other->julian_day());    } else    error("Can't convert %O->%s.%O\n",other,
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:140:   //! method TimeRange set_size(TimeRange size)   //! method TimeRange set_size(int n,TimeRange size)   //! Gives back a new (or the same, if the size matches)   //! timerange with the new size.   //! If <i>n</i> are given, the resulting size   //! will be <i>n</i> amounts of the given size.   //! note:   //! A negative size is not permitted; a zero one are.      // virtual -  static TimeRange _set_size(int n,TimeRange x); +  protected TimeRange _set_size(int n,TimeRange x);       TimeRange set_size(function|TimeRange|int(0..0x7fffffff) a,    void|function|TimeRange b)    {    function|object(TimeRange) x;    int(0..0x7fffffff) n;    if (!b)    if (intp(a))    x=this,n=[int(0..0x7fffffff)]a;    else
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:184:   //! TimeRange orig_day=month()->day(5);   //! for (int i=0; i&lt;10; i++)   //! {   //! month++;   //! TimeRange day=month->place(orig_day);   //! <i>...use day...</i>   //! }   //! </pre>      // virtual -  static this_program _add(int n,this_program step); +  protected this_program _add(int n,this_program step);       this_program add(function|this_program|int a,    void|function|this_program b)    {    function|object(this_program) x;    int n;    if (!b)    if (intp(a))    x=this,n=[int]a;    else
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1157:   //! (the zero-length time range), isn't placed   //! in time. This is the result of for instance   //! <ref>`&</ref> between two strict non-overlapping   //! timeranges - no time at all.   //!   //! It has a constant, <tt>is_nulltimerange</tt>, which   //! is non-zero. <tt>`!</tt> on this timerange is true.         program NullTimeRange=cNullTimeRange; - static class cNullTimeRange + protected class cNullTimeRange   {    inherit TimeRange;       constant is_nulltimerange=1;      // overload    void create()    {    }   
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1258:    case 't': return "Calendar."+calendar_name()+".NullTimeRange";    default: return ::_sprintf(t,m);    }    }   }      cNullTimeRange nulltimerange=NullTimeRange();      // helper functions    - static mapping(function:TimeRange) program2stuff=([]); + protected mapping(function:TimeRange) program2stuff=([]);    - static TimeRange promote_program(function p) + protected TimeRange promote_program(function p)   {    TimeRange x;    if ( (x=program2stuff[p]) ) return x;    x=[object(TimeRange)]p();    if (!x->is_timerange)    error("Not a timerange program: %O\n",p);    return program2stuff[p]=x;   }