Poco::OSP::Shell

class OSPCommand

Library: OSP/Shell
Package: Shell
Header: Poco/OSP/Shell/OSPCommand.h

Description

OSPCommand is the base class for all OSP-specific commands.

It provides various helper functions that make implementing commands that deal with OSP internals easier.

Inheritance

Direct Base Classes: AbstractCommand

All Base Classes: AbstractCommand, Command

Member Summary

Member Functions: context, findBundle, match

Inherited Functions: commandName, defineOptions, displayHelp, execute, executeImpl, handleHelp, handleOption, options, processOptions, stopOptionsProcessing

Constructors

OSPCommand

OSPCommand(
    Poco::OSP::BundleContext::Ptr pContext,
    const std::string & name
);

Creates the OSPCommand, using the given bundle context and name.

The name is used to load the command description and usage string from the bundle properties, using the <name>.description and <name>.usage properties.

Destructor

~OSPCommand virtual

~OSPCommand();

Destroys the OSPCommand.

Member Functions

context inline

Poco::OSP::BundleContext::Ptr context() const;

Returns the bundle context.

findBundle protected

Poco::OSP::Bundle::Ptr findBundle(
    const std::string & symbolicNameOrId
) const;

Finds a bundle, either by symbolic name or ID.

If the given argument is an integer, it is treated as bundle ID. Otherwise, it is treated as symbolic name.

Returns a pointer to the bundle that matches the symbolic name or id, or a null pointer otherwise.

match protected static

static bool match(
    const std::string & pattern,
    const std::string & subject
);

Returns true if the given subject matches the given pattern.

Every subject matches an empty pattern.

match protected static

static bool match(
    const std::vector < std::string > & patterns,
    const std::string & subject
);

Returns true if the given subject matches at least one of the given pattern.

Every subject matches an empty pattern.