コード例 #1
0
ファイル: FCTest.cpp プロジェクト: Marlinc/0ad
int main(int argc, char* argv[])
{
	ProcessCommandLine(argc, argv);
	FCollada::Initialize(); //Needed for Mac/Linux when FCollada is statically linked.
	// In debug mode, output memory leak information and do periodic memory checks
#ifdef PLUG_CRT
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_128_DF);
#endif

	FUTestBed testBed(logFilename.c_str(), isVerbose);

#ifndef _DEBUG
	try {
#endif
	// Set the current folder to the folder with the samples DAE files
	_chdir("Samples");

	// FMath tests
	RUN_TESTSUITE(FCTestAll)

#ifndef _DEBUG
	}
	catch (const char* sz) { testBed.GetLogFile().WriteLine(sz); }
#ifdef UNICODE
	catch (const fchar* sz) { testBed.GetLogFile().WriteLine(sz); }
#endif
	catch (...) { testBed.GetLogFile().WriteLine("Exception caught!"); }
#endif

	return 0;
}
コード例 #2
0
ファイル: FUFileManager.cpp プロジェクト: tweakoz/orkid
// Strip a full filename of its filename, returning the path
fstring FUFileManager::StripFileFromPath(const fstring& filename)
{
	fchar fullPath[MAX_PATH + 1];
	fstrncpy(fullPath, filename.c_str(), MAX_PATH);
	fullPath[MAX_PATH] = 0;
	fchar* lastSlash = fstrrchr(fullPath, FC('/'));
	fchar* lastBackslash = fstrrchr(fullPath, FC('\\'));
	lastSlash = max(lastSlash, lastBackslash);
	if (lastSlash != NULL) *(lastSlash + 1) = 0;
	return fstring(fullPath);
}
コード例 #3
0
ファイル: FUFileManager.cpp プロジェクト: tweakoz/orkid
// Extract the file extension out of a filename
fstring FUFileManager::GetFileExtension(const fstring& _filename)
{
	fchar filename[MAX_PATH];
	fstrncpy(filename, _filename.c_str(), MAX_PATH);
	filename[MAX_PATH - 1] = 0;

	fchar* lastPeriod = fstrrchr(filename, '.');
	if (lastPeriod == NULL) return emptyFString;

	fchar* lastSlash = fstrrchr(filename, '/');
	fchar* lastBackslash = fstrrchr(filename, '\\');
	lastSlash = max(lastSlash, lastBackslash);
	if (lastSlash > lastPeriod) return emptyFString;

	fstrlower(lastPeriod + 1);	// [claforte] Untested on __PPU__, refer to definition of fstrlower.
	return fstring(lastPeriod + 1);
}
コード例 #4
0
ファイル: FUStringConversion.cpp プロジェクト: righnatios/0ad
// Split a fstring into multiple substrings
void FUStringConversion::ToFStringList(const fstring& value, FStringList& array)
{
	const fchar* s = value.c_str();

	// Skip beginning white spaces
	fchar c;
	while ((c = *s) != 0 && (c == ' ' || c == '\t' || c == '\r' || c == '\n')) { ++s; }

	size_t index = 0;
	while (*s != 0)
	{
		const fchar* word = s;

		// Find next white space
		while ((c = *s) != 0 && c != ' ' && c != '\t' && c != '\r' && c != '\n') { ++s; }

		if (index < array.size()) array[index++].append(word, s - word);
		else { array.push_back(fstring(word, s - word)); ++index; }

		// Skip all white spaces
		while ((c = *s) != 0 && (c == ' ' || c == '\t' || c == '\r' || c == '\n')) { ++s; }
	}
	array.resize(index);
}
コード例 #5
0
void FCDEntityInstance::SetName(const fstring& _name) 
{
	name = FCDEntity::CleanName(_name.c_str());
	SetDirtyFlag();
}
コード例 #6
0
BadChecksumException::
BadChecksumException(fstring msg, uint64_t Old, uint64_t New)
  : super(msg.c_str()), m_old(Old), m_new(New) {}