"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/Examples/test-suite/abstract_typedef.i" (30 Nov 2022, 1039 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) ALAN Interactive Fiction Language source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 %module abstract_typedef
    2 
    3 
    4 %inline %{
    5     struct Engine
    6     {
    7     };
    8 
    9     struct AbstractBaseClass
   10     {
   11       virtual ~AbstractBaseClass()
   12       {
   13       }
   14       
   15       virtual bool write(Engine& archive) const = 0;
   16     };    
   17 
   18     typedef Engine PersEngine;
   19     typedef AbstractBaseClass PersClassBase;      
   20 
   21     
   22     class A : public PersClassBase
   23     {
   24       // This works always
   25       // bool write(Engine& archive) const;
   26 
   27       // This doesn't with Swig 1.3.17.
   28       // But it works fine with 1.3.16
   29       bool write(PersEngine& archive) const
   30       {
   31     return true;
   32       }
   33       
   34     
   35     };
   36       
   37 %}
   38 
   39 
   40 /*
   41 
   42 Problem related to the direct comparison of strings
   43 in the file allocate.cxx (line 55)
   44 
   45           ......
   46       String *local_decl = Getattr(dn,"decl");
   47       if (local_decl && !Strcmp(local_decl, base_decl)) {
   48           ......
   49 
   50 with the direct string comparison, no equivalent types
   51 are checked and the two 'write' functions appear to be
   52 different because
   53 
   54   "q(const).f(r.bss::PersEngine)." != "q(const).f(r.bss::Engine)."
   55 
   56 */