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


C++ TString::empty方法代码示例

本文整理汇总了C++中TString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ TString::empty方法的具体用法?C++ TString::empty怎么用?C++ TString::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TString的用法示例。


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

示例1: FindOutputFile

static TString FindOutputFile() {
    TString candidate;
    if (!out_argument.empty()) {
        candidate = StripQuotes(out_argument);
    } else if (!first_object_name.empty()) {
        candidate = first_object_name;
        if (!StripSuffix(candidate, TEXT(".obj")))
            StripSuffix(candidate, TEXT(".o"));
    } else {
        return TString();
    }
    if (PathFileExists(candidate.c_str()))
        return candidate;

    // FIXME: we should figure out from the linker's command line
    // whether the output file is an .exe or .dll
    TString exe_file = candidate + TEXT(".exe");
    if (PathFileExists(exe_file.c_str()))
        return exe_file;

    TString dll_file = candidate + TEXT(".dll");
    if (PathFileExists(dll_file.c_str()))
        return dll_file;

    return TString();
}
开发者ID:immunant,项目名称:selfrando,代码行数:26,代码来源:LinkWrapper.cpp

示例2: wcstombs

bool
CSymbolEngine::LoadModuleSymbols( 
	HANDLE hFile, 
	const TString& ImageName, 
	DWORD64 ModBase, 
	DWORD ModSize 
	)
{
	// Check preconditions 

	if( m_hProcess == NULL )
	{
		_ASSERTE( !_T("Symbol engine is not yet initialized.") );
		m_LastError = ERROR_INVALID_FUNCTION;
		return false;
	}


	// In Unicode build, ImageName parameter should be translated to ANSI

#ifdef _UNICODE
	char* pImageName = 0;
	if( !ImageName.empty() )
	{
		size_t BufSize = 2 * ImageName.length();
		pImageName = (char*)_alloca( BufSize + 2 );
		size_t res = wcstombs( pImageName, ImageName.c_str(), BufSize );
		pImageName[BufSize] = 0;
		if( res == -1 )
		{
			_ASSERTE( !_T("Module name has bad format.") );
			m_LastError = ERROR_INVALID_PARAMETER;
			return false;
		}
	}
#else
	const char* pImageName = ImageName.empty() ? 0 : ImageName.c_str();
#endif //_UNICODE


	// Load symbols for the module
#pragma TODO("replace SymLoadModule64 with SymLoadModuleEx ")
	DWORD64 rv = SymLoadModule64( m_hProcess, hFile, pImageName, NULL, ModBase, ModSize );

	if( rv == 0 )
	{
		m_LastError = GetLastError();
		_ASSERTE( !_T("SymLoadModule64() failed.") );
		return false;
	}


	// Complete 

	return true;
}
开发者ID:cosmicb0y,项目名称:vesper,代码行数:56,代码来源:SymbolEngine.cpp

示例3: SetText

void CTextEdit::SetText(const TString &text)
{
    if(!text.empty())
    {
        m_strText = text;
    }
}
开发者ID:nobitalwm,项目名称:FCEngine,代码行数:7,代码来源:TextEdit.cpp

示例4: Create

/*****************************************************************************
** Procedure:  CEventFactory::Create
**
** Arguments: 'strCommand' - String from PBX
**
** Returns:    Derivative CEventBlock for this PBX command
**
** Description: This function creates a new CEventBlock object
**
*****************************************************************************/
CEventBlock* CEventFactory::Create(TString& strData)
{
	// We should have at least one object in our event list
	_TSP_ASSERT(m_pHead != NULL);

	// The first element is always the command.
	TString strCommand = GetNextElem(strData);
	if (strCommand.empty())
		return NULL;

	// Uppercase the command string
	CharUpperBuff(&strCommand[0], strCommand.length());

	// Convert the command string into its numerical equivelant for
	// quick lookup.
	enum CEventBlock::PBXEvent evtType = CEventBlock::Unknown;
	for (int i = 0; g_StringToEvent[i].pszEvent != NULL; i++)
	{
		if (!strCommand.compare(g_StringToEvent[i].pszEvent))
		{
			evtType = g_StringToEvent[i].evtType;
			break;
		}
	}

	// If the event is unknown, it means we have not completely defined
	// the interface and have a problem!
	_TSP_ASSERT (evtType != CEventBlock::Unknown);

	// Return the event object which encapsulates this command
	return m_pHead->Create(evtType, strData);

}// CEventFactory::Create
开发者ID:junction,项目名称:jn-tapi,代码行数:43,代码来源:EventTypes.cpp

