Scott R Charlton 2c4422593b # IPQ_DLL_EXPORT int GetDumpOn(int id);
#	IPQ_DLL_EXPORT int         GetDumpFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetDumpOn(int id, int dump_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetDumpFileOn(int id, int dump_on);
s/etDumpOn/etDumpFileOn/g
s/etdumpon/etdumpfileon/g
s/ETDUMPON/ETDUMPFILEON/g
#	IPQ_DLL_EXPORT int         GetErrorOn(int id);
#	IPQ_DLL_EXPORT int         GetErrorFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetErrorOn(int id, int error_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetErrorFileOn(int id, int error_on);
s/etErrorOn/etErrorFileOn/g
s/eterroron/eterrorfileon/g
s/ETERRORON/ETERRORFILEON/g
#	IPQ_DLL_EXPORT int         GetLogOn(int id);
#	IPQ_DLL_EXPORT int         GetLogFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetLogOn(int id, int log_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetLogFileOn(int id, int log_on);
s/etLogOn/etLogFileOn/g
s/etlogon/etlogfileon/g
s/ETLOGON/ETLOGFILEON/g
#	IPQ_DLL_EXPORT int         GetOutputOn(int id);
#	IPQ_DLL_EXPORT int         GetOutputFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetOutputOn(int id, int output_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetOutputFileOn(int id, int output_on);
s/etOutputOn/etOutputFileOn/g
s/etoutputon/etoutputfileon/g
s/ETOUTPUTON/ETOUTPUTFILEON/g
#	IPQ_DLL_EXPORT int         GetSelectedOutputOn(int id);
#	IPQ_DLL_EXPORT int         GetSelectedOutputFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetSelectedOutputOn(int id, int sel_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetSelectedOutputFileOn(int id, int sel_on);
s/etSelectedOutputOn/etSelectedOutputFileOn/g
s/etselectedoutputon/etselectedoutputfileon/g
s/ETSELECTEDOUTPUTON/ETSELECTEDOUTPUTFILEON/g
#	IPQ_DLL_EXPORT const char* GetDumpLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetDumpStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetDumpLineCount(int id);
#	IPQ_DLL_EXPORT int         GetDumpStringLineCount(int id);
s/GetDumpLine/GetDumpStringLine/g
s/getdumpline/getdumpstringline/g
s/GETDUMPLINE/GETDUMPSTRINGLINE/g
#	IPQ_DLL_EXPORT const char* GetErrorLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetErrorStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetErrorLineCount(int id);
#	IPQ_DLL_EXPORT int         GetErrorStringLineCount(int id);
s/GetErrorLine/GetErrorStringLine/g
s/geterrorline/geterrorstringline/g
s/GETERRORLINE/GETERRORSTRINGLINE/g
#	IPQ_DLL_EXPORT const char* GetWarningLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetWarningStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetWarningLineCount(int id);
#	IPQ_DLL_EXPORT int         GetWarningStringLineCount(int id);
s/GetWarningLine/GetWarningStringLine/g
s/getwarningline/getwarningstringline/g
s/GETWARNINGLINE/GETWARNINGSTRINGLINE/g
#	IPQ_DLL_EXPORT void        OutputError(int id);
#	IPQ_DLL_EXPORT void        OutputErrorString(int id);
s/OutputError/OutputErrorString/g
s/outputerror/outputerrorstring/g
s/OUTPUTERROR/OUTPUTERRORSTRING/g
#	IPQ_DLL_EXPORT void        OutputLines(int id);
#	IPQ_DLL_EXPORT void        OutputAccumulatedLines(int id);
s/OutputLines/OutputAccumulatedLines/g
s/outputlines/outputaccumulatedlines/g
s/OUTPUTLINES/OUTPUTACCUMULATEDLINES/g
#	IPQ_DLL_EXPORT void        OutputWarning(int id);
#	IPQ_DLL_EXPORT void        OutputWarningString(int id);
s/OutputWarning/OutputWarningString/g
s/outputwarning/outputwarningstring/g
s/OUTPUTWARNING/OUTPUTWARNINGSTRING/g


git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4411 1feff8c3-07ed-0310-ac33-dd36852eb9cd
2010-05-18 01:59:33 +00:00

152 lines
3.6 KiB
C++

