Malcontent.SessionLimitsBuilder

Fields

Name

Type

Access

Description

p0

[object]

r

u0

int

r

u1

int

r

u2

int

r

Methods

class

new ()

clear ()

copy ()

end ()

free ()

init ()

set_daily_schedule (start_time_secs, end_time_secs)

set_none ()

Details

class Malcontent.SessionLimitsBuilder

Malcontent.SessionLimitsBuilder is a stack-allocated mutable structure used to build an Malcontent.SessionLimits instance. Use Malcontent.SessionLimitsBuilder.init(), various method calls to set properties of the session limits, and then Malcontent.SessionLimitsBuilder.end(), to construct an Malcontent.SessionLimits.

New in version 0.5.0.

classmethod new()
Returns:

a new heap-allocated Malcontent.SessionLimitsBuilder

Return type:

Malcontent.SessionLimitsBuilder

Construct a new Malcontent.SessionLimitsBuilder on the heap. This is intended for language bindings. The returned builder must eventually be freed with Malcontent.SessionLimitsBuilder.free(), but can be cleared zero or more times with Malcontent.SessionLimitsBuilder.clear() first.

New in version 0.5.0.

clear()

Clear self, freeing any internal state in it. This will not free the top-level storage for self itself, which is assumed to be allocated on the stack.

If called on an already-cleared Malcontent.SessionLimitsBuilder, this function is idempotent.

New in version 0.5.0.

copy()
Returns:

a copy of self

Return type:

Malcontent.SessionLimitsBuilder

Copy the given self to a newly-allocated Malcontent.SessionLimitsBuilder on the heap. This is safe to use with cleared, stack-allocated Malcontent.SessionLimitsBuilders.

New in version 0.5.0.

end()
Returns:

a newly constructed Malcontent.SessionLimits

Return type:

Malcontent.SessionLimits

Finish constructing an Malcontent.SessionLimits with the given self, and return it. The Malcontent.SessionLimitsBuilder will be cleared as if Malcontent.SessionLimitsBuilder.clear() had been called.

New in version 0.5.0.

free()

Free an Malcontent.SessionLimitsBuilder originally allocated using Malcontent.SessionLimitsBuilder.new(). This must not be called on stack-allocated builders initialised using Malcontent.SessionLimitsBuilder.init().

New in version 0.5.0.

init()

Initialise the given self so it can be used to construct a new Malcontent.SessionLimits. self must have been allocated on the stack, and must not already be initialised.

Construct the Malcontent.SessionLimits by calling methods on self, followed by Malcontent.SessionLimitsBuilder.end(). To abort construction, use Malcontent.SessionLimitsBuilder.clear().

New in version 0.5.0.

set_daily_schedule(start_time_secs, end_time_secs)
Parameters:
  • start_time_secs (int) – number of seconds since midnight when the user’s session can first start

  • end_time_secs (int) – number of seconds since midnight when the user’s session can last end

Set the session limits in self to be a daily schedule, where sessions are allowed between start_time_secs and end_time_secs every day. start_time_secs and end_time_secs are given as offsets from the start of the day, in seconds. end_time_secs must be greater than start_time_secs. end_time_secs must be at most 24 * 60 * 60.

This will overwrite any other session limits.

New in version 0.5.0.

set_none()

Unset any session limits currently set in the self.

New in version 0.5.0.