示例5: mode_fit

int mode_fit(const int argc, const char* argv[]) {
    ConfigureMalloc();

    NCatboostOptions::TPoolLoadParams poolLoadOptions;
    TString paramsFile;
    NJson::TJsonValue catBoostFlatJsonOptions;
    ParseCommandLine(argc, argv, &catBoostFlatJsonOptions, &paramsFile, &poolLoadOptions);
    NJson::TJsonValue catBoostJsonOptions;
    NJson::TJsonValue outputOptionsJson;
    if (!paramsFile.empty()) {
        CB_ENSURE(NFs::Exists(paramsFile), "Params file does not exists " << paramsFile);
        TIFStream in(paramsFile);
        NJson::TJsonValue fromFileParams;
        CB_ENSURE(NJson::ReadJsonTree(&in, &fromFileParams), "can't parse params file");
        NCatboostOptions::PlainJsonToOptions(fromFileParams, &catBoostJsonOptions, &outputOptionsJson);
    }
    NCatboostOptions::PlainJsonToOptions(catBoostFlatJsonOptions, &catBoostJsonOptions, &outputOptionsJson);
    poolLoadOptions.Validate();

    auto taskType = NCatboostOptions::GetTaskType(catBoostJsonOptions);
    THolder<IModelTrainer> modelTrainerHolder;
    NCatboostOptions::TOutputFilesOptions outputOptions(taskType);
    outputOptions.Load(outputOptionsJson);

    const bool isGpuDeviceType = taskType == ETaskType::GPU;
    if (isGpuDeviceType && TTrainerFactory::Has(ETaskType::GPU)) {
        modelTrainerHolder = TTrainerFactory::Construct(ETaskType::GPU);
    } else {
        CB_ENSURE(!isGpuDeviceType, "GPU Device not found.");

        modelTrainerHolder = TTrainerFactory::Construct(ETaskType::CPU);
    }
    modelTrainerHolder->TrainModel(poolLoadOptions, outputOptions, catBoostJsonOptions);
    return 0;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:35,代码来源:mode_fit.cpp

示例6: ExamLanguageText

bool CEditLanguageDialog::ExamLanguageText(const TString& strEnum, bool bCheckExist)
{
    bool bRet = false;
    std::map<TString, std::map<ELanguageType, TString> >& languageMap = CLanguageManager::GetInstance()->GetLanguageMap();
    if (strEnum.empty())
    {
        wxMessageBox(_T("enum string Can't be empty!"));
    }
    else if (strEnum.find("eLTT_") != 0)
    {
        wxMessageBox(_T("enum string should begin with eLTT_"));
    }
    else if (!((wxString)strEnum).IsAscii())
    {
        wxMessageBox(_T("enum string should be all ascii!"));
    }
    else if (strEnum.find(_T(' '), 0) != 0xFFFFFFFF)
    {
        wxMessageBox(_T("enum string can't contain space!"));
    }
    else if (bCheckExist && languageMap.find(strEnum) != languageMap.end())
    {
        wxMessageBox(wxString::Format(_T("enum string %s already exists!"), strEnum.c_str()));
    }
    else
    {
        bRet = true;
    }
    return bRet;
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:30,代码来源:EditLanguageDialog.cpp

示例7: GetSceneFileId

uint32_t CSceneManager::GetSceneFileId(const TString& strFileName)
{
    uint32_t uRet = 0xFFFFFFFF;
    if (strFileName.length() > 0)
    {
        CComponentProject* pProject = CEngineCenter::GetInstance()->GetComponentManager()->GetProject();
        TString strFullFileName = strFileName;
#ifdef EDITOR_MODE
        const std::vector<TString>* pFileList = pProject->GetFileList();
        for (size_t i = 0; i < pFileList->size(); ++i)
        {
            const TString& strFilePath = pFileList->at(i);
            int pos = strFilePath.rfind(strFileName);
            if (pos != -1 && strFilePath.length() - pos == strFileName.length())
            {
                strFullFileName = pFileList->at(i);
                break;
            }
        }
#endif
        BEATS_ASSERT(!strFullFileName.empty());
        strFullFileName = CStringHelper::GetInstance()->ToLower(strFullFileName);
        uRet = pProject->GetComponentFileId(strFullFileName);
    }
    return uRet;
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:26,代码来源:SceneManager.cpp

示例8: uniformsHeader

TString UniformHLSL::uniformsHeader(ShShaderOutput outputType, const ReferencedSymbols &referencedUniforms)
{
    TString uniforms;

    for (ReferencedSymbols::const_iterator uniformIt = referencedUniforms.begin();
         uniformIt != referencedUniforms.end(); uniformIt++)
    {
        const TIntermSymbol &uniform = *uniformIt->second;
        const TType &type = uniform.getType();
        const TString &name = uniform.getSymbol();

        int registerIndex = declareUniformAndAssignRegister(type, name);

        if (outputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType()))   // Also declare the texture
        {
            uniforms += "uniform " + SamplerString(type) + " sampler_" + DecorateUniform(name, type) + ArrayString(type) +
                        " : register(s" + str(registerIndex) + ");\n";

            uniforms += "uniform " + TextureString(type) + " texture_" + DecorateUniform(name, type) + ArrayString(type) +
                        " : register(t" + str(registerIndex) + ");\n";
        }
        else
        {
            const TStructure *structure = type.getStruct();
            const TString &typeName = (structure ? QualifiedStructNameString(*structure, false, false) : TypeString(type));

            const TString &registerString = TString("register(") + UniformRegisterPrefix(type) + str(registerIndex) + ")";

            uniforms += "uniform " + typeName + " " + DecorateUniform(name, type) + ArrayString(type) + " : " + registerString + ";\n";
        }
    }

    return (uniforms.empty() ? "" : ("// Uniforms\n\n" + uniforms));
}
开发者ID:rtwf,项目名称:skia-externals,代码行数:34,代码来源:UniformHLSL.cpp

示例9: QuoteForHelp

// Like TString::Quote(), but does not quote digits-only string
static TString QuoteForHelp(const TString& str) {
    if (str.empty())
        return str.Quote();
    for (size_t i = 0; i < str.size(); ++i) {
        if (!isdigit(str[i]))
            return str.Quote();
    }
    return str;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:10,代码来源:last_getopt_opts.cpp

示例10: interfaceBlocksHeader

TString UniformHLSL::interfaceBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks)
{
    TString interfaceBlocks;

    for (ReferencedSymbols::const_iterator interfaceBlockIt = referencedInterfaceBlocks.begin();
         interfaceBlockIt != referencedInterfaceBlocks.end(); interfaceBlockIt++)
    {
        const TType &nodeType = interfaceBlockIt->second->getType();
        const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
        const TFieldList &fieldList = interfaceBlock.fields();

        unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
        InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize, mInterfaceBlockRegister);
        for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
        {
            const TField &field = *fieldList[typeIndex];
            const TString &fullFieldName = InterfaceBlockFieldName(interfaceBlock, field);

            bool isRowMajor = (field.type()->getLayoutQualifier().matrixPacking == EmpRowMajor);
            GetInterfaceBlockFieldTraverser traverser(&activeBlock.fields, isRowMajor);
            traverser.traverse(*field.type(), fullFieldName);
        }

        mInterfaceBlockRegisterMap[activeBlock.name] = mInterfaceBlockRegister;
        mInterfaceBlockRegister += std::max(1u, arraySize);

        BlockLayoutType blockLayoutType = GetBlockLayoutType(interfaceBlock.blockStorage());
        SetBlockLayout(&activeBlock, blockLayoutType);

        if (interfaceBlock.matrixPacking() == EmpRowMajor)
        {
            activeBlock.isRowMajorLayout = true;
        }

        mActiveInterfaceBlocks.push_back(activeBlock);

        if (interfaceBlock.hasInstanceName())
        {
            interfaceBlocks += interfaceBlockStructString(interfaceBlock);
        }

        if (arraySize > 0)
        {
            for (unsigned int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
            {
                interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex + arrayIndex, arrayIndex);
            }
        }
        else
        {
            interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex, GL_INVALID_INDEX);
        }
    }

    return (interfaceBlocks.empty() ? "" : ("// Interface Blocks\n\n" + interfaceBlocks));
}
开发者ID:rtwf,项目名称:skia-externals,代码行数:56,代码来源:UniformHLSL.cpp

