lex_string.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License, version 2.0,
  5. as published by the Free Software Foundation.
  6. This program is also distributed with certain software (including
  7. but not limited to OpenSSL) that is licensed under separate terms,
  8. as designated in a particular file or component or in included license
  9. documentation. The authors of MySQL hereby grant you an additional
  10. permission to link the program and your derivative works with the
  11. separately licensed software that they have included with MySQL.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License, version 2.0, for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  19. #ifndef LEX_STRING_INCLUDED
  20. #define LEX_STRING_INCLUDED
  21. #include "mysql/mysql_lex_string.h"
  22. #ifdef __cplusplus
  23. #include <string>
  24. #endif
  25. /*
  26. LEX_STRING -- a pair of a C-string and its length.
  27. (it's part of the plugin API as a MYSQL_LEX_STRING)
  28. Ditto LEX_CSTRING/MYSQL_LEX_CSTRING.
  29. */
  30. typedef struct MYSQL_LEX_STRING LEX_STRING;
  31. typedef struct MYSQL_LEX_CSTRING LEX_CSTRING;
  32. #ifdef __cplusplus
  33. static inline std::string to_string(const LEX_STRING &str) {
  34. return std::string(str.str, str.length);
  35. }
  36. static inline std::string to_string(const LEX_CSTRING &str) {
  37. return std::string(str.str, str.length);
  38. }
  39. #endif // defined(__cplusplus)
  40. #endif