当前位置: 首页>>代码示例>>C++>>正文


C++ SimpleString函数代码示例

本文整理汇总了C++中SimpleString函数的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString函数的具体用法?C++ SimpleString怎么用?C++ SimpleString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SimpleString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VStringFromFormat

SimpleString VStringFromFormat(const char* format, va_list args)
{
	va_list argsCopy;
	va_copy(argsCopy, args);
	enum
	{
		sizeOfdefaultBuffer = 100
	};
	char defaultBuffer[sizeOfdefaultBuffer];
	SimpleString resultString;

	int size = PlatformSpecificVSNprintf(defaultBuffer, sizeOfdefaultBuffer,
			format, args);
	if (size < sizeOfdefaultBuffer) {
		resultString = SimpleString(defaultBuffer);
	}
	else {
		char* newBuffer = new char[size + 1];
		PlatformSpecificVSNprintf(newBuffer, size + 1, format, argsCopy);
		resultString = SimpleString(newBuffer);

		delete[] newBuffer;
	}
	return resultString;
}
开发者ID:auser,项目名称:cpputest,代码行数:25,代码来源:SimpleString.cpp

示例2: VStringFromFormat

SimpleString VStringFromFormat(const char* format, va_list args)
{
    va_list argsCopy;
    va_copy(argsCopy, args);
    enum
    {
        sizeOfdefaultBuffer = 100
    };
    char defaultBuffer[sizeOfdefaultBuffer];
    SimpleString resultString;

    size_t size = (size_t)PlatformSpecificVSNprintf(defaultBuffer, sizeOfdefaultBuffer, format, args);
    if (size < sizeOfdefaultBuffer) {
        resultString = SimpleString(defaultBuffer);
    }
    else {
        size_t newBufferSize = size + 1;
        char* newBuffer = SimpleString::allocStringBuffer(newBufferSize, __FILE__, __LINE__);
        PlatformSpecificVSNprintf(newBuffer, newBufferSize, format, argsCopy);
        resultString = SimpleString(newBuffer);

        SimpleString::deallocStringBuffer(newBuffer, __FILE__, __LINE__);
    }
    va_end(argsCopy);
    return resultString;
}
开发者ID:uecasm,项目名称:cpputest,代码行数:26,代码来源:SimpleString.cpp

示例3: StringFrom

static SimpleString StringFrom(const Vec2D & v)
{
    SimpleString s = SimpleString();
    s += SimpleString("(");
    s += StringFrom(v.get_x());
    s += SimpleString(",");
    s += StringFrom(v.get_y());
    s += SimpleString(")");

    return s;
}
开发者ID:31415us,项目名称:beacons,代码行数:11,代码来源:positioning_test.cpp

示例4: testName

Failure::Failure (const SimpleString&	theTestName, 
			 	  const SimpleString&	theFileName, 
				  long					theLineNumber,
				  const SimpleString&	expected,
				  const SimpleString&	actual) 
: testName (theTestName), 
  fileName (theFileName), 
  lineNumber (theLineNumber)
{
	TCHAR *part1 = TEXT("expected ");
	TCHAR *part3 = TEXT(" but was: ");

	//[guyu modify
	size_t buflen = _tcslen (part1) 
					+ expected.size () 
					+ _tcslen (part3)
					+ actual.size ()
					+ 1;
	TCHAR *stage = new TCHAR [buflen];

	_stprintf_s (stage, buflen, TEXT("%s%s%s%s"), 
		part1, 
		expected.asCharString(), 
		part3, 
		actual.asCharString());
	//]guyu

	message = SimpleString(stage);

	delete stage;
}
开发者ID:ccanan,项目名称:BladeMaster,代码行数:31,代码来源:Failure.cpp

示例5: SimpleString

SimpleString ConsoleInput::GetUserInput() const
{
	char Buffer[256];
	DWORD OutNum = 0;

	if( ReadConsole( m_hConsoleInput, Buffer, 256, &OutNum, NULL ) )
	{
		// The last two characters should be a CRLF, unless we Ctrl+C or Ctrl+Break out of the zinput.
		OutNum = OutNum >= 2 ? OutNum - 2 : OutNum;

		Buffer[ OutNum ] = '\0';
		return SimpleString( Buffer );
	}

	return SimpleString( "" );
}
开发者ID:Johnicholas,项目名称:EldritchCopy,代码行数:16,代码来源:consoleinput.cpp

示例6: testName

Failure::Failure (const SimpleString&	theTestName, 
			 	  const SimpleString&	theFileName, 
				  long					theLineNumber,
				  const SimpleString&	expected,
				  const SimpleString&	actual) 
: testName (theTestName), 
  fileName (theFileName), 
  lineNumber (theLineNumber)
{
	char *part1 = "expected ";
	char *part3 = " but was: ";

	char *stage = new char [strlen (part1) 
					+ expected.size () 
					+ strlen (part3)
					+ actual.size ()
					+ 1];

	sprintf(stage, "%s%s%s%s", 
		part1, 
		expected.asCharString(), 
		part3, 
		actual.asCharString());

	message = SimpleString(stage);

	delete stage;
}
开发者ID:brindza,项目名称:phys-anim,代码行数:28,代码来源:Failure.cpp

示例7: TEST

TEST(SimpleString, CollectionWritingToEmptyString)
{
	SimpleStringCollection col;
	col.allocate(3);
	col[3] = SimpleString("HAH");
	STRCMP_EQUAL("", col[3].asCharString());
}
开发者ID:dhbw-fn-micro,项目名称:cpputest,代码行数:7,代码来源:SimpleStringTest.cpp

