added Poco::Shell

This commit is contained in:
Aleksandar Fabijanic
2013-04-23 20:06:03 -05:00
parent 03a1d4dc33
commit d712530c7d
70 changed files with 7019 additions and 0 deletions

View File

@@ -0,0 +1,164 @@
//
// AbstractCommand.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/AbstractCommand.h#1 $
//
// Library: Shell
// Package: Shell
// Module: AbstractCommand
//
// Definition of the AbstractCommand class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_AbstractCommand_INCLUDED
#define Shell_AbstractCommand_INCLUDED
#include "Poco/Shell/Command.h"
#include "Poco/Util/OptionSet.h"
namespace Poco {
namespace Shell {
class Shell_API AbstractCommand: public Command
/// AbstractCommand provides a partial implementation of Command,
/// doing automatic argument handling based on the options handling
/// framework from the Util library.
///
/// Options must be given in Unix-style syntax (-o or --option).
///
/// Option handling for commands works in a similar way to
/// command line options handling in the Poco::Util::Application
/// class.
{
public:
// Command
virtual int execute(Session& session, const std::vector<std::string>& args, std::ostream& ostr);
protected:
AbstractCommand();
/// Creates the AbstractCommand.
AbstractCommand(const std::string& description, const std::string& usage);
/// Creates the AbstractCommand, using the given description and usage hint.
///
/// The given description and usage hint is used in the help text given
/// if the command is invoked with the --help option.
virtual ~AbstractCommand();
/// Destroys the AbstractCommand.
virtual int executeImpl(Session& session, const std::vector<std::string>& args, std::ostream& ostr) = 0;
/// Execute the command, using the given arguments.
/// Called by AbstractCommand::execute() after options have been handled.
///
/// Any output produced by executing the command can be
/// written to the given output stream.
///
/// An integer must be returned that denotes success or failure of the command.
/// Upon success, 0 shall be returned. The CommandStatus enumeration defines
/// a few commonly used error codes that should be used.
virtual void defineOptions(Poco::Util::OptionSet& options);
/// Called before command line processing begins.
/// If a Command wants to support command line arguments,
/// it must override this method and call the base class
/// implementation as well.
///
/// The default implementation only defines the --help option.
///
/// A Command should specify a callback to handle the option.
const Poco::Util::OptionSet& options() const;
/// Returns the application's option set.
void processOptions(std::vector<std::string>& args);
/// Processes command-line options.
void stopOptionsProcessing();
/// If called from an option callback, stops all further
/// options processing.
///
/// If called, the following options on the command line
/// will not be processed, and required options will not
/// be checked.
///
/// This is useful, for example, if an option for displaying
/// help information has been encountered and no other things
/// besides displaying help shall be done.
virtual void handleOption(const std::string& name, const std::string& value);
/// Called when the option with the given name is encountered
/// during command line arguments processing.
///
/// The default implementation does option validation, bindings
/// and callback handling.
///
/// Overriding implementations must call the base class implementation.
const std::string& commandName() const;
/// Returns the command name.
void handleHelp(const std::string& name, const std::string& value);
/// Handles the --help command line option.
void displayHelp(std::ostream& ostr);
/// Writes a help text to the given stream.
private:
std::string _description;
std::string _usage;
Poco::Util::OptionSet _options;
bool _stopOptionsProcessing;
bool _showHelp;
std::string _commandName;
};
//
// inlines
//
inline const Poco::Util::OptionSet& AbstractCommand::options() const
{
return _options;
}
inline const std::string& AbstractCommand::commandName() const
{
return _commandName;
}
} } // namespace Poco::Shell
#endif // Shell_AbstractCommand_INCLUDED

View File

