00001
00163 #ifndef INC_RVC_OBJITEM_H
00164 #define INC_RVC_OBJITEM_H
00165
00166 #ifndef INC_RVC_DESCRIPTOR_H
00167 #include <rvc/descriptor.h>
00168 #endif
00169
00170 #ifndef INC_RVC_OBJTYPE_H
00171 #include <rvc/objtype.h>
00172 #endif
00173
00174 #ifndef INC_MI32_FILEPATH_H
00175 #include <mi32/filepath.h>
00176 #endif
00177
00178 #ifndef INC_MI32_FILEFIND_H
00179 #include <mi32/filefind.h>
00180 #endif
00181
00182 #ifndef INC_MI32_ICONID_H
00183 #include <mi32/iconid.h>
00184 #endif
00185
00186 #ifdef RVCSYSDLL
00187 #define CLASSEXPORT MI_DLLCLASSEXPORT
00188 #else
00189 #define CLASSEXPORT MI_DLLCLASSIMPORT
00190 #endif
00191
00192 namespace RVC {
00193 #ifndef GENERATING_DOXYGEN_OUTPUT
00194 class CREDENTIALS;
00195 class OBJECT;
00196 class OBJITEMLIST;
00197 class OBJMAKEPARMS;
00198 class OBJOPENPARMS;
00199 #endif // GENERATING_DOXYGEN_OUTPUT
00200
00201
00202
00204 class CLASSEXPORT OBJITEM {
00205 public:
00206
00208 enum TYPE {
00209 TYPE_Empty = 0,
00210 TYPE_Invalid = 1,
00211 TYPE_General_Folder = 2,
00212 TYPE_General_File = 3,
00213 TYPE_RVC_File = 4,
00214 TYPE_RVC_Folder = 5,
00215 TYPE_RVC_Object = 6,
00216 TYPE_URL = 7,
00217 };
00218
00219 static ICONID GetIconIdFromObjectType (
00220 OBJTYPE objtype
00221 );
00222
00224 static void SetupOutputList (
00225 OBJITEMLIST& oobjlist,
00226 const OBJITEMLIST& iobjlist,
00227 const char *source = 0
00228 );
00229
00231 OBJITEM (
00232 );
00233
00235 OBJITEM (
00236 const OBJITEM& rhs
00237 );
00238
00240 OBJITEM (
00241 const FILEPATH& filename,
00242 const MISTRING& ObjectPath
00243 );
00244
00246 OBJITEM (
00247 const MISTRING& URL,
00248 const MISTRING& Title,
00249 const RVC::OBJTYPE& ObjType
00250 );
00251
00252 #ifndef NO_DEPRECATED
00255 DEPRECATED OBJITEM (
00256 const FILEPATH& filename,
00257 RVCINODENUM inode,
00258 const CREDENTIALS *pCredentials = 0
00259 );
00260 #endif
00261
00264 OBJITEM (
00265 const DESCRIPTOR& Descriptor
00266 );
00267
00269 ~OBJITEM (
00270 );
00271
00273 OBJITEM operator= (
00274 const OBJITEM& rhs
00275 );
00276
00278 OBJITEM& operator= (
00279 const DESCRIPTOR& Descriptor
00280 );
00281
00283 void Clear (
00284 );
00285
00288 void CreateNew (
00289 const DESCRIPTOR& Descriptor,
00290 RVC::OBJTYPE ObjType = RVC::OBJTYPE_All
00291 );
00292
00294 void CreateNew (
00295 const RVC::OBJITEM& ParentItem,
00296 RVC::OBJTYPE ObjType,
00297 const DESCRIPTOR& Descriptor
00298 );
00299
00301 void CreateNewFileNonRVC (
00302 const FILEPATH& filepath
00303 );
00304
00309 ERRVALUE GetCombinedPath (
00310 MISTRING& CombinedPath,
00311 const CREDENTIALS *pCredentials = 0
00312 ) const;
00313
00318 void GetDisplayPath (
00319 MISTRING& pathstr,
00320 const CREDENTIALS *pCredentials = 0
00321 ) const;
00322
00326 void GetDisplayString (
00327 MISTRING& string,
00328 const CREDENTIALS *pCredentials = 0
00329 ) const;
00330
00334 MISTRING GetDisplayString (
00335 const CREDENTIALS *pCredentials = 0
00336 ) const { MISTRING str; GetDisplayString(str, pCredentials); return (str); }
00337
00339 const FILEPATH& GetFilePath (
00340 ) const { return (m_filename); }
00341
00343 ICONID GetIconID (
00344 ) const;
00345
00346 #ifndef NO_DEPRECATED
00349 DEPRECATED RVCINODENUM GetInode (
00350 const CREDENTIALS *pCredentials = 0
00351 ) const {
00352 if (!IsResolved()) ResolveObjectPath(pCredentials);
00353 return (m_ObjectInode);
00354 }
00355 #endif
00356
00359 const DESCRIPTOR& GetObjectDescriptor (
00360 const CREDENTIALS *pCredentials = 0
00361 ) const {
00362 if (!IsResolved()) ResolveObjectPath(pCredentials);
00363 return (m_Descriptor);
00364 }
00365
00370 void GetObjectDisplayPath (
00371 MISTRING& string,
00372 const CREDENTIALS *pCredentials = 0
00373 ) const;
00374
00376 ERRVALUE GetObjectPath (
00377 MISTRING& ObjectPath,
00378 const CREDENTIALS *pCredentials = 0
00379 ) const {
00380 if (m_ObjectInode == -1) {
00381 ObjectPath = m_ObjectPath;
00382 return (0);
00383 }
00384 return (DetermineObjectPath(ObjectPath, pCredentials));
00385 }
00386
00388 RVC::OBJTYPE GetObjectType (
00389 ) const;
00390
00393 bool GetParent (
00394 OBJITEM& ParentObjItem,
00395 const CREDENTIALS *pCredentials = 0
00396 ) const;
00397
00398 #if defined(RVCSYSDLL) && !defined(NO_DEPRECATED)
00401 DEPRECATED RVCINODENUM GetParentInode (
00402 const CREDENTIALS *pCredentials = 0
00403 ) const {
00404 if (!IsResolved()) ResolveObjectPath(pCredentials);
00405 return (m_ParentInode);
00406 }
00407 #endif
00408
00410 const MISTRING& GetURL (
00411 ) const {
00412 if (GetType() != TYPE_URL) return MISTRING::GetEmpty();
00413 return (m_ObjectPath);
00414 }
00415
00419 void GetToolTipString (
00420 MISTRING& string,
00421 const CREDENTIALS *pCredentials = 0
00422 ) const;
00423
00425 const MISTRING& GetTitle (
00426 ) const { return (m_Title); }
00427
00431 MISTRING GetToolTipString (
00432 const CREDENTIALS *pCredentials = 0
00433 ) const { MISTRING str; GetToolTipString(str, pCredentials); return (str); }
00434
00436 OBJITEM::TYPE GetType (
00437 ) const;
00438
00440 bool HasObjectDescription (
00441 const CREDENTIALS *pCredentials = 0
00442 ) const {
00443 if (!IsResolved()) ResolveObjectPath(pCredentials);
00444 return (!m_Descriptor.GetDescription().IsEmpty());
00445 }
00446
00448 bool HasSameParent (
00449 const OBJITEM& rhs
00450 ) const { return (m_filename == rhs.m_filename && m_ParentInode == rhs.m_ParentInode); }
00451
00454 bool IniRead (
00455 INIHANDLE handle,
00456 const char *group,
00457 const char *field
00458 );
00459
00461 void IniWrite (
00462 INIHANDLE handle,
00463 const char *group,
00464 const char *field,
00465 const CREDENTIALS *pCredentials = 0
00466 ) const;
00467
00470 bool IsAssigned (
00471 ) const;
00472
00474 bool IsEqual (
00475 const OBJITEM& rhs,
00476 const CREDENTIALS *pCredentials = 0
00477 ) const;
00478
00482 bool IsExisting (
00483 const CREDENTIALS *pCredentials = 0
00484 ) const;
00485
00487 bool IsFileNonRVC (
00488 ) const;
00489
00491 bool IsFileOnly (
00492 ) const { return (!m_filename.IsEmpty() && (m_ObjectInode == 0 || m_ObjectInode == -2)); }
00493
00496 bool IsLessThan (
00497 const OBJITEM& rhs
00498 ) const;
00499
00501 bool IsLessThanChild (
00502 const OBJITEM& rhs
00503 ) const { return (m_ObjectInode < rhs.m_ObjectInode); }
00504
00506 bool IsNewRequest (
00507 ) const { return (m_ObjectInode == R_NewRequest); }
00508
00510 bool IsObjectExtFile (
00511 const CREDENTIALS *pCredentials = 0
00512 ) const;
00513
00515 bool IsResolved (
00516 ) const;
00517
00519 bool IsSkipRequest (
00520 ) const { return (m_ObjectInode == R_SkipRequest); }
00521
00526 bool LocateRelated (
00527 const FILEPATH& SourcePath,
00528 FILEFIND::RELATEDORDER order,
00529 const CREDENTIALS *pCredentials = 0
00530 );
00531
00534 void SetCombinedPath (
00535 const MISTRING& CombinedPath,
00536 const CREDENTIALS *pCredentials = 0
00537 );
00538
00540 void SetFilePath (
00541 const FILEPATH& filepath
00542 );
00543
00547 bool SetFromDisplayPath (
00548 const MISTRING& pathstr,
00549 const CREDENTIALS *pCredentials = 0
00550 );
00551
00553 void SetItem (
00554 const FILEPATH& filename,
00555 const MISTRING& ObjectPath
00556 );
00557
00558 #if defined(RVCSYSDLL) && !defined(NO_DEPRECATED)
00561 DEPRECATED void SetItem (
00562 const FILEPATH& filename,
00563 RVCINODENUM inode,
00564 const CREDENTIALS *pCredentials = 0
00565 );
00566 #endif
00567
00569 void SetItemToFile (
00570 const FILEPATH& filename,
00571 const CREDENTIALS *pCredentials = 0
00572 );
00573
00575 void SetObjectDescriptor (
00576 const DESCRIPTOR& NewDescriptor
00577 );
00578
00580 void SetObjectPath (
00581 const MISTRING& ObjectPath,
00582 const CREDENTIALS *pCredentials = 0
00583 );
00584
00586 void SetObjectType (
00587 OBJTYPE objtype
00588 ) { if (m_ObjectInode < 0) m_ObjType = objtype; }
00589
00591 void SetSkipRequest ();
00592
00594 void SetTitle (
00595 const MISTRING& title
00596 ) { m_Title = title; }
00597
00599 void SetURL (
00600 const MISTRING& url,
00601 RVC::OBJTYPE ObjType = RVC::OBJTYPE_Remote
00602 );
00603
00604 private:
00605 #ifndef GENERATING_DOXYGEN_OUTPUT
00606
00607 FILEPATH m_filename;
00608 mutable RVCINODENUM m_ObjectInode;
00609 mutable RVCINODENUM m_ParentInode;
00610 mutable OBJTYPE m_ObjType;
00611 MISTRING m_ObjectPath;
00612 mutable DESCRIPTOR m_Descriptor;
00613 MISTRING m_Title;
00614
00615
00616 ERRVALUE DetermineObjectPath (MISTRING& ObjectPath, const CREDENTIALS *pCredentials) const;
00617
00618
00619 void ResolveObjectPath (const CREDENTIALS *pCredentials) const;
00620
00621 friend class OBJECT;
00622 friend class OBJMAKEPARMS;
00623 friend class OBJOPENPARMS;
00624 #endif // GENERATING_DOXYGEN_OUTPUT
00625 };
00626
00627
00629 inline bool operator== (
00630 const RVC::OBJITEM& lhs,
00631 const RVC::OBJITEM& rhs
00632 ) {
00633 return (lhs.IsEqual(rhs));
00634 }
00635
00637 inline bool operator!= (
00638 const RVC::OBJITEM& lhs,
00639 const RVC::OBJITEM& rhs
00640 ) {
00641 return (!lhs.IsEqual(rhs));
00642 }
00643
00645 inline bool operator< (
00646 const RVC::OBJITEM& lhs,
00647 const RVC::OBJITEM& rhs
00648 ) { return (lhs.IsLessThan(rhs)); }
00649
00650
00651
00652 }
00653
00654 #undef CLASSEXPORT
00655
00656 #endif // INC_RVC_OBJITEM_H
00657