<?php

/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.12
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */

// Try to load our extension if it's not already loaded.
if (!extension_loaded('cppcms_api')) {
  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
    if (!dl('php_cppcms_api.dll')) return;
  } else {
    // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
    if (PHP_SHLIB_SUFFIX === 'dylib') {
      if (!dl('cppcms_api.so')) return;
    } else {
      if (!dl('cppcms_api.'.PHP_SHLIB_SUFFIX)) return;
    }
  }
}



abstract class cppcms_api {
	const SESSION_FIXED = SESSION_FIXED;

	const SESSION_RENEW = SESSION_RENEW;

	const SESSION_BROWSER = SESSION_BROWSER;

	const ERROR_OK = ERROR_OK;

	const ERROR_GENERAL = ERROR_GENERAL;

	const ERROR_RUNTIME = ERROR_RUNTIME;

	const ERROR_INVALID_ARGUMENT = ERROR_INVALID_ARGUMENT;

	const ERROR_LOGIC = ERROR_LOGIC;

	const ERROR_ALLOC = ERROR_ALLOC;
}

/* PHP Proxy Classes */
class CppCMSAPIPool {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_session_pool') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_CppCMSAPIPool();
	}

	function error() {
		return CppCMSAPIPool_error($this->_cPtr);
	}

	function error_message() {
		return CppCMSAPIPool_error_message($this->_cPtr);
	}

	function error_clear() {
		return CppCMSAPIPool_error_clear($this->_cPtr);
	}

	function init($conf) {
		return CppCMSAPIPool_init($this->_cPtr,$conf);
	}

	function init_from_json($conf) {
		return CppCMSAPIPool_init_from_json($this->_cPtr,$conf);
	}
}

class CppCMSAPISession {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_session') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_CppCMSAPISession();
	}

	function error() {
		return CppCMSAPISession_error($this->_cPtr);
	}

	function error_message() {
		return CppCMSAPISession_error_message($this->_cPtr);
	}

	function error_clear() {
		return CppCMSAPISession_error_clear($this->_cPtr);
	}

	function init($pool) {
		return CppCMSAPISession_init($this->_cPtr,$pool);
	}

	function clear() {
		return CppCMSAPISession_clear($this->_cPtr);
	}

	function is_set($key) {
		return CppCMSAPISession_is_set($this->_cPtr,$key);
	}

	function erase($key) {
		return CppCMSAPISession_erase($this->_cPtr,$key);
	}

	function get_exposed($key) {
		return CppCMSAPISession_get_exposed($this->_cPtr,$key);
	}

	function set_exposed($key,$is_exposed) {
		return CppCMSAPISession_set_exposed($this->_cPtr,$key,$is_exposed);
	}

	function get_first_key() {
		return CppCMSAPISession_get_first_key($this->_cPtr);
	}

	function get_next_key() {
		return CppCMSAPISession_get_next_key($this->_cPtr);
	}

	function get_csrf_token() {
		return CppCMSAPISession_get_csrf_token($this->_cPtr);
	}

	function set($key,$value) {
		return CppCMSAPISession_set($this->_cPtr,$key,$value);
	}

	function get($key) {
		return CppCMSAPISession_get($this->_cPtr,$key);
	}

	function set_binary_as_hex($key,$value) {
		return CppCMSAPISession_set_binary_as_hex($this->_cPtr,$key,$value);
	}

	function get_binary_as_hex($key) {
		return CppCMSAPISession_get_binary_as_hex($this->_cPtr,$key);
	}

	function get_binary_len($key) {
		return CppCMSAPISession_get_binary_len($this->_cPtr,$key);
	}

	function reset_session() {
		return CppCMSAPISession_reset_session($this->_cPtr);
	}

	function set_default_age() {
		return CppCMSAPISession_set_default_age($this->_cPtr);
	}

	function set_age($t) {
		return CppCMSAPISession_set_age($this->_cPtr,$t);
	}

	function get_age() {
		return CppCMSAPISession_get_age($this->_cPtr);
	}

	function set_default_expiration() {
		return CppCMSAPISession_set_default_expiration($this->_cPtr);
	}

	function set_expiration($t) {
		return CppCMSAPISession_set_expiration($this->_cPtr,$t);
	}

	function get_expiration() {
		return CppCMSAPISession_get_expiration($this->_cPtr);
	}

	function set_on_server($is_on_server) {
		return CppCMSAPISession_set_on_server($this->_cPtr,$is_on_server);
	}

	function get_on_server() {
		return CppCMSAPISession_get_on_server($this->_cPtr);
	}

	function get_session_cookie_name() {
		return CppCMSAPISession_get_session_cookie_name($this->_cPtr);
	}

	function add_cookie_name($key) {
		return CppCMSAPISession_add_cookie_name($this->_cPtr,$key);
	}

	function set_session_cookie($value) {
		return CppCMSAPISession_set_session_cookie($this->_cPtr,$value);
	}

	function load() {
		return CppCMSAPISession_load($this->_cPtr);
	}

	function save() {
		return CppCMSAPISession_save($this->_cPtr);
	}

	function cookie_first() {
		$r=CppCMSAPISession_cookie_first($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new CppCMSAPICookie($r);
		}
		return $r;
	}

	function cookie_next() {
		$r=CppCMSAPISession_cookie_next($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new CppCMSAPICookie($r);
		}
		return $r;
	}
}

class CppCMSAPICookie {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_cookie') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_CppCMSAPICookie();
	}

	function header() {
		return CppCMSAPICookie_header($this->_cPtr);
	}

	function header_content() {
		return CppCMSAPICookie_header_content($this->_cPtr);
	}

	function name() {
		return CppCMSAPICookie_name($this->_cPtr);
	}

	function value() {
		return CppCMSAPICookie_value($this->_cPtr);
	}

	function path() {
		return CppCMSAPICookie_path($this->_cPtr);
	}

	function domain() {
		return CppCMSAPICookie_domain($this->_cPtr);
	}

	function max_age_defined() {
		return CppCMSAPICookie_max_age_defined($this->_cPtr);
	}

	function max_age() {
		return CppCMSAPICookie_max_age($this->_cPtr);
	}

	function expires_defined() {
		return CppCMSAPICookie_expires_defined($this->_cPtr);
	}

	function expires() {
		return CppCMSAPICookie_expires($this->_cPtr);
	}

	function is_secure() {
		return CppCMSAPICookie_is_secure($this->_cPtr);
	}
}


?>
