imgtools/imglib/host/h_utl.cpp
changeset 654 7c11c3d8d025
parent 626 ac03b93ca9c4
child 714 e5a58c351011
equal deleted inserted replaced
653:8ee61c1e0c5c 654:7c11c3d8d025
    17 
    17 
    18 
    18 
    19 
    19 
    20 #define __INCLUDE_CAPABILITY_NAMES__
    20 #define __INCLUDE_CAPABILITY_NAMES__
    21 
    21 
    22 #if defined(_MSVCDOTNET__) || defined(__TOOLS2__)
    22 
       
    23 
       
    24 #include <stdarg.h>
       
    25 #include <stdlib.h>
       
    26 
       
    27 #include <e32std.h>
       
    28 #include <e32std_private.h>
       
    29 
       
    30 #include "h_utl.h"
       
    31 
       
    32 #if defined(__MSVCDOTNET__)|| defined(__TOOLS2__)
    23 
    33 
    24 #else //!__MSVCDOTNET__
    34 #else //!__MSVCDOTNET__
    25 #include <string.h>
    35 #include <string.h>
    26 #endif //__MSVCDOTNET__
    36 #endif //__MSVCDOTNET__
    27 
       
    28 #include <stdarg.h>
       
    29 #include <stdlib.h>
       
    30 
       
    31 #include <e32std.h>
       
    32 #include <e32std_private.h>
       
    33 
       
    34 #include "h_utl.h"
       
    35 
    37 
    36 #ifdef __LINUX__
    38 #ifdef __LINUX__
    37  
    39  
    38  // Convert the supplied string to uppercase, in-place 
    40  // Convert the supplied string to uppercase, in-place 
    39  char* strupr(char *a)
    41  char* strupr(char *a)
   153 TVersion::TVersion()
   155 TVersion::TVersion()
   154 	{}
   156 	{}
   155 TVersion::TVersion(TInt aMajor, TInt aMinor, TInt aBuild)
   157 TVersion::TVersion(TInt aMajor, TInt aMinor, TInt aBuild)
   156 	: iMajor((TInt8)aMajor), iMinor((TInt8)aMinor), iBuild((TInt16)aBuild)
   158 	: iMajor((TInt8)aMajor), iMinor((TInt8)aMinor), iBuild((TInt16)aBuild)
   157 	{}
   159 	{}
   158 #ifdef __TOOLS2__
   160 #if defined(__TOOLS2__ ) ||  defined(__MSVCDOTNET__ )
   159 istringstream &operator>>(istringstream &is, TVersion &aVersion)
   161 istringstream &operator>>(istringstream &is, TVersion &aVersion)
   160 #else
   162 #else
   161 istrstream &operator>>(istrstream &is, TVersion &aVersion)
   163 istrstream &operator>>(istrstream &is, TVersion &aVersion)
   162 #endif
   164 #endif
   163 //
   165 //
   164 // Input a TVersion with syntax: major[.minor][(build)]
   166 // Input a TVersion with syntax: major[.minor][(build)]
   165 //	
   167 //	
   166 	{
   168 	{
   167 #ifdef __TOOLS2__
   169 #if defined(__TOOLS2__ ) ||  defined(__MSVCDOTNET__ )
   168 string tmp = is.str();
   170 string tmp = is.str();
   169 const char *str=tmp.c_str();
   171 const char *str=tmp.c_str();
   170 #else
   172 #else
   171 #ifdef __LINUX__
   173 #ifdef __LINUX__
   172     char *str = is.rdbuf()->str();
   174     char *str = is.rdbuf()->str();
   190 	// iMajor is defined as TInt8 so it should not be bigger than 127
   192 	// iMajor is defined as TInt8 so it should not be bigger than 127
   191 	if (majorV > 127)
   193 	if (majorV > 127)
   192 		{ 
   194 		{ 
   193 		cout << "\n Warning: major version must be in range 0 - 127 \n";
   195 		cout << "\n Warning: major version must be in range 0 - 127 \n";
   194 		}
   196 		}
   195 	char* pMinor = strchr(str, '.');
   197 	char* pMinor = (char*)strchr(str, '.');
   196 	if (pMinor)
   198 	if (pMinor)
   197 		{
   199 		{
   198 		pMinor++; 
   200 		pMinor++; 
   199 		aVersion.iMinor = (TInt8)Min(KMaxTInt8, atoi(pMinor));
   201 		aVersion.iMinor = (TInt8)Min(KMaxTInt8, atoi(pMinor));
   200 		int minorV = atoi(pMinor);
   202 		int minorV = atoi(pMinor);
   298 	TInt hour=10;
   300 	TInt hour=10;
   299 	TInt minute=10;
   301 	TInt minute=10;
   300 	TInt sec=0;
   302 	TInt sec=0;
   301 	TInt mill=0;
   303 	TInt mill=0;
   302 	char ch;
   304 	char ch;
   303 	#ifdef __TOOLS2__
   305 	#if defined(__TOOLS2__) || defined(__MSVCDOTNET__)
   304 	istringstream val(aString);
   306 	istringstream val(aString);
   305 	#else
   307 	#else
   306 	istrstream val(aString,strlen(aString));
   308 	istrstream val(aString,strlen(aString));
   307 	#endif
   309 	#endif
   308 	val >> dec >> day; // locks istrstream in decimal mode for further extractions
   310 	val >> dec >> day; // locks istrstream in decimal mode for further extractions