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 #ifndef __FULLID_HPP
00032 #define __FULLID_HPP
00033
00034 #include "libecs.hpp"
00035 #include "EntityType.hpp"
00036
00037
00038 namespace libecs
00039 {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 class SystemPath : public StringList
00057 {
00058
00059 public:
00060
00061 explicit SystemPath( StringCref systempathstring = "" )
00062 {
00063 parse( systempathstring );
00064 }
00065
00066 SystemPath( SystemPathCref systempath )
00067 :
00068 StringList( static_cast<StringList>( systempath ) )
00069 {
00070 ;
00071 }
00072
00073 ~SystemPath() {}
00074
00075 const String getString() const;
00076
00077 bool isAbsolute() const
00078 {
00079 return ( ( ( ! empty() ) && ( front()[0] == DELIMITER ) ) || empty() );
00080 }
00081
00082 bool isValid() const
00083 {
00084
00085 return true;
00086 }
00087
00088 protected:
00089
00090
00091
00092
00093
00094
00095
00096 void standardize();
00097
00098 private:
00099
00100
00101
00102
00103 ECELL_API void parse( StringCref systempathstring );
00104
00105 public:
00106
00107 static const char DELIMITER = '/';
00108
00109 };
00110
00111
00112
00113
00114
00115
00116
00117
00118 class FullID
00119 {
00120
00121 public:
00122
00123 FullID( const EntityType type,
00124 SystemPathCref systempath,
00125 StringCref id )
00126 :
00127 theEntityType( type ),
00128 theSystemPath( systempath ),
00129 theID( id )
00130 {
00131 ;
00132 }
00133
00134 explicit FullID( const EntityType type,
00135 StringCref systempathstring,
00136 StringCref id )
00137 :
00138 theEntityType( type ),
00139 theSystemPath( systempathstring ),
00140 theID( id )
00141 {
00142 ;
00143 }
00144
00145 FullID( StringCref fullidstring )
00146 {
00147 parse( fullidstring );
00148 }
00149
00150 FullID( FullIDCref fullid )
00151 :
00152 theEntityType( fullid.getEntityType() ),
00153 theSystemPath( fullid.getSystemPath() ),
00154 theID( fullid.getID() )
00155 {
00156 ;
00157 }
00158
00159
00160 ~FullID() {}
00161
00162 const EntityType getEntityType() const
00163 {
00164 return theEntityType;
00165 }
00166
00167 SystemPathCref getSystemPath() const
00168 {
00169 return theSystemPath;
00170 }
00171
00172 StringCref getID() const
00173 {
00174 return theID;
00175 }
00176
00177
00178 void setEntityType( const EntityType type )
00179 {
00180 theEntityType = type;
00181 }
00182
00183 void setSystemPath( SystemPathCref systempath )
00184 {
00185 theSystemPath = systempath;
00186 }
00187
00188 void setID( StringCref id )
00189 {
00190 theID = id;
00191 }
00192
00193 bool isValid() const;
00194
00195 ECELL_API const String getString() const;
00196
00197 bool operator<( FullIDCref rhs ) const
00198 {
00199
00200 if( getEntityType() != rhs.getEntityType() )
00201 {
00202 return getEntityType() < rhs.getEntityType();
00203 }
00204
00205
00206
00207 if( getSystemPath() != rhs.getSystemPath() )
00208 {
00209 return getSystemPath() < rhs.getSystemPath();
00210 }
00211
00212
00213 return getID() < rhs.getID();
00214 }
00215
00216 bool operator==( FullIDCref rhs ) const
00217 {
00218
00219 if( getEntityType() != rhs.getEntityType() )
00220 {
00221 return false;
00222 }
00223
00224
00225 if( getSystemPath() != rhs.getSystemPath() )
00226 {
00227 return false;
00228 }
00229
00230
00231 return getID() == rhs.getID();
00232 }
00233
00234 bool operator!=( FullIDCref rhs ) const
00235 {
00236 return ! operator==( rhs );
00237 }
00238
00239 protected:
00240
00241 ECELL_API void parse( StringCref fullidstring );
00242
00243 private:
00244
00245 FullID();
00246
00247 public:
00248
00249 static const char DELIMITER = ':';
00250
00251 private:
00252
00253 EntityType theEntityType;
00254 SystemPath theSystemPath;
00255 String theID;
00256
00257 };
00258
00259 class FullPN
00260 {
00261
00262 public:
00263
00264 FullPN( const EntityType type,
00265 SystemPathCref systempath,
00266 StringCref id,
00267 StringCref propertyname )
00268 :
00269 theFullID( type, systempath, id ),
00270 thePropertyName( propertyname )
00271 {
00272 ;
00273 }
00274
00275 FullPN( FullIDCref fullid, StringCref propertyname )
00276 :
00277 theFullID( fullid ),
00278 thePropertyName( propertyname )
00279 {
00280 ;
00281 }
00282
00283 FullPN( FullPNCref fullpn )
00284 :
00285 theFullID( fullpn.getFullID() ),
00286 thePropertyName( fullpn.getPropertyName() )
00287 {
00288 ;
00289 }
00290
00291 ECELL_API FullPN( StringCref fullpropertynamestring );
00292
00293 ~FullPN()
00294 {
00295 ;
00296 }
00297
00298 FullIDCref getFullID() const
00299 {
00300 return theFullID;
00301 }
00302
00303 const EntityType getEntityType() const
00304 {
00305 return getFullID().getEntityType();
00306 }
00307
00308 SystemPathCref getSystemPath() const
00309 {
00310 return getFullID().getSystemPath();
00311 }
00312
00313 StringCref getID() const
00314 {
00315 return getFullID().getID();
00316 }
00317
00318 StringCref getPropertyName() const
00319 {
00320 return thePropertyName;
00321 }
00322
00323 void setEntityType( const EntityType type )
00324 {
00325 theFullID.setEntityType( type );
00326 }
00327
00328 void setSystemPath( SystemPathCref systempath )
00329 {
00330 theFullID.setSystemPath( systempath );
00331 }
00332
00333 void setID( StringCref id )
00334 {
00335 theFullID.setID( id );
00336 }
00337
00338 void setPropertyName( StringCref propertyname )
00339 {
00340 thePropertyName = propertyname;
00341 }
00342
00343 ECELL_API const String getString() const;
00344
00345 bool isValid() const;
00346
00347 bool operator<( FullPNCref rhs ) const
00348 {
00349 if( getFullID() != rhs.getFullID() )
00350 {
00351 return getFullID() < rhs.getFullID();
00352 }
00353
00354 return getPropertyName() < rhs.getPropertyName();
00355 }
00356
00357 bool operator==( FullPNCref rhs ) const
00358 {
00359 if( getFullID() != rhs.getFullID() )
00360 {
00361 return false;
00362 }
00363
00364
00365 return getPropertyName() == rhs.getPropertyName();
00366 }
00367
00368 bool operator!=( FullPNCref rhs ) const
00369 {
00370 return ! operator==( rhs );
00371 }
00372
00373 private:
00374
00375 FullID theFullID;
00376 String thePropertyName;
00377
00378 };
00379
00380
00381
00382 }
00383
00384 #endif // __FULLID_HPP
00385
00386
00387
00388
00389
00390
00391
00392