@@ -0,0 +1,99 @@
//
// Command.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/Command.h#1 $
//
// Library: Shell
// Package: Shell
// Module: Command
//
// Definition of the Command class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_Command_INCLUDED
#define Shell_Command_INCLUDED
#include "Poco/Shell/Shell.h"
#include <vector>
#include <ostream>
namespace Poco {
namespace Shell {
class Session;
class Shell_API Command
/// Command defines the interface every shell command must implement.
///
/// The interface is quite simple, consisting only of a single member
/// function that subclasses must override.
{
public:
enum CommandStatus
{
STATUS_OK = 0, /// successful execution
STATUS_USAGE = 1, /// command line usage error
STATUS_ERROR = 2, /// command execution error
STATUS_DENIED = 3 /// bad credentials or insufficient permissions to execute the command
};
Command();
/// Creates the Command.
virtual ~Command();
/// Destroys the Command.
virtual int execute(Session& session, const std::vector<std::string>& args, std::ostream& ostr) = 0;
/// Execute the command, using the given arguments, within
/// the given session.
/// The first element of the args vector is the command name.
///
/// Any output produced by executing the command can be
/// written to the given output stream.
///
/// An integer must be returned that denotes success or failure of the command.
/// Upon success, 0 shall be returned. The CommandStatus enumeration defines
/// a few commonly used error codes that should be used. Other statis codes in
/// the range 0 - 99 can be used as well. Negative status codes are reserved
/// for internal use.
private:
Command(const Command&);
Command& operator = (const Command&);
};
} } // namespace Poco::Shell
#endif // Shell_Command_INCLUDED

View File

@@ -0,0 +1,82 @@
//
// CommandFactory.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/CommandFactory.h#1 $
//
// Library: Shell
// Package: Shell
// Module: CommandFactory
//
// Definition of the CommandFactory class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_CommandFactory_INCLUDED
#define Shell_CommandFactory_INCLUDED
#include "Poco/Shell/Shell.h"
namespace Poco {
namespace Shell {
class Command;
class Shell_API CommandFactory
/// A factory for Command objects.
{
public:
CommandFactory();
/// Creates the CommandFactory.
virtual ~CommandFactory();
/// Destroys the CommandFactory.
virtual Command* createCommand() = 0;
/// Create a Command object.
void init();
/// Initializes the factory.
protected:
virtual void initImpl();
/// Add extra initialization code by overriding this method in your subclass.
private:
CommandFactory(const CommandFactory&);
CommandFactory& operator = (const CommandFactory&);
};
} } // namespace Poco::Shell
#endif // Shell_CommandFactory_INCLUDED

View File

@@ -0,0 +1,141 @@
//
// CommandProcessor.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/CommandProcessor.h#1 $
//
// Library: Shell
// Package: Shell
// Module: CommandProcessor
//
// Definition of the CommandProcessor class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_CommandProcessor_INCLUDED
#define Shell_CommandProcessor_INCLUDED
#include "Poco/Shell/Shell.h"
#include "Poco/Shell/CommandFactory.h"
#include "Poco/SharedPtr.h"
#include "Poco/Mutex.h"
#include <map>
#include <set>
#include <vector>
namespace Poco {
namespace Shell {
class Session;
class Shell_API CommandProcessor
/// The CommandProcessor parses command lines and invokes
/// commands.
{
public:
typedef Poco::SharedPtr<CommandFactory> FactoryPtr;
CommandProcessor();
/// Creates the CommandProcessor.
~CommandProcessor();
/// Destroys the CommandProcessor.
int execute(Session& session, const std::string& commandLine, std::ostream& ostr);
/// Executes the command given in commandLine in the given session.
///
/// Throws a Poco::NotFoundException if the given command
/// is not known.
///
/// The following commands are builtin:
/// - .login <userName> <credentials>:
/// Attempts to log the user into the current session with the given userName and credentials (password).
/// - .help
/// Displays a list of all registered commands.
/// - .quit
/// Ends the session.
void addCommand(const std::string& command, const std::set<std::string>& aliases, FactoryPtr pFactory, const std::string& permission);
/// Adds a command to the command processor.
///
/// The given command name must be unique, otherwise an ExistsException will be thrown.
/// The given aliases set can be empty.
/// Upon execution of the command, the given permission is checked against
/// the current user's permissions. It can be empty to disable the check.
void removeCommand(const std::string& command);
/// Removes the given command.
void listCommands(std::vector<std::string>& commands) const;
/// Fills the given vector with the names of all registered commands.
void aliases(const std::string& command, std::set<std::string>& aliases) const;
/// Fills the given set with all aliases for the given command.
static const std::string COMMAND_LOGIN;
static const std::string COMMAND_HELP;
static const std::string COMMAND_QUIT;
protected:
Command* createCommand(const Session& session, const std::string& command);
/// Creates a Command object for the given command name.
///
/// Throws a Poco::NotFoundException if the given command is unknown.
/// Returns a new command object, or a null pointer if the user
/// is not authorized to call the command.
void parseCommandLine(const std::string& commandLine, std::vector<std::string>& items);
/// Parses the command line into single items.
///
/// The first item is used as command name. Remaining items are arguments
/// to the command. Items are separated by one or more space or tab characters.
/// An item can be enclosed in single or double quotes.
/// Characters can be escaped with a backslash.
private:
struct CommandInfo
{
std::string name;
std::set<std::string> aliases;
std::string permission;
FactoryPtr pFactory;
};
typedef std::map<std::string, CommandInfo> CommandMap;
CommandMap _commandMap;
mutable Poco::FastMutex _mutex;
};
} } // namespace Poco::Shell
#endif // Shell_CommandProcessor_INCLUDED

