00001 // Filename: cppManifest.h 00002 // Created by: drose (22Oct99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CPPMANIFEST_H 00020 #define CPPMANIFEST_H 00021 00022 #include <dtoolbase.h> 00023 00024 #include "cppFile.h" 00025 #include "cppVisibility.h" 00026 00027 #include <vector_string.h> 00028 00029 class CPPExpression; 00030 class CPPType; 00031 00032 /////////////////////////////////////////////////////////////////// 00033 // Class : CPPManifest 00034 // Description : 00035 //////////////////////////////////////////////////////////////////// 00036 class CPPManifest { 00037 public: 00038 CPPManifest(const string &args, const CPPFile &file = CPPFile()); 00039 ~CPPManifest(); 00040 string expand(const vector_string &args = vector_string()) const; 00041 00042 CPPType *determine_type() const; 00043 00044 void output(ostream &out) const; 00045 00046 string _name; 00047 bool _has_parameters; 00048 int _num_parameters; 00049 CPPFile _file; 00050 CPPExpression *_expr; 00051 00052 // Manifests don't have a visibility in the normal sense. Normally 00053 // this will be V_public. But a manifest that is defined between 00054 // __begin_publish and __end_publish will have a visibility of 00055 // V_published. 00056 CPPVisibility _vis; 00057 00058 private: 00059 void parse_parameters(const string &args, size_t &p, 00060 vector_string ¶meter_names); 00061 void save_expansion(const string &exp, 00062 const vector_string ¶meter_names); 00063 00064 class ExpansionNode { 00065 public: 00066 ExpansionNode(int parm_number); 00067 ExpansionNode(const string &str); 00068 int _parm_number; 00069 string _str; 00070 }; 00071 typedef vector<ExpansionNode> Expansion; 00072 Expansion _expansion; 00073 }; 00074 00075 inline ostream &operator << (ostream &out, const CPPManifest &manifest) { 00076 manifest.output(out); 00077 return out; 00078 } 00079 00080 #endif