示例11: LoadFromFile

bool IniFile::LoadFromFile(const TString FileName) {
    bool result = false;
    Platform& platform = Platform::GetInstance();

    std::list<TString> contents = platform.LoadFromFile(FileName);

    if (contents.empty() == false) {
        bool found = false;

        // Determine the if file is an INI file or property file. Assign FDefaultSection if it is
        // an INI file. Otherwise FDefaultSection is NULL.
        for (std::list<TString>::const_iterator iterator = contents.begin(); iterator != contents.end(); iterator++) {
            TString line = *iterator;

            if (line[0] == ';') {
                // Semicolon is a comment so ignore the line.
                continue;
            }
            else {
                if (line[0] == '[') {
                    found = true;
                }

                break;
            }
        }

        if (found == true) {
            TString sectionName;

            for (std::list<TString>::const_iterator iterator = contents.begin(); iterator != contents.end(); iterator++) {
                TString line = *iterator;

                if (line[0] == ';') {
                    // Semicolon is a comment so ignore the line.
                    continue;
                }
                else if (line[0] == '[' && line[line.length() - 1] == ']') {
                    sectionName = line.substr(1, line.size() - 2);
                }
                else if (sectionName.empty() == false) {
                    TString name;
                    TString value;

                    if (Helpers::SplitOptionIntoNameValue(line, name, value) == true) {
                        Append(sectionName, name, value);
                    }
                }
            }

            result = true;
        }
    }

    return result;
}
开发者ID:puce77,项目名称:openjfx-9-dev-rt,代码行数:56,代码来源:IniFile.cpp

