cppManifest.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Filename: cppManifest.h
  2. // Created by: drose (22Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef CPPMANIFEST_H
  19. #define CPPMANIFEST_H
  20. #include "dtoolbase.h"
  21. #include "cppFile.h"
  22. #include "cppVisibility.h"
  23. #include <vector_string.h>
  24. class CPPExpression;
  25. class CPPType;
  26. ///////////////////////////////////////////////////////////////////
  27. // Class : CPPManifest
  28. // Description :
  29. ////////////////////////////////////////////////////////////////////
  30. class CPPManifest {
  31. public:
  32. CPPManifest(const string &args, const CPPFile &file = CPPFile());
  33. ~CPPManifest();
  34. string expand(const vector_string &args = vector_string()) const;
  35. CPPType *determine_type() const;
  36. void output(ostream &out) const;
  37. string _name;
  38. bool _has_parameters;
  39. int _num_parameters;
  40. CPPFile _file;
  41. CPPExpression *_expr;
  42. // Manifests don't have a visibility in the normal sense. Normally
  43. // this will be V_public. But a manifest that is defined between
  44. // __begin_publish and __end_publish will have a visibility of
  45. // V_published.
  46. CPPVisibility _vis;
  47. private:
  48. void parse_parameters(const string &args, size_t &p,
  49. vector_string &parameter_names);
  50. void save_expansion(const string &exp,
  51. const vector_string &parameter_names);
  52. class ExpansionNode {
  53. public:
  54. ExpansionNode(int parm_number);
  55. ExpansionNode(const string &str);
  56. int _parm_number;
  57. string _str;
  58. };
  59. typedef vector<ExpansionNode> Expansion;
  60. Expansion _expansion;
  61. };
  62. inline ostream &operator << (ostream &out, const CPPManifest &manifest) {
  63. manifest.output(out);
  64. return out;
  65. }
  66. #endif