96 /** Flag to indicate whether the '-V' arg was passed in */ |
96 /** Flag to indicate whether the '-V' arg was passed in */ |
97 TBool gValidityChecking = EFalse; |
97 TBool gValidityChecking = EFalse; |
98 /** flag to indicate whether the execution format is .dll or .exe*/ |
98 /** flag to indicate whether the execution format is .dll or .exe*/ |
99 TBool gIsExeDLL = EFalse; |
99 TBool gIsExeDLL = EFalse; |
100 /** flag to indicate whether the configuration file is in XML format */ |
100 /** flag to indicate whether the configuration file is in XML format */ |
101 TBool gIsXML = ETrue; |
101 TBool gIsXML = ETrue; |
102 /** flag to keep generic records */ |
|
103 TBool gKeepGenerics = ETrue; |
|
104 |
102 |
105 #ifdef SYMBIAN_NETWORKING_3GPPDEFAULTQOS |
103 #ifdef SYMBIAN_NETWORKING_3GPPDEFAULTQOS |
106 TBool gDeprecatedFields = EFalse; |
104 TBool gDeprecatedFields = EFalse; |
107 #endif |
105 #endif |
108 //SYMBIAN_NETWORKING_3GPPDEFAULTQOS |
106 //SYMBIAN_NETWORKING_3GPPDEFAULTQOS |
293 { |
291 { |
294 User::LeaveIfError(err); |
292 User::LeaveIfError(err); |
295 } |
293 } |
296 |
294 |
297 // delete everything in the database |
295 // delete everything in the database |
298 TInt keptElements = 0; |
|
299 if (ids.Count()) |
296 if (ids.Count()) |
300 { |
297 { |
301 for ( TInt i = ids.Count()-1; i >=0 ; i--) |
298 for ( TInt i = ids.Count()-1; i >=0 ; i--) |
302 { |
299 { |
303 if( i == ids.Count()-1 || i>=10000 && i%10000==0 || i<10000 && i>= 1000 && i%1000==0 || |
300 if( i == ids.Count()-1 || i>=10000 && i%10000==0 || i<10000 && i>= 1000 && i%1000==0 || |
304 i<1000 && i>=100 && i%100==0 || i<100 && i>=10 && i%10==0 || i<10) |
301 i<1000 && i>=100 && i%100==0 || i<100 && i>=10 && i%10==0 || i<10) |
305 { |
302 { |
306 gMsg->Msg(_L("%d"),i); |
303 gMsg->Msg(_L("%d"),i); |
307 } |
304 } |
308 if(!gKeepGenerics || ids[i] < KCDInitialUDefRecordType || ids[i] > KCDLastUDefRecordType) |
305 User::LeaveIfError(storage->Delete(ids[i])); |
309 { |
306 } |
310 User::LeaveIfError(storage->Delete(ids[i])); |
307 } |
311 } |
308 |
312 else |
|
313 { |
|
314 ++keptElements; |
|
315 } |
|
316 } |
|
317 } |
|
318 |
|
319 gMsg->Msg(_L("Kept %d elements intact (KeepGenerics option == %d"), keptElements, gKeepGenerics); |
|
320 TUint32 aErrorId; |
309 TUint32 aErrorId; |
321 err = storage->CommitTransaction(aErrorId); |
310 err = storage->CommitTransaction(aErrorId); |
322 |
311 |
323 CleanupStack::PopAndDestroy(2); |
312 CleanupStack::PopAndDestroy(2); |
324 |
313 |
699 // provided, so the caller should only look for process exit != 0 to mean failure, and then examine the |
688 // provided, so the caller should only look for process exit != 0 to mean failure, and then examine the |
700 // log to see what failed. |
689 // log to see what failed. |
701 return !gProcessingSuccessful; |
690 return !gProcessingSuccessful; |
702 } |
691 } |
703 |
692 |
704 TBool MatchArg(const TDesC& aArg, const TDesC& aOpt) |
|
705 { |
|
706 return aArg.Left(aOpt.Length()).CompareF(aOpt) == 0; |
|
707 } |
|
708 |
693 |
709 TInt ParseCommandLineL(TBool &aDebugOn, TBool &aOverWrite, TBool &aForceXMLProcessing, TDes &aIn, TDes &aOut, TDes &aInPref) |
694 TInt ParseCommandLineL(TBool &aDebugOn, TBool &aOverWrite, TBool &aForceXMLProcessing, TDes &aIn, TDes &aOut, TDes &aInPref) |
710 /** Parse the command line for any overriding settings from exe command line |
695 /** Parse the command line for any overriding settings from exe command line |
711 |
696 |
712 @param bDebugOn Wether to output debug messages to the log file using CFileDump::Dbg(TPtrC text, ...) |
697 @param bDebugOn Wether to output debug messages to the log file using CFileDump::Dbg(TPtrC text, ...) |
747 arg = pCmd->Arg(i); |
732 arg = pCmd->Arg(i); |
748 arg.UpperCase(); |
733 arg.UpperCase(); |
749 |
734 |
750 // CED will report all the failures on the end, unlike success in all the cases except missing cfg file |
735 // CED will report all the failures on the end, unlike success in all the cases except missing cfg file |
751 // Switch introduced because of high impact on test results and to avoid BC break |
736 // Switch introduced because of high impact on test results and to avoid BC break |
752 if ( MatchArg(arg, _L("-V")) ) |
737 if ( arg.FindF(_L("-V")) != KErrNotFound ) |
753 { |
738 { |
754 gValidityChecking = ETrue; |
739 gValidityChecking = ETrue; |
755 continue; |
740 continue; |
756 } |
741 } |
757 |
742 |
758 //Display help |
743 //Display help |
759 if ( MatchArg(arg, _L("-H")) ) |
744 if ( arg.FindF(_L("-H")) != KErrNotFound ) |
760 { |
745 { |
761 HelpDump(); |
746 HelpDump(); |
762 CleanupStack::Pop(pCmd); |
747 CleanupStack::Pop(pCmd); |
763 delete pCmd; |
748 delete pCmd; |
764 return valid; |
749 return valid; |
765 } |
750 } |
766 |
751 |
767 // Append database switch |
752 // Append database switch |
768 if ( MatchArg(arg, _L("-A")) ) |
753 if ( arg.FindF(_L("-A")) != KErrNotFound ) |
769 { |
754 { |
770 aOverWrite = EFalse; |
755 aOverWrite = EFalse; |
771 continue; |
756 continue; |
772 } |
757 } |
773 |
758 |
774 // Debug switch |
759 // Debug switch |
775 if ( MatchArg(arg, _L("-D")) ) |
760 if ( arg.FindF(_L("-D")) != KErrNotFound ) |
776 { |
761 { |
777 aDebugOn = ETrue; |
762 aDebugOn = ETrue; |
778 continue; |
763 continue; |
779 } |
764 } |
780 |
765 |
781 // Debug switch |
766 // Debug switch |
782 if ( MatchArg(arg, _L("-M")) ) |
767 if ( arg.FindF(_L("-M")) != KErrNotFound ) |
783 { |
768 { |
784 aInPref = pCmd->Arg(++i); |
769 aInPref = pCmd->Arg(++i); |
785 continue; |
770 continue; |
786 } |
771 } |
787 |
772 |
788 // Keep generics switch |
|
789 if ( MatchArg(arg, _L("-KG")) ) |
|
790 { |
|
791 gKeepGenerics = ETrue; |
|
792 continue; |
|
793 } |
|
794 |
|
795 // Zap generics switch |
|
796 if ( MatchArg(arg, _L("-ZG")) ) |
|
797 { |
|
798 gKeepGenerics = EFalse; |
|
799 continue; |
|
800 } |
|
801 |
|
802 // Presence of invalid table entry links |
773 // Presence of invalid table entry links |
803 // will not cause an error |
774 // will not cause an error |
804 if ( MatchArg(arg, _L("-F")) ) |
775 if ( arg.FindF(_L("-F")) != KErrNotFound ) |
805 { |
776 { |
806 aForceXMLProcessing = ETrue; |
777 aForceXMLProcessing = ETrue; |
807 continue; |
778 continue; |
808 } |
779 } |
809 |
780 |
810 // Specification of an input file |
781 // Specification of an input file |
811 if ( MatchArg(arg, _L("-I")) ) |
782 if ( arg.FindF(_L("-I")) != KErrNotFound ) |
812 { |
783 { |
813 if( i != pCmd->Count()-1 ) |
784 if( i != pCmd->Count()-1 ) |
814 { |
785 { |
815 aIn = pCmd->Arg(++i); |
786 aIn = pCmd->Arg(++i); |
816 bInFound = ETrue; |
787 bInFound = ETrue; |
850 #ifdef __TOOLS2__ |
821 #ifdef __TOOLS2__ |
851 // Specification of the database binary version |
822 // Specification of the database binary version |
852 // This must be specified on the tools2 platform. |
823 // This must be specified on the tools2 platform. |
853 TBuf<16> databaseVersion; |
824 TBuf<16> databaseVersion; |
854 |
825 |
855 if ( MatchArg(arg, _L("-B")) ) |
826 if ( arg.FindF(_L("-B")) != KErrNotFound ) |
856 { |
827 { |
857 if( i != pCmd->Count()-1 ) |
828 if( i != pCmd->Count()-1 ) |
858 { |
829 { |
859 databaseVersion = pCmd->Arg(++i); |
830 databaseVersion = pCmd->Arg(++i); |
860 if(databaseVersion.Compare(SUPPORTED_OS) == 0) |
831 if(databaseVersion.Compare(SUPPORTED_OS) == 0) |
956 gConsole->Printf(_L("\n-m Specifies the default mesh configuration file to CED. Defaults to reading '%S'."), &KMeshPrefaceFile); |
927 gConsole->Printf(_L("\n-m Specifies the default mesh configuration file to CED. Defaults to reading '%S'."), &KMeshPrefaceFile); |
957 #endif |
928 #endif |
958 gConsole->Printf(_L("\n-v Enables validation of the configuration data while writing to the database.")); |
929 gConsole->Printf(_L("\n-v Enables validation of the configuration data while writing to the database.")); |
959 gConsole->Printf(_L("\n-i Specifies an input file to CED. Must be either *.xml or *.cfg. Defaults to reading '%S' or '%S'."), &CFG_TARGET, &XML_TARGET); |
930 gConsole->Printf(_L("\n-i Specifies an input file to CED. Must be either *.xml or *.cfg. Defaults to reading '%S' or '%S'."), &CFG_TARGET, &XML_TARGET); |
960 gConsole->Printf(_L("\n-o Specifies an output file for CED to log to. Defaults to '%S'."), &LOG_TARGET); |
931 gConsole->Printf(_L("\n-o Specifies an output file for CED to log to. Defaults to '%S'."), &LOG_TARGET); |
961 gConsole->Printf(_L("\n-kg Keep existing generic-record elements (default)")); |
|
962 gConsole->Printf(_L("\n-zg Zap all existing elements including generics (unless appending)")); |
|
963 #ifdef __TOOLS2__ |
932 #ifdef __TOOLS2__ |
964 gConsole->Printf(_L("\n-b Specifies the binary output should be compatible with this Symbian OS version.\n")); |
933 gConsole->Printf(_L("\n-b Specifies the binary output should be compatible with this Symbian OS version.\n")); |
965 #endif |
934 #endif |
966 #ifndef __TOOLS2__ |
935 #ifndef __TOOLS2__ |
967 gConsole->Printf(_L("\nPress any key to finish")); |
936 gConsole->Printf(_L("\nPress any key to finish")); |