Things that can be efficienlty written to a Writer

The point of this interface is to allow the instance to be efficiently written into a Writer.

Ready-to-save documents usually provide this interface.

Introduced properties

abstract fun write_to(stream: Writer)

core :: Writable :: write_to

Write itself to a stream
fun write_to_bytes: Bytes

core :: Writable :: write_to_bytes

Like write_to but return a new Bytes (may be quite large)
fun write_to_file(filepath: String)

core :: Writable :: write_to_file

Like write_to but take care of creating the file
fun write_to_string: String

core :: Writable :: write_to_string

Like write_to but return a new String (may be quite large).

Redefined properties

redef type SELF: Writable

core $ Writable :: 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
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 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.
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.
abstract fun write_to(stream: Writer)

core :: Writable :: write_to

Write itself to a stream
fun write_to_bytes: Bytes

core :: Writable :: write_to_bytes

Like write_to but return a new Bytes (may be quite large)
fun write_to_file(filepath: String)

core :: Writable :: write_to_file

Like write_to but take care of creating the file
fun write_to_string: String

core :: Writable :: write_to_string

Like write_to but return a new String (may be quite large).
package_diagram core::Writable Writable core::Object Object core::Writable->core::Object core::Bytes Bytes core::Bytes->core::Writable core::Text Text core::Text->core::Writable ini::IniFile IniFile ini::IniFile->core::Writable csv::CsvDocument CsvDocument csv::CsvDocument->core::Writable template::Template Template template::Template->core::Writable html::HTMLPage HTMLPage html::HTMLPage->core::Writable html::HTMLTag HTMLTag html::HTMLTag->core::Writable ordered_tree::OrderedTree OrderedTree ordered_tree::OrderedTree->core::Writable nitc::POFile POFile nitc::POFile->core::Writable nitc::MPackageDot MPackageDot nitc::MPackageDot->core::Writable core::ropes::Rope Rope core::ropes::Rope->core::Text core::FlatText FlatText core::FlatText->core::Text core::String String core::String->core::Text core::Buffer Buffer core::Buffer->core::Text core::U16String U16String core::U16String->core::Text core::ropes::Rope... ... core::ropes::Rope...->core::ropes::Rope core::FlatText... ... core::FlatText...->core::FlatText core::String... ... core::String...->core::String core::Buffer... ... core::Buffer...->core::Buffer core::U16String... ... core::U16String...->core::U16String template::Template... ... template::Template...->template::Template html::NitHomepage NitHomepage html::NitHomepage->html::HTMLPage html::NitHomepage... ... html::NitHomepage...->html::NitHomepage html::html::HTMLRaw HTMLRaw html::html::HTMLRaw->html::HTMLTag html::html::HTMLRaw... ... html::html::HTMLRaw...->html::html::HTMLRaw nitc::ASTDump ASTDump nitc::ASTDump->ordered_tree::OrderedTree nitc::MEntityTree MEntityTree nitc::MEntityTree->ordered_tree::OrderedTree nitc::ConcernsTree ConcernsTree nitc::ConcernsTree->ordered_tree::OrderedTree nitc::ProjTree ProjTree nitc::ProjTree->ordered_tree::OrderedTree nitc::MPackageTree MPackageTree nitc::MPackageTree->ordered_tree::OrderedTree nitc::ASTDump... ... nitc::ASTDump...->nitc::ASTDump nitc::MEntityTree... ... nitc::MEntityTree...->nitc::MEntityTree nitc::ConcernsTree... ... nitc::ConcernsTree...->nitc::ConcernsTree nitc::ProjTree... ... nitc::ProjTree...->nitc::ProjTree nitc::MPackageTree... ... nitc::MPackageTree...->nitc::MPackageTree

Parents

interface Object

core :: Object

The root of the class hierarchy.

Children

class Bytes

core :: Bytes

A buffer containing Byte-manipulation facilities
class CsvDocument

csv :: CsvDocument

A CSV document representation.
class HTMLPage

html :: HTMLPage

A html page
class HTMLTag

html :: HTMLTag

An HTML element.
class IniFile