示例12: SetAnimationName

void CControl::SetAnimationName( const TString& animationName )
{
    m_strPressAnimationName = animationName;
    if (!animationName.empty() && m_pPressAnimation != NULL)
    {
        CNodeAnimationData* pData = CNodeAnimationManager::GetInstance()->GetNodeAnimationData(animationName);
        BEATS_ASSERT(pData != NULL);
        m_pPressAnimation->SetData(pData);
    }
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:10,代码来源:Control.cpp

示例13: hash

// static
TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
{
    if (hashFunction == NULL || name.empty())
        return name;
    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
    TStringStream stream;
    stream << HASHED_NAME_PREFIX << std::hex << number;
    TString hashedName = stream.str();
    return hashedName;
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:11,代码来源:Intermediate.cpp

示例14: hashName

TString TOutputGLSLBase::hashName(const TString& name)
{
    if (mHashFunction == NULL || name.empty())
        return name;
    NameMap::const_iterator it = mNameMap.find(name.c_str());
    if (it != mNameMap.end())
        return it->second.c_str();
    TString hashedName = TIntermTraverser::hash(name, mHashFunction);
    mNameMap[name.c_str()] = hashedName.c_str();
    return hashedName;
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:11,代码来源:OutputGLSLBase.cpp

示例15: SwitchSceneAsync

bool CSceneManager::SwitchSceneAsync(const TString& strFileName, bool UnloadBeforeLoad)
{
    SceneSwithNotify();
    BEATS_ASSERT(!strFileName.empty(), "File name can't be empty.");
    BEATS_ASSERT(m_bSwitchingSceneState == false);
    uint32_t uFileId = GetSceneFileId(strFileName);
    BEATS_ASSERT(uFileId != 0xFFFFFFFF);
    m_pSwitchSceneTask->SetUnloadBeforeLoad(UnloadBeforeLoad);
    m_pSwitchSceneTask->SetTargetSceneFileId(uFileId);
    CTaskManager::GetInstance()->AddTask(m_pSwitchSceneTask, true);
    return true;
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:12,代码来源:SceneManager.cpp


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