[C++-sig] pyplusplus ui / API

Roman Yakovenko roman.yakovenko at gmail.com
Thu Feb 23 06:54:04 CET 2006

On 2/16/06, Matthias Baas <baas at ira.uka.de> wrote:
> Basically, that's what Allen did (the class is called MultiDeclWrapper
> instead of class_group). It's an object that represents a collection of
> declarations (not just class declarations) and that can be used to
> manipulate all the contained declarations at once. The nice thing is
> that the user can work with this collection just as if it was a single
> object.

Yes, the idea belongs to Allen. I just summarized.
> I had a look into the code creator stuff in pyplusplus. The code
> creators represent text blocks and they do not know anything about
> directory/file layout, right?


> The latter is done by the file writers, right?


> What I don't understand is, how exactly does the multi file
> writer know what code creators belong to what file?

Take a look on code. Basically I use next principle:
A class is going to be written in 1 .cpp + 1.hpp
All enums, global variables, free function have their own source and
header file.

> From what I've seen
> every class goes into its own file, but what happens if I've injected a
> custom_text_t object right between two classes:
>    Class A code creator
>    Custom text
>    Class B code creator
> Will the custom text be put at the end of file A or at the beginning of
> file B?

Custom text will stay in main function. After registration of class A
and before registration
of class B.

> I also wonder, why isn't there a "file tree" in the pyplusplus pipeline
> that I could also manipulate? It seems to me that the two trees we have
> so far can be interpreted as follows:

I do not have use case where it could be useful.

> What I'm missing is an object representation of the actual files that
> will be generated. Then I could add headers (or other code) to only some
> selected files instead of all at once, I could modify the file name, etc.
> So after the full code creator tree has been generated there could be a
> new step that splits the tree up into several smaller trees that are
> assigned to something like a File object. The result could either be a
> list of such File objects or again a tree that also has Directory nodes
> in addition to the File nodes. Then pyplusplus could give me the chance
> to modify this tree before finally writing the files to disk.

I understand how that tree could be used. Declarations tree will be
used to configure
"what and how" will be exposed to Python. Code creators tree will be
used to configure
splitting module to files. You really don't need the tree. There is an
other tree you are
missing: with pyplusplys you can generate Python code. This could be useful:

1. code completion in editors
2. You can treat code written in C++ as implementation details and to generate
    additional code ( convenience functions/classes ) in Python.

> But how can you specify the directory/file layout and everything else
> that deals with the compilation process just by adding decorations?

By modifying code creators tree.

> - Matthias -

Thanks for comments, they are definitely useful.

Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list