Introduced properties

Redefined properties

redef type SELF: CPPCompilationUnit

nitc $ CPPCompilationUnit :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _body_custom: Template

nitc :: CCompilationUnit :: _body_custom

custom code and generated for ffi
private var _body_decl: Template

nitc :: CCompilationUnit :: _body_decl

body
private var _body_impl: Template

nitc :: CCompilationUnit :: _body_impl

implementation body of extern methods
private var _files: Array[String]

nitc :: CCompilationUnit :: _files

files to compile TODO check is appropriate
private var _header_c_types: Template

nitc :: CCompilationUnit :: _header_c_types

types of extern classes and friendly types
private var _header_custom: Template

nitc :: CCompilationUnit :: _header_custom

custom C header code or generated for other languages
private var _header_decl: Template

nitc :: CCompilationUnit :: _header_decl

implementation declaration for extern methods
fun add_exported_function(c_function: CFunction)

nitc :: CCompilationUnit :: add_exported_function

Add a public c_function accessible from outside this compilation unit
fun add_local_function(c_function: CFunction)

nitc :: CCompilationUnit :: add_local_function

Add a static c_function to be strictly local to this unit
private fun add_non_static_local_function(c_function: CFunction)

nitc :: CCompilationUnit :: add_non_static_local_function

Similar to add_local_function but not static
fun body_custom: Template

nitc :: CCompilationUnit :: body_custom

custom code and generated for ffi
protected fun body_custom=(body_custom: Template)

nitc :: CCompilationUnit :: body_custom=

custom code and generated for ffi
protected fun body_decl=(body_decl: Template)

nitc :: CCompilationUnit :: body_decl=

body
fun body_impl: Template

nitc :: CCompilationUnit :: body_impl

implementation body of extern methods
protected fun body_impl=(body_impl: Template)

nitc :: CCompilationUnit :: body_impl=

implementation body of extern methods
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun compile_body_core(stream: Writer)

nitc :: CCompilationUnit :: compile_body_core

Write the core of the body to stream
fun compile_header_core(stream: Writer)

nitc :: CCompilationUnit :: compile_header_core

Write the core of the header to stream
fun files: Array[String]

nitc :: CCompilationUnit :: files

files to compile TODO check is appropriate
protected fun files=(files: Array[String])

nitc :: CCompilationUnit :: files=

files to compile TODO check is appropriate
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
protected fun header_c_base=(header_c_base: Template)

nitc :: CCompilationUnit :: header_c_base=

header
fun header_c_types: Template

nitc :: CCompilationUnit :: header_c_types

types of extern classes and friendly types
protected fun header_c_types=(header_c_types: Template)

nitc :: CCompilationUnit :: header_c_types=

types of extern classes and friendly types
fun header_custom: Template

nitc :: CCompilationUnit :: header_custom

custom C header code or generated for other languages
protected fun header_custom=(header_custom: Template)

nitc :: CCompilationUnit :: header_custom=

custom C header code or generated for other languages
fun header_decl: Template

nitc :: CCompilationUnit :: header_decl

implementation declaration for extern methods
protected fun header_decl=(header_decl: Template)

nitc :: CCompilationUnit :: header_decl=

implementation declaration for extern methods
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
private fun write_as_foreign_lib_api(mmodule: MModule, compdir: String)

nitc :: CCompilationUnit :: write_as_foreign_lib_api

Write this compilation unit as the API of a foreign code library
fun write_as_impl(mmodule: MModule, compdir: String)

nitc :: CCompilationUnit :: write_as_impl

Compile as _ffi files which contains the implementation of extern methods
fun write_as_nitni(mmodule: MModule, compdir: String)

nitc :: CCompilationUnit :: write_as_nitni

Compile a _nitni files, used to implement nitni features for the compiler
fun write_body_to_file(mmodule: MModule, file: String, includes: Array[String])

nitc :: CCompilationUnit :: write_body_to_file

Write the body part to file including all includes
fun write_header_to_file(mmodule: MModule, file: String, includes: Array[String], guard: String)

nitc :: CCompilationUnit :: write_header_to_file

Write the header part to file including all includes using the guard
package_diagram nitc::CPPCompilationUnit CPPCompilationUnit nitc::CCompilationUnit CCompilationUnit nitc::CPPCompilationUnit->nitc::CCompilationUnit core::Object Object nitc::CCompilationUnit->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

class CCompilationUnit

nitc :: CCompilationUnit

Accumulates all C code for a compilation unit

Class definitions

nitc $ CPPCompilationUnit
class CPPCompilationUnit
	super CCompilationUnit

	fun write_to_files(mmodule: MModule, compdir: String): ExternCppFile
	do
		var base_name = "{mmodule.c_name}._ffi"

		var h_file = "{base_name}.hpp"
		var guard = "{mmodule.c_name.to_s.to_upper}_NIT_HPP"

		write_header_to_file(mmodule, "{compdir}/{h_file}", new Array[String], guard)

		var c_file = "{base_name}.cpp"
		write_body_to_file(mmodule, "{compdir}/{c_file}", ["<string>", "<iostream>", "\"{h_file}\""])

		files.add("{compdir}/{c_file}")

		return new ExternCppFile(c_file, mmodule)
	end
end
src/ffi/cpp.nit:157,1--176,3