源处理器

内容表

关于

The source processor is a collection of Python scripts that are executed when a project (plugin / framework) is build. These Python scripts analyse the source code and create additional auxiliary-code.

代码检查

The source processor checks if the source code sticks to various coding rules. How strict this check is depends on the "level" setting defined in the projectdefinition.txt 文件。见 工程工具 .

代码生成

The source processor automatically generates new source files. These new files contain additional auxiliary-code for virtual interfaces, reference classes, published objects, etc. The generated files have the suffix *.hxx and must be included in the original header file:

// This example shows the declaration of a simple interface.

// --------------------------------------------------------------------- // Simple class that stores a maxon::Int number. // --------------------------------------------------------------------- class SimpleClassInterface : MAXON_INTERFACE_BASES (maxon::ObjectInterface) { MAXON_INTERFACE (SimpleClassInterface, MAXON_REFERENCE_NORMAL , "net.maxonexample.interfaces.simpleclass" );

public : // --------------------------------------------------------------------- // Sets the number to store. // --------------------------------------------------------------------- MAXON_METHOD void SetNumber( maxon::Int number);

// --------------------------------------------------------------------- // Returns the stored number. // --------------------------------------------------------------------- MAXON_METHOD maxon::Int GetNumber() const ; };

// This interface is declared in a file named "simpleclass.h". The automatically // generated files are therefore named "simpleclass1.hxx" and "simpleclass2.hxx"

// The .hxx header files define the reference class "SimpleClassRef".

#include "simpleclass1.hxx"

// declare the published objects "SomeSimpleClass" and "OtherSimpleClass" // that give access to implementations of SimpleClassInterface

// the declaration must be placed between the two hxx files since "SimpleClassRef" is defined in the first hxx file

MAXON_DECLARATION ( maxon::Class<SimpleClassRef> , SomeSimpleClass, "net.maxonexample.somesimpleclass" ); MAXON_DECLARATION (SimpleClassRef, OtherSimpleClass, "net.maxonexample.othersimpleclass" ); #include "simpleclass2.hxx"

延伸阅读

maxon::Class
定义: objectbase.h:681
MAXON_INTERFACE_BASES
#define MAXON_INTERFACE_BASES(...)
定义: objectbase.h:977
MAXON_METHOD
#define MAXON_METHOD
定义: interfacebase.h:855
MAXON_DECLARATION
#define MAXON_DECLARATION(T, Name, id)
定义: module.h:797
maxon::Int
Int64 Int
signed 32/64 bit int, size depends on the platform
定义: apibase.h:184
MAXON_INTERFACE
#define MAXON_INTERFACE(Name, REFKIND, ID)
定义: objectbase.h:1048
MAXON_REFERENCE_NORMAL
#define MAXON_REFERENCE_NORMAL(DUMMY)
定义: interfacebase.h:957

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1