我正在尝试为具有从std::exception
继承的类的库生成一个swig接口。我似乎无法正常工作。
这是一个简单的例子。 mylib.h
的代码:
#pragma once
#include <exception>
class CustomException : public std::exception
{
};
这是mylib.i
的代码:
%module mylib
%{
#include "mylib.h"
%}
/*
Run without anything:
mylib.h:5: Warning 401: Nothing known about base class 'std::exception'. Ignored.
*/
/*
Run with: %include <exception>
mylib.i:11: Error: Unable to find 'exception'
*/
/*
Run with: %include exception.i
mylib.h:5: Warning 401: Nothing known about base class 'std::exception'. Ignored.
*/
%include "mylib.h"
正如您在mylib.i
的注释中看到的那样,swig似乎很难弄清std::exception
是什么。
答案 0 :(得分:1)
使用// my control opacity jQuery object
var $controlOpacity = $('#control-opacity');
var removeOpacityTimer;
function removeOpacity() {
clearTimeout(removeOpacityTimer);
// begin the 5 second set timeout function
removeOpacityTimer = setTimeout(function(){
// removes the open class to hide my input range slider
$controlOpacity.removeClass('open');
}, 5000);
}
// when the child button is clicked it reveals my input range slider
$controlOpacity.on('click','BUTTON', function() {
// this toggles a open class to reveal my input range slider
$controlOpacity.toggleClass('open');
removeOpacity();
});
// my input range slider inside my control opacity div
$('INPUT', $controlOpacity).change(function() {
// how can I add another 5 seconds to setTimeout function via this function?
removeOpacity();
});
:
%include <std_except.i>