as_namespace.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2013-2014 Andreas Jonsson
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any
  6. damages arising from the use of this software.
  7. Permission is granted to anyone to use this software for any
  8. purpose, including commercial applications, and to alter it and
  9. redistribute it freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you
  11. must not claim that you wrote the original software. If you use
  12. this software in a product, an acknowledgment in the product
  13. documentation would be appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and
  15. must not be misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source
  17. distribution.
  18. The original version of this library can be located at:
  19. http://www.angelcode.com/angelscript/
  20. Andreas Jonsson
  21. andreas@angelcode.com
  22. */
  23. #ifndef AS_NAMESPACE_H
  24. #define AS_NAMESPACE_H
  25. #include "as_string.h"
  26. BEGIN_AS_NAMESPACE
  27. struct asSNameSpace
  28. {
  29. asCString name;
  30. // TODO: namespace: A namespace should have access masks. The application should be
  31. // able to restrict specific namespaces from access to specific modules
  32. };
  33. struct asSNameSpaceNamePair
  34. {
  35. const asSNameSpace *ns;
  36. asCString name;
  37. asSNameSpaceNamePair() : ns(0) {}
  38. asSNameSpaceNamePair(const asSNameSpace *_ns, const asCString &_name) : ns(_ns), name(_name) {}
  39. asSNameSpaceNamePair &operator=(const asSNameSpaceNamePair &other)
  40. {
  41. ns = other.ns;
  42. name = other.name;
  43. return *this;
  44. }
  45. bool operator==(const asSNameSpaceNamePair &other) const
  46. {
  47. return (ns == other.ns && name == other.name);
  48. }
  49. bool operator<(const asSNameSpaceNamePair &other) const
  50. {
  51. return (ns < other.ns || (ns == other.ns && name < other.name));
  52. }
  53. };
  54. END_AS_NAMESPACE
  55. #endif