1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
// PyRowRef.h --
// $Id: PyRowRef.h,v 1.5 2001/12/19 16:26:00 wcvs Exp $
// This is part of MetaKit, see http://www.equi4.com/metakit/
//
// Copyright 1999 McMillan Enterprises, Inc. -- www.mcmillan-inc.com
// Copyright (C) 1999-2001 Jean-Claude Wippler <jcw@equi4.com>
//
// RowRef class header
#if !defined INCLUDE_PYROWREF_H
#define INCLUDE_PYROWREF_H
#include <mk4.h>
#include "PyHead.h"
#include <PWOSequence.h>
#include "PyView.h"
#include "PyProperty.h"
#define PyRowRef_Check(ob) ((ob)->ob_type == &PyRowReftype)
#define PyRORowRef_Check(ob) ((ob)->ob_type == &PyRORowReftype)
#define PyGenericRowRef_Check(ob) (PyRowRef_Check(ob) || PyRORowRef_Check(ob))
extern PyTypeObject PyRowReftype;
extern PyTypeObject PyRORowReftype;
class PyRowRef : public PyHead, public c4_RowRef {
public:
//PyRowRef();
PyRowRef(const c4_RowRef& o, int immutable=0);
//PyRowRef(c4_Row row);
~PyRowRef() {
c4_Cursor c = & (*(c4_RowRef*) this);
c._seq->DecRef();
}
PyProperty *getProperty(char *nm) {
c4_View cntr = Container();
int ndx = cntr.FindPropIndexByName(nm);
if (ndx > -1) {
return new PyProperty(cntr.NthProperty(ndx));
}
return 0;
};
PyObject* getPropertyValue(char *nm) {
PyProperty *prop = getProperty(nm);
if (prop)
{
PyObject* result = asPython(*prop);
Py_DECREF(prop);
return result;
}
return 0;
};
static void setFromPython(const c4_RowRef& row, const c4_Property& prop, PyObject* val);
static void setDefault(const c4_RowRef& row, const c4_Property& prop);
PyObject* asPython(const c4_Property& prop);
};
#endif
|