View File

@@ -0,0 +1,119 @@
//
// Connection.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/Connection.h#1 $
//
// Library: Shell
// Package: Shell
// Module: Connection
//
// Definition of the Connection class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_Connection_INCLUDED
#define Shell_Connection_INCLUDED
#include "Poco/Shell/Shell.h"
#include "Poco/Net/TCPServerConnection.h"
namespace Poco {
namespace Shell {
class CommandProcessor;
class Shell_API Connection: public Poco::Net::TCPServerConnection
/// The Connection class receives commands over a TCP connection
/// and sends responses back to the client.
///
/// Commands are received one per line, and responses are sent in
/// RFC 2821-style response chunks. Every command can send
/// multiple response chunks. Intermediate response chunks have a
/// status code of 100, and can occur more than once.
/// The final chunk has a status code has a 200, 4xx or 500 status code
/// and is exactly one line long.
/// If the command was successful, the status code is 200 and the
/// response text is "OK". If the command was not successful
/// (its return code was not 0), the status code is 400 + return code.
/// If the comand resulted in an exception, the status code is 500.
///
/// Example (positive response to help command):
/// 100-The following commands are available:
/// 100-bundles (ls, ss)
/// 100-services (lss)
/// 100-start
/// 100-stop
/// ...
/// 100-set
/// 100 Enter <command> --help for more information about a command
/// 200 OK
///
/// Example (negative response to login command):
/// 403 DENIED
{
public:
enum StatusCode
{
STATUS_INTERMEDIATE = 100,
STATUS_OK = 200,
STATUS_GOODBYE = 201,
STATUS_CLIENT_ERROR = 400,
STATUS_CLIENT_USAGE = 401,
STATUS_CLIENT_DENIED = 403,
STATUS_SERVER_ERROR = 500
};
Connection(const Poco::Net::StreamSocket& s, CommandProcessor& processor, const std::string& authServiceName);
/// Creates the Connection.
~Connection();
/// Destroys the Connection.
// TCPServerConnection
void run();
protected:
static int statusFor(int exitCode, std::string& message);
/// Creates a suitable status code and response message
private:
Connection();
CommandProcessor& _commandProcessor;
std::string _authServiceName;
};
} } // namespace Poco::Shell
#endif // Shell_Connection_INCLUDED

View File

@@ -0,0 +1,60 @@
//
// ConnectionFactory.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/ConnectionFactory.h#1 $
//
// Library: Shell
// Package: Shell
// Module: Connection
//
// Definition of the ConnectionFactory class.
//
// Copyright (c) 2009, Applied Informatics Software Engineering GmbH.
// All rights reserved.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
//
#ifndef Shell_ConnectionFactory_INCLUDED
#define Shell_ConnectionFactory_INCLUDED
#include "Poco/Shell/Shell.h"
#include "Poco/Net/TCPServerConnectionFactory.h"
namespace Poco {
namespace Shell {
class CommandProcessor;
class Shell_API ConnectionFactory: public Poco::Net::TCPServerConnectionFactory
/// The factory for Connection objects.
{
public:
ConnectionFactory(CommandProcessor& processor, const std::string& authServiceName);
/// Creates the ConnectionFactory.
~ConnectionFactory();
/// Destroys the ConnectionFactory.
// TCPServerConnectionFactory
Poco::Net::TCPServerConnection* createConnection(const Poco::Net::StreamSocket& socket);
private:
ConnectionFactory();
CommandProcessor& _commandProcessor;
std::string _authServiceName;
};
} } // namespace Poco::Shell
#endif // Shell_ConnectionFactory_INCLUDED

View File

