home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) 1996 by Lele Gaifax. All Rights Reserved
- *
- * This software may be used and distributed freely for any purpose
- * provided that this notice is included unchanged on any and all
- * copies. The author does not warrant or guarantee this software in
- * any way.
- *
- * This file is part of the PyObjC package.
- *
- * $RCSfile: OC_PythonString.m,v $
- * $Revision: 1.1.1.2 $
- * $Date: 1996/10/04 20:59:03 $
- *
- * Created Thu Sep 5 19:49:36 1996.
- */
-
- #include "OC_PythonString.h"
-
- #define CLASS_VERSION 0
-
- @implementation OC_PythonString
-
- + (void) initialize
- {
- if (self == [OC_PythonString class])
- {
- [OC_PythonString setVersion:CLASS_VERSION];
- }
- }
-
- + (id <PythonObject>) fromString:(char *) str andSize:(int) size
- {
- PyObject *pystr = PyString_FromStringAndSize (str, size);
- id <PythonObject> result = [self newWithObject:pystr];
-
- Py_DECREF(pystr);
- return result;
- }
-
- + (id <PythonObject>) fromString:(char *) str
- {
- PyObject *pystr = PyString_FromString (str);
- id <PythonObject> result = [self newWithObject:pystr];
-
- Py_DECREF(pystr);
- return result;
- }
-
- - (int) size
- {
- return PyString_Size ([self object]);
- }
-
- - (char *) asString
- {
- return PyString_AsString ([self object]);
- }
-
- @end /* OC_PythonString class implementation */
-
- /*
- ** Local Variables:
- ** change-log-default-name:"../ChangeLog.PyObjC"
- ** End:
- */
-