cppNameComponent.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file cppNameComponent.h
  10. * @author drose
  11. * @date 1999-11-12
  12. */
  13. #ifndef CPPNAMECOMPONENT_H
  14. #define CPPNAMECOMPONENT_H
  15. #include "dtoolbase.h"
  16. #include <string>
  17. class CPPTemplateParameterList;
  18. class CPPScope;
  19. class CPPNameComponent {
  20. public:
  21. CPPNameComponent(const std::string &name);
  22. bool operator == (const CPPNameComponent &other) const;
  23. bool operator != (const CPPNameComponent &other) const;
  24. bool operator < (const CPPNameComponent &other) const;
  25. std::string get_name() const;
  26. std::string get_name_with_templ(CPPScope *scope = nullptr) const;
  27. CPPTemplateParameterList *get_templ() const;
  28. bool empty() const;
  29. bool has_templ() const;
  30. bool is_tbd() const;
  31. void set_name(const std::string &name);
  32. void append_name(const std::string &name);
  33. void set_templ(CPPTemplateParameterList *templ);
  34. void output(std::ostream &out) const;
  35. private:
  36. std::string _name;
  37. CPPTemplateParameterList *_templ;
  38. };
  39. inline std::ostream &operator << (std::ostream &out, const CPPNameComponent &name) {
  40. name.output(out);
  41. return out;
  42. }
  43. #endif