GObject
共 11 篇文章
GObject 2-01: A convention-compliant minimal complete working example.
My coding style has been so weird that no proper GObject programmers would ever use. GObject do have their coding/naming convention which is "designed by both smart and experienced people" and I am supposed "to put my ego aside". Here are the official document about the "conventions": :: http://lib…
2009-12-18 01:19 · GObject · C · C++ · Blog · GCC · C#
GObject 09: An Interface
An interface is a class with multiple abstract methods. A class may implement one or more interfaces which means that the class provides all the abstract methods specified in the interfaces. This separates the behavior pattern from the actual implementation. An interface cannot be instantiated. How…
2009-11-09 16:56 · GObject · C · C++ · C# · .net
GObject 08: A class with a signal
A GObject may emit signals to show that something have happened. Signals can be connected to many "handlers" which are called when the signals are emitted. Full code: /* A subclass of GObject with a property. */ #include <stdio.h> #include <glib-object.h> typedef struct { GObject something_as_boile…
2009-10-22 17:09 · GObject
GObject 07: A class with properties.
A good practice of Object-oriented Programming is to hide implementation details from the user. As explained before, programmers are encouraged to use "private" fields. However, if you want to let users access those fields, you could do this: typedef { int foo; } MyInstancePrivate; int get_foo(MyIn…
2009-10-22 16:17 · GObject · Qt · Access
GObject 06: A subclass of GObject
This time GObject refers to the type named GObject in the GObject library. Don't be confused. The type GObject is supposed to be the base class of other user-defined classes. GObject has reference counting and deallocate the instance when reference count reaches zero. GObject allows users to add pr…
2009-10-21 13:44 · GObject
GObject 05: An Inheritable class.
In this article I will implement a class inheriting another. An inherited class is also known as a "child class", a "derived class" or a "subclass". The class it inherits is call the "parent class", the "base class" or the "superclass". The subclass contains all the data its superclass has and all …
2009-10-21 01:32 · GObject · prototype · Access
GObject 04: A class with private members
A private member is a member that is only accessible by other methods of the class. Q: Why private? It is inconvenient, isn't it? A: Exposing all details may offer some convenience, but it is almost always undesirable. Q: Why? A: You may allow your users to directly access your private data and you…
2009-10-21 00:49 · GObject · C · C++ · C# · UP · Access
GObject 03: An Instantiatable Class
Most of the time classes are instantiatable. It can create "instances", which have their own data and share common methods of the class. So a CLASS is shared by many INSTANCEs. In GObject, we need two structs. One for the class and one for the instance. [code="c"]/* A fundamental type. Instantiatab…
2009-10-16 16:35 · GObject · C · C++ · C#
GObject 02: A classed type
Now I am going to create a classed type. Q: What is a class? A: I don't know for sure. In object-oriented programming, a class represents a "kind" of data. It specifies what data there is (the members/fields) in each object (instance) and what can be done (the methods) to the object. Q: What is a "…
2009-10-13 16:53 · GObject · C · C++ · C# · Access · IDEA
GObject 01: My first fundamental type.
GObject system handles "types". Q: So what is a "type"? A: Err.. A "type" is how you consider a piece of data. See, there is no "type" in assembly language. The data, whether in registers or memory, are what they are treated as. You can always read/write data in "words" which is defined by the proc…
2009-10-13 01:25 · GObject · C · C++ · Go · C# · Python
GObject 00: A bottom-up introduction to the GObject system
This document introduces the GObject library. This cannot replace the official tutorial/reference. It is recommended to lookup the official reference every time you encountered new concepts. -- After trying to learn GObject object system for more than ten times (and failed as many times as I have t…
2009-10-13 00:34 · GObject · C · C++ · GCC · C# · UP