skins/AknSkins/sdcsrc/SDCData.cpp
changeset 50 c6286dcf6040
parent 0 05e9090e2422
child 53 8f0f421d3d0f
equal deleted inserted replaced
43:1951b3078691 50:c6286dcf6040
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <string.h>
    19 #include <string.h>
    20 #include <sys/stat.h>
    20 #include <sys/stat.h>
       
    21 #include <wchar.h>
    21 
    22 
    22 #include "SDCGlobals.h"
    23 #include "SDCGlobals.h"
    23 #include "SDCData.h"
    24 #include "SDCData.h"
    24 #include "SDCException.h"
    25 #include "SDCException.h"
    25 #include "SDCInput.h"
    26 #include "SDCInput.h"
       
    27 #include "SDCCompat.h"
    26 
    28 
    27 // Make std namespace available for compatibility
    29 // Make std namespace available for compatibility
    28 namespace std {}
    30 namespace std {}
    29 using namespace std;
    31 using namespace std;
    30 
    32 
   124     return false;
   126     return false;
   125     }
   127     }
   126 
   128 
   127 bool CSDCData::IsDefined( const TSDCIID aIID )
   129 bool CSDCData::IsDefined( const TSDCIID aIID )
   128     {
   130     {
   129     int i;
   131     unsigned int i;
   130     for( i=0; i<iBitmapDefVector.size(); i++ )
   132     for( i=0; i<iBitmapDefVector.size(); i++ )
   131         {
   133         {
   132         TSDCBitmapDef* entry = iBitmapDefVector[i];
   134         TSDCBitmapDef* entry = iBitmapDefVector[i];
   133         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) ) return true;
   135         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) ) return true;
   134         }
   136         }
   170     return false;
   172     return false;
   171     }
   173     }
   172 
   174 
   173 bool CSDCData::IsDefined( const TSDCIID aIID, const int aRestriction )
   175 bool CSDCData::IsDefined( const TSDCIID aIID, const int aRestriction )
   174     {
   176     {
   175     int i;
   177     unsigned int i;
   176     for( i=0; i<iBitmapDefVector.size(); i++ )
   178     for( i=0; i<iBitmapDefVector.size(); i++ )
   177         {
   179         {
   178         TSDCBitmapDef* entry = iBitmapDefVector[i];
   180         TSDCBitmapDef* entry = iBitmapDefVector[i];
   179         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) && (entry->iRestriction==aRestriction) ) return true;
   181         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) && (entry->iRestriction==aRestriction) ) return true;
   180         }
   182         }
   216     return false;
   218     return false;
   217     }
   219     }
   218 
   220 
   219 void CSDCData::AppendNameEntry( const int aLanguageID, const wchar_t* aName )
   221 void CSDCData::AppendNameEntry( const int aLanguageID, const wchar_t* aName )
   220     {
   222     {
   221     for( int i=0; i<iNameVector.size(); i++ )
   223     for( unsigned int i=0; i<iNameVector.size(); i++ )
   222         {
   224         {
   223         TSDCNameEntry* entry = iNameVector[i];
   225         TSDCNameEntry* entry = iNameVector[i];
   224         if( entry->iLanguageID == aLanguageID ) throw CSDCException( ESDCContentError, "Name for the language ID has already been specified" );
   226         if( entry->iLanguageID == aLanguageID ) throw CSDCException( ESDCContentError, "Name for the language ID has already been specified" );
   225         }
   227         }
   226 
   228 
   242     return FindMbmEntry(aColorDepth,aFilename)?true:false;
   244     return FindMbmEntry(aColorDepth,aFilename)?true:false;
   243     }
   245     }
   244 
   246 
   245 TSDCMBMEntry* CSDCData::FindMbmEntry( const TSDCColorDepth aColorDepth, const wchar_t* aFilename )
   247 TSDCMBMEntry* CSDCData::FindMbmEntry( const TSDCColorDepth aColorDepth, const wchar_t* aFilename )
   246     {
   248     {
   247     for( int i=0; i<iMbmVector.size(); i++ )
   249     for( unsigned int i=0; i<iMbmVector.size(); i++ )
   248         {
   250         {
   249         TSDCMBMEntry* entry = iMbmVector[i];
   251         TSDCMBMEntry* entry = iMbmVector[i];
   250         if( (_wcsicmp(entry->iSourcePath,iBmpPath)==0) &&
   252         if( (sd_wcscasecmp(entry->iSourcePath,iBmpPath)==0) &&
   251             (entry->iColorDepth==aColorDepth) &&
   253             (entry->iColorDepth==aColorDepth) &&
   252             (_wcsicmp(entry->iSourceFilename,aFilename)==0) ) return entry;
   254             (sd_wcscasecmp(entry->iSourceFilename,aFilename)==0) ) return entry;
   253         }
   255         }
   254     return NULL;
   256     return NULL;
   255     }
   257     }
   256 
   258 
   257 TSDCMBMEntry* CSDCData::AppendMbmEntry( const bool aSvg,
   259 TSDCMBMEntry* CSDCData::AppendMbmEntry( const bool aSvg,
   321     iBitmapDefVector.push_back( entry );
   323     iBitmapDefVector.push_back( entry );
   322     }
   324     }
   323 
   325 
   324 TSDCBitmapDef* CSDCData::GetBitmapDef( const TSDCIID aIID )
   326 TSDCBitmapDef* CSDCData::GetBitmapDef( const TSDCIID aIID )
   325     {
   327     {
   326     for( int i=0; i<iBitmapDefVector.size(); i++ )
   328     for( unsigned int i=0; i<iBitmapDefVector.size(); i++ )
   327         {
   329         {
   328         TSDCBitmapDef* entry = iBitmapDefVector[i];
   330         TSDCBitmapDef* entry = iBitmapDefVector[i];
   329         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) ) return entry;
   331         if( (entry->iIID.iMajor==aIID.iMajor) && (entry->iIID.iMinor==aIID.iMinor) ) return entry;
   330         }
   332         }
   331     return NULL;
   333     return NULL;
   448 		char asciiFileName[512];
   450 		char asciiFileName[512];
   449 		CSDCInput::ConvertToAscii( asciiFileName, aFileName );
   451 		CSDCInput::ConvertToAscii( asciiFileName, aFileName );
   450 		
   452 		
   451 		strcat(asciiPatch,asciiFileName);
   453 		strcat(asciiPatch,asciiFileName);
   452 
   454 
   453     struct _stat buf;
   455     struct stat buf;
   454     int result = _stat( asciiPatch, &buf );
   456     int result = stat( asciiPatch, &buf );
   455     if(result == -1)
   457     if(result == -1)
   456 		    {
   458 		    {
   457 		    return false;
   459 		    return false;
   458 		    }
   460 		    }
   459     return true;
   461     return true;