X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..HEAD:/icuSources/tools/genrb/reslist.h diff --git a/icuSources/tools/genrb/reslist.h b/icuSources/tools/genrb/reslist.h index ee1ecf3d..07874fdb 100644 --- a/icuSources/tools/genrb/reslist.h +++ b/icuSources/tools/genrb/reslist.h @@ -23,6 +23,8 @@ #define KEY_SPACE_SIZE 65536 #define RESLIST_MAX_INT_VECTOR 2048 +#include + #include "unicode/utypes.h" #include "unicode/unistr.h" #include "unicode/ures.h" @@ -36,7 +38,9 @@ U_CDECL_BEGIN +class PathFilter; class PseudoListResource; +class ResKeyPath; struct ResFile { ResFile() @@ -212,6 +216,19 @@ struct SResource { 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 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 */ @@ -231,7 +248,10 @@ public: 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 collector) const override; + protected: void writeAllRes16(SRBRoot *bundle); void preWriteAllRes(uint32_t *byteOffset); @@ -254,9 +274,11 @@ public: 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;