#define KEY_SPACE_SIZE 65536
#define RESLIST_MAX_INT_VECTOR 2048
+#include <functional>
+
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/ures.h"
U_CDECL_BEGIN
+class PathFilter;
class PseudoListResource;
+class ResKeyPath;
struct ResFile {
ResFile()
void write(UNewDataMemory *mem, uint32_t *byteOffset);
virtual void handleWrite(UNewDataMemory *mem, uint32_t *byteOffset);
+ /**
+ * Applies the given filter with the given base path to this resource.
+ * Removes child resources rejected by the filter recursively.
+ *
+ * @param bundle Needed in order to access the key for this and child resources.
+ */
+ virtual void applyFilter(const PathFilter& filter, ResKeyPath& path, const SRBRoot* bundle);
+
+ /**
+ * Calls the given function for every key ID present in this tree.
+ */
+ virtual void collectKeys(std::function<void(int32_t)> collector) const;
+
int8_t fType; /* nominal type: fRes (when != 0xffffffff) may use subtype */
UBool fWritten; /* res_write() can exit early */
uint32_t fRes; /* resource item word; RES_BOGUS=0xffffffff if not known yet */
fCount(0), fFirst(NULL) {}
virtual ~ContainerResource();
- virtual void handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet, UErrorCode &errorCode);
+ void handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet, UErrorCode &errorCode) override;
+
+ void collectKeys(std::function<void(int32_t)> collector) const override;
+
protected:
void writeAllRes16(SRBRoot *bundle);
void preWriteAllRes(uint32_t *byteOffset);
void add(SResource *res, int linenumber, UErrorCode &errorCode);
- virtual void handleWrite16(SRBRoot *bundle);
- virtual void handlePreWrite(uint32_t *byteOffset);
- virtual void handleWrite(UNewDataMemory *mem, uint32_t *byteOffset);
+ void handleWrite16(SRBRoot *bundle) override;
+ void handlePreWrite(uint32_t *byteOffset) override;
+ void handleWrite(UNewDataMemory *mem, uint32_t *byteOffset) override;
+
+ void applyFilter(const PathFilter& filter, ResKeyPath& path, const SRBRoot* bundle) override;
int8_t fTableType; // determined by table_write16() for table_preWrite() & table_write()
SRBRoot *fRoot;