PageRenderTime 33ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/tests/lldir_stub.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 62 lines | 27 code | 9 blank | 26 comment | 0 complexity | b0f5a306c9d255a6a64576dabdffa8f4 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lldir_stub.cpp
  3. * @brief stub class to allow unit testing
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2011, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. // Use me only if you need to stub out some helper functions, not if you e.g. need sane numbers from countFilesInDir
  27. LLDir::LLDir() {}
  28. LLDir::~LLDir() {}
  29. BOOL LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { return true; }
  30. void LLDir::setChatLogsDir(const std::string &path) {}
  31. void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last) {}
  32. void LLDir::setLindenUserDir(const std::string &first, const std::string &last) {}
  33. void LLDir::setSkinFolder(const std::string &skin_folder) {}
  34. bool LLDir::setCacheDir(const std::string &path) { return true; }
  35. void LLDir::dumpCurrentDirectories() {}
  36. class LLDir_stub : public LLDir
  37. {
  38. public:
  39. LLDir_stub() {}
  40. ~LLDir_stub() {}
  41. /*virtual*/ void initAppDirs(const std::string &app_name) {}
  42. /*virtual*/ std::string getCurPath() { return "CUR_PATH_FROM_LLDIR"; }
  43. /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; }
  44. /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; }
  45. /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; }
  46. /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; }
  47. };
  48. LLDir_stub gDirUtil;
  49. LLDir* gDirUtilp = &gDirUtil;
  50. std::string LLDir::getExpandedFilename(ELLPath loc, const std::string& subdir, const std::string& filename) const
  51. {
  52. return subdir + " --- " + filename + " --- expanded!";
  53. }