@@ -0,0 +1,85 @@
//
// HelpCommand.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/HelpCommand.h#1 $
//
// Library: Shell
// Package: Shell
// Module: HelpCommand
//
// Definition of the HelpCommand class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_HelpCommand_INCLUDED
#define Shell_HelpCommand_INCLUDED
#include "Poco/Shell/Command.h"
namespace Poco {
namespace Shell {
class CommandProcessor;
class Shell_API HelpCommand: public Command
/// HelpCommand implements the "help" command,
/// with the help of the CommandProcessor.
///
/// The help command produces a list of commands
/// known by the CommandProcessor, as well as their aliases.
///
/// The output of the command can be customized with
/// the following bundle properties:
/// - help.header: the header text displayed before the list
/// of commands.
/// - help.footer: the footer text displayed after the list
/// of commands.
{
public:
HelpCommand(CommandProcessor& commandProcessor);
/// Creates the HelpCommand, using the given command processor.
~HelpCommand();
/// Destroys the HelpCommand.
// Command
virtual int execute(Session& session, const std::vector<std::string>& args, std::ostream& ostr);
private:
CommandProcessor& _commandProcessor;
};
} } // namespace Poco::Shell
#endif // Shell_HelpCommand_INCLUDED

View File

@@ -0,0 +1,74 @@
//
// HelpCommandFactory.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/HelpCommandFactory.h#1 $
//
// Library: Shell
// Package: Shell
// Module: HelpCommand
//
// Definition of the HelpCommandFactory class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_HelpCommandFactory_INCLUDED
#define Shell_HelpCommandFactory_INCLUDED
#include "Poco/Shell/CommandFactory.h"
namespace Poco {
namespace Shell {
class CommandProcessor;
class Shell_API HelpCommandFactory: public CommandFactory
/// The factory for HelpCommand objects.
{
public:
HelpCommandFactory(CommandProcessor& commandProcessor);
/// Creates the HelpCommandFactory, using the given command processor.
~HelpCommandFactory();
/// Destroys the HelpCommandFactory.
// CommandFactory
Command* createCommand();
private:
CommandProcessor& _commandProcessor;
};
} } // namespace Poco::Shell
#endif // Shell_HelpCommandFactory_INCLUDED

View File

@@ -0,0 +1,82 @@
//
// LoginCommand.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/LoginCommand.h#1 $
//
// Library: Shell
// Package: Shell
// Module: LoginCommand
//
// Definition of the LoginCommand class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_LoginCommand_INCLUDED
#define Shell_LoginCommand_INCLUDED
#include "Poco/Shell/AbstractCommand.h"
namespace Poco {
namespace Shell {
class Shell_API LoginCommand: public AbstractCommand
/// LoginCommand implements the "login" command,
/// with the help of the Session object.
///
/// The login command takes two arguments, a user
/// name and a password, and passes them to the
/// login() member function of Session.
///
/// The help text of the login command can be
/// customized by providing the following bundle
/// properties:
/// - login.description: The description of the command.
/// - login.usage: The usage string.
{
public:
LoginCommand();
/// Creates the LoginCommand.
~LoginCommand();
/// Destroys the LoginCommand.
protected:
// AbstractCommand
virtual int executeImpl(Session& session, const std::vector<std::string>& args, std::ostream& ostr);
private:
};
} } // namespace Poco::Shell
#endif // Shell_LoginCommand_INCLUDED

View File

@@ -0,0 +1,68 @@
//
// LoginCommandFactory.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/LoginCommandFactory.h#1 $
//
// Library: Shell
// Package: Shell
// Module: LoginCommand
//
// Definition of the LoginCommandFactory class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_LoginCommandFactory_INCLUDED
#define Shell_LoginCommandFactory_INCLUDED
#include "Poco/Shell/CommandFactory.h"
namespace Poco {
namespace Shell {
class Shell_API LoginCommandFactory: public CommandFactory
/// The factory for LoginCommand objects.
{
public:
LoginCommandFactory();
/// Creates the LoginCommandFactory.
~LoginCommandFactory();
/// Destroys the LoginCommandFactory.
// CommandFactory
Command* createCommand();
};
} } // namespace Poco::Shell
#endif // Shell_LoginCommandFactory_INCLUDED

View File

