//============================================================================
//
// Name : libqm++
// File : libqm++.h
// Author : Andrew Hubl
// Version : 1
// Copyright : (c) Copyright 2008 Andrew Hubl. All Rights Reserved.
// Description : C++ class for OpenQM database connection
// License : GNU GPLv2
// Notes : Other license terms may be available upon request.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
// This program 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 General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
//============================================================================
#ifndef LIBQMPP_H_INCLUDED
#define LIBQMPP_H_INCLUDED
#include
extern "C" {
#include "libqmcli.h"
}
// Necessary for FIELD_MARK_STRING
#include "gpl.qmsys/gplsrc/qmdefs.h"
#include
#include
// This is so the libqm++ library can be easily used with multiple versions
// of OpenQM. The minor version number and release version number are
// multiplied by 10 to account for version numbering schemes that aren't
// strictly mathematical. Here are a few examples:
// OpenQM QMVERSION
// 1.0.0 10000
// 2.6.6 20606
// 2.6.14 20614
#define QMVERSION 20606
// This library is meant to be a hack to make it easier to use qmclilib/libqmcli with
// C++ to avoid memory leaks. It is strongly suggested that you use the C library
// included with OpenQM.
//
class Qm/*: public string*/ {
public:
// saccount = directory/account name to connect
// success = int, 1 if successful, 0 if not successful
Qm(const std::string& saccount);
Qm(const std::string& saccount, \
int& success);
// shost = host to connect
// port = port to connect
// susername = username of connecting user
// spassword = password of connecting user
// saccount = account to connect
// success = int, 1 if successful, 0 if not successful
Qm(const std::string& shost, \
const int& port, \
const std::string& susername, \
const std::string& spassword, \
const std::string& saccount);
Qm(const std::string& shost, \
const int& port, \
const std::string& susername, \
const std::string& spassword, \
const std::string& saccount, \
int& success);
// Ends all running commands and closes all database connections
~Qm();
void qmCall(const std::string& ssubrname, \
const std::string& sarg1);
std::string qmChange(const std::string& ssrc, \
const std::string& sold, \
const std::string& snew, \
const int& occurences, \
const int& start);
void qmClearSelect(const int& listno);
void qmClose(const int& fileno);
/* int Connect(const std::string& shost, \
const int& port, \
const std::string& susername, \
const std::string& spassword, \
const std::string& saccount);
*/ bool qmConnected();
// int ConnectLocal(const std::string& saccount);
int qmDcount(const std::string& ssrc, const std::string& sdelim);
std::string qmDel(const std::string& ssrc, const int& fno, const int& vno, const int& svno);
void qmDelete(const int& fileno, const std::string& sid);
void qmDeleteu(const int& fileno, const std::string& sid);
// void qmDisconnect();
// void qmDisconnectAll();
// void qmEndCommand();
std::string qmError(void);
std::string qmExecute(const std::string& scmnd, int& errno);
std::string qmExtract(const std::string& ssrcstr, const int& fno, const int& vno, const int& svno);
std::string qmField(const std::string& ssrcstr, const std::string& sdelimiter, const int& start, const int& occurences);
// void qmFree(void *paddr);
int qmGetSession();
std::string qmIns(const std::string& ssrcstr, const int& fno, const int& vno, const int& svno, const std::string& snewdata);
int qmLocate(const std::string& sitem, const std::string& sdynarray, const int& fno, const int& vno, const int& svno, int* ppos, std::string sorder);
int qmLogto(const std::string& saccount);
void qmMarkMapping(const int& fileno, const int& state);
int qmMatch(const std::string& ssrcstr, const std::string& spattern);
std::string qmMatchfield(const std::string& ssrcstr, const std::string& spattern, const int& component);
int qmOpen(const std::string& sfilename);
std::string qmRead(const int& fileno, const std::string& sid, int& errno);
std::string qmReadl(const int& fileno, const std::string& sid, const int& wait, int& errno);
std::string qmReadList(const int& listno);
std::string qmReadNext(const int& listno);
std::string qmReadu(const int& fileno, const std::string& sid, const int& wait, int& errno);
void qmRecordlock(const int& fileno, const std::string& sid, const int& update, const int& wait);
void qmRelease(const int& fileno, const std::string& sid);
std::string qmReplace(const std::string& ssrcstr, const int& fno, const int& vno, const int& svno, const std::string& snewdata);
std::string qmRespond(const std::string& sresponse, int& errno);
void qmSelect(const int& fileno, const int& listno);
void qmSelectIndex(const int& fileno, const std::string& sindexname, const std::string& sindexvalue, const int& listno);
std::string qmSelectLeft(const int& fileno, const std::string& sindexname, const int& listno);
std::string qmSelectRight(const int& fileno, const std::string& sindexname, const int& listno);
void qmSetLeft(const int& fileno, const std::string& sindexname);
void qmSetRight(const int& fileno, const std::string& sindexname);
int qmSetSession(const int& session);
int qmStatus();
#if QMVERSION > 20606
void qmTrapCallAbort(const bool& mode);
#endif
void qmWrite(const int& fileno, const std::string& sid, const std::string& srec);
void qmWriteu(const int& fileno, const std::string& sid, const std::string& srec);
//private:
};
#endif // LIBQMPP_H_INCLUDED