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


C++ wstring::append方法代码示例

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


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

示例1: GetVideoInfoURL

HRESULT URLParser::GetVideoInfoURL(URLParser::VIDEO_URL_PARSER eVideoURLParser, std::wstring& wstrURL, std::wstring& wstrVideoURL)
{
    HRESULT hr          = E_FAIL;
    int     iVdoIDStart = -1;
    int     iVdoIDEnd   = -1;
    std::wstring wstrVideoID;
    if(std::wstring::npos != (iVdoIDStart = wstrURL.find(L"v=")))
    {
        iVdoIDStart += wcslen(L"v=");
        iVdoIDEnd = wstrURL.find(L"&", iVdoIDStart);
        if(std::wstring::npos != iVdoIDEnd)
        {
            // pick start to end
            wstrVideoID = wstrURL.substr(iVdoIDStart, (iVdoIDEnd - iVdoIDStart));
        }
        else
        {
            // pick the entire string
            wstrVideoID = wstrURL.substr(iVdoIDStart, (wstrURL.length() - iVdoIDStart));
        }
    }
    if(0 != wstrVideoID.length())
    {
        wstrVideoURL.clear();
        wstrVideoURL.assign(PRE_VIDEO_ID_URL_STRING);
        wstrVideoURL.append(wstrVideoID);
        wstrVideoURL.append(POST_VIDEO_ID_URL_STRING);
        hr = S_OK;
    }
    return hr;
}
开发者ID:navtez,项目名称:YoutubeDownloader,代码行数:31,代码来源:URLParser.cpp

示例2: CopyFiles

/*
** Copies files and folders from one location to another.
**
*/
bool System::CopyFiles(std::wstring from, std::wstring to, bool bMove)
{
	// If given "from" path ends with path separator, remove it (Workaround for XP: error code 1026)
	size_t len;
	while (len = from.size(), len > 0 && PathUtil::IsSeparator(from[len - 1]))
	{
		from.resize(len - 1);
	}

	// The strings must end with double \0
	from.append(1, L'\0');
	to.append(1, L'\0');

	SHFILEOPSTRUCT fo =
	{
		nullptr,
		bMove ? FO_MOVE : FO_COPY,
		from.c_str(),
		to.c_str(),
		FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
	};

	int result = SHFileOperation(&fo);
	if (result != 0)
	{
		LogErrorF(L"Copy error: From %s to %s (%i)", from.c_str(), to.c_str(), result);
		return false;
	}
	return true;
}
开发者ID:boxmein,项目名称:rainmeter,代码行数:34,代码来源:System.cpp

示例3: FormatPointer

    HRESULT FormatPointer( IValueBinder* binder, const DataObject& objVal, std::wstring& outStr )
    {
        _ASSERT( objVal._Type->IsPointer() );

        HRESULT hr = S_OK;
        RefPtr<Type>    pointed = objVal._Type->AsTypeNext()->GetNext();

        hr = FormatAddress( objVal.Value.Addr, objVal._Type, outStr );
        if ( FAILED( hr ) )
            return hr;

        if ( pointed->IsChar() )
        {
            bool    foundTerm = false;

            outStr.append( L" \"" );

            FormatString( binder, objVal.Value.Addr, pointed->GetSize(), false, 0, outStr, foundTerm );
            // don't worry about an error here, we still want to show the address

            if ( foundTerm )
                outStr.append( 1, L'"' );
        }

        return S_OK;
    }
开发者ID:aBothe,项目名称:MagoWrapper,代码行数:26,代码来源:FormatValue.cpp

示例4:

bool UTF8Charset::decode(std::wstring &result, const std::string &bytes, int offset, int length) {
	
	result.clear();
	
	unsigned char b1, b2, b3, b4;
	
	for (int i = 0; i < length; ) {

		b1 = bytes[i++] & 0xFF;
		switch (UTF8_BYTES[b1]) {
			case 1:
				result.append(1, b1);
				break;
			case 2:
				b2 = bytes[i++];
				result.append(1, ((b1 & 0x1f) << 6) | (b2 & 0x3f));
				break;
			case 3:
				b2 = bytes[i++];
				b3 = bytes[i++];
				result.append(1, ((b1 & 0x1f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x3f));
				break;
			case 4:
				b2 = bytes[i++];
				b3 = bytes[i++];
				b4 = bytes[i++];
				result.append(1, (((b1 & 0x1f) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x1f) << 6) | (b4 & 0x1f) - 0x10000) / 0x400 + 0xd800);
				break;
		}

	}
	return true;
}
开发者ID:snakemunch,项目名称:SMC,代码行数:33,代码来源:UTF8Charset.cpp

示例5: EvaluateNext

    HRESULT EEDEnumPointer::EvaluateNext( 
        const EvalOptions& options, 
        EvalResult& result,
        std::wstring& name,
        std::wstring& fullName )
    {
        if ( mCountDone >= GetCount() )
            return E_FAIL;

        HRESULT hr = S_OK;
        RefPtr<IEEDParsedExpr>  parsedExpr;

        name.clear();
        fullName.clear();
        fullName.append( L"*(" );
        fullName.append( mParentExprText );
        fullName.append( 1, L')' );

        hr = ParseText( fullName.c_str(), mTypeEnv, mStrTable, parsedExpr.Ref() );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Bind( options, mBinder );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Evaluate( options, mBinder, result );
        if ( FAILED( hr ) )
            return hr;

        mCountDone++;

        return S_OK;
    }
