Commit d98e5eab authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

support notes

2007-09-07  Juerg Billeter  <j@bitron.ch>

	* doc/vala/default.css, doc/vala/xhtml.xsl: support notes

	* doc/vala/classes.xml: document class declarations

svn path=/trunk/; revision=589
parent 36ff288f
2007-09-07 Jürg Billeter <j@bitron.ch>
* doc/vala/default.css, doc/vala/xhtml.xsl: support notes
* doc/vala/classes.xml: document class declarations
2007-09-07 Jürg Billeter <j@bitron.ch>
* update license headers to the GNU Lesser General Public License,
......
<?xml version="1.0"?>
<section id="classes">
<h>Classes</h>
<p>A class is a data type that can contain fields, constants, methods, properties, and signals. Class types support inheritance, a mechanism whereby a derived class can extend and specialize a base class.</p>
<section id="declaration">
<h>Class declarations</h>
<p>The simplest class declaration looks like this:</p>
<blockcode>
class ClassName {
&lt;class-member&gt;
}</blockcode>
<p>As class types support inheritance, you can specify a base class you want to derive from:</p>
<blockcode>
class ClassName : BaseClassName {
&lt;class-member&gt;
}</blockcode>
<div role="note">
<h>GObject Note</h>
<p>It's recommended that you derive all your classes directly or indirectly from GLib.Object, unless you have a strong reason not to. Some class features are not supported for classes not deriving from GLib.Object. If your class does not derive from GLib.Object, it will map to a struct in C code.</p>
</div>
<p>Classes cannot have multiple base classes, however they may implement multiple interfaces:</p>
<blockcode>
class ClassName : BaseClassName, FirstInterfaceName, SecondInterfaceName {
&lt;class-member&gt;
}</blockcode>
<p>You may optionally specify an accessibility modifier. Classes support <code>public</code> and <code>private</code> accessibility and default to private if you don't specify one. Public classes may be accessed from outside the library or application they are defined in.</p>
<blockcode>
public class ClassName {
&lt;class-member&gt;
}</blockcode>
<p>The <code>abstract</code> modifier may be placed between the optional accessibility modifier and the class name to define an abstract class. An abstract class cannot be instantiated and is used as a base class for derived classes.</p>
<blockcode>
abstract class ClassName {
&lt;class-member&gt;
}</blockcode>
<p>The <code>static</code> modifier may be placed between the optional accessibility modifier and the class name to define a static class. A static class cannot be instantiated and may not have a base class. It can also not be used as a base class for derived classes and may only contain static members. Static classes are implicitly abstract, you may not use both modifiers, <code>abstract</code> and <code>static</code>, in the same class declaration.</p>
<blockcode>
static class ClassName {
&lt;class-member&gt;
}</blockcode>
<p>You may optionally prefix the class name with a namespace name. This places the class in the specified namespace without the need for a separate namespace declaration.</p>
<blockcode>
class NamespaceName.ClassName {
&lt;class-member&gt;
}</blockcode>
</section>
</section>
......@@ -3,7 +3,7 @@ body {
margin-top: 2.8em;
}
h1, h2, h3 {
h1, h2, h3, h4 {
color: #005a9c;
}
......@@ -46,3 +46,20 @@ h3 a {
color: white;
}
div.note {
border: 3px solid #005a9c;
padding: 1em;
margin: 0 2em 1em 2em;
}
div.note p, div.note h4 {
margin: 0;
}
pre {
background-color: #eee;
border: 1px solid black;
padding: .5em 1em;
margin: 0 2em 1em 2em;
}
......@@ -61,11 +61,17 @@
<h2><xsl:value-of select="text()"/></h2>
</xsl:template>
<xsl:template match="body/section/section">
<xsl:apply-templates select="h|p|blockcode|section"/>
<xsl:apply-templates select="h|p|div|blockcode|section"/>
</xsl:template>
<xsl:template match="body/section/section/h">
<h3><xsl:value-of select="text()"/><a id="{../@id}"><xsl:text> </xsl:text></a></h3>
</xsl:template>
<xsl:template match="div[@role='note']">
<div class="note"><xsl:apply-templates select="h|p|blockcode"/></div>
</xsl:template>
<xsl:template match="div/h">
<h4><xsl:value-of select="text()"/></h4>
</xsl:template>
<xsl:template match="p">
<p><xsl:apply-templates select="text()|code"/></p>
</xsl:template>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment