Skip to content

Remove, clear, or delete preferences

This operation covers the three in-memory reset paths on clsPreferences: removing a single key, clearing a scope's items, and deleting every loaded record. None of the three persist the change — Persist preferences must follow.

Field Value
Operation ID OP-PRES-004
Trigger Consuming code calls Remove, Clear, or Delete
Inputs Key and/or scope
Outputs Mutated in-memory Preference records
Primary components clsPreferences.Remove (two overloads), clsPreferences.Clear, clsPreferences.Delete
Entry point SAIF.Presentation/clsPreferences.vb

Steps

  1. Remove(inKey) / Remove(inKey, inScope):
  2. Logs entry via clsLogTrace.MethodBegin().
  3. Exits silently on a Nothing key (BR-PRES-006).
  4. Lower-cases the key (BR-PRES-007).
  5. Locates the matching Preference record and removes the item when present; a missing key is a silent no-op (BR-PRES-016).
  6. Clear(scope): locates the Preference record for the current application + resolved page key and clears all of its items (BR-PRES-017).
  7. Delete(): clears the items of every loaded Preference record, regardless of application or page (BR-PRES-018).
  8. None of the three persist the change — Persist preferences must be called explicitly (BR-PRES-019).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Remove / Clear / Delete called]) --> D1{Which operation?}
    D1 -->|Remove| R1[Key is Nothing?]
    R1 -->|Yes| REnd([No-op])
    R1 -->|No| R2[Lower-case key, locate record, remove item if present]
    D1 -->|Clear scope| C1[Locate record for application + page key]
    C1 --> C2[Clear all items in that record]
    D1 -->|Delete| E1[Clear items in every loaded record]
    R2 --> EndMem([In-memory records mutated])
    C2 --> EndMem
    E1 --> EndMem
    EndMem --> Note[Save must be called to persist]

Failure and edge-case behavior

  • Removing a key that is not present is a silent no-op (BR-PRES-016).
  • Delete() affects every loaded application/page record for the user, not just the current application — callers must be careful about scope when calling Delete().

Sources

  • SAIF.Presentation/clsPreferences.vb