/*! @file Var.h
@brief %IPhreeqc VARIANT Documentation
*/
// Var.h
#ifndef __VAR_H_INC
#define __VAR_H_INC
#if defined(_WINDLL)
#define IPQ_DLL_EXPORT __declspec(dllexport)
#else
#define IPQ_DLL_EXPORT
#endif
/*! \brief Enumeration used to determine the type of data stored in a VAR.
*/
typedef enum {
TT_EMPTY = 0, /*!< VAR contains no data */
TT_ERROR = 1, /*!< vresult is valid */
TT_LONG = 2, /*!< lVal is valid */
TT_DOUBLE = 3, /*!< dVal is valid */
TT_STRING = 4 /*!< sVal is valid */
} VAR_TYPE;
/*! \brief Enumeration used to return error codes.
*/
typedef enum {
VR_OK = 0, /*!< Success */
VR_OUTOFMEMORY = -1, /*!< Failure, Out of memory */
VR_BADVARTYPE = -2, /*!< Failure, Invalid VAR type */
VR_INVALIDARG = -3, /*!< Failure, Invalid argument */
VR_INVALIDROW = -4, /*!< Failure, Invalid row */
VR_INVALIDCOL = -5 /*!< Failure, Invalid column */
} VRESULT;
/*! \brief Datatype used to store SELECTED_OUTPUT values.
*/
typedef struct {
VAR_TYPE type; /*!< holds datatype of <code>VAR</code> */
union {
long lVal; /*!< valid when <code>(type == TT_LONG)</code> */
double dVal; /*!< valid when <code>(type == TT_DOUBLE)</code> */
char* sVal; /*!< valid when <code>(type == TT_STRING)</code> */
VRESULT vresult; /*!< valid when <code>(type == TT_ERROR)</code> */
};
} VAR;
#if defined(__cplusplus)
extern "C" {
#endif
/** Initializes a VAR.
* @param pvar Pointer to the VAR that will be initialized.
*/
IPQ_DLL_EXPORT void VarInit(VAR* pvar);
/** Clears a VAR.
* @param pvar Pointer to the VAR that will be freed and initialized.
* @retval VR_OK Success.
* @retval VR_BADVARTYPE The \c VAR was invalid (probably uninitialized).
*/
IPQ_DLL_EXPORT VRESULT VarClear(VAR* pvar);
/** Frees the destination VAR and makes a copy of the source VAR.
* @param pvarDest Pointer to the VAR to receive the copy.
* @param pvarSrc Pointer to the VAR to be copied.
* @retval VR_OK Success.
* @retval VR_BADVARTYPE The source and/or the destination are invalid (usually uninitialized).
* @retval VR_OUTOFMEMORY Memory could not be allocated for the copy.
* @return The return value is one of the following.
*/
IPQ_DLL_EXPORT VRESULT VarCopy(VAR* pvarDest, const VAR* pvarSrc);
/** Allocates a new string for use in a VAR and copies the passed string into it.
* @param pSrc Pointer to the VAR that will be initialized.
* @return A pointer to the string on success NULL otherwise.
*/
IPQ_DLL_EXPORT char* VarAllocString(const char* pSrc);
/** Frees a string allocated using VarAllocString.
* @param pSrc Pointer to the string to be freed.
*/
IPQ_DLL_EXPORT void VarFreeString(char* pSrc);
#if defined(__cplusplus)
}
#endif
#if defined(__cplusplus)
#include <ostream> // std::ostream
inline std::ostream& operator<< (std::ostream &os, const VAR_TYPE& vt)
{
switch(vt)
{
case TT_EMPTY:
os << "TT_EMPTY";
break;
case TT_ERROR:
os << "TT_ERROR";
break;
case TT_LONG:
os << "TT_LONG";
break;
case TT_DOUBLE:
os << "TT_DOUBLE";
break;
case TT_STRING:
os << "TT_STRING";
break;
default:
os << (int)vt;
break;
}
return os;
}
inline std::ostream& operator<< (std::ostream &os, const VRESULT& vr)
{
switch(vr)
{
case VR_OK:
os << "VR_OK";
break;
case VR_OUTOFMEMORY:
os << "VR_OUTOFMEMORY";
break;
case VR_BADVARTYPE:
os << "VR_BADVARTYPE";
break;
case VR_INVALIDARG:
os << "VR_INVALIDARG";
break;
case VR_INVALIDROW:
os << "VR_INVALIDROW";
break;
case VR_INVALIDCOL:
os << "VR_INVALIDCOL";
break;
default:
os << (int)vr;
break;
}
return os;
}
#endif /* __cplusplus */
#endif /* __VAR_H_INC */