File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,15 @@ TEventInfo = class(TInterfacedObject, IDatabaseChangeEventInfo)
152
152
function SnippetExists (const ASnippetID: TSnippetID): Boolean;
153
153
function SnippetCount : Integer;
154
154
function IsEmpty : Boolean;
155
+ // / <summary>Checks if a any snippet in the database satisfies a given
156
+ // / condition.</summary>
157
+ // / <param name="FilterFn">Closure that is passed each snippet. True must
158
+ // / be returned if the snippet meets the condition.</param>
159
+ // / <returns>True if a snippet meets the condition, False if not.</returns>
160
+ // / <remarks>Ceases searching database when 1st snippet meets the
161
+ // / condition. The whole database is searched if the condition is not met.
162
+ // / </remarks>
163
+ function SnippetConditionExists (FilterFn: TDBFilterFn): Boolean;
155
164
// Returns a list of IDs of all snippets that depend on the snippet with
156
165
// the given ID.
157
166
function GetDependentsOf (const ASnippetID: TSnippetID): ISnippetIDList;
@@ -430,6 +439,16 @@ function TDatabase.SelectSnippets(FilterFn: TDBFilterFn): ISnippetIDList;
430
439
);
431
440
end ;
432
441
442
+ function TDatabase.SnippetConditionExists (FilterFn: TDBFilterFn): Boolean;
443
+ var
444
+ Snippet: TDBSnippet;
445
+ begin
446
+ for Snippet in fSnippetsTable do
447
+ if FilterFn(Snippet.CloneAsReadOnly) then
448
+ Exit(True);
449
+ Result := False;
450
+ end ;
451
+
433
452
function TDatabase.SnippetCount : Integer;
434
453
begin
435
454
Result := fSnippetsTable.Size;
You can’t perform that action at this time.
0 commit comments