Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef XObjectPathH
00033 #define XObjectPathH
00034
00035 #include <zeusbase/System/Interfaces/IXObject.hpp>
00036 #include <zeusbase/System/ZObject.h>
00037 #include <zeusbase/System/Queue.hpp>
00038 #include <zeusbase/System/Stack.hpp>
00039 #include <zeusbase/System/String.h>
00040 #include <zeusbase/System/ZVariant.h>
00041
00042 BEGIN_NAMESPACE_Zeus
00043
00044 class TXObjectCollection;
00045
00046
00066
00067 class TXObjectPath : public TZObject
00068 {
00069 public:
00070 TXObjectPath(IXObject* pObj);
00071 virtual ~TXObjectPath();
00072
00073 Retval getObject(const IString& rPath, IXObject*& rpObject);
00074 Retval getObjects(const IString& rPath, IXObjectCollection*& pObjects);
00075
00076 protected:
00077
00078 private:
00080 IXObject* m_pObject;
00082 Int m_iCounter;
00084 wchar_t* m_wcBuffer;
00085
00086 Retval findSingleObject(IXObject** ppObject);
00087 void startScanner(const IString& path);
00088 void clearBuffer();
00089
00090 public:
00091 enum ETokenValue
00092 {
00093 etValueEnd = '\0',
00094 etValuePoint = '.',
00095 etValueSeperator = '/',
00096 etValueOpenBracket = '[',
00097 etValueCloseBracket = ']',
00098 etValueEquals = '=',
00099 etValueAttribute = '@',
00100 etValueSmi = '\''
00101 };
00102
00103
00104 enum ETokenType
00105 {
00106 etTokenUnknown,
00107 etTokenRoot,
00108 etTokenParent,
00109 etTokenRecursive,
00110 etTokenObject
00111 };
00112
00113 protected:
00114
00115
00119
00120 struct TypeToken
00121 {
00123 ETokenType Type;
00125 TString strName;
00126
00128 inline TypeToken()
00129 {
00130 Type = etTokenUnknown;
00131 }
00132
00134 inline TypeToken(ETokenType type)
00135 {
00136 Type = type;
00137 }
00138
00140 inline TypeToken(ETokenType type, const TString& name)
00141 {
00142 Type = type;
00143 strName = name;
00144 }
00145
00147 inline bool operator==(const TypeToken& inpar) const
00148 {
00149 return (Type == inpar.Type &&
00150 strName == inpar.strName);
00151 }
00152
00153 };
00154
00156 TQueue<TypeToken> m_lstTokens;
00157
00158 Retval findObject(IXObject& rBaseObject, IXObject*& rpResult);
00159 Retval findObjects2(IXObject& rBaseObject, TStack<TypeToken>& rTokens, TXObjectCollection& rResults);
00160
00161 };
00162
00163
00164 END_NAMESPACE_Zeus
00165
00166 #endif