Panda3D
 All Classes Functions Variables Enumerations
eggCurve.cxx
1 // Filename: eggCurve.cxx
2 // Created by: drose (15Feb00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "eggCurve.h"
16 
17 #include "string_utils.h"
18 #include "pnotify.h"
19 
20 TypeHandle EggCurve::_type_handle;
21 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: EggCurve::string_curve_type
25 // Access: Public, Static
26 // Description: Returns the CurveType value associated with the given
27 // string representation, or CT_invalid if the string
28 // does not match any known CurveType value.
29 ////////////////////////////////////////////////////////////////////
30 EggCurve::CurveType EggCurve::
31 string_curve_type(const string &string) {
32  if (cmp_nocase_uh(string, "xyz") == 0) {
33  return CT_xyz;
34  } else if (cmp_nocase_uh(string, "hpr") == 0) {
35  return CT_hpr;
36  } else if (cmp_nocase_uh(string, "t") == 0) {
37  return CT_t;
38  } else {
39  return CT_none;
40  }
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: CurveType output operator
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 ostream &operator << (ostream &out, EggCurve::CurveType t) {
48  switch (t) {
49  case EggCurve::CT_none:
50  return out << "none";
51  case EggCurve::CT_xyz:
52  return out << "XYZ";
53  case EggCurve::CT_hpr:
54  return out << "HPR";
55  case EggCurve::CT_t:
56  return out << "T";
57  }
58 
59  nassertr(false, out);
60  return out << "(**invalid**)";
61 }
62 
static CurveType string_curve_type(const string &string)
Returns the CurveType value associated with the given string representation, or CT_invalid if the str...
Definition: eggCurve.cxx:31
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85