From 8362bf63dea22bbf6736609b0f49c152f975eb63 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 20 Jan 2010 01:29:50 +0000 Subject: Added old abandoned KDE3 version of koffice git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kexi/kexidb/simplecommandlineapp.h | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 kexi/kexidb/simplecommandlineapp.h (limited to 'kexi/kexidb/simplecommandlineapp.h') diff --git a/kexi/kexidb/simplecommandlineapp.h b/kexi/kexidb/simplecommandlineapp.h new file mode 100644 index 00000000..13d1f115 --- /dev/null +++ b/kexi/kexidb/simplecommandlineapp.h @@ -0,0 +1,86 @@ +/* This file is part of the KDE project + Copyright (C) 2006 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef KEXIDB_SIMPLECMDLINEAPP_H +#define KEXIDB_SIMPLECMDLINEAPP_H + +#include +#include + +#include + +struct KCmdLineOptions; + +namespace KexiDB +{ + //! @short A skeleton for creating a simple command line database application. + /*! This class creates a KInstance object and automatically handles the following + command line options: + - --driver \ (Database driver name) or -drv + - --user \ (Database user name) or -u + - --password (Prompt for password) or -p + - --host \ (Server (host) name) or -h + - --port \ (Server's port number) + - --local-socket \ (Server's local socket filename, if needed) or -s + + You can use this helper class to create test applications or small tools that open + a KexiDB-compatible database using command line arguments, do some data processing + and close the database. + */ + class KEXI_DB_EXPORT SimpleCommandLineApp : public KexiDB::Object + { + public: + SimpleCommandLineApp( + int argc, char** argv, KCmdLineOptions *options, const char *programName, + const char *version, const char *shortDescription=0, + int licenseType=KAboutData::License_Unknown, + const char *copyrightStatement=0, const char *text=0, + const char *homePageAddress=0, const char *bugsEmailAddress="submit@bugs.kde.org"); + + ~SimpleCommandLineApp(); + + //! \return program instance + KInstance* instance() const; + + /*! Opens database \a databaseName for connection data + specified via the command line. \return true in success. + In details: the database driver is loaded, the connection is opened + and the database is used. + Use KexiDB::Object methods to get status of the operation on failure. */ + bool openDatabase(const QString& databaseName); + + /*! Closes database connection previously opened using openDatabase() + \return true on success. This method is called on destruction. + Use KexiDB::Object methods to get status of the operation on failure. */ + bool closeDatabase(); + + /*! \return connection data for this application. */ + KexiDB::ConnectionData* connectionData() const; + + /*! \return connection object for this application or 0 if there is no properly + opened connection. */ + KexiDB::Connection* connection() const; + + protected: + class Private; + Private * const d; + }; +} + +#endif -- cgit v1.2.1