mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
fix line endings
This commit is contained in:
parent
cc3bae7e76
commit
d2720d4365
@ -1,75 +1,75 @@
|
|||||||
// Filename: extension.h
|
// Filename: extension.h
|
||||||
// Created by: rdb (11Sep13)
|
// Created by: rdb (11Sep13)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PANDA 3D SOFTWARE
|
// PANDA 3D SOFTWARE
|
||||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
//
|
//
|
||||||
// All use of this software is subject to the terms of the revised BSD
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
// license. You should have received a copy of this license along
|
// license. You should have received a copy of this license along
|
||||||
// with this source code in a file named "LICENSE."
|
// with this source code in a file named "LICENSE."
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef EXTENSION_H
|
#ifndef EXTENSION_H
|
||||||
#define EXTENSION_H
|
#define EXTENSION_H
|
||||||
|
|
||||||
#include "dtoolbase.h"
|
#include "dtoolbase.h"
|
||||||
|
|
||||||
struct _object;
|
struct _object;
|
||||||
typedef struct _object PyObject;
|
typedef struct _object PyObject;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : ExtensionBase
|
// Class : ExtensionBase
|
||||||
// Description : This is where all extensions should derive from.
|
// Description : This is where all extensions should derive from.
|
||||||
// It defines the _self and _this members that can
|
// It defines the _self and _this members that can
|
||||||
// be used from the extension method.
|
// be used from the extension method.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class T>
|
template<class T>
|
||||||
class EXPCL_DTOOLCONFIG ExtensionBase {
|
class EXPCL_DTOOLCONFIG ExtensionBase {
|
||||||
public:
|
public:
|
||||||
T * _this;
|
T * _this;
|
||||||
PyObject * _self;
|
PyObject * _self;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : Extension
|
// Class : Extension
|
||||||
// Description : The default class template does not define any
|
// Description : The default class template does not define any
|
||||||
// methods. Classes that are extended should create
|
// methods. Classes that are extended should create
|
||||||
// a specialization of this class template.
|
// a specialization of this class template.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class T>
|
template<class T>
|
||||||
class EXPCL_DTOOLCONFIG Extension : public ExtensionBase<T> {
|
class EXPCL_DTOOLCONFIG Extension : public ExtensionBase<T> {
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function : invoke_extension
|
// Function : invoke_extension
|
||||||
// Description : Creates a new extension object for the given
|
// Description : Creates a new extension object for the given
|
||||||
// pointer that can then be used to call extension
|
// pointer that can then be used to call extension
|
||||||
// methods, as follows:
|
// methods, as follows:
|
||||||
// invoke_extension((MyClass) *ptr).method()
|
// invoke_extension((MyClass) *ptr).method()
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Extension<T>
|
inline Extension<T>
|
||||||
invoke_extension(T *ptr, PyObject *self = NULL) {
|
invoke_extension(T *ptr, PyObject *self = NULL) {
|
||||||
Extension<T> ext;
|
Extension<T> ext;
|
||||||
ext._this = ptr;
|
ext._this = ptr;
|
||||||
ext._self = self;
|
ext._self = self;
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function : invoke_extension
|
// Function : invoke_extension
|
||||||
// Description : The const version of the above function.
|
// Description : The const version of the above function.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const Extension<T>
|
inline const Extension<T>
|
||||||
invoke_extension(const T *ptr, PyObject *self = NULL) {
|
invoke_extension(const T *ptr, PyObject *self = NULL) {
|
||||||
Extension<T> ext;
|
Extension<T> ext;
|
||||||
ext._this = (T *) ptr;
|
ext._this = (T *) ptr;
|
||||||
ext._self = self;
|
ext._self = self;
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user