secureswitools/swisistools/source/sisxlibrary/utility.h
changeset 60 245df5276b97
parent 0 ba25891c3a9e
child 81 42552535c1ac
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    30 #define __UTILITY_H__
    30 #define __UTILITY_H__
    31 
    31 
    32 #include <string>
    32 #include <string>
    33 #include "basetype.h"
    33 #include "basetype.h"
    34 #include "fieldroot.h"
    34 #include "fieldroot.h"
       
    35 #include "../common/toolsconf.h"
    35 
    36 
    36 #define FreeMemory(x) {if((x) != NULL) {free(x); (x)=NULL;}}
    37 #define FreeMemory(x) {if((x) != NULL) {free(x); (x)=NULL;}}
    37 
    38 
    38 // Constants
    39 // Constants
    39 const std::wstring KSisDirectorySeparator( L"/" );
    40 const std::wstring KSisDirectorySeparator( L"/" );
       
    41 const std::wstring KSisInitialNetworkPathSlashes( L"//" );
    40 
    42 
    41 typedef struct {
    43 typedef struct {
    42 	wchar_t*		iName;
    44 	wchar_t*		iName;
    43 	TUint32			iValue;
    45 	TUint32			iValue;
    44 	TUint32			iSubValue;
    46 	TUint32			iSubValue;
    60 
    62 
    61 typedef enum {CERTFILE, KEYFILE} TFileType;
    63 typedef enum {CERTFILE, KEYFILE} TFileType;
    62 
    64 
    63 int SearchSortedUCTable (const SIdentifierTable aTable [], const std::wstring& aIdentifier);
    65 int SearchSortedUCTable (const SIdentifierTable aTable [], const std::wstring& aIdentifier);
    64 TUint32 IdentifyUCKeyword (const SKeyword aKeyword [], std::wstring aIdentifier, const std::wstring& aContext);
    66 TUint32 IdentifyUCKeyword (const SKeyword aKeyword [], std::wstring aIdentifier, const std::wstring& aContext);
    65 std::string wstring2string (const std::wstring& aWide);
    67 DllExport std::string wstring2string (const std::wstring& aWide);
    66 std::wstring string2wstring (const std::string& aNarrow);
    68 std::wstring string2wstring (const std::string& aNarrow);
    67 bool ValidateFileName (std::wstring& aName, const bool aMustExist);
    69 bool ValidateFileName (std::wstring& aName, const bool aMustExist);
    68 bool ValidateFileName (std::wstring& aName, const bool aMustExist, const std::wstring& aDefaultExtension);
    70 bool ValidateFileName (std::wstring& aName, const bool aMustExist, const std::wstring& aDefaultExtension);
    69 bool ValidateDirectory (std::wstring& aName, const bool aMustExist);
    71 bool ValidateDirectory (std::wstring& aName, const bool aMustExist);
    70 void EnsureExtended (std::wstring& aName, const std::wstring& aDefaultExtension);
    72 void EnsureExtended (std::wstring& aName, const std::wstring& aDefaultExtension);