forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsampleClass.h
More file actions
108 lines (83 loc) · 2.7 KB
/
sampleClass.h
File metadata and controls
108 lines (83 loc) · 2.7 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* 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
* with this source code in a file named "LICENSE."
*
* @file sampleClass.h
* @author drose
* @date 2000-06-10
*/
#ifndef SAMPLECLASS_H
#define SAMPLECLASS_H
// This file shows some sample code that illustrates our general naming and
// style conventions for Panda coding. Note that there is generally one .h
// file per class, with the .h file named after the class but the first letter
// lowercase.
#include "pandabase.h"
#include "localHeaderFile.h"
#include "anotherLocalHeaderFile.h"
#include "typedObject.h"
#include "anotherPandaHeaderFile.h"
#include <systemHeaderFile.h>
/**
* A basic description of the function and purpose of SampleClass. Note that
* class names are generally mixed case, no underscore, beginning with a
* capital letter.
*/
class EXPCL_PANDA SampleClass : public TypedObject {
public:
enum NestedEnum {
NE_case_one,
NE_case_two,
};
class EXPCL_PANDA NestedClass {
public:
int _data_member;
};
SampleClass();
INLINE SampleClass(const SampleClass ©);
INLINE ~SampleClass();
// Note that inline function bodies are generally not given here in the .h
// file--they're defined in the associated .I file.
// Method names are generally lower case, with underscores separating words.
// Accessors are generally of the form set_*() and get_*(). Respect the
// const convention for methods which should be const.
INLINE void set_flag(int flag);
INLINE int get_flag() const;
int public_method();
protected:
bool protected_method();
private:
void private_method();
public:
// Data members, whether private or public, are generally lower case, with
// underscores separating words, and beginning with a leading underscore.
bool _public_data_member;
private:
NestedEnumType _private_data_member;
int _flag;
// The TypeHandle stuff, below, need be present only for classes that
// inherit from TypedObject. Classes that do not inherit from TypedObject
// may optionally define just the non-virtual methods below:
// get_class_type(), init_type().
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "SampleClass",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "sampleClass.I"
#endif