开发者ID:Kentorix,项目名称:MagoWrapper,代码行数:34,代码来源:EnumValues.cpp

示例6: ToString

 void TypeAArray::ToString( std::wstring& str )
 {
     Next->ToString( str );
     str.append( L"[" );
     Index->ToString( str );
     str.append( L"]" );
 }
开发者ID:Stretto,项目名称:mago,代码行数:7,代码来源:Type.cpp

示例7: AppendStatsValue

/*
** Appends "key=value\0" to given string.
**
*/
inline void AppendStatsValue(std::wstring& data, const WCHAR* key, size_t key_len, const WCHAR* value, size_t value_len)
{
	data.append(key, key_len);
	data += L'=';
	data.append(value, value_len);
	data += L'\0';
}
开发者ID:testaccountx,项目名称:testrepo,代码行数:11,代码来源:MeasureNet.cpp

示例8: FormatSArray

    HRESULT FormatSArray( IValueBinder* binder, Address addr, Type* type, int radix, std::wstring& outStr )
    {
        UNREFERENCED_PARAMETER( radix );
        _ASSERT( type->IsSArray() );

        ITypeSArray*    arrayType = type->AsTypeSArray();

        if ( arrayType == NULL )
            return E_FAIL;

        if ( arrayType->GetElement()->IsChar() )
        {
            bool    foundTerm = true;

            outStr.append( L"\"" );

            FormatString( 
                binder, 
                addr, 
                arrayType->GetElement()->GetSize(),
                true,
                arrayType->GetLength(),
                outStr,
                foundTerm );

            outStr.append( 1, L'"' );
        }

        return S_OK;
    }
开发者ID:aBothe,项目名称:MagoWrapper,代码行数:30,代码来源:FormatValue.cpp

示例9: quote_argv_winapi

// https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
// This routine appends the given argument to a command line such that CommandLineToArgvW will return the argument string unchanged.
// Arguments in a command line should be separated by spaces; this function does not add these spaces.
// Argument    - Supplies the argument to encode.
// CommandLine - Supplies the command line to which we append the encoded argument string.
static void quote_argv_winapi(const std::wstring &argument, std::wstring &commmand_line_out)
{
	// Don't quote unless we actually need to do so --- hopefully avoid problems if programs won't parse quotes properly.
	if (argument.empty() == false && argument.find_first_of(L" \t\n\v\"") == argument.npos)
		commmand_line_out.append(argument);
	else {
		commmand_line_out.push_back(L'"');
		for (auto it = argument.begin(); ; ++ it) {
			unsigned number_backslashes = 0;
			while (it != argument.end() && *it == L'\\') {
				++ it;
				++ number_backslashes;
			}
			if (it == argument.end()) {
				// Escape all backslashes, but let the terminating double quotation mark we add below be interpreted as a metacharacter.
				commmand_line_out.append(number_backslashes * 2, L'\\');
				break;
			} else if (*it == L'"') {
				// Escape all backslashes and the following double quotation mark.
				commmand_line_out.append(number_backslashes * 2 + 1, L'\\');
				commmand_line_out.push_back(*it);
			} else {
				// Backslashes aren't special here.
				commmand_line_out.append(number_backslashes, L'\\');
				commmand_line_out.push_back(*it);
			}
		}
		commmand_line_out.push_back(L'"');
	}
}
开发者ID:prusa3d,项目名称:Slic3r,代码行数:35,代码来源:PostProcessor.cpp

示例10: ResourcesDirMakeUrl

void CSalsitaExtensionHelper::ResourcesDirMakeUrl(const wchar_t *resourcesDir, const wchar_t *relativeUrl, std::wstring &pageUrl)
{
  pageUrl.assign(L"file:///");
  pageUrl.append(resourcesDir);
  ResourcesDirNormalize(pageUrl);
  pageUrl.append(relativeUrl);
  std::replace(pageUrl.begin(), pageUrl.end(), L'\\', L'/');
}
开发者ID:ondravondra,项目名称:adobo-ie,代码行数:8,代码来源:SalsitaExtensionHelper.cpp

示例11: GetServiceInfo

