Package pyplusplus :: Package file_writers :: Module multiple_files :: Class multiple_files_t

# type multiple_files_t

source code

         object --+
                  |
    writer.writer_t --+
                      |
                     multiple_files_t

Known Subclasses:
  - class_multiple_files.class_multiple_files_t
  - , balanced_files.balanced_files_t

This class implements classic strategy of deviding classes to files one class in one header + source files.

Instance Methods

__init__(self, extmodule, directory_path, write_main=True, files_sum_repository=None, encoding=`'``ascii``'`) Constructor. | source code

write_file(self, fpath, content) Write a source file. | source code

create_dir(self, directory_path) Create the output directory if it doesn't already exist. | source code

get_unique_creators(self, creators) | source code

associated_decl_creators(self, creator) references to all class declaration code creators. | source code

create_function_code(self, function_name) | source code

str

create_header(self, file_name, code) Return the content of a header file. | source code

find_out_value_traits_header(self, code_creator) | source code

create_include_code(self, creators, head_headers=None, tail_headers=None) | source code

create_namespaces_code(self, creators) | source code

str

create_source(self, file_name, function_name, registration_creators) Return the content of a cpp file. | source code

split_class_impl(self, class_creator) | source code

split_class(self, class_creator) Write the .h/.cpp file for one class. | source code

split_classes(self) | source code

create_value_traits_header_name(self, value_class) | source code

split_value_traits(self, value_traits) Write the value_traits class to header file, that will be included from files, that uses indexing suite 2 | source code

split_values_traits(self) | source code

split_creators(self, creators, pattern, function_name, registrator_pos) Write non-class creators into a particular .h/.cpp file. | source code

split_enums(self) Write all enumerations into a separate .h/.cpp file. | source code

split_global_variables(self) Write all global variables into a separate .h/.cpp file. | source code

split_free_functions(self) Write all free functions into a separate .h/.cpp file. | source code

write(self) Write out the module. | source code

Inherited from `writer.writer_t`: `get_user_headers`, `save_exposed_decls_db`, `write_code_repository`

Static Methods
Inherited from `writer.writer_t`: `create_backup`

Class Variables
| HEADER_EXT = ``'``.pypp.hpp``'``
| SOURCE_EXT = ``'``.pypp.cpp``'``
Inherited from `writer.writer_t`: `logger`

Properties
str | directory_path The name of the output directory.
Inherited from `writer.writer_t`: `encoding`, `extmodule`, `files_sum_repository`

Method Details

### __init__(self, extmodule, directory_path, write_main=True, files_sum_repository=None, encoding=`'``ascii``'`)
(Constructor)

source code

Constructor.

Parameters:
  - `extmodule` (module_t) - The root of a code creator tree
  - `directory_path` (str) - The output directory where the source files are written
  - `write_main` (boolean) - if it is True, the class will write out a main file that calls all the registration methods.
Overrides: writer.writer_t.__init__

### write_file(self, fpath, content)

source code

Write a source file.

This method writes the string content into the specified file. An additional fixed header is written at the top of the file before content.

Parameters:
  - `fpath` - File name
  - `content` - The content of the file
Overrides: writer.writer_t.write_file
  (inherited documentation)

### create_header(self, file_name, code)

source code

Return the content of a header file.

Parameters:
  - `file_name` (str) - A string that uniquely identifies the file name
  - `function_name` (str) - The name of the register_xyz() function
Returns: str
  The content for a header file

### create_source(self, file_name, function_name, registration_creators)

source code

Return the content of a cpp file.

Parameters:
  - `file_name` (str) - The base name of the corresponding include file (without extension)
  - `function_name` (str) - The name of the register_xyz() function
  - `creators` (list of code_creator_t) - The code creators that create the register_xyz() function
Returns: str
  The content for a cpp file

### split_class(self, class_creator)

source code

Write the .h/.cpp file for one class.

Writes a .h/.cpp file for the given class. The files use the class name as base file name.

Parameters:
  - `class_creator` (class_t) - The class creator for one particular class

### split_creators(self, creators, pattern, function_name, registrator_pos)

source code

Write non-class creators into a particular .h/.cpp file.

Parameters:
  - `creators` (list of code_creator_t) - The code creators that should be written
  - `pattern` (str) - Name pattern that is used for constructing the final output file name
  - `function_name` (str) - The name of the register_xyz() function
  - `registrator_pos` (int) - The position of the code creator that creates the code to invoke the register_xyz() function.

### write(self)

source code

Write out the module. Creates a separate source/header combo for each class and for enums, globals, and free functions. If write_main is True it writes out a main file that calls all the registration methods. After this call split_header_names and split_method_names will contain all the header files and registration methods used. This can be used by user code to create custom registration methods if main is not written.

Overrides: writer.writer_t.write

Property Details

### directory_path

The name of the output directory.

Get Method:
  _get_directory_path(self)
Type:
  str