PageRenderTime 25ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 2ms 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
 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
27// Use me only if you need to stub out some helper functions, not if you e.g. need sane numbers from countFilesInDir
28
29LLDir::LLDir() {}
30LLDir::~LLDir() {}
31BOOL LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { return true; }
32void LLDir::setChatLogsDir(const std::string &path) {}
33void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last) {}
34void LLDir::setLindenUserDir(const std::string &first, const std::string &last) {}
35void LLDir::setSkinFolder(const std::string &skin_folder) {}
36bool LLDir::setCacheDir(const std::string &path) { return true; }
37void LLDir::dumpCurrentDirectories() {}
38
39class LLDir_stub : public LLDir
40{
41public:
42	LLDir_stub() {}
43	~LLDir_stub() {}
44
45	/*virtual*/ void initAppDirs(const std::string &app_name) {}
46
47	/*virtual*/ std::string getCurPath() { return "CUR_PATH_FROM_LLDIR"; }
48	/*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; }
49	/*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; }
50	/*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; }
51	/*virtual*/ BOOL fileExists(const std::string &filename) const { return false; }
52};
53
54LLDir_stub gDirUtil;
55
56LLDir* gDirUtilp = &gDirUtil;
57
58std::string LLDir::getExpandedFilename(ELLPath loc, const std::string& subdir, const std::string& filename) const
59{
60	return subdir + " --- " + filename + " --- expanded!";
61}
62