| Basic Types | Enum Types | Object Types | Array Types | Interface Types | Exception Types | Member Types | Method Types | Namespace Types | Foreign Types |
Namespaces groups ACDK classes and interfaces into
a logical unit.
Full qualified identifier
To address objects from other namespace you can use the
full qualified identifiers:
#include <acdk/io/File.h>
bool foo()
{
::acdk::lang::RString str = "./temp.file";
::acdk::io::RFile file = new ::acdk::io::File(str);
return file->exists();
}
|
You can import the scope of another namespace
with the C++ using:
#include <acdk/io/File.h>
using namespace ::acdk::lang;
using namespace ::acdk::io;
bool foo()
{
RString str = "./temp.file";
RFile file = new File(str);
return file->exists();
}
|
Unfortunatelly in many C++ compiler namespaces are buggy implemented,
and it is better not import the scope complete namespaces.
You can import single classes with C++ using declaration:
#include <acdk/io/File.h>
using ::acdk::lang::RString;
using ::acdk::io::File;
using ::acdk::io::RFile;
bool foo()
{
RString str = "./temp.file";
RFile file = new File(str);
return file->exists();
}
|
To make life a little bit more easy ACDK provides an own using:
#include <acdk/io/File.h>
// using now String, RString, StringArray and RStringArray
USING_CLASS(::acdk::lang::, String);
// using now File, RFile, FileArray, RFileArray
USING_CLASS(::acdk::io::, File);
bool foo()
{
RString str = "./temp.file";
RFile file = new File(str);
return file->exists();
}
|
Writing your own ACDK classes you should
group it into a namespace following the java standard
pattern:
Your app name: myapp.
Your company url: artefakur.com.
the namespace: com::artefaktur::myapp
Sample Header:
// this is myapp/src/com/artefaktur/myapp/MyClass.h
#ifndef com_artefaktur_myapp_MyClass_h
#define com_artefaktur_myapp_MyClass_h
namespace com {
namespace artefaktur {
namespace myapp {
class MyClass
: extends acdk::lang::Object
{
// ...
};
} // namespace myapp
} // namespace artefaktur
} // namespace com
#endif //com_artefaktur_myapp_MyClass_h
|