示例#1
0
 CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType):
   UpdateItem(&ui),
   Index(index),
   ExtensionPos(0),
   NamePos(0),
   ExtensionIndex(0)
 {
   if (sortByType)
   {
     int slashPos = GetReverseSlashPos(ui.Name);
     NamePos = ((slashPos >= 0) ? (slashPos + 1) : 0);
     int dotPos = ui.Name.ReverseFind(L'.');
     if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
       ExtensionPos = ui.Name.Length();
     else
     {
       ExtensionPos = dotPos + 1;
       UString us = ui.Name.Mid(ExtensionPos);
       if (!us.IsEmpty())
       {
         us.MakeLower();
         int i;
         AString s;
         for (i = 0; i < us.Length(); i++)
         {
           wchar_t c = us[i];
           if (c >= 0x80)
             break;
           s += (char)c;
         }
         if (i == us.Length())
           ExtensionIndex = GetExtIndex(s);
         else
           ExtensionIndex = 0;
       }
     }
   }
 }
示例#2
0
 CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType):
   UpdateItem(&ui),
   Index(index),
   ExtensionPos(0),
   NamePos(0),
   ExtensionIndex(0)
 {
   if (sortByType)
   {
     int slashPos = GetReverseSlashPos(ui.Name);
     NamePos = slashPos + 1;
     int dotPos = ui.Name.ReverseFind(L'.');
     if (dotPos < 0 || dotPos < slashPos)
       ExtensionPos = ui.Name.Len();
     else
     {
       ExtensionPos = dotPos + 1;
       if (ExtensionPos != ui.Name.Len())
       {
         AString s;
         for (unsigned pos = ExtensionPos;; pos++)
         {
           wchar_t c = ui.Name[pos];
           if (c >= 0x80)
             break;
           if (c == 0)
           {
             ExtensionIndex = GetExtIndex(s);
             break;
           }
           s += (char)MyCharLower_Ascii((char)c);
         }
       }
     }
   }
 }