HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: 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
Upload Files
File: //usr/share/swig4.0/d/std_string.i
/* -----------------------------------------------------------------------------
 * std_string.i
 *
 * Typemaps for std::string and const std::string&
 * These are mapped to a D char[] and are passed around by value.
 *
 * To use non-const std::string references, use the following %apply. Note
 * that they are passed by value.
 * %apply const std::string & {std::string &};
 * ----------------------------------------------------------------------------- */

%{
#include <string>
%}

namespace std {

%naturalvar string;

class string;

%define SWIGD_STD_STRING_TYPEMAPS(DW_STRING_TYPE, DP_STRING_TYPE, FROM_STRINGZ, TO_STRINGZ)
// string
%typemap(ctype) string, const string & "char *"
%typemap(imtype) string, const string & #DW_STRING_TYPE
%typemap(dtype) string, const string & #DP_STRING_TYPE

%typemap(in, canthrow=1) string, const string &
%{ if (!$input) {
    SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string");
    return $null;
  }
  $1.assign($input); %}
%typemap(in, canthrow=1) const string &
%{ if (!$input) {
    SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string");
    return $null;
   }
   $*1_ltype $1_str($input);
   $1 = &$1_str; %}

%typemap(out) string %{ $result = SWIG_d_string_callback($1.c_str()); %}
%typemap(out) const string & %{ $result = SWIG_d_string_callback($1->c_str()); %}

%typemap(din) string, const string & "($dinput ? TO_STRINGZ($dinput) : null)"
%typemap(dout, excode=SWIGEXCODE) string, const string & {
  DP_STRING_TYPE ret = FROM_STRINGZ($imcall);$excode
  return ret;
}

%typemap(directorin) string, const string & %{ $input = SWIG_d_string_callback($1.c_str()); %}

%typemap(directorout, canthrow=1) string
%{ if (!$input) {
    SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string");
    return $null;
  }
  $result.assign($input); %}

%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string &
%{ if (!$input) {
    SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string");
    return $null;
  }
  /* possible thread/reentrant code problem */
  static $*1_ltype $1_str;
  $1_str = $input;
  $result = &$1_str; %}

%typemap(ddirectorin) string, const string & "FROM_STRINGZ($winput)"
%typemap(ddirectorout) string, const string & "TO_STRINGZ($dcall)"

%typemap(throws, canthrow=1) string, const string &
%{ SWIG_DSetPendingException(SWIG_DException, $1.c_str());
  return $null; %}

%typemap(typecheck) string, const string & = char *;
%enddef

// We need to have the \0-terminated string conversion functions available in
// the D proxy modules.
SWIGD_STD_STRING_TYPEMAPS(const(char)*, string, std.conv.to!string, std.string.toStringz)

%pragma(d) globalproxyimports = %{
static import std.conv;
static import std.string;
%}

#undef SWIGD_STD_STRING_TYPEMAPS

} // namespace std