XmPath Class ReferenceInheritance diagram for XmPath:
List of all members.
Detailed Description
Instances of this class are used to identify objects, member data and functions.
This class provide a type safe possibility for identifying objects, member data and functions especially in user interface extensions. In general a path is relative to an object, the exom root or another path. To identify objects or their members within a complex hierarchy, a path contain items which store ID's (XmID) or indices for refering them.
The identification is independent from the class definition of the objects, which will be accessed.
More information in section Locating objects and members.
Following example show the access to an atom within an object.
#include <exom.h>
using namespace exom;
class mynsNamespace : public XmNamespace
{
public:
XmObjID OBJ_MY_OBJECT;
XmAtmID ATM_MY_INT;
XmAtmID ATM_MY_STRING;
XmAtmID ATM_UNKNOWN;
mynsNamespace()
{
SetNamespaceNames ("mynsNamespace", "myns");
SetObj (OBJ_MY_OBJECT, "OBJ_MY_OBJECT", "myObject");
SetAtm (ATM_MY_INT, "ATM_MY_INT", "myInt");
SetAtm (ATM_MY_STRING, "ATM_MY_STRING", "myStr");
SetAtm (ATM_UNKNOWN, "ATM_UNKNOWN", "unknown");
}
};
mynsNamespace myns;
class MyClass : public XmObject
{
int m_MyInt;
XmString m_MyStr;
XMOBJ ObjectID() const { return myns.OBJ_MY_OBJECT; }
void manage (XmMan& m)
{
m.manInt32 (m_MyInt, myns.ATM_MY_INT);
m.manStr (m_MyStr, myns.ATM_MY_STRING);
}
};
void Sample_UsePath ()
{
bool ret;
MyClass my;
XmPathObj path (&my);
path << myns.ATM_MY_INT;
ret = path.ExistPath();
XmPathObj path2 (&my);
path2 << myns.ATM_UNKNOWN;
ret = path2.ExistPath();
}
void Run_base_sample ()
{
XmNamespaceMan::RegisterNamespace (myns);
Sample_UsePath ();
}
|
Public Types |
| enum | PATHBASE {
PATHBASE_NULL = -1,
PATHBASE_ROOT = 0,
PATHBASE_PATH = 1,
PATHBASE_OBJ = 2
} |
| | Specify the base, to which a path is relative to. More...
|
Public Member Functions |
| XmPath & | operator<< (XMID ID) |
| | Append an ID to a path.
|
| XmPath & | operator<< (XmObject &o) |
| | Append the ID of the given object.
|
|
bool | SetRefPath (const XmPath *path) |
| | Set the path relative to another path.
|
|
bool | SetPathDirectObj (XmObject *baseObj) |
| | Set the path relative to an object.
|
|
bool | SetPathRoot () |
| | Set the path relative to the exom root.
|
|
bool | ClearPath () |
| | Clear the path and set PathBase to PATHBASE_NULL.
|
|
bool | ExistPath () const |
| | Check, if object, member data and function exist, the path is pointing to.
|
| bool | GetAbsPath (const XmPath &p) |
| | Create an absolute path based on the given path.
|
| bool | EqualPath (const XmPath &path) const |
| | Compare two paths on equality.
|
| bool | NotEqual (const XmPath &path) const |
| | Compare two paths on inequality.
|
|
PATHBASE | GetPathBase () const |
| | Supply the base, the path is relative to.
|
|
bool | GetPathSet () const |
| | Return true, if path is set.
|
Static Public Member Functions |
| static bool | GetObjectPath (XmPath &p, const XmPath &entryPath, const XmObject *object) |
| | Retrieve the path to the given object within the object tree spanned by entryPath.
|
Private Attributes |
|
PATHBASE | PathBase |
| | The base of the path.
|
Member Enumeration Documentation
|
|
Specify the base, to which a path is relative to.
- Enumeration values:
-
| PATHBASE_NULL |
Path base is undefined. |
| PATHBASE_ROOT |
path is relative to the exom root |
| PATHBASE_PATH |
path is relative to another path |
| PATHBASE_OBJ |
path is relative to an object |
|
Member Function Documentation
|
|
Append an ID to a path.
Can be an ID identifing an object (XmObjID), a member data (XmAtmID) or a member function (XmFcnID). |
|
|
Append the ID of the given object.
Append the ID of the given object. |
| bool GetAbsPath |
( |
const XmPath & |
p |
) |
|
|
|
|
Create an absolute path based on the given path.
An absolute path will have the same GetPathBase() as the deepest referenced path. References to relative paths are resolved to an absolute path. |
| bool EqualPath |
( |
const XmPath & |
path |
) |
const |
|
|
|
Compare two paths on equality.
return true, if paths are equal. |
| bool NotEqual |
( |
const XmPath & |
path |
) |
const [inline] |
|
|
|
Compare two paths on inequality.
return true, if paths are not equal. |
| static bool GetObjectPath |
( |
XmPath & |
p, |
|
|
const XmPath & |
entryPath, |
|
|
const XmObject * |
object |
|
) |
[static] |
|
|
|
Retrieve the path to the given object within the object tree spanned by entryPath.
Return true, if a path exist; Otherwise false. |
|