403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.163.100
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/swig4.0/lua/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/swig4.0/lua/_std_common.i
/* -----------------------------------------------------------------------------
 * _std_common.i
 *
 * std::helpers for LUA
 * ----------------------------------------------------------------------------- */

%include <std_except.i> // the general exceptions

/*
The basic idea here, is instead of trying to feed SWIG all the
horribly templated STL code, to give it a neatened version.

These %defines cover some of the more common methods
so the class declarations become just a set of %defines

*/

/* #define for basic container features
note: I allow front(), back() & pop_back() to throw exceptions
upon empty containers, rather than coredump
(as we haven't defined the methods, we can use %extend to add with
new features)

*/
%define %STD_CONTAINER_METHODS(CLASS,T)
public:
	CLASS();
	CLASS(const CLASS&);
	unsigned int size() const;
	unsigned int max_size() const;
	bool empty() const;
	void clear();
	%extend {	// the extra stuff which must be checked
		T front()const throw (std::out_of_range){ // only read front & back
			if (self->empty())
				throw std::out_of_range("in "#CLASS"::front()");
			return self->front();
		}
		T back()const throw (std::out_of_range){ // not write to them
			if (self->empty())
				throw std::out_of_range("in "#CLASS"::back()");
			return self->back();
		}
	}
%enddef

/* push/pop for front/back
also note: front & back are read only methods, not used for writing
*/
%define %STD_FRONT_ACCESS_METHODS(CLASS,T)
public:
	void push_front(const T& val);
	%extend {	// must check this
		void pop_front() throw (std::out_of_range){
			if (self->empty())
				throw std::out_of_range("in "#CLASS"::pop_front()");
			self->pop_back();
		}
	}
%enddef

%define %STD_BACK_ACCESS_METHODS(CLASS,T)
public:
	void push_back(const T& val);
	%extend {	// must check this
		void pop_back() throw (std::out_of_range){
			if (self->empty())
				throw std::out_of_range("in "#CLASS"::pop_back()");
			self->pop_back();
		}
	}
%enddef

/*
Random access methods
*/
%define %STD_RANDOM_ACCESS_METHODS(CLASS,T)
	%extend // this is a extra bit of SWIG code
	{
		// [] is replaced by __getitem__ & __setitem__
		// simply throws a string, which causes a lua error
		T __getitem__(unsigned int idx) throw (std::out_of_range){
			if (idx>=self->size())
				throw std::out_of_range("in "#CLASS"::__getitem__()");
			return (*self)[idx];
		}
		void __setitem__(unsigned int idx,const T& val) throw (std::out_of_range){
			if (idx>=self->size())
				throw std::out_of_range("in "#CLASS"::__setitem__()");
			(*self)[idx]=val;
		}
	};
%enddef

Youez - 2016 - github.com/yon3zu
LinuXploit