コード例 #1
0
ファイル: VDirAdapter.cpp プロジェクト: asnwerear/Demo
	bool VDirAdapter::remove(const VString &strFileName)
	{
		if (strFileName.empty() || strFileName == "")
			return false;

		return (remove(strFileName.c_str()) == 0);
	}
コード例 #2
0
ファイル: VDirAdapter.cpp プロジェクト: asnwerear/Demo
	bool VDirAdapter::removeDir(const VString &strDir)
	{
		if (strDir.empty() || strDir == "")
			return false;

		return (rmdir(strDir.c_str()) == 0);
	}
コード例 #3
0
ファイル: VDirAdapter_Unix.cpp プロジェクト: asnwerear/Demo
	bool VDirAdapter_Unix::makeDir(const VString &strDir)
	{
        if (strDir.empty() || strDir == "")
            return false;
        
		return (mkdir(strDir.c_str(), S_IRWXU) == 0);
	}
コード例 #4
0
ファイル: VDirAdapter_Unix.cpp プロジェクト: asnwerear/Demo
	uint32_t VDirAdapter_Unix::getLength() const
	{
        VString strPath = m_strRoot + VString(m_pDirent->d_name);
        struct stat s;
        int result = stat(strPath.c_str(), &s);
        
		return (result == 0 ? s.st_size : 0);
	}
コード例 #5
0
ファイル: VDirAdapter.cpp プロジェクト: asnwerear/Demo
	bool VDirAdapter::findFile(const VString &strPath)
	{
		if (strPath.empty() || strPath == "")
			return false;

#ifdef UNICODE
		WCHAR wszPath[512] = {0};
		::MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), strPath.length(), wszPath, sizeof(wszPath));
		m_hFindFile = ::FindFirstFile(wszPath, &m_FindFileData);
#else
		m_hFindFile = ::FindFirstFile(strPath.c_str(), &m_FindFileData);
#endif
		
		extractRoot(strPath, m_strRoot);

		m_bExtractName = false;

		return (m_hFindFile != INVALID_HANDLE_VALUE);
	}
コード例 #6
0
ファイル: VDirAdapter_Unix.cpp プロジェクト: asnwerear/Demo
	bool VDirAdapter_Unix::isDirectory() const
	{
        if (NULL == m_pDir || NULL == m_pDirent)
            return false;
        
        VString strPath = m_strRoot + VString(m_pDirent->d_name);
        struct stat s;
        int result = stat(strPath.c_str(), &s);
        
		return (result == 0 && S_ISDIR(s.st_mode));
	}
コード例 #7
0
bool VShadingPass::Compile(const VFileList &vertexShaders, const VFileList &fragmShaders)
{
	VString bigSourceStr;

	for( VFileList::const_iterator i = vertexShaders.begin(); i != vertexShaders.end(); ++i ) {
		const VString &fileName = *i;
		CPVRTResourceFile shaderFile(fileName.c_str());
		if( !shaderFile.IsOpen() )
			return false;

		VString fileContent((const char*) shaderFile.DataPtr(), shaderFile.Size());
		bigSourceStr += fileContent;
	}

	if( !mVertexShader.Create(GL_VERTEX_SHADER, bigSourceStr.c_str(), &mErrorLog ) ) {
		return false;
	}

	bigSourceStr.clear();

	for( VFileList::const_iterator i = fragmShaders.begin(); i != fragmShaders.end(); ++i ) {
		const VString &fileName = *i;
		CPVRTResourceFile shaderFile(fileName.c_str());
		if( !shaderFile.IsOpen() )
			return false;

		VString fileContent((const char*) shaderFile.DataPtr(), shaderFile.Size());
		bigSourceStr += fileContent;
	}

	if( !mFragmentShader.Create(GL_FRAGMENT_SHADER, bigSourceStr.c_str(), &mErrorLog ) ) {
		return false;
	}

	return true;
}
コード例 #8
0
bool VShader::Create(GLuint type, const VString &data, VString *logMessage)
{
	mHandle = glCreateShader(type);
	if( glGetError() != GL_NO_ERROR )
		return false;
	
	const GLchar *src[] = { data.c_str() };
	glShaderSource(mHandle, 1, src, NULL);

	glCompileShader(mHandle);

	GLint compilationResult = GL_FALSE;
	glGetShaderiv(mHandle, GL_COMPILE_STATUS, &compilationResult);
	if( logMessage )
		*logMessage = GetShaderBuildInfo(mHandle);
	if( !compilationResult )
		return false;

	mType = type;

	return true;
}
コード例 #9
0
ファイル: mmo.hpp プロジェクト: qiuhw/tmwa
 const char *c_str() const { return _impl.c_str(); }
コード例 #10
0
ファイル: VDirAdapter_Unix.cpp プロジェクト: asnwerear/Demo
 bool VDirAdapter_Unix::exists(const VString &strPath) const
 {
     struct stat s;
     int result = stat(strPath.c_str(), &s);
     return (result == 0);
 }