| The Interface Files

The interface files are the heart of Pyste. The user creates one or more interface files declaring the classes and functions he wants to export, and then invokes pyste passing the interface files to it. Pyste then generates a single cpp file with Boost.Python code, with all the classes and functions exported.

Besides declaring the classes and functions, the user has a number of other options, like renaming classes and methods, excluding methods and attributes, and so on.

## Basics

Suppose we have a class and some functions that we want to expose to Python declared in the header `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 };

        namespace test {

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

        }

`

We create a file named `hello.pyste` and create instances of the classes `Function`, `Class` and `Enum`:

`

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

`

That will expose the class, the free function and the enum found in `hello.h`.

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.