gmStringObject.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. _____ __ ___ __ ____ _ __
  3. / ___/__ ___ _ ___ / |/ /__ ___ / /_____ __ __/ __/_______(_)__ / /_
  4. / (_ / _ `/ ' \/ -_) /|_/ / _ \/ _ \/ '_/ -_) // /\ \/ __/ __/ / _ \/ __/
  5. \___/\_,_/_/_/_/\__/_/ /_/\___/_//_/_/\_\\__/\_, /___/\__/_/ /_/ .__/\__/
  6. /___/ /_/
  7. See Copyright Notice in gmMachine.h
  8. */
  9. #ifndef _GMSTRINGOBJECT_H_
  10. #define _GMSTRINGOBJECT_H_
  11. #include "gmConfig.h"
  12. #include "gmVariable.h"
  13. #include "gmHash.h"
  14. class gmMachine;
  15. /// \class gmStringObject
  16. /// \brief
  17. class gmStringObject : public gmObject, public gmHashNode<const char *, gmStringObject>
  18. {
  19. public:
  20. inline const char * GetKey() const { return m_string; }
  21. virtual int GetType() const { return GM_STRING; }
  22. virtual void Destruct(gmMachine * a_machine);
  23. inline operator const char *() const { return m_string; }
  24. inline const char * GetString() const { return m_string; }
  25. inline int GetLength() const { return m_length; }
  26. protected:
  27. /// \brief Non-public constructor. Create via gmMachine.
  28. gmStringObject(const char * a_string, int a_length) { m_string = a_string; m_length = a_length; }
  29. friend class gmMachine;
  30. private:
  31. const char * m_string;
  32. int m_length;
  33. };
  34. #endif // _GMSTRINGOBJECT_H_