]>
git.saurik.com Git - android/aapt.git/blob - tests/MockFileFinder.h
2 // Copyright 2011 The Android Open Source Project
5 #ifndef MOCKFILEFINDER_H
6 #define MOCKFILEFINDER_H
8 #include <utils/Vector.h>
9 #include <utils/KeyedVector.h>
10 #include <utils/String8.h>
12 #include "DirectoryWalker.h"
14 using namespace android
;
16 class MockFileFinder
: public FileFinder
{
18 MockFileFinder (KeyedVector
<String8
, KeyedVector
<String8
,time_t> >& files
)
25 * findFiles implementation for the abstraction.
27 * No checking is done, so there MUST be an entry in mFiles with
28 * path matching basePath.
31 * fileStore is filled with a copy of the data in mFiles corresponding
35 virtual bool findFiles(String8 basePath
, Vector
<String8
>& extensions
,
36 KeyedVector
<String8
,time_t>& fileStore
,
39 const KeyedVector
<String8
,time_t>* payload(&mFiles
.valueFor(basePath
));
40 // Since KeyedVector doesn't implement swap
41 // (who doesn't use swap??) we loop and add one at a time.
42 for (size_t i
= 0; i
< payload
->size(); ++i
) {
43 fileStore
.add(payload
->keyAt(i
),payload
->valueAt(i
));
49 // Virtual mapping between "directories" and the "files" contained
51 KeyedVector
<String8
, KeyedVector
<String8
,time_t> > mFiles
;
55 #endif // MOCKFILEFINDER_H