Exporting An Entire Header

| Exporting An Entire Header

Pyste also supports a mechanism to export all declarations found in a header file. Suppose again our file, `hello.h`:

`

        struct World
        {
            World(std::string msg): msg(msg) {}
            void set(std::string msg) { this->msg = msg; }
            std::string greet() { return msg; }
            std::string msg;
        };

        enum choice { red, blue };

        void show(choice c) { std::cout << "value: " << (int)c << std::endl; }

`

You can just use the `AllFromHeader` construct:

`

        hello = AllFromHeader("hello.h")

`

this will export all the declarations found in `hello.h`, which is equivalent to write:

`

        Class("World", "hello.h")
        Enum("choice", "hello.h")
        Function("show", "hello.h")

`

Note that you can still use the functions `rename`, `set_policy`, `exclude`, etc. Just access the members of the header object like this:

`

        rename(hello.World.greet, "Greet")
        exclude(hello.World.set, "Set")

`

AllFromHeader is broken in some cases. Until it is fixed, use at you own risk.

Copyright © 2003 Bruno da Silva de Oliveira
Copyright © 2002-2003 Joel de Guzman
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.