ini :: IniFile

Read and write INI configuration files
class MPackageDot

nitc :: MPackageDot

Generate graphiz files based on packages, groups and modules
class OrderedTree[E: Object]

ordered_tree :: OrderedTree

Generic structure to manage and display an ordered tree
class POFile

nitc :: POFile

A GNU gettext .po/.pot file
class Template

template :: Template

Templates are simple hierarchical pieces of text used for efficient stream writing.
abstract class Text

core :: Text

High-level abstraction for all text representations

Descendants

private class ASCIIFlatString

core :: ASCIIFlatString

Special cases of String where all the characters are ASCII-based
class ASTDump

nitc :: ASTDump

A helper class to handle (print) Nit AST as an OrderedTree
class BSAlert

html :: BSAlert

A Bootstrap alert component.
class BSBadge

html :: BSBadge

A Bootstrap badge component.
class BSBreadCrumbs

html :: BSBreadCrumbs

A Bootstrap breadcrumbs component.
abstract class BSComponent

html :: BSComponent

Bootstrap component abstraction.
class BSIcon

html :: BSIcon

A Boostrap icon.
class BSLabel

html :: BSLabel

A Bootstrap label component.
class BSPageHeader

html :: BSPageHeader

A Bootstrap page header component.
class BSPanel

html :: BSPanel

A Bootstrap panel component.
class BashCompletion

nitc :: BashCompletion

This class generates a compatible bash_completion script file.
abstract class Buffer

core :: Buffer

A mutable sequence of characters.
abstract class CardCatalog

nitc :: CardCatalog

A card that displays Nit catalog related data
class CardCatalogPackage

nitc :: CardCatalogPackage

A card that displays a package from a Nit catalog
class CardCatalogStats

nitc :: CardCatalogStats

A card that displays statistics about a Nit catalog
class CardCatalogTags

nitc :: CardCatalogTags

A card that displays a list of tags
class CardCode

nitc :: CardCode

A card that displays the code of a MEntity
class CardGraph

nitc :: CardGraph

A card that displays a graph
class CardInheritance

nitc :: CardInheritance

A card about the inheritance of a MEntity
class CardLinearizationDef

nitc :: CardLinearizationDef

A card about a definition in a linearization list
class CardLinearizationList

nitc :: CardLinearizationList

A card about the linearization of a MEntity
class CardList

nitc :: CardList

A list of cards
class CardMDoc

nitc :: CardMDoc

A card that displays the content of a MDoc
class CardMEntity

nitc :: CardMEntity

A card about a mentity
class CardMdSummary

nitc :: CardMdSummary

A card that displays the summary of a Markdown document
class CardMetadata

nitc :: CardMetadata

A card that displays the metadata about a package in the Nit catalog
class CardPageHeader

nitc :: CardPageHeader

A page header
class CardSection

nitc :: CardSection

A heading section
class CardSummary

nitc :: CardSummary

A card that displays a summary of a list of cards
class CardText

nitc :: CardText

A card that display custom text data
class CatalogPage

nitc :: CatalogPage

A HTML page in a catalog
private class Concat

core :: Concat

Node that represents a concatenation between two String
class ConcernsTree

nitc :: ConcernsTree

A MEntityTree borned to MConcern.
class DocPage

nitc :: DocPage

A documentation page abstraction
class DocSidebar

nitc :: DocSidebar

Nitdoc sidebar abstraction
class DocTab

nitc :: DocTab

A documentation tabulated view
class DocTopMenu

nitc :: DocTopMenu

Top menu bar template
class ErrorTemplate

nitcorn :: ErrorTemplate

A basic error page for the HTTP error code
class FlatBuffer

core :: FlatBuffer

Mutable strings of characters.
abstract class FlatString

core :: FlatString

Immutable strings of characters.
abstract class FlatText

core :: FlatText

All kinds of array-based text representations.
abstract class HTMLList

html :: HTMLList

An abstract HTML list.
private class HTMLRaw

html :: HTMLRaw

class Header

html :: Header

A <h1> to <h6> tag.
class JavaClassTemplate

