SWIG parses all declarations in its input in an object tree. Each node of this
tree is a DOHHash
and developer documentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0"> | |
<object class="Frobnicator" name="my_frob"> | |
<num_times>17</num_times> | |
</object> | |
</resource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wx/secretstore.h> | |
void DoSomethingRequiringAPassword(const wxString& username) | |
{ | |
wxSecretStore store = wxSecretStore::GetDefault(); | |
if ( !store.IsOk() ) { | |
// Complain about not being able to store the password securely | |
... | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cloning into '.'... | |
10.80s user 2.47s system 1% cpu 13:00.52 total | |
ATTENTION: no --prefix supplied, building and installing to /tmp/tmp.o2BIF8otPY/install | |
No pre-existing installed file found at /tmp/tmp.o2BIF8otPY/install/bin/nqp-m | |
Cloning into 'nqp'... | |
Note: checking out '2017.09-119-g4494e7049'. | |
You are in 'detached HEAD' state. You can look around, make experimental | |
changes and commit them, and you can discard any commits you make in this | |
state without impacting any branches by performing another checkout. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile using the following command | |
// | |
// g++ -Wall -Wno-deprecated-declarations gtkdpi.cpp `pkg-config --cflags --libs gtk+-3.0` | |
// | |
// And then run ./a.out | |
#include <gtk/gtk.h> | |
static void | |
print_sizes_and_dpi(int w, int h, int wmm, int hmm) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include "optionalvalue.h" | |
%} | |
// Provide simplified declarations of various template classes we use for SWIG. | |
template <typename T> | |
class OptionalValue | |
{ | |
public: | |
OptionalValue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The macro arguments for all these macros are the name of the exported class | |
// and the C++ type T of OptionalValue<T> to generate the typemaps for. | |
// Common part of the macros below, shouldn't be used directly. | |
%define DEFINE_OPTIONAL_HELPER(OptT, T) | |
// The OptionalValue<> specializations themselves are only going to be used | |
// inside our own code, the user will deal with either T? or T, depending on | |
// whether T is a value or a reference type, so make them private to our own | |
// assembly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%define DEFINE_OPTIONAL_SIMPLE(OptT, T) | |
// Use reference, not pointer, typemaps for member variables of this type. | |
%naturalvar OptionalValue< T >; | |
%template(OptT) OptionalValue< T >; | |
// Note the use of "jboxtype" instead of just "jstype": for primitive types, | |
// such as "double", they're different and we must use the former as | |
// Optional<> can only be used with reference types in Java. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%define DEFINE_OPTIONAL_SIMPLE(OptT, T) | |
// Use reference, not pointer, typemaps for member variables of this type. | |
%naturalvar OptionalValue< T >; | |
// Even though this type is not mentioned anywhere, we must still do this to | |
// tell SWIG to actually export this type. | |
%template(OptT) OptionalValue< T >; | |
// This typemap is used for function arguments and for setting member fields of |