//Get infomation of service
size_t __stdcall GetServiceInfo()
{
//Get service information
	SC_HANDLE SCM = nullptr, Service = nullptr;
	DWORD nResumeHandle = 0;

	if((SCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == nullptr)
		return EXIT_FAILURE;
 
	Service = OpenService(SCM, LOCALSERVERNAME, SERVICE_ALL_ACCESS);
	if(Service == nullptr)
		return EXIT_FAILURE;

	LPQUERY_SERVICE_CONFIG ServicesInfo = (LPQUERY_SERVICE_CONFIG)LocalAlloc(LPTR, PACKET_MAXSIZE*4); //Max buffer of QueryServiceConfig() is 8KB/8192 Bytes.
	if (ServicesInfo == nullptr)
		return EXIT_FAILURE;

	if (QueryServiceConfig(Service, ServicesInfo, PACKET_MAXSIZE*4, &nResumeHandle) == FALSE)
	{
		LocalFree(ServicesInfo);
		return EXIT_FAILURE;
	}

	Path = ServicesInfo->lpBinaryPathName;
	LocalFree(ServicesInfo);

//Path process
	size_t Index = Path.rfind(_T("\\"));
	static const WCHAR wBackslash[] = _T("\\");
	Path.erase(Index + 1, Path.length());

	for (Index = 0;Index < Path.length();Index++)
	{
		if (Path[Index] == _T('\\'))
		{
			Path.insert(Index, wBackslash);
			Index++;
		}
	}

//Get path of error log file and delete the old one
	ErrorLogPath.append(Path);
	ErrorLogPath.append(_T("Error.log"));
	DeleteFile(ErrorLogPath.c_str());
	Parameter.PrintError = true;

//Winsock initialization
	WSADATA WSAData = {0};
	if (WSAStartup(MAKEWORD(2, 2), &WSAData) != 0 || LOBYTE(WSAData.wVersion) != 2 || HIBYTE(WSAData.wVersion) != 2)
	{
		PrintError(Winsock_Error, _T("Winsock initialization failed"), WSAGetLastError(), NULL);

		WSACleanup();
		return EXIT_FAILURE;
	}

	return EXIT_SUCCESS;
}
开发者ID:AstroProfundis,项目名称:pcap_dnsproxy,代码行数:59,代码来源:Service.cpp

示例12: GenerateSearchNameWild

void GenerateSearchNameWild(const std::wstring& aFileName, std::wstring& aSearchNameWild)
{
	std::wstring unadornedFileName;
	GetUnadornedFileName(aFileName, unadornedFileName);

	aSearchNameWild = StringUtils::Name(unadornedFileName);
	aSearchNameWild.append(KAdornedWildCharString);
	aSearchNameWild.append(StringUtils::Ext(unadornedFileName));
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:9,代码来源:adornedutilities.cpp

示例13: StorageClassToString

    void StorageClassToString( StorageClass storage, std::wstring& str )
    {
        if ( (storage & STCconst) != 0 )
            str.append( L"const " );

        if ( (storage & STCimmutable) != 0 )
            str.append( L"immutable " );

        if ( (storage & STCshared) != 0 )
            str.append( L"shared " );

        if ( (storage & STCin) != 0 )
            str.append( L"in " );

        if ( (storage & STCout) != 0 )
            str.append( L"out " );

        // it looks like ref is preferred over inout
        if ( (storage & STCref) != 0 )
            str.append( L"ref " );

        if ( (storage & STClazy) != 0 )
            str.append( L"lazy " );

        if ( (storage & STCscope) != 0 )
            str.append( L"scope " );

        if ( (storage & STCfinal) != 0 )
            str.append( L"final " );

        // TODO: any more storage classes?
    }
开发者ID:Stretto,项目名称:mago,代码行数:32,代码来源:Type.cpp

示例14: FormatDArray

    HRESULT FormatDArray( IValueBinder* binder, DArray array, Type* type, int radix, std::wstring& outStr )
    {
        _ASSERT( type->IsDArray() );

        HRESULT         hr = S_OK;
        ITypeDArray*    arrayType = type->AsTypeDArray();

        if ( arrayType == NULL )
            return E_FAIL;

        outStr.append( L"{length=" );

        hr = FormatInt( array.Length, arrayType->GetLengthType(), radix, outStr );
        if ( FAILED( hr ) )
            return hr;

        if ( !arrayType->GetElement()->IsChar() )
        {
            outStr.append( L" ptr=" );

            hr = FormatAddress( array.Addr, arrayType->GetPointerType(), outStr );
            if ( FAILED( hr ) )
                return hr;
        }

        if ( arrayType->GetElement()->IsChar() )
        {
            bool        foundTerm = true;
            uint32_t    len = MaxStringLen;

            // cap it somewhere under the range of a long
            // do it this way, otherwise only truncating could leave us with a tiny array
            // which would not be useful

            if ( array.Length < MaxStringLen )
                len = (uint32_t) array.Length;

            outStr.append( L" \"" );

            FormatString( 
                binder, 
                array.Addr, 
                arrayType->GetElement()->GetSize(),
                true,
                len,
                outStr,
                foundTerm );

            outStr.append( 1, L'"' );
        }

        outStr.append( 1, L'}' );

        return S_OK;
    }
开发者ID:aBothe,项目名称:MagoWrapper,代码行数:55,代码来源:FormatValue.cpp

示例15: FormatBool

    HRESULT FormatBool( const DataObject& objVal, std::wstring& outStr )
    {
        if ( objVal.Value.UInt64Value == 0 )
        {
            outStr.append( L"false" );
        }
        else
        {
            outStr.append( L"true" );
        }

        return S_OK;
    }
开发者ID:aBothe,项目名称:MagoWrapper,代码行数:13,代码来源:FormatValue.cpp


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