示例8: StringFrom

SimpleString StringFrom(double value)
{
    char buffer [DEFAULT_SIZE];
    sprintf(buffer, "%lf", value);

    return SimpleString(buffer);
}
开发者ID:mpetri,项目名称:OrderedSet,代码行数:7,代码来源:SimpleString.cpp

示例9: GetSaveLoadPath

void EldritchFramework::WritePrefsConfig() {
  const SimpleString PrefsConfigFilename =
      GetSaveLoadPath() + SimpleString("prefs.cfg");
  const FileStream PrefsConfigStream =
      FileStream(PrefsConfigFilename.CStr(), FileStream::EFM_Write);

  PrefsConfigStream.PrintF(
      "# This file is automatically generated.\n# You may delete it to restore "
      "defaults.\n\n");

  ConfigManager::BeginWriting();

  ConfigManager::Write(PrefsConfigStream, "Language");
  ConfigManager::Write(PrefsConfigStream, "DisplayWidth");
  ConfigManager::Write(PrefsConfigStream, "DisplayHeight");
  ConfigManager::Write(PrefsConfigStream, "Fullscreen");
  ConfigManager::Write(PrefsConfigStream, "OpenGL");
  ConfigManager::Write(PrefsConfigStream, "Brightness");
  ConfigManager::Write(PrefsConfigStream, "FOV");
  ConfigManager::Write(PrefsConfigStream, "VSync");
  ConfigManager::Write(PrefsConfigStream, "MouseSpeed");
  ConfigManager::Write(PrefsConfigStream, "ControllerSpeed");
  ConfigManager::Write(PrefsConfigStream, "InvertY");
  ConfigManager::Write(PrefsConfigStream, "MasterVolume");
  ConfigManager::Write(PrefsConfigStream, "MusicVolume");

  m_InputSystem->WriteConfigBinds(PrefsConfigStream);
}
开发者ID:ptitSeb,项目名称:Eldritch,代码行数:28,代码来源:eldritchframework.cpp

示例10: SimpleString

// Save to working directory on Windows and Linux. On Mac, save in proper
// location.
/*virtual*/ SimpleString EldritchFramework::GetSaveLoadPath() {
#if BUILD_MAC
  return ObjCJunk::GetUserDirectory();
#else
  return SimpleString("./");
#endif
}
开发者ID:ptitSeb,项目名称:Eldritch,代码行数:9,代码来源:eldritchframework.cpp

示例11: SaveCommandLineArguments

void SaveCommandLineArguments( int argc, char* argv[] )
{
	for( int ArgumentIndex = 0; ArgumentIndex < argc; ++ArgumentIndex )
	{
		g_CommandLineArguments.PushBack( SimpleString( argv[ ArgumentIndex ] ) );
	}
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:7,代码来源:main.cpp

示例12: getTestResult

void UtestShell::assertCstrContains(const char* expected, const char* actual, const char* text, const char* fileName, int lineNumber)
{
    getTestResult()->countCheck();
    if (actual == NULLPTR && expected == NULLPTR) return;
    if (actual == NULLPTR || expected == NULLPTR)
        failWith(ContainsFailure(this, fileName, lineNumber, expected, actual, text));
    if (!SimpleString(actual).contains(expected))
        failWith(ContainsFailure(this, fileName, lineNumber, expected, actual, text));
}
开发者ID:KisImre,项目名称:cpputest,代码行数:9,代码来源:Utest.cpp

示例13: getTestResult

void UtestShell::assertCstrNoCaseContains(const char* expected, const char* actual, const char* fileName, int lineNumber)
{
    getTestResult()->countCheck();
    if (actual == 0 && expected == 0) return;
    if(actual == 0 || expected == 0)
    	failWith(ContainsFailure(this, fileName, lineNumber, expected, actual));
    if (!SimpleString(actual).containsNoCase(expected))
    	failWith(ContainsFailure(this, fileName, lineNumber, expected, actual));
}
开发者ID:KevinWMatthews,项目名称:cpputest,代码行数:9,代码来源:Utest.cpp

示例14: if

bool MockNamedValue::equals(const MockNamedValue& p) const
{
	if (type_ != p.type_) return false;

	if (type_ == "int")
		return value_.intValue_ == p.value_.intValue_;
	else if (type_ == "char*")
		return SimpleString(value_.stringValue_) == SimpleString(p.value_.stringValue_);
	else if (type_ == "void*")
		return value_.pointerValue_ == p.value_.pointerValue_;
	else if (type_ == "double")
		return (doubles_equal(value_.doubleValue_, p.value_.doubleValue_, 0.005));

	if (comparator_)
		return comparator_->isEqual(value_.objectPointerValue_, p.value_.objectPointerValue_);

	return false;
}
开发者ID:CNCBASHER,项目名称:mri,代码行数:18,代码来源:MockNamedValue.cpp

示例15: getTestResult

void UtestShell::assertCstrNoCaseEqual(const char* expected, const char* actual, const char* text, const char* fileName, int lineNumber)
{
    getTestResult()->countCheck();
    if (actual == 0 && expected == 0) return;
    if (actual == 0 || expected == 0)
        failWith(StringEqualNoCaseFailure(this, fileName, lineNumber, expected, actual, text));
    if (!SimpleString(expected).equalsNoCase(actual))
        failWith(StringEqualNoCaseFailure(this, fileName, lineNumber, expected, actual, text));
}
开发者ID:DynonAvionics,项目名称:cpputest,代码行数:9,代码来源:Utest.cpp


注:本文中的SimpleString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。