Example #1
0
 const Asset::Ident
 createIdent (Query<STRU> const& query)
   {
     // does the query somehow specify the desired name-ID?
     string nameID = query.extractID (genericIdSymbol);
     if (isnil (nameID))
       nameID = query.extractID (StructTraits<STRU>::idSymbol());
     if (isnil (nameID))
       {
          // no name-ID contained in the query...
         //  so we'll create a new one
         static int i=0;
         nameID = _Fmt("%s.%d")
                      % StructTraits<STRU>::namePrefix()
                      % (++i);
       }
     ENSURE (!isnil (nameID));
     
     // does the query actually demand the Nth instance/element?
     string seqID = query.extractID (seqNrPredicate);
     if (!isnil (seqID) && 1 < uNum(seqID))
       nameID += "."+seqID;
     
     Category cat (STRUCT, StructTraits<STRU>::catFolder());
     return Asset::Ident (nameID, cat );
   }