QGearsStringUtil.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include "common/TypeDefine.h"
  17. namespace QGears{
  18. /**
  19. * Static class for common string manipulations.
  20. */
  21. class StringUtil : public Ogre::StringUtil{
  22. public:
  23. /**
  24. * Extract a file path.
  25. *
  26. * Extracts a file path from a fully qualified file name (i.e: full
  27. * filepath + filename).
  28. *
  29. * @param nameame[in] Fully qualified file name.
  30. * @param path[out] Path to the file, without the file name.
  31. */
  32. static void splitPath(const String &name, String &path);
  33. /**
  34. * Extract a file name without extension.
  35. *
  36. * Extracts a file name, without the file extension, from a fully
  37. * qualified file name (i.e: full filepath + filename).
  38. *
  39. * @param name[in] Fully qualified file name.
  40. * @param basename[out] File name, without extension.
  41. */
  42. static void splitBase(const String &name, String &basename);
  43. /**
  44. * Extract a file name without extension.
  45. *
  46. * Extracts a file name, without the file extension, from a full
  47. * file name without path.
  48. *
  49. * @param name[in] File name.
  50. * @param basename[out] File name, without extension.
  51. */
  52. static void splitFull(const String &name, String &basename);
  53. };
  54. }