@@ -0,0 +1,96 @@
//
// OSPCommand.h
//
// $Id: //poco/1.4/OSP/Shell/include/Poco/OSP/Shell/OSPCommand.h#1 $
//
// Library: OSP/Shell
// Package: Shell
// Module: OSPCommand
//
// Definition of the OSPCommand class.
//
// Copyright (c) 2009, Applied Informatics Software Engineering GmbH.
// All rights reserved.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
//
#ifndef OSP_Shell_OSPCommand_INCLUDED
#define OSP_Shell_OSPCommand_INCLUDED
#include "Poco/OSP/Shell/AbstractCommand.h"
#include "Poco/OSP/BundleContext.h"
#include "Poco/OSP/Bundle.h"
#include <vector>
namespace Poco {
namespace OSP {
namespace Shell {
class OSPShell_API OSPCommand: public AbstractCommand
/// 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.
{
public:
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.
~OSPCommand();
/// Destroys the OSPCommand.
Poco::OSP::BundleContext::Ptr context() const;
/// Returns the bundle context.
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.
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.
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.
private:
Poco::OSP::BundleContext::Ptr _pContext;
};
//
// inlines
//
inline Poco::OSP::BundleContext::Ptr OSPCommand::context() const
{
return _pContext;
}
} } } // namespace Poco::OSP::Shell
#endif // OSP_Shell_OSPCommand_INCLUDED

View File

@@ -0,0 +1,79 @@
//
// QuitCommand.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/QuitCommand.h#1 $
//
// Library: Shell
// Package: Shell
// Module: QuitCommand
//
// Definition of the QuitCommand class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_QuitCommand_INCLUDED
#define Shell_QuitCommand_INCLUDED
#include "Poco/Shell/AbstractCommand.h"
namespace Poco {
namespace Shell {
class Shell_API QuitCommand: public AbstractCommand
/// QuitCommand implements the "quit" command.
///
/// Executing the command returns a negative
/// return code, which causes the Connection
/// object to close the connection.
///
/// The help text of the quit command can be
/// customized by providing the following bundle
/// properties:
/// - quit.description: The description of the command.
/// - quit.usage: The usage string.
{
public:
QuitCommand();
/// Creates the QuitCommand.
~QuitCommand();
/// Destroys the QuitCommand.
protected:
// AbstractCommand
virtual int executeImpl(Session& session, const std::vector<std::string>& args, std::ostream& ostr);
};
} } // namespace Poco::Shell
#endif // Shell_QuitCommand_INCLUDED

View File

@@ -0,0 +1,68 @@
//
// QuitCommandFactory.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/QuitCommandFactory.h#1 $
//
// Library: Shell
// Package: Shell
// Module: QuitCommand
//
// Definition of the QuitCommandFactory class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_QuitCommandFactory_INCLUDED
#define Shell_QuitCommandFactory_INCLUDED
#include "Poco/Shell/CommandFactory.h"
namespace Poco {
namespace Shell {
class Shell_API QuitCommandFactory: public CommandFactory
/// The factory for QuitCommand objects.
{
public:
QuitCommandFactory();
/// Creates the QuitCommandFactory.
~QuitCommandFactory();
/// Destroys the QuitCommandFactory.
// CommandFactory
Command* createCommand();
};
} } // namespace Poco::Shell
#endif // Shell_QuitCommandFactory_INCLUDED

View File

@@ -0,0 +1,170 @@
//
// ResponseStream.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/ResponseStream.h#1 $
//
// Library: Shell
// Package: Shell
// Module: ResponseStream
//
// Definition of the ResponseStream class and friends.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_ResponseStream_INCLUDED
#define Shell_ResponseStream_INCLUDED
#include "Poco/Shell/Shell.h"
#include "Poco/UnbufferedStreamBuf.h"
#include <ostream>
namespace Poco {
namespace Shell {
class Shell_API ResponseStreamBuf: public Poco::UnbufferedStreamBuf
/// This stream wraps all lines sent through it in
/// SMTP (RFC 2821) format.
///
/// Lines are grouped together in blocks, which every block having
/// the format of an RFC 2821 server response message.
///
/// The block begins with a three-digit status code, followed by
/// either a minus sign ('-') if more lines follow, or a space
/// character (' '), if the line is the only line in this block.
/// All lines but the last line in a block also start with a
/// three-digit status code and a minus character. The last line
/// starts with a three-digit status code, a space character and
/// the line data.
///
/// Examples:
/// 100-This is a multiline
/// 100-message. The message
/// 100 has three lines in total.
///
/// 200 OK
{
public:
ResponseStreamBuf(std::ostream& ostr, int status);
/// Creates the ResponseStreamBuf and connects it
/// to the given output stream.
~ResponseStreamBuf();
/// Destroys the ResponseStreamBuf.
int sync();
/// Flushes the currently buffered line and ends the
/// response block.
void setStatus(int status);
/// Sets the status code that is prepended to response lines.
int getStatus() const;
/// Returns the status code that is prepended to response lines.
protected:
int writeToDevice(char c);
void flushLine(bool more);
private:
ResponseStreamBuf();
std::ostream& _ostr;
int _status;
std::string _line;
bool _lineComplete;
};
class Shell_API ResponseIOS: public virtual std::ios
/// The base class for ResponseStream.
{
public:
ResponseIOS(std::ostream& ostr, int status);
/// Creates the ResponseIOS using the given output stream and status.
~ResponseIOS();
/// Destroys the ResponseIOS.
ResponseStreamBuf* rdbuf();
/// Returns a pointer to the underlying streambuf.
void setStatus(int status);
/// Sets the response status code.
int getStatus() const;
/// Returns the response status code.
protected:
ResponseStreamBuf _buf;
private:
ResponseIOS();
};
class Shell_API ResponseStream: public ResponseIOS, public std::ostream
/// An output stream, based on ResponseStreamBuf.
{
public:
ResponseStream(std::ostream& ostr, int status = 0);
/// Creates the ResponseStream, using the given output
/// stream and status.
~ResponseStream();
/// Destroys the ResponseStream.
};
//
// inlines
//
inline int ResponseStreamBuf::getStatus() const
{
return _status;
}
inline void ResponseIOS::setStatus(int status)
{
_buf.setStatus(status);
}
inline int ResponseIOS::getStatus() const
{
return _buf.getStatus();
}
} } // namespace Poco::Shell
#endif // Shell_ResponseStream_INCLUDED

