#include <sgscan.h>
Inheritance diagram for Library:

Public Member Functions | |
| Library () | |
| Constructor. | |
| ~Library () | |
| Time to die... | |
| INT32 | Init (SuperGallery *ParentGal, PathName *Path, String_64 *Title, StringBase *IndexFile, SGLibType Type, BOOL Updated=FALSE, BOOL AllowedToCreateVirtualised=FALSE) |
| Given a specified sublibrary index, scan it and create a supergallery display group for it, containing display items for all of the items in the index. | |
| INT32 | CreateItems (void) |
| Mainly for use by the de-virtualise function... Init MUST have been called previously for this to work ! | |
| void | GetLibraryTitle (StringBase *ReturnedTitle) |
| To retrieve the title text for this library (this is the text that a linked SGDisplayGroup will display in the gallery list as in "Pictures of animals"). | |
| UINT32 | GetModified () |
| void | SetModified (UINT32 nModified) |
| SGLibType | GetType () |
| BOOL | GetFilename (LibraryIndex Offset, StringBase *File, BOOL FullPath=TRUE) |
| Return the path/filename for the indexed library item. | |
| BOOL | GetFilename (LibraryIndex Offset, TCHAR **File) |
| Return a pointer to the filename for the indexed library item. | |
| BOOL | GetTextname (LibraryIndex Offset, StringBase *Text) |
| Return the textual description for the indexed library item. | |
| BOOL | GetTextname (LibraryIndex Offset, TCHAR **Text) |
| Return a pointer to the textual description for the indexed library item. | |
| UINT32 | GetID (LibraryIndex Offset) |
| Return the ID for the indexed library item Returns 0 if there was a problem (0 is an invalid ID). | |
| BOOL | GetTitle (LibraryIndex Offset, StringBase *Title) |
| Return the 'title' for the indexed library item (if there is one). | |
| BOOL | GetTitle (LibraryIndex Offset, TCHAR **Title) |
| Return a pointer to the title for the indexed library item. | |
| BOOL | GetThumbnail (LibraryIndex Offset, SGThumbSize Size, BOOL Urgent, KernelBitmap **Thumbnail) |
| Return a pointer to the thumbnail for the given library index. | |
| void | KillAllThumbnails (void) |
| Deletes all thumbnails from cache. | |
| INT32 | PreviewBMPWidth (SGThumbSize Size) |
| INT32 | PreviewBMPHeight (SGThumbSize Size) |
| PathName * | ReturnIndexLocation (void) |
| PathName * | ReturnSubLibraryLocation (void) |
| PathName * | ReturnSynonymFile (void) |
| BOOL | LocalPath2URL (String_256 *pLocalPath) |
| converts a local path to a URL, using the base URL read from the library index file The URL can be used to download the file | |
| BOOL | GetSingleField (LibraryIndex Offset, UINT32 Count, StringBase *Field) |
| Return a single field for a given library item Use this for extended info. | |
| BOOL | GetSingleField (LibraryIndex Offset, UINT32 Count, TCHAR **Field) |
| Return a single field for a given library item Use this for extended info. | |
| BOOL | GetSingleField (LibraryIndex Offset, String_64 *FieldName, StringBase *Field) |
| Return a single field for a given library item and field description Use this for extended info. | |
| BOOL | GetSingleField (LibraryIndex Offset, String_64 *FieldName, TCHAR **Field) |
| Get a pointer to a single field for a given library item and field description using the extended info. | |
| INT32 | FindField (String_64 *FieldName) |
| Works out the column for the given field string. | |
| BOOL | GotField (String_64 *FieldName) |
| Check if a string is in the field description string... | |
| BOOL | IsWebLibrary () |
| BOOL | SaveIndexInDisplayedOrder (PathName *IndexFile, BOOL NewIDs) |
| Save out an index file in the order the group is displayed (possibly sorted !) Notes: This is strictly a debug only function ! | |
| BOOL | FreeCachedIndexes () |
| Free some memory when we close a gallery by freeing all the cached index files... | |
| BOOL | ReCacheIndexes () |
| Re-caches the indexes when opening a gallery... | |
Static Public Member Functions | |
| static BOOL | InitLibPrefs (void) |
| Initialises the preferences in the ini file and returns the values of the entries if they're there already. | |
| static BOOL | CacheLibPrefs (void) |
| Called during preference wiping to allow us to squirrel away any settings that we desire before they are wiped. This is useful if we want to retain newly installed preferences that the installer has deliberately put there! E.g the paths to the clipart etc on the CD. | |
| static BOOL | RestoreLibPrefs (void) |
| Called during preference wiping to allow us to squirrel away any settings that we desire before they are wiped. This is useful if we want to retain newly installed preferences that the installer has deliberately put there! E.g the paths to the clipart etc on the CD. | |
Public Attributes | |
| BOOL | m_bIsWebLib |
| String_64 * | Title |
| PathName * | IndexFile |
| PathName * | SubLibPath |
| PathName * | SynonymFile |
| SuperGallery * | ParentGallery |
| SGLibGroup * | ParentGroup |
| SGThumbs * | Thumbnails |
Static Public Attributes | |
| static String_256 | URLBase = _T("") |
| static Progress * | ProgressBar = NULL |
| static INT32 | MaxFieldCacheEntries = 25 |
| static BOOL | BackgroundRedraw = TRUE |
| static BOOL | CacheIndexFile = TRUE |
| static BOOL | RemoteIndexes = TRUE |
| static String_256 | RemoteIndexLocation = "" |
| static BOOL | QuickIndex = TRUE |
Protected Member Functions | |
| BOOL | CacheSubIndex (PathName *IndexFile) |
| Creates a CCMemTextFile with the given file in, and opens it. The idea being that reading from a file in memory will be quicker than off a very slow single speed CD ROM drive. | |
| BOOL | ScanRestOfFile (TCHAR *CachedIndex, INT32 Start, INT32 Finish, BOOL AddItems=TRUE) |
| Scan the rest of the file (following the START), creating items for each entry... Also change ','s to 0's, so we can retrieve field strings more quickly later on. | |
| BOOL | GetSingleFieldFromMemory (LibraryIndex Offset, UINT32 Count, StringBase *Field) |
| Return a single field for a given library item using the 0 padded, cached index file in memory. | |
| BOOL | GetSingleFieldFromMemory (LibraryIndex Offset, UINT32 Count, TCHAR **Field) |
| Return a pointer to a single field for a given library item using the 0 padded, cached index file in memory. | |
| BOOL | GetSingleFieldFromDisk (LibraryIndex Offset, UINT32 Count, StringBase *Field) |
| Return a single field for a given library item using a diskfile for the index. | |
| BOOL | CacheInit (INT32 Entries) |
| Initialises memory for a sub-index file field cache. Currently we use a single entry wide hash table with the specified number of buckets. Reading items from the cache is much quicker than from the index file itself, be it in memory or not ! (Well, that's the theory). | |
| BOOL | CacheKill (void) |
| Reclaims all the memory used by the field cache. | |
| INT32 | CacheHashFunction (LibraryIndex Offset, UINT32 Count) |
| Returns an index into the hash table for the given parameters. The simpler, the quicker, but probably the less efficient. | |
| BOOL | CachePut (LibraryIndex Offset, UINT32 Count, StringBase *Field) |
| Adds an item into the cache for returning later on with CacheGet. | |
| BOOL | CacheGet (LibraryIndex Offset, UINT32 Count, StringBase *Field) |
| Checks if an item is in the cache. If it is, return it. | |
Protected Attributes | |
| SGLibType | Type |
| INT32 | ItemCount |
| String_256 | FieldString |
| LibraryIndex | FirstLineOffset |
| LibraryIndex | LastLineOffset |
| INT32 | PreviewX [3] |
| INT32 | PreviewY [3] |
| UINT32 | IndexDateStamp |
| UINT32 | m_nModified |
| INT32 | m_lOldIndex |
| TCHAR * | CachedSubIndexBuf |
| INT32 | CachedBufLength |
| INT32 | FieldCacheEntries |
| SGFieldCache * | FieldCache |
| BOOL | QuickIndexEnabled |
| PathName * | QuickIndexFile |
Private Member Functions | |
| BOOL | SetUpMembers (SuperGallery *ParentGal, PathName *Path, String_64 *SLTitle, StringBase *SubI, SGLibType SLType) |
| Fill in the member variables with the required paths, and things... Should only be called from Init. | |
| BOOL | SetupQuickIndexMembers (PathName *Path, BOOL CheckTheyExist) |
| Given a normal index file path, set up members to a 'quick index file'. The idea is for groups of library directories to have copies of all their indexes in some common folder so that loading them in doesn't thrash the CD drive too much. | |
| INT32 | ReadHeaderInfo (CCLexFile *pSubIndex) |
| Read the no of items, field text and line pSubIndex up with the first proper index line. | |
| BOOL | ScanRestOfFile (CCLexFile *pSubIndex) |
| Scan the rest of the file (following the START), creating items for each entry... | |
Static Private Attributes | |
| static String_256 | g_ClipartLibraryPath = TEXT("") |
| static String_256 | g_WebThemeLibraryPath = TEXT("") |
| static String_256 | g_FontLibraryPath = TEXT("") |
| static String_256 | g_FillsLibraryPath = TEXT("") |
Friends | |
| class | LibClipartSGallery |
| class | LibraryGallery |
Definition at line 139 of file sgscan.h.
|
|
Constructor.
Definition at line 196 of file sgscan.cpp. 00197 { 00198 ParentGallery = NULL; 00199 ParentGroup = NULL; 00200 00201 Title = NULL; 00202 IndexFile = NULL; 00203 Thumbnails = NULL; 00204 SubLibPath = NULL; 00205 SynonymFile = NULL; 00206 00207 ItemCount = 0; 00208 Type = SGLib_Blank; 00209 00210 FirstLineOffset = LastLineOffset = 0; 00211 00212 for(INT32 i=0; i<3; i++) 00213 { 00214 PreviewX[i] = 64; // Widths of thumbnails 00215 PreviewY[i] = 64; // Heights of thumbnails 00216 } 00217 00218 // Add in a field cache for the library 00219 #ifdef FIELDCACHE 00220 FieldCache = NULL; 00221 CacheInit(MaxFieldCacheEntries); 00222 #endif 00223 00224 // No sub index cached yet... 00225 //CachedSubIndex = NULL; 00226 CachedSubIndexBuf = NULL; 00227 CachedBufLength = 0; 00228 00229 // Datestamp of last index cached 00230 IndexDateStamp = 0; 00231 00232 // Quick Index stuff... 00233 QuickIndexEnabled = FALSE; 00234 QuickIndexFile = NULL; 00235 00236 // Progress bar stuff 00237 ProgressBar = NULL; 00238 //>> webster (Adrian 02/01/97) 00239 m_nModified = 0; 00240 m_bIsWebLib = FALSE; 00241 m_lOldIndex = 0; 00242 //<< webster 00243 }
|
|
|
Time to die...
Definition at line 258 of file sgscan.cpp. 00259 { 00260 TRACEUSER( "Richard", _T("~Library called\n")); 00261 00262 // Ensure our parent gallery is no longer displaying us 00263 if (ParentGallery != NULL) 00264 { 00265 ParentGallery->RemoveLibraryGroup(this); 00266 ParentGallery = NULL; 00267 } 00268 00269 if(Title != NULL) 00270 { 00271 delete Title; 00272 Title = NULL; 00273 } 00274 00275 if(IndexFile != NULL) 00276 { 00277 delete IndexFile; 00278 IndexFile = NULL; 00279 } 00280 00281 if(Thumbnails != NULL) 00282 { 00283 delete Thumbnails; 00284 Thumbnails = NULL; 00285 } 00286 00287 if(SubLibPath != NULL) 00288 { 00289 delete SubLibPath; 00290 SubLibPath = NULL; 00291 } 00292 00293 if(SynonymFile != NULL) 00294 { 00295 delete SynonymFile; 00296 SynonymFile = NULL; 00297 } 00298 00299 // Reclaim field cache memory 00300 #ifdef FIELDCACHE 00301 CacheKill(); 00302 #endif 00303 00304 // Free the CachedSubIndex file buffer 00305 if(CachedSubIndexBuf != NULL) 00306 { 00307 CCFree((void *)CachedSubIndexBuf); 00308 CachedSubIndexBuf = NULL; 00309 } 00310 00311 CachedBufLength = 0; 00312 00313 00314 // And reclaim all memory used by the cached subindex itself 00315 // if(CachedSubIndex != NULL) 00316 // { 00317 // CachedSubIndex->DeinitLexer(); 00318 // if(CachedSubIndex->isOpen()) 00319 // CachedSubIndex->close(); 00320 // delete CachedSubIndex; 00321 // } 00322 00323 00324 if(QuickIndexFile != NULL) 00325 delete QuickIndexFile; 00326 }
|
|
||||||||||||||||
|
Checks if an item is in the cache. If it is, return it.
Definition at line 2625 of file sgscan.cpp. 02626 { 02627 #if 0 02628 // Check the FieldCache occupancy 02629 if(FieldCache != NULL) 02630 { 02631 INT32 Occupancy = 0; 02632 for(INT32 i=0; i<FieldCacheEntries; i++) 02633 { 02634 if(FieldCache[i].Field != NULL) Occupancy++; 02635 } 02636 TRACEUSER( "Richard", _T("Hash usage %d out of %d - %d%%\n"), Occupancy, FieldCacheEntries, (100 * Occupancy / FieldCacheEntries)); 02637 } 02638 #endif 02639 02640 // See if our entry is in the cache 02641 SGFieldCache OurEntry; 02642 if(FieldCache != NULL) 02643 { 02644 OurEntry = FieldCache[CacheHashFunction(Offset, Count)]; 02645 02646 if(OurEntry.Offset == Offset && OurEntry.Count == Count && OurEntry.Field != NULL) 02647 { 02648 String_256 tmpstr(OurEntry.Field); 02649 *Field = tmpstr; 02650 return TRUE; 02651 } 02652 } 02653 02654 //TRACEUSER( "Richard", _T("Field not in cache...")); 02655 02656 return FALSE; 02657 }
|
|
||||||||||||
|
Returns an index into the hash table for the given parameters. The simpler, the quicker, but probably the less efficient.
Definition at line 2550 of file sgscan.cpp. 02551 { 02552 return ((Count + Offset) % FieldCacheEntries); 02553 }
|
|
|
Initialises memory for a sub-index file field cache. Currently we use a single entry wide hash table with the specified number of buckets. Reading items from the cache is much quicker than from the index file itself, be it in memory or not ! (Well, that's the theory).
Definition at line 2459 of file sgscan.cpp. 02460 { 02461 if(Entries == 0) 02462 FieldCache = NULL; 02463 else 02464 if(FieldCache == NULL) 02465 FieldCache = (SGFieldCache *)CCMalloc(sizeof(SGFieldCache) * Entries); 02466 02467 if(FieldCache == NULL) 02468 { 02469 FieldCacheEntries = 0; 02470 ERROR3("Library::CacheInit - Not enough memory for a field cache - reduce the Fields in the ini file"); 02471 return FALSE; 02472 } 02473 else 02474 { 02475 FieldCacheEntries = Entries; 02476 02477 SGFieldCache Dummy; 02478 Dummy.Offset = 0; 02479 Dummy.Count = 0; 02480 Dummy.Field = NULL; 02481 02482 for(INT32 i=0; i<Entries; i++) 02483 { 02484 FieldCache[i] = Dummy; 02485 } 02486 } 02487 return TRUE; 02488 }
|
|
|
Reclaims all the memory used by the field cache.
Definition at line 2506 of file sgscan.cpp. 02507 { 02508 TRACEUSER( "Richard", _T("Cache Kill\n")); 02509 02510 if(FieldCache != NULL) 02511 { 02512 for(INT32 i=0; i<FieldCacheEntries; i++) 02513 { 02514 if(FieldCache[i].Field != NULL) 02515 { 02516 CCFree(FieldCache[i].Field); 02517 FieldCache[i].Field = NULL; 02518 } 02519 } 02520 FieldCacheEntries = 0; 02521 02522 CCFree(FieldCache); 02523 FieldCache = NULL; 02524 } 02525 02526 return TRUE; 02527 }
|
|
|
Called during preference wiping to allow us to squirrel away any settings that we desire before they are wiped. This is useful if we want to retain newly installed preferences that the installer has deliberately put there! E.g the paths to the clipart etc on the CD.
Definition at line 2906 of file sgscan.cpp. 02907 { 02908 // Save away the current values stored in the preferences 02909 // Must read the values directly from the preferences as our preference variables will 02910 // not have been set up yet! 02911 Camelot.GetPrefDirect(TEXT("Libraries"), TEXT("ClipArt"), &g_ClipartLibraryPath); 02912 Camelot.GetPrefDirect(TEXT("Libraries"), TEXT("WebTheme"), &g_WebThemeLibraryPath); 02913 Camelot.GetPrefDirect(TEXT("Libraries"), TEXT("Font"), &g_FontLibraryPath); 02914 Camelot.GetPrefDirect(TEXT("Libraries"), TEXT("Texture"), &g_FillsLibraryPath); 02915 02916 //g_ClipartLibraryPath = LibClipartSGallery::DefaultLibraryPath; 02917 //g_FontLibraryPath = FontsSGallery::DefaultLibraryPath; 02918 //g_FillsLibraryPath = LibFillsSGallery::DefaultLibraryPath; 02919 02920 return TRUE; 02921 }
|
|
||||||||||||||||
|
Adds an item into the cache for returning later on with CacheGet.
Definition at line 2572 of file sgscan.cpp. 02573 { 02574 TRACEUSER( "Richard", _T("Cache Put\n")); 02575 02576 // Put the field in the field buffer / line cache, etc... 02577 if(FieldCache != NULL) 02578 { 02579 SGFieldCache OurEntry; 02580 OurEntry.Offset = Offset; 02581 OurEntry.Count = Count; 02582 OurEntry.Field = (TCHAR *)CCMalloc((Field->Length()+1) * sizeof(TCHAR)); 02583 if(OurEntry.Field == NULL) 02584 { 02585 ERROR3("Library::GetSingleField can't allocate enough string space in field buffer"); 02586 return FALSE; 02587 } 02588 else 02589 { 02590 camStrcpy(OurEntry.Field, (TCHAR *)*Field); 02591 } 02592 02593 SGFieldCache *plc = &FieldCache[CacheHashFunction(Offset, Count)]; 02594 02595 if(plc->Field != NULL) 02596 { 02597 CCFree(plc->Field); 02598 plc->Field = NULL; 02599 //TRACEUSER( "Richard", _T("Hash Clash at %d\n"), CacheHashFunction(Offset, Count)); 02600 } 02601 02602 *plc = OurEntry; 02603 02604 return TRUE; 02605 } 02606 return FALSE; 02607 }
|
|
|
Creates a CCMemTextFile with the given file in, and opens it. The idea being that reading from a file in memory will be quicker than off a very slow single speed CD ROM drive.
Definition at line 440 of file sgscan.cpp. 00441 { 00442 BOOL OpenedOK = FALSE; 00443 00444 // Doesn't bother with modified calls anymore, uses file size... 00445 INT32 NewFileSize = 0; 00446 00447 if(QuickIndexEnabled) 00448 NewFileSize = SGLibOil::FileSize(QuickIndexFile); 00449 else 00450 NewFileSize = SGLibOil::FileSize(IndexFile); 00451 00452 if(NewFileSize == 0) 00453 return FALSE; 00454 00455 if(IndexDateStamp != 0 && IndexDateStamp != (UINT32)NewFileSize) 00456 return FALSE; 00457 IndexDateStamp = (UINT32)NewFileSize; 00458 00459 CachedBufLength = NewFileSize; 00460 CachedSubIndexBuf = (TCHAR *)CCMalloc(CachedBufLength + 4); 00461 00462 if(CachedSubIndexBuf != NULL) 00463 { 00464 CCDiskFile TmpDiskFile; 00465 TRY 00466 { 00467 if(QuickIndexEnabled) 00468 OpenedOK = TmpDiskFile.open(*QuickIndexFile, ios::in); 00469 else 00470 OpenedOK = TmpDiskFile.open(*IndexFile, ios::in); 00471 00472 if(!OpenedOK) 00473 { 00474 ERROR3("Couldn't open disk file for mem file"); 00475 if(CachedSubIndexBuf != NULL) 00476 CCFree(CachedSubIndexBuf); 00477 CachedSubIndexBuf = NULL; 00478 CachedBufLength = 0; 00479 return FALSE; 00480 } 00481 00482 TmpDiskFile.read(CachedSubIndexBuf, CachedBufLength); 00483 TmpDiskFile.close(); 00484 } 00485 CATCH(CFileException, e) 00486 { 00487 if(CachedSubIndexBuf != NULL) 00488 CCFree(CachedSubIndexBuf); 00489 CachedSubIndexBuf = NULL; 00490 CachedBufLength = 0; 00491 if(TmpDiskFile.isOpen()) 00492 TmpDiskFile.close(); 00493 return FALSE; 00494 } 00495 END_CATCH 00496 } 00497 else 00498 { 00499 CachedBufLength = 0; 00500 ERROR3("Couldn't allocate space for cached subindex file"); 00501 return FALSE; 00502 } 00503 return TRUE; 00504 /* FIX */ 00505 }
|
|
|
Mainly for use by the de-virtualise function... Init MUST have been called previously for this to work !
Definition at line 832 of file sgscan.cpp. 00833 { 00834 // Don't do this it the group isn't v'd out 00835 if(ParentGroup != NULL && ParentGroup->IsVirtualised()) 00836 { 00837 String_256 SubI; 00838 SubI = IndexFile->GetFileName(); 00839 PathName pathOldIndex(IndexFile->GetPath()); 00840 pathOldIndex.SetType(_T("old")); 00841 INT32 hOldIndex = _open(pathOldIndex.GetPath(), _O_RDONLY | _O_BINARY, _S_IREAD); 00842 if (hOldIndex != -1) 00843 { 00844 m_lOldIndex = _filelength(hOldIndex); 00845 _close(hOldIndex); 00846 } 00847 INT32 ItemCount = Init(ParentGallery, SubLibPath, Title, &SubI, Type); 00848 return ItemCount; 00849 } 00850 00851 return 0; 00852 }
|
|
|
Works out the column for the given field string.
Definition at line 2390 of file sgscan.cpp. 02391 { 02392 ERROR3IF(FieldName == NULL, "Library::FindField given nulls"); 02393 02394 INT32 Pos = FieldString.Sub(*FieldName); 02395 02396 if(Pos != -1) 02397 { 02398 // Find out which field it was 02399 String_256 Left; 02400 FieldString.Left(&Left, Pos); 02401 const TCHAR BrkChar = ','; 02402 02403 // This bit could go in basestr... 02404 INT32 Count = 0; 02405 TCHAR *Buf = (TCHAR *)Left; 02406 INT32 Len = Left.Length(); 02407 for(INT32 i = 0; i < Len; i++) 02408 if(Buf[i] == BrkChar) 02409 Count ++; 02410 02411 // Number of commas + 1 is our field 02412 Count ++; 02413 02414 return Count; 02415 } 02416 02417 return 0; 02418 }
|
|
|
Free some memory when we close a gallery by freeing all the cached index files...
Definition at line 342 of file sgscan.cpp. 00343 { 00344 // Reclaim field cache memory 00345 #ifdef FIELDCACHE 00346 CacheKill(); 00347 #endif 00348 00349 // Free the CachedSubIndex file buffer 00350 if(CachedSubIndexBuf != NULL) 00351 { 00352 CCFree((void *)CachedSubIndexBuf); 00353 CachedSubIndexBuf = NULL; 00354 CachedBufLength = 0; 00355 return TRUE; 00356 } 00357 00358 return FALSE; 00359 }
|
|
||||||||||||
|
Return a pointer to the filename for the indexed library item.
Definition at line 1606 of file sgscan.cpp. 01607 { 01608 ERROR3IF(File == NULL, "Library::GetFilename - NULL params are illegal"); 01609 01610 // Get filename from index file 01611 return (GetSingleField(Offset, 1, File)); 01612 }
|
|
||||||||||||||||
|
Return the path/filename for the indexed library item.
Definition at line 1563 of file sgscan.cpp. 01564 { 01565 ERROR3IF(File == NULL, "Library::GetFilename - NULL params are illegal"); 01566 01567 if(!FullPath) 01568 { 01569 // Get filename from index file 01570 return (GetSingleField(Offset, 1, File)); 01571 } 01572 01573 String_256 Filename; 01574 01575 // Get filename from index file 01576 if (!GetSingleField(Offset, 1, &Filename)) 01577 return FALSE; 01578 01579 // Path for normal files 01580 *File = SubLibPath->GetPath(TRUE); 01581 *File += Filename; 01582 01583 return TRUE; 01584 }
|
|
|
Return the ID for the indexed library item Returns 0 if there was a problem (0 is an invalid ID).
Definition at line 1671 of file sgscan.cpp. 01672 { 01673 String_8 Tmp; 01674 if (!GetSingleField(Offset, 3, &Tmp)) 01675 return(0); 01676 01677 return((UINT32) _ttoi((TCHAR *)Tmp)); 01678 }
|
|
|
To retrieve the title text for this library (this is the text that a linked SGDisplayGroup will display in the gallery list as in "Pictures of animals").
Definition at line 1529 of file sgscan.cpp. 01530 { 01531 ERROR3IF(ReturnedTitle == NULL, "Library::GetLIbraryTitle - NULL Params are illegal"); 01532 01533 if (Title == NULL) 01534 *ReturnedTitle = String_16(_R(IDS_LIBRARIES_UNAMED)); 01535 else 01536 *ReturnedTitle = *Title; 01537 }
|
|
|
Definition at line 199 of file sgscan.h. 00199 { return m_nModified;}
|
|
||||||||||||||||
|
Get a pointer to a single field for a given library item and field description using the extended info.
After that we've got things like 'Key', 'Size', 'Title' which we check the positions of using this string... If the index isn't in memory we can't return the pointer ! Definition at line 2363 of file sgscan.cpp. 02364 { 02365 ERROR3IF(FieldName == NULL || Field == NULL, "Library::GetSingleField given nulls"); 02366 02367 if(!GotField(FieldName)) 02368 return FALSE; 02369 02370 INT32 Count = FindField(FieldName); 02371 02372 return (Count > 0 && GetSingleField(Offset, Count, Field)); 02373 }
|
|
||||||||||||||||
|
Return a single field for a given library item and field description Use this for extended info.
We've now got 'Title' as a fourth, but only if it's in the field description... After that we've got things like 'Key' and 'Size' which we check the positions of using this string... Definition at line 2321 of file sgscan.cpp. 02322 { 02323 ERROR3IF(FieldName == NULL || Field == NULL, "Library::GetSingleField given nulls"); 02324 02325 if(!GotField(FieldName)) 02326 { 02327 *Field = TEXT(""); 02328 return FALSE; 02329 } 02330 02331 INT32 Count = FindField(FieldName); 02332 02333 return (Count > 0 && GetSingleField(Offset, Count, Field)); 02334 }
|
|
||||||||||||||||
|
Return a single field for a given library item Use this for extended info.
Definition at line 1969 of file sgscan.cpp. 01970 { 01971 ERROR3IF(Field == NULL, "Library::GetSingleField - NULL Params are illegal"); 01972 01973 // Extract the entry from the index file 01974 BOOL GotField = FALSE; 01975 01976 // Check if we've got a cached version of the index 01977 if(CachedSubIndexBuf != NULL) 01978 { 01979 // This will call the TCHAR ** version, not the stringbase version 01980 GotField = GetSingleFieldFromMemory(Offset, Count, Field); 01981 } 01982 01983 return GotField; 01984 }
|
|
||||||||||||||||
|
Return a single field for a given library item Use this for extended info.
Definition at line 1905 of file sgscan.cpp. 01906 { 01907 ERROR3IF(Field == NULL, "Library::GetSingleField - NULL Params are illegal"); 01908 01909 #ifdef FIELDCACHE 01910 // We've got a hit in our field cache 01911 if(CacheGet(Offset, Count, Field)) 01912 return TRUE; 01913 #endif 01914 01915 // Extract the entry from the index file 01916 BOOL GotField = FALSE; 01917 01918 // Check if we've got a cached version of the index 01919 if(CachedSubIndexBuf != NULL) 01920 { 01921 GotField = GetSingleFieldFromMemory(Offset, Count, Field); 01922 } 01923 01924 // Memory file didn't have item, or not present... use a disk file 01925 if(!GotField) 01926 { 01927 GotField = GetSingleFieldFromDisk(Offset, Count, Field); 01928 } 01929 01930 // If we got the field, whack it in the cache, otherwise return a blank 01931 if(!GotField) 01932 *Field = TEXT(""); 01933 #ifdef FIELDCACHE 01934 else 01935 { 01936 // Clean the string up a bit 01937 LibraryFile::KillLeadingSpaces(Field); 01938 CachePut(Offset, Count, Field); 01939 } 01940 #endif 01941 01942 return GotField; 01943 }
|
|
||||||||||||||||
|
Return a single field for a given library item using a diskfile for the index.
|