Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using public non-native settings

Follow these steps to add a public non-native settings store to your component:

  1. Write a component that implements the ISettings interface for your non-native store.
  2. Register the component with the system by adding information to the component's CIF. For example:

    Note: When registering the new class, the ClassID specified in the CIF is the ID of the new class defined by your implementation of ISettings.

    local s = require 'SettingsCIFHelpers'
    
    s:RegisterClass {
       class = 0xdcab4321,
       key = "/myApp/myCustomSettings",
    }
  3. To access your settings from an application or component, use code similar to the following example:
    {
       ISettings *piSettings = NULL;
       if (SUCCESS == IEnv_CreateInstance(piEnv,
                   AEECLSID_SettingsReg,
                   (void**) &piSettings)) {
          int nChildren = 0;
          int result;
          result = ISettings_GetNumChildren(piSettings,
                      "/myApp/myCustomSettings",
                      &nChildren);
          if (SUCCESS == result) {
             // do something
          }
          ISettings_Release(piSettings);
          pSettings = NULL;
       }
    }

    When a component or application accesses settings in the non-native settings store, the SettingsReg delegates the operation to the class defined by your new implementation of ISettings.