Beispiel #1
0
//! read the next token from file
void CImageLoaderPPM::getNextToken(io::IReadFile* file, core::stringc& token) const
{
	token = "";
	c8 c;
	while(file->getPos()<file->getSize())
	{
		file->read(&c, 1);
		if (c=='#')
		{
			while (c!='\n' && c!='\r' && (file->getPos()<file->getSize()))
				file->read(&c, 1);
		}
		else if (!core::isspace(c))
		{
			token.append(c);
			break;
		}
	}
	while(file->getPos()<file->getSize())
	{
		file->read(&c, 1);
		if (c=='#')
		{
			while (c!='\n' && c!='\r' && (file->getPos()<file->getSize()))
				file->read(&c, 1);
		}
		else if (!core::isspace(c))
			token.append(c);
		else
			break;
	}
}
Beispiel #2
0
const c8* CTextSceneNode::getSceneCorePropertiesXMLString()
{
	core::stringc str;
	static core::stringc xmlstr;
	xmlstr = "";

	if (getMaterialsCount() == 1)
	{
		const c8* mat_xml = SCENE_MANAGER.getMaterialXMLText(getMaterial(0));
		xmlstr.append(mat_xml);
	}

	str.sprintf(
		"<Font filename=\"%s\" size=\"%d/\" />\n",
		m_Font->getFileName(), m_Font->getSize()		
		);
	xmlstr.append(str);

	str.sprintf(
		"<Text value=\"%s\" />\n",
		core::stringc(getText()).c_str()
		);
	xmlstr.append(str);

	img::SColor c = getTextColor();

	str.sprintf(
		"<TextColor value=\"%d,%d,%d,%d\" />\n",
		c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha() 
		);
	xmlstr.append(str);

	return xmlstr.c_str();
}
Beispiel #3
0
void B3DMeshLoader::readString(core::stringc& newstring)
{
    newstring="";
    while (B3DFile->getPos() <= B3DFile->getSize())
    {
        c8 character;
        B3DFile->read(&character, sizeof(character));
        if (character==0)
            return;
        newstring.append(character);
    }
}
Beispiel #4
0
//!
const c8* CTestSceneNode::getSceneCorePropertiesXMLString()
{
	static core::stringc xmlstr;
	xmlstr = "";

	if (getMaterialsCount() == 1)
	{
		const c8* mat_xml = SCENE_MANAGER.getMaterialXMLText(getMaterial(0));
		xmlstr.append(mat_xml);
	}

	xmlstr.sprintf("<GeomPrimitive type=\"%s\" />\n",
		GeomPrimitiveTypeStr[m_GeomPrimitiveType]);

	return xmlstr.c_str();
}
void CNPKReader::readString(core::stringc& name)
{
	short stringSize;
	char buf[256];
	File->read(&stringSize, 2);
#ifdef __BIG_ENDIAN__
	stringSize = os::Byteswap::byteswap(stringSize);
#endif
	name.reserve(stringSize);
	while(stringSize)
	{
		const short next = core::min_(stringSize, (short)255);
		File->read(buf,next);
		buf[next]=0;
		name.append(buf);
		stringSize -= next;
	}
}
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
{
	OSVERSIONINFOEX osvi;
	BOOL bOsVersionInfoEx;

	ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
	osvi.dwOSVersionInfoSize	= sizeof(OSVERSIONINFOEX);

	if(!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO*) &osvi)))
	{
		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
		if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) 
			return;
	}

	switch (osvi.dwPlatformId)
	{
	case VER_PLATFORM_WIN32_NT:
		if (osvi.dwMajorVersion <= 4)
			out.append("Microsoft Windows NT ");
		if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
			out.append("Microsoft Windows 2000 ");
		if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
			out.append("Microsoft Windows XP ");

		if( bOsVersionInfoEx )
		{
			#ifdef VER_SUITE_ENTERPRISE
			if (osvi.wProductType == VER_NT_WORKSTATION)
			{
				if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
					out.append("Personal ");
				else
					out.append("Professional ");
			}
			else if (osvi.wProductType == VER_NT_SERVER)
			{
				if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
					out.append("DataCenter Server ");
			   else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
				   out.append("Advanced Server ");
			   else
				   out.append("Server ");
			}
			#endif
		}
		else
		{
			HKEY hKey;
			char szProductType[80];
			DWORD dwBufLen;

			RegOpenKeyEx( HKEY_LOCAL_MACHINE,
				"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 
				0, KEY_QUERY_VALUE, &hKey );
			RegQueryValueEx( hKey, "ProductType", NULL, NULL,
				(LPBYTE) szProductType, &dwBufLen);
			RegCloseKey( hKey );

			if (lstrcmpi( "WINNT", szProductType) == 0 )
				out.append("Professional ");
			if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
				out.append("Server " );
			if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
				out.append("Advanced Server ");
         	}

		// Display version, service pack (if any), and build number.
		
		char tmp[255];

		if (osvi.dwMajorVersion <= 4 )
		{
			sprintf (tmp, "version %d.%d %s (Build %d)",
				osvi.dwMajorVersion,
				osvi.dwMinorVersion,
				osvi.szCSDVersion,
				osvi.dwBuildNumber & 0xFFFF);
		}
		else
		{
			sprintf (tmp, "%s (Build %d)", osvi.szCSDVersion, 
				osvi.dwBuildNumber & 0xFFFF);
		}

		out.append(tmp);
		break;

	case VER_PLATFORM_WIN32_WINDOWS:

		IsNonNTWindows = true;

		if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
		{
			out.append("Microsoft Windows 95 ");
			if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
				out.append("OSR2 " );
		} 

		if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
		{
			out.append("Microsoft Windows 98 ");
			if ( osvi.szCSDVersion[1] == 'A' )
				out.append( "SE " );
        } 

		if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
			out.append("Microsoft Windows Me ");

		break;

	case VER_PLATFORM_WIN32s:

		IsNonNTWindows = true;
		out.append("Microsoft Win32s ");
		break;
   }
}