|
|||
Home
|
You are here: Home > Support > Reference v1.0 | ||
|
Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members
Hello World on consoleMinimal console applicationBefore showing a small 'hello world' application for console the following sample show a minimal console application. This application does the initialization and start run the console io loop. The root object, which is connected to the main dialog have no properties, functions and sub object. So anything you can do in this 'dialog' is executing the commands of the exom shell.
#include "exom.h" #include "exom_EvalKey.h" // contain evaluation key using namespace exom; int main (int argc, char *argv[ ]) { if (!exomInit (exomKey)) return 1; stdioLoop (XmPathRoot(), NULL); return 0; }
The io loop in this small application will be active unless you leave with
Output: minimal console application 'Hello world' applicationAdditional to the previous application this sample use the basics of the exom framework. These basisc are the exom::XmNamespace and an implementation of exom::XmObject. The namepace provide the IDs used by the object class. An instance of this class is connected to the main dialog.
#include "exom.h" #include "exom_EvalKey.h" // contain evaluation key using namespace exom; // Namespace providing two IDs used by MyClass class MynsNamespace : public XmNamespace { public: XmAtmID ATM_TEST; XmObjID OBJ_TEST; MynsNamespace () { SetNamespaceNames ("myns_Namespace", "myns"); SetAtm (ATM_TEST, "ATM_TEST", "testString"); SetObj (OBJ_TEST, "OBJ_TEST", "testObject"); } }; MynsNamespace myns; // namespace singleton // Small test class with one string property 'testStr' class MyClass : public XmObject { public: XmString testStr; XMOBJ ObjectID () const { return myns.OBJ_TEST; } void manage (XmMan& m) { m.manStr (testStr, myns.ATM_TEST); } }; // main() function with initialization and console main loop int main (int argc, char *argv[ ]) { if (!exomInit (exomKey)) return 1; XmNamespaceMan::RegisterNamespace (myns); MyClass myClass; myClass.testStr.AssignStr ("Hello World"); stdioLoop (XmPathObj (&myClass), NULL); return 0; } When running the application you have the possibility to show and change the string property of the class instance. For learning and understanding the usage of the API try to add some more properties and subobjects or give the object class array functionality.
Output: 'Hello World' for console
|
|||
| Copyright © 2006 Praetz Software Development - www.exomware.com | |||