nitc :: JavaClassTemplate

Java class source template
class LaunchScreenStoryboardTemplate

nitc :: LaunchScreenStoryboardTemplate

Template for the loading screen to generate LaunchScreen.storyboard
class ListItem

html :: ListItem

A <li> tag.
class MEntityTree

nitc :: MEntityTree

An OrderedTree bound to MEntity.
class MPackageTree

nitc :: MPackageTree

A simple specialisation of OrderedTree to display packages, groups and modules
class NitModule

gen_nit :: NitModule

Template of a Nit module to generate Nit code
class OrderedList

html :: OrderedList

A <ol> list tag.
class PageHome

nitc :: PageHome

The Nitdoc overview page that displays the nit packages catalog
class PageMClass

nitc :: PageMClass

A documentation page about a MClass
abstract class PageMEntity

nitc :: PageMEntity

A DocPage documenting a MEntity
class PageMGroup

nitc :: PageMGroup

A documentation page about a MGroup
class PageMModule

nitc :: PageMModule

A documentation page about a MModule
class PageMPackage

nitc :: PageMPackage

A documentation page for a MPackage
class PageMProperty

nitc :: PageMProperty

A documentation page about a MProperty
class PagePerson

nitc :: PagePerson

A page that lists the packages maintained and contributed by a person
class PageTag

nitc :: PageTag

A page that lists the packages related to a tab
class PbxprojectTemplate

nitc :: PbxprojectTemplate

Template for a PBX project file, usually a project.pbcproj
class PiwikScript

nitc :: PiwikScript

JS script for Piwik Tracker
class PlistTemplate

nitc :: PlistTemplate

Template for a property list used by XCode for iOS projects
class ProjTree

nitc :: ProjTree

private abstract class Rope

core :: Rope

String using a tree-based representation with leaves as FlatStrings
abstract class StaticCard

nitc :: StaticCard

A card that can be rendered to HTML
abstract class String

core :: String

Immutable sequence of characters.
private class TemplateMacro

template :: TemplateMacro

A macro is a special text command that is replaced by other content in a TemplateString.
class TemplateString

template :: TemplateString

Template with macros replacement.
class TmplComposer

template :: TmplComposer

A composer in the short list of composers
class TmplComposerDetail

template :: TmplComposerDetail

A composer in the detailled list of composers
class TmplComposers

template :: TmplComposers

The root template for composers
class U16String

core :: U16String

UTF-16 encoded string
private class UnicodeFlatString

core :: UnicodeFlatString

Regular Nit UTF-8 strings
class UnorderedList

html :: UnorderedList

A <ul> list tag.

Class definitions

core $ Writable
# Things that can be efficienlty written to a `Writer`
#
# The point of this interface is to allow the instance to be efficiently
# written into a `Writer`.
#
# Ready-to-save documents usually provide this interface.
interface Writable
	# Write itself to a `stream`
	# The specific logic it let to the concrete subclasses
	fun write_to(stream: Writer) is abstract

	# Like `write_to` but return a new String (may be quite large).
	#
	# This functionality is anecdotal, since the point
	# of a streamable object is to be efficiently written to a
	# stream without having to allocate and concatenate strings.
	fun write_to_string: String
	do
		var stream = new StringWriter
		write_to(stream)
		return stream.to_s
	end

	# Like `write_to` but return a new Bytes (may be quite large)
	#
	# This functionality is anecdotal, since the point
	# of a streamable object is to be efficiently written to a
	# stream without having to allocate and concatenate buffers.
	#
	# Nevertheless, you might need this method if you want to know
	# the byte size of a writable object.
	fun write_to_bytes: Bytes
	do
		var stream = new BytesWriter
		write_to(stream)
		return stream.bytes
	end
end
lib/core/stream.nit:547,1--584,3

core :: file $ Writable
redef class Writable
	# Like `write_to` but take care of creating the file
	fun write_to_file(filepath: String)
	do
		var stream = new FileWriter.open(filepath)
		write_to(stream)
		stream.close
	end
end
lib/core/file.nit:365,1--373,3