View File

@@ -0,0 +1,121 @@
//
// Session.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/Session.h#1 $
//
// Library: Shell
// Package: Shell
// Module: Session
//
// Definition of the Session class.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_Session_INCLUDED
#define Shell_Session_INCLUDED
#include "Poco/Shell/Shell.h"
namespace Poco {
namespace Shell {
class Shell_API Session
/// The Session class provides user authentication and
/// authorization for the CommandProcessor.
///
/// It is also passed as the first argument to
/// the execute() member function of Command, so
/// that command implementations can perform
/// custom authorization.
{
public:
Session(const std::string& authServiceName);
/// Creates the Session, using the given bundle context and
/// the given service name of the authentication service.
///
/// An empty service name disables authentication and authorization.
~Session();
/// Destroys the Session.
bool login(const std::string& userName, const std::string& credentials);
/// Attempts to authenticate the user by checking the
/// given userName and credentials with the authentication service.
///
/// Returns true if the user was successfully authenticated, false otherwise.
bool authorize(const std::string& permission) const;
/// Returns true if the user is authenticated and has the
/// given permission, false otherwise.
bool authenticated() const;
/// Returns true if the user is authenticated.
const std::string& user() const;
/// Returns the name of the current user, or an empty string
/// if no user is logged in.
protected:
//TODO
//Poco::AuthService::Ptr authService() const;
private:
Session();
Session(const Session&);
Session& operator = (const Session&);
std::string _authServiceName;
//TODO
//mutable Poco::Auth::AuthService::Ptr _pAuthService;
std::string _userName;
bool _authenticated;
};
//
// inlines
//
inline bool Session::authenticated() const
{
return _authenticated;
}
inline const std::string& Session::user() const
{
return _userName;
}
} } // namespace Poco::Shell
#endif // Shell_Session_INCLUDED

View File

@@ -0,0 +1,84 @@
//
// Shell.h
//
// $Id: //poco/1.4/Shell/include/Poco/Shell/Shell.h#1 $
//
// Library: Shell
// Package: Shell
// Module: Shell
//
// Basic definitions for the Poco Shell library.
// This file must be the first file included by every other Shell
// header file.
//
// Copyright (c) 2009-2013, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Shell_Shell_INCLUDED
#define Shell_Shell_INCLUDED
#include "Poco/Foundation.h"
//
// The following block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the Shell_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// Shell_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
//
#if defined(_WIN32) && defined(POCO_DLL)
#if defined(Shell_EXPORTS)
#define Shell_API __declspec(dllexport)
#else
#define Shell_API __declspec(dllimport)
#endif
#endif
#if !defined(Shell_API)
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
#define Shell_API __attribute__ ((visibility ("default")))
#else
#define Shell_API
#endif
#endif
//
// Automatically link Shell library.
//
#if defined(_MSC_VER)
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Shell_EXPORTS)
#pragma comment(lib, "PocoShell" POCO_LIB_SUFFIX)
#endif
#endif
#endif // Shell_Shell_INCLUDED