diff --git a/src/lib/idi/entry-id.hpp b/src/lib/idi/entry-id.hpp index 3c237589a..54b5debf4 100644 --- a/src/lib/idi/entry-id.hpp +++ b/src/lib/idi/entry-id.hpp @@ -229,6 +229,19 @@ namespace idi { EntryID (string const& symbolID) : BareEntryID (util::sanitise(symbolID), getTypeHash()) { } + explicit + EntryID (const char* symbolID) + : BareEntryID (util::sanitise(symbolID), getTypeHash()) + { } + + /** case-2b: rely on an internal, already sanitised symbol. + * The symbol string will be passed through as-is, while + * the type information from TY will be hashed in. + */ + explicit + EntryID (Symbol const& internalSymbol) + : BareEntryID (string(internalSymbol), getTypeHash()) + { } /** @return true if the upcast would yield exactly the same diff --git a/tests/core/proc/asset/entry-id-test.cpp b/tests/core/proc/asset/entry-id-test.cpp index 4f6180292..4f58cbb23 100644 --- a/tests/core/proc/asset/entry-id-test.cpp +++ b/tests/core/proc/asset/entry-id-test.cpp @@ -137,10 +137,19 @@ namespace test{ using proc::asset::idi::getAssetIdent; ForkID tID(" test ⚡ ☠ ☭ ⚡ track "); - CHECK (getAssetIdent(tID) == Asset::Ident("test_track", Category(STRUCT,"forks"), "lumi", 0)); + + // Symbol-ID will be "sanitised" + CHECK ("test_track" == tID.getSym()); + CHECK (tID == ForkID("☢ test ☢ track ☢")); + CHECK (tID == ForkID(string{"☢ test ☢ track ☢"})); + + // but: there is a pass-through for internal symbols + CHECK (tID != ForkID(Symbol{"☢ test ☢ track ☢"})); CHECK (tID.getHash() == ForkID("☢ test ☢ track ☢").getHash()); + CHECK (getAssetIdent(tID) == Asset::Ident("test_track", Category(STRUCT,"forks"), "lumi", 0)); + CHECK (tID.getSym() == getAssetIdent(tID).name); CHECK (getAssetIdent(ForkID()).category == Category (STRUCT,"forks")); CHECK (getAssetIdent(ClipID()).category == Category (STRUCT,"clips"));