persistentstorage/centralrepository/common/src/inifile.cpp
changeset 55 44f437012c90
parent 0 08ec8eefde2f
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    32 
    32 
    33 //Repository (ini) file  - version string and version number
    33 //Repository (ini) file  - version string and version number
    34 _LIT(KVersion, "version");
    34 _LIT(KVersion, "version");
    35 static const TInt KVersionLen = 7;
    35 static const TInt KVersionLen = 7;
    36 static const TUint KCurrentVersion = 1;
    36 static const TUint KCurrentVersion = 1;
       
    37 
       
    38 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
    39 //Repository (ini) file - type string (PMA/Protected keyspace)
       
    40 _LIT(KKeyspaceProtectedTag, "protected");
       
    41 static const TInt KKeyspaceProtectedTagLen = 9;
       
    42 #endif
    37 
    43 
    38 //Repository (ini) file - supported types names
    44 //Repository (ini) file - supported types names
    39 _LIT(KTypeInt, "int");
    45 _LIT(KTypeInt, "int");
    40 _LIT(KTypeReal, "real");
    46 _LIT(KTypeReal, "real");
    41 _LIT(KTypeString, "string");
    47 _LIT(KTypeString, "string");
   671 		SkipComments();
   677 		SkipComments();
   672 		}
   678 		}
   673 	return KErrNone;
   679 	return KErrNone;
   674 }
   680 }
   675 
   681 
       
   682 
       
   683 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
   684 /**
       
   685 Check for a Keyspace Type Tag from ini file to see if it is a
       
   686 protected repository/keyspace or not. 
       
   687 
       
   688 @internalTechnology
       
   689 @return 1 if found.
       
   690         KErrNone if not found.
       
   691 */
       
   692 TInt CIniFileIn::CheckKeyspaceTypeSectionL()
       
   693     {
       
   694     TBuf<KBufLen> buf;
       
   695 
       
   696     SkipComments();
       
   697     
       
   698     // We will need this section later to write the out file...
       
   699     iLex.Mark(iMainSectionMark);
       
   700     
       
   701     iLex.Mark();
       
   702     iLex.SkipCharacters();
       
   703     
       
   704     if( iLex.TokenLength()==KKeyspaceProtectedTagLen && ( buf.CopyLC(iLex.MarkedToken()), buf.Compare(KKeyspaceProtectedTag) == 0 ) )
       
   705         {
       
   706         // "protected" keyword found.
       
   707         iLex.Mark(iMainSectionMark);
       
   708         return EPMAKeyspace; // 1
       
   709         }
       
   710 
       
   711     // "protected" keyword not found.
       
   712     iLex.UnGetToMark();
       
   713     return ENonPMAKeyspace;  // 0
       
   714     }
       
   715 #endif
       
   716 
       
   717 
   676 /**
   718 /**
   677 Read Owner section from ini file and extract owner UID 
   719 Read Owner section from ini file and extract owner UID 
   678 
   720 
   679 @internalTechnology
   721 @internalTechnology
   680 @return KErrNone, KErrCorrupt or KErrNotFound
   722 @return KErrNone, KErrCorrupt or KErrNotFound
  2069 	buf.Append(KSpace);
  2111 	buf.Append(KSpace);
  2070 	buf.AppendNum(KCurrentVersion);
  2112 	buf.AppendNum(KCurrentVersion);
  2071 	buf.Append(KCrNl);
  2113 	buf.Append(KCrNl);
  2072 	WriteLineL(buf);
  2114 	WriteLineL(buf);
  2073 	}
  2115 	}
  2074 	
  2116 
       
  2117 
       
  2118 #ifdef SYMBIAN_INCLUDE_APP_CENTRIC
       
  2119 /**
       
  2120 Writes "protected" to a repository file if it is a protected/PMA repository.
       
  2121 */
       
  2122 void CIniFileOut::WriteKeyspaceTypeL(TInt8 iKeyspaceType)
       
  2123     {
       
  2124     if (iKeyspaceType == EPMAKeyspace)
       
  2125         {
       
  2126         WriteLineL(KKeyspaceProtectedTag());
       
  2127         TBuf<5> buf;
       
  2128         buf.Append(KCrNl);
       
  2129         WriteLineL(buf);
       
  2130         }
       
  2131     }
       
  2132 #endif
       
  2133 
       
  2134 
  2075 /**
  2135 /**
  2076 Writes owner section to repository file.
  2136 Writes owner section to repository file.
  2077 */
  2137 */
  2078 void CIniFileOut::WriteOwnerSectionL(TUid aOwner)
  2138 void CIniFileOut::WriteOwnerSectionL(TUid aOwner)
  2079 	{
  2139 	{