e32tools/elf2e32/source/h_utl.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17  #ifndef __H_UTL_H__
       
    18  #define __H_UTL_H__
       
    19 
       
    20 #include "e32defwrap.h"
       
    21 #include <e32err.h>
       
    22 #include <iostream>
       
    23 
       
    24 #ifdef __TOOLS2__
       
    25 #include <sstream>
       
    26 #include <fstream>
       
    27 using namespace std;
       
    28 #else
       
    29 #include <strstream.h>
       
    30 #endif
       
    31 
       
    32  /**
       
    33  Convert string to number.
       
    34  @internalComponent
       
    35  @released
       
    36  */
       
    37  template <class T>
       
    38  TInt Val(T& aVal, char* aStr)
       
    39  {
       
    40  
       
    41  
       
    42 	T x;
       
    43 	#ifdef __TOOLS2__
       
    44 	istringstream val(aStr);
       
    45 	#else
       
    46 	istrstream val(aStr,strlen(aStr));
       
    47 	#endif
       
    48 	val >> x;
       
    49 	if (!val.eof() || val.fail())
       
    50 		return KErrGeneral;
       
    51 	aVal=x;
       
    52 	return KErrNone;
       
    53 	
       
    54      /*T x;
       
    55      istrstream val(aStr,strlen(aStr));
       
    56      val >> x;
       
    57      if (!val.eof() || val.fail())
       
    58          return KErrGeneral;
       
    59      aVal=x;
       
    60      return KErrNone;*/
       
    61  }
       
    62  
       
    63  
       
    64  //enum for decompose flag
       
    65  enum TDecomposeFlag
       
    66  {
       
    67      EUidPresent=1,
       
    68      EVerPresent=2
       
    69  };
       
    70  
       
    71  /**
       
    72  class for FileNameInfo
       
    73  @internalComponent
       
    74  @released
       
    75  */
       
    76  class TFileNameInfo
       
    77  {
       
    78      public:
       
    79          TFileNameInfo(const char* aFileName, TBool aLookForUid);
       
    80      public:
       
    81          const char* iFileName;
       
    82          TInt iTotalLength;
       
    83          TInt iBaseLength;
       
    84          TInt iExtPos;
       
    85          TUint32 iUid3;
       
    86          TUint32 iModuleVersion;
       
    87          TUint32 iFlags;
       
    88  };
       
    89  
       
    90  extern char* NormaliseFileName(const char* aName);
       
    91  
       
    92  
       
    93  
       
    94  #ifdef __LINUX__ 
       
    95  // Case insensitive comparison functions are named differently on Linux
       
    96  #define stricmp strcasecmp 
       
    97  #define strnicmp strncasecmp 
       
    98  
       
    99  // Convert the provided string to Uppercase
       
   100  char* strupr(char *a);
       
   101  #endif // __LINUX__
       
   102  
       
   103  #endif // __H_UTL_H__
       
   104  
       
   105  
       
   106  
       
   107  
       
   108  
       
   109 
       
   110 
       
   111 
       
   112