#include <filtrmgr.h>
Public Types | |
enum | DESTRUCTION_METHOD { DM_INVALID = 0, DM_DELETE_WHEN_DONE = 1, DM_KEEP_WHEN_DONE } |
Public Member Functions | |
FilterManager () | |
Set the Filter object up to be in a clean state. | |
BOOL | Init () |
Initializes the filter manager Currently just does some tests. | |
INT32 | DeInit () |
Destroy all the FileFormat objects, maybe. | |
UINT32 | RegisterFilter (Filter *const pFilter, const DESTRUCTION_METHOD DestructMethod) |
Permits the filter to be used by the FilterManager. For an import filter to be present on the Import dialog the filter should associate itself with the requisite FileFormats via AssociateFilterWithFormat(). | |
FileFormatID | RegisterFileFormat (FileFormat *const pFormat, const DESTRUCTION_METHOD DestructMethod) |
Registers the given FileFormat with this FilterManager. | |
BOOL | AssociateFilterWithFormat (const UINT32 FilterID, const FileFormatID FileFormatID) |
Filter * | FindFilterFromID (const UINT32 FilterID) const |
Provides the Filter given its ID. | |
Filter * | FindFilter (FilterSearchCriteria &Criteria) const |
To find a filter with the given SearchCriteria Notes: Returns the first matching filter within the context of the given SearchCriteria (the SearchContext is contained within the SearchCriteria). | |
FilterList * | ListMatchingFilters (FilterSearchCriteria &Criteria) |
Creates a list of filters matching the given FilterSearchCriteria. | |
FileFormat * | FindFormatFromID (const FileFormatID FormatID) const |
Provides the FileFormat given its ID See Also: FindFormatEntryFromID. | |
FileFormat * | FindFormatFromName (const StringBase &FormatName) const |
Finds the one & only FileFormat with the given FormatName Used by Xtra's mainly. | |
FileFormatID | FindFormatIDFromName (const StringBase &Name) const |
Relief function returning the FileFormat ID instead of the FileFormat per se See Also: Other overloaded function. | |
Protected Member Functions | |
List & | GetFilters () const |
UINT32 | GetNewFilterID () |
Support function providing an unique ID for each newly registered Filter. | |
FormatArray & | GetFormats () |
Support function providing access to the FileFormats. | |
const FormatArray & | GetFormats () const |
FileFormatID | GetNewFormatID () |
Support function providing an unique ID for each newly registered FileFormat. | |
FileFormatID | GetLastFormatID () const |
FormatEntry * | FindFormatEntryFromID (const FileFormatID FormatID) const |
Internally does the actual finding by ID See Also: FindFormatFromID. | |
FormatEntry * | FindFormatEntryFromName (const StringBase &FormatName) const |
Finds the one & only FileFormat with the given FormatName Used by Xtra's mainly. | |
Protected Attributes | |
const UINT32 | FILTERID_START |
const FileFormatID | FORMATID_START |
Private Member Functions | |
CC_DECLARE_MEMDUMP (FilterManager) | |
Private Attributes | |
UINT32 | m_NextFilterID |
FormatArray | m_Formats |
FileFormatID | m_NextFormatID |
Definition at line 148 of file filtrmgr.h.
|
Definition at line 161 of file filtrmgr.h. 00162 { 00163 DM_INVALID = 0, // don't use this, it's for catching duff initialization 00164 DM_DELETE_WHEN_DONE = 1, 00165 DM_KEEP_WHEN_DONE 00166 };
|
|
Set the Filter object up to be in a clean state.
Definition at line 130 of file filtrmgr.cpp. 00130 : 00131 FILTERID_START(FILTERID_ALDUS_END + 1), 00132 FORMATID_START(1) 00133 { 00134 m_NextFilterID = FILTERID_START; 00135 m_NextFormatID = FORMATID_START; 00136 }
|
|
|
|
|
|
Destroy all the FileFormat objects, maybe.
Definition at line 232 of file filtrmgr.cpp. 00233 { 00234 for (UINT32 index = 0; index < GetLastFormatID(); index++) 00235 { 00236 FormatEntry* pEntry = GetFormats()[index]; 00237 ERROR2IF(pEntry == NULL, FALSE, "pEntry NULL"); 00238 00239 FileFormat* pFormat = pEntry->GetFormat(); 00240 ERROR2IF(pFormat == NULL, FALSE, "pFormat NULL"); 00241 00242 if (pEntry->GetDestructionMethod() == DM_DELETE_WHEN_DONE) 00243 { 00244 delete pFormat; 00245 } 00246 delete pEntry; 00247 GetFormats()[index] = NULL; 00248 } 00249 00250 // All ok 00251 return TRUE; 00252 }
|
|
To find a filter with the given SearchCriteria Notes: Returns the first matching filter within the context of the given SearchCriteria (the SearchContext is contained within the SearchCriteria).
Definition at line 563 of file filtrmgr.cpp. 00564 { 00565 return NULL; 00566 }
|
|
Provides the Filter given its ID.
Definition at line 284 of file filtrmgr.cpp. 00285 { 00286 Filter* pFilter = Filter::GetFirst(); 00287 while (pFilter != NULL) 00288 { 00289 if (pFilter->FilterID == FilterID) 00290 { 00291 break; 00292 } 00293 pFilter = Filter::GetNext(pFilter); 00294 } 00295 return pFilter; 00296 }
|
|
Internally does the actual finding by ID See Also: FindFormatFromID.
Definition at line 506 of file filtrmgr.cpp. 00507 { 00508 ERROR2IF(FormatID == 0 || FormatID > GetLastFormatID(), NULL, 00509 "Invalid FileFormatID"); 00510 00511 return GetFormats()[FormatID - 1]; 00512 }
|
|
Finds the one & only FileFormat with the given FormatName Used by Xtra's mainly.
Definition at line 528 of file filtrmgr.cpp. 00529 { 00530 for (UINT32 index = 0; index < GetLastFormatID(); ++index) 00531 { 00532 FormatEntry* pFormatEntry = GetFormats()[index]; 00533 if (pFormatEntry != NULL) 00534 { 00535 FileFormat* pFormat = pFormatEntry->GetFormat(); 00536 if (pFormat->GetName() == FormatName) 00537 { 00538 return pFormatEntry; 00539 } 00540 } 00541 else 00542 { 00543 // we'll ignore this one 00544 } 00545 } 00546 00547 return NULL; 00548 }
|
|
Provides the FileFormat given its ID See Also: FindFormatEntryFromID.
Definition at line 478 of file filtrmgr.cpp. 00479 { 00480 FileFormat* pReturnedFormat; 00481 00482 FormatEntry* pEntry = FindFormatEntryFromID(FormatID); 00483 if (pEntry != NULL) 00484 { 00485 pReturnedFormat = pEntry->GetFormat(); 00486 } 00487 else 00488 { 00489 pReturnedFormat = NULL; 00490 } 00491 00492 return pReturnedFormat; 00493 }
|
|
Finds the one & only FileFormat with the given FormatName Used by Xtra's mainly.
Definition at line 457 of file filtrmgr.cpp. 00458 { 00459 FormatEntry* pEntry = FindFormatEntryFromName(FormatName); 00460 if (pEntry != NULL) 00461 { 00462 return pEntry->GetFormat(); 00463 } 00464 return NULL; 00465 }
|
|
Relief function returning the FileFormat ID instead of the FileFormat per se See Also: Other overloaded function.
Definition at line 427 of file filtrmgr.cpp. 00428 { 00429 FileFormatID FoundID = 0; 00430 FormatEntry* pFoundEntry = FindFormatEntryFromName(FormatName); 00431 00432 if (pFoundEntry != NULL) 00433 { 00434 FoundID = pFoundEntry->GetID(); 00435 } 00436 else 00437 { 00438 FoundID = 0; 00439 } 00440 00441 return FoundID; 00442 }
|
|
|
|
Definition at line 195 of file filtrmgr.h. 00195 { return m_Formats; }
|
|
Support function providing access to the FileFormats.
Definition at line 311 of file filtrmgr.cpp. 00312 { 00313 return m_Formats; 00314 }
|
|
Definition at line 198 of file filtrmgr.h. 00198 { return m_NextFormatID - 1; }
|
|
Support function providing an unique ID for each newly registered Filter.
Definition at line 149 of file filtrmgr.cpp. 00150 { 00151 ERROR3IF(!m_NextFilterID, "Creating duff FilterID"); 00152 00153 return m_NextFilterID++; 00154 }
|
|
Support function providing an unique ID for each newly registered FileFormat.
Definition at line 326 of file filtrmgr.cpp. 00327 { 00328 return m_NextFormatID++; 00329 }
|
|
Initializes the filter manager Currently just does some tests.
Definition at line 196 of file filtrmgr.cpp. 00197 { 00198 #if defined(DEBUG_THIS) 00199 00200 String_256 MyFormatName = _T("myFormat"); 00201 String_256 MyFormatDesc = _T("Format (*.frm)"); 00202 XtraFileFormat* pFormat = new XtraFileFormat(MyFormatName, MyFormatDesc); 00203 FileFormatID myFormatID = RegisterFileFormat((FileFormat*)pFormat, FilterManager::DM_DELETE_WHEN_DONE); 00204 MyFormatDesc = _T(".fm1"); 00205 pFormat->AddExtension(MyFormatDesc); 00206 MyFormatDesc = _T(".fm2"); 00207 pFormat->AddExtension(MyFormatDesc); 00208 MyFormatDesc = _T(".fm3"); 00209 pFormat->AddExtension(MyFormatDesc); 00210 MyFormatDesc = _T(".fm2"); 00211 pFormat->AddExtension(MyFormatDesc); 00212 MyFormatDesc = _T(".one long mother of an extension well beyond thirty-two"); 00213 pFormat->AddExtension(MyFormatDesc); 00214 00215 #endif 00216 00217 // All ok 00218 return TRUE; 00219 }
|
|
Creates a list of filters matching the given FilterSearchCriteria.
Definition at line 582 of file filtrmgr.cpp. 00583 { 00584 FilterList* pList = new FilterList; 00585 00586 return pList; 00587 }
|
|
Registers the given FileFormat with this FilterManager.
Definition at line 345 of file filtrmgr.cpp. 00347 { 00348 ERROR2IF(pFormat == NULL, 0, "NULL Args"); 00349 00350 // Look for one we might already have 00351 FileFormatID IDToReturn = FindFormatIDFromName(pFormat->GetName()); 00352 if (IDToReturn == 0) 00353 { 00354 // Have to add a new one 00355 IDToReturn = GetNewFormatID(); 00356 FormatEntry* pFormatEntry = new FormatEntry(IDToReturn, pFormat, DestructMethod); 00357 if (pFormatEntry == NULL) 00358 { 00359 goto AddFormatError; 00360 } 00361 00362 if (!GetFormats().Add(pFormatEntry)) 00363 { 00364 delete pFormatEntry; 00365 goto AddFormatError; 00366 } 00367 } 00368 else 00369 { 00370 // Use the duplicate then 00371 } 00372 00373 return IDToReturn; 00374 00375 AddFormatError: 00376 00377 return 0; 00378 }
|
|
Permits the filter to be used by the FilterManager. For an import filter to be present on the Import dialog the filter should associate itself with the requisite FileFormats via AssociateFilterWithFormat().
Definition at line 173 of file filtrmgr.cpp. 00175 { 00176 //DestructMethod; // This line just read "DestructMethod;" - what's that meant to do then? 00177 UINT32 newID = Filter::RegisterFilter(pFilter); 00178 00179 return newID; 00180 }
|
|
Definition at line 191 of file filtrmgr.h. |
|
Definition at line 196 of file filtrmgr.h. |
|
Definition at line 208 of file filtrmgr.h. |
|
Definition at line 206 of file filtrmgr.h. |
|
Definition at line 209 of file filtrmgr.h. |