Below is the source code for retrieving the list of all known scopes.
Note that instantiating the runtime and tearing it down is moderately
expensive, so you probably want to hang onto the runtime handle for the
duration. Apply whatever pattern match is appropriate to the returned
strings.

Given the size of this, I don't think it justifies a separate API call.
For one, as I said earlier, I don't want the concept of application IDs
in the scopes runtime because it doesn't belong there. And a separate
API call wouldn't really make things easier. It takes three lines to
iterate over the list of scopes. That doesn't justify a new API call,
IMO.

#include <unity-scopes.h>

#include <boost/filesystem.hpp>
#include <iostream>

using namespace std;
using namespace unity::scopes;

int main(int /* argc */, char** /* argv */)
{
    try
    {
        // use Runtime.ini from the current directory if present, otherwise let 
the API pick the default one
        const boost::filesystem::path path("Runtime.ini");
        auto rt = boost::filesystem::exists(path) ? 
Runtime::create(path.native()) : Runtime::create();
        RegistryProxy r = rt->registry();
        auto mmap = r->list();
        for (auto const& meta : mmap)
        {
            cout << meta.first << endl;
        }
        return 0;
    }
    catch (unity::Exception const& e)
    {
        cerr << e.to_string() << endl;
        return 1;
    }
    return 0;
}

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1465675

Title:
  API needed to determine if App ID is a scope

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity-scopes-api/+bug/1465675/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to