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


C++ CStdStringW::c_str方法代码示例

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


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

示例1: Exists

bool CWINFileSMB::Exists(const CURL& url)
{
    CStdString strFile = GetLocal(url);
    URIUtils::RemoveSlashAtEnd(strFile);
    CStdStringW strWFile;
    g_charsetConverter.utf8ToW(strFile, strWFile, false);
    DWORD attributes = GetFileAttributesW(strWFile.c_str());
    if(attributes != INVALID_FILE_ATTRIBUTES)
        return true;

    DWORD err = GetLastError();
    if(err != ERROR_ACCESS_DENIED)
        return false;

    XFILE::CWINSMBDirectory smb;
    if(smb.ConnectToShare(url) == false)
        return false;

    attributes = GetFileAttributesW(strWFile.c_str());

    if(attributes == INVALID_FILE_ATTRIBUTES)
        return false;

    return true;
}
开发者ID:nikkpap,项目名称:SPMC,代码行数:25,代码来源:WINFileSMB.cpp

示例2: Open

//*********************************************************************************************
bool CWINFileSMB::Open(const CURL& url)
{
    CStdString strFile = GetLocal(url);

    CStdStringW strWFile;
    g_charsetConverter.utf8ToW(strFile, strWFile, false);
    m_hFile.attach(CreateFileW(strWFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));

    if (!m_hFile.isValid())
    {
        if(GetLastError() == ERROR_FILE_NOT_FOUND)
            return false;

        XFILE::CWINSMBDirectory smb;
        smb.ConnectToShare(url);
        m_hFile.attach(CreateFileW(strWFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));
        if (!m_hFile.isValid())
        {
            CLog::Log(LOGERROR,"CWINFileSMB: Unable to open file %s Error: %d", strFile.c_str(), GetLastError());
            return false;
        }
    }

    m_i64FilePos = 0;
    Seek(0, SEEK_SET);

    return true;
}
开发者ID:nikkpap,项目名称:SPMC,代码行数:29,代码来源:WINFileSMB.cpp

示例3: OpenForWrite

//*********************************************************************************************
bool CWINFileSMB::OpenForWrite(const CURL& url, bool bOverWrite)
{
    CStdString strPath = GetLocal(url);

    CStdStringW strWPath;
    g_charsetConverter.utf8ToW(strPath, strWPath, false);
    m_hFile.attach(CreateFileW(strWPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));

    if (!m_hFile.isValid())
    {
        if(GetLastError() == ERROR_FILE_NOT_FOUND)
            return false;

        XFILE::CWINSMBDirectory smb;
        smb.ConnectToShare(url);
        m_hFile.attach(CreateFileW(strWPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
        if (!m_hFile.isValid())
        {
            CLog::Log(LOGERROR,"CWINFileSMB: Unable to open file for writing '%s' Error '%d%",strPath.c_str(), GetLastError());
            return false;
        }
    }

    m_i64FilePos = 0;
    Seek(0, SEEK_SET);

    return true;
}
开发者ID:nikkpap,项目名称:SPMC,代码行数:29,代码来源:WINFileSMB.cpp

示例4: Download

void DominoDocArtifact::Download()
{
   DominoDoc::IDocumentPtr spDocument = GetDocument();   
   CStdStringW workingFileName = CTempFileManager::GetTempFileName();
   spDocument->GetContents(workingFileName.c_str());
   m_workingFileName = workingFileName.c_str();

   Log(_T("The working file [%S] was downloaded from the Domino.Doc library [%S] as document [%S]"), m_workingFileName.c_str(), m_libraryUrl.c_str(), m_documentId.c_str());
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:DominoDocArtifact.cpp

示例5: Rename

bool CWINFileSMB::Rename(const CURI& url, const CURI& urlnew)
{
  CStdString strFile=GetLocal(url);
  CStdString strNewFile=GetLocal(urlnew);

  CStdStringW strWFile;
  CStdStringW strWNewFile;
  g_charsetConverter.utf8ToW(strFile, strWFile, false);
  g_charsetConverter.utf8ToW(strNewFile, strWNewFile, false);
  return ::MoveFileW(strWFile.c_str(), strWNewFile.c_str()) ? true : false;
}
开发者ID:flyingtime,项目名称:boxee,代码行数:11,代码来源:WINFileSMB.cpp

示例6: Rename

bool CHDFile::Rename(const CURL& url, const CURL& urlnew)
{
    CStdString strFile=GetLocal(url);
    CStdString strNewFile=GetLocal(urlnew);

#ifdef _WIN32
    CStdStringW strWFile;
    CStdStringW strWNewFile;
    g_charsetConverter.utf8ToW(strFile, strWFile, false);
    g_charsetConverter.utf8ToW(strNewFile, strWNewFile, false);
    return ::MoveFileW(strWFile.c_str(), strWNewFile.c_str()) ? true : false;
#else
    return ::MoveFile(strFile.c_str(), strNewFile.c_str()) ? true : false;
#endif
}
开发者ID:BlakeOrth,项目名称:xbmc,代码行数:15,代码来源:HDFile.cpp

示例7: sizeof

void CCharsetConverter::utf16BEtoUTF8(const CStdStringW& strSource, CStdStringA &strDest)
{
  if (m_iconvUtf16BEtoUtf8 == (iconv_t) - 1)
    m_iconvUtf16BEtoUtf8 = iconv_open("UTF-8", "UTF-16BE");

  if (m_iconvUtf16BEtoUtf8 != (iconv_t) - 1)
  {
    size_t inBytes  = (strSource.length() + 1) * sizeof(wchar_t);
    size_t outBytes = (strSource.length() + 1) * 4;
    const char *src = (const char*) strSource.c_str();
    char       *dst = strDest.GetBuffer(outBytes);

    if (iconv_const(m_iconvUtf16BEtoUtf8, &src, &inBytes, &dst, &outBytes))
    {
      CLog::Log(LOGERROR, "%s failed", __FUNCTION__);
      strDest.ReleaseBuffer();
      strDest = strSource;
      return;
    }

    if (iconv(m_iconvUtf16BEtoUtf8, NULL, NULL, &dst, &outBytes))
    {
      CLog::Log(LOGERROR, "%s failed cleanup", __FUNCTION__);
      strDest.ReleaseBuffer();
      strDest = strSource;
      return;
    }
    strDest.ReleaseBuffer();
  }
}
开发者ID:jimmyswimmy,项目名称:plex,代码行数:30,代码来源:CharsetConverter.cpp

示例8: IsLoggingSystemEnabled

PerformanceMonitor::PerformanceMonitor(const wchar_t* function) :
	m_function(function)	
{	
	try
	{
		if(PerformanceMonitor::m_timer == PerformanceMonitor::UnknownTimer)
		{			
			DetermineTimer();							
			PerformanceMonitor::m_enableLogging = IsLoggingSystemEnabled();
		}

		if(!PerformanceMonitor::m_enableLogging)
			return;

		if(PerformanceMonitor::m_timer == PerformanceMonitor::HighResolutionTimer)
				QueryPerformanceCounter(&m_start);
		else
			m_startClock = clock();

		CStdStringW sFunction;
		sFunction.Format(_T("Starting %s"), m_function.c_str());
		LOG_WS_INFO(sFunction.c_str());		
	}
	catch(...)
	{
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:PerformanceMonitor.cpp

示例9: dllFindFirstFileA

extern "C" HANDLE WINAPI dllFindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
{
  char* p = strdup(lpFileName);
  CORRECT_SEP_STR(p);

  // change default \\*.* into \\* which the xbox is using
  char* e = strrchr(p, '.');
  if (e != NULL && strlen(e) > 1 && e[1] == '*')
  {
    e[0] = '\0';
  }

#ifdef TARGET_WINDOWS
  struct _WIN32_FIND_DATAW FindFileDataW;
  CStdStringW strwfile;
  g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(p), strwfile, false);
  HANDLE res = FindFirstFileW(strwfile.c_str(), &FindFileDataW);
  if (res != INVALID_HANDLE_VALUE)
    to_WIN32_FIND_DATA(&FindFileDataW, lpFindFileData);
#else
  HANDLE res = FindFirstFile(CSpecialProtocol::TranslatePath(p).c_str(), lpFindFileData);
#endif
  free(p);
  return res;
}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:25,代码来源:emu_kernel32.cpp

示例10: GetFileName

bool Win32DllLoader::Load()
{
  if (m_dllHandle != NULL)
    return true;

  CStdString strFileName = GetFileName();
  CLog::Log(LOGDEBUG, "%s(%s)\n", __FUNCTION__, strFileName.c_str());

  CStdStringW strDllW;
  g_charsetConverter.utf8ToW(_P(strFileName), strDllW);
  m_dllHandle = LoadLibraryExW(strDllW.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  if (!m_dllHandle)
  {
    CLog::Log(LOGERROR, "%s: Unable to load %s (%d)", __FUNCTION__, strFileName.c_str(), GetLastError());
    return false;
  }

  // handle functions that the dll imports
  if (NeedsHooking(strFileName.c_str()))
    OverrideImports(strFileName);
  else
    bIsSystemDll = true;

  return true;
}
开发者ID:marlboroman,项目名称:xbmc,代码行数:25,代码来源:Win32DllLoader.cpp

示例11: _T

_bstr_t GetString(const OcText& value)
{
   if(!value.getBuffer() || (1 > value.getCharacterCount()))
      return _T("");
   
   switch(value.getCharacterEncoding())
   {
      case ENCODING_NONE:
      {
         CStdString val((const TCHAR*)value.getBuffer());
         val.Trim();
         val.ReleaseBuffer();
         return val.c_str();
      }   
      case ENCODING_UTF16:
      {
         CStdStringW wideVal((const wchar_t*)value.getBuffer());
         wideVal.Trim();
         wideVal.ReleaseBuffer();
         return wideVal.c_str();
      }
      default:
      {
         CStdStringA multiByteVal((LPSTR)value.getBuffer());
         multiByteVal.ReleaseBuffer();
         CStdStringW wideVal = MultiByteSupport::ACPToWide(multiByteVal);
         return wideVal.c_str();
      }
   }
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:30,代码来源:ExcelSchemaSoftDiscoverStrategy.cpp

示例12: DeleteDocument

HRESULT DMSHelper::DeleteDocument(CStdStringW sDocID)
{
	LOG_WS_FUNCTION_SCOPE_MSG(sDocID);

	HRESULT hr = GetDocProvProxy()->DeleteDocument(sDocID.c_str());
	return hr;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:7,代码来源:DMSHelper.cpp

示例13: GetLFSSaveInfo

HRESULT DMSHelper::GetLFSSaveInfo(long lHWnd, const CStdStringW& sFormatString, long lFlags, long* plFormatIndex, WSDocNonCom& docInfo)
{
	LOG_WS_FUNCTION_SCOPE_MSG(docInfo.GetDocId());

	HRESULT  hr = E_FAIL;
	WSDOCUMENTPROVIDERLib::tagWSDOCUMENT wsDocument;
	docInfo.InitializeWSDOCUMENT((WSDOCUMENT*) &wsDocument);

	hr = GetDocProvProxy()->GetLFSSaveInfo(lHWnd, _bstr_t(sFormatString.c_str()), lFlags, plFormatIndex, &wsDocument);
	
	if (SUCCEEDED(hr))
	{
		docInfo = WSDocNonCom((WSDOCUMENT*)&wsDocument);
	}
	else
	{
		CStdString sError;
		sError.Format(_T("hr = %x"), hr);
		LOG_WS_ERROR(sError.c_str());
	}
	// this gets used as a temp file path in many places so we need to _tremove illegal characters
	CStdString sDescription = docInfo.GetDescription();
	Gen::CFilePath::ReplaceIllegalCharsInFilePath(sDescription);
	docInfo.SetDescription(sDescription);
	WSDocCleaner::CleanWSDoc(wsDocument);
	return hr;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:DMSHelper.cpp

示例14: GetModuleHandleW

bool Win32DllLoader::NeedsHooking(const char *dllName)
{
  LibraryLoader *loader = DllLoaderContainer::GetModule(dllName);
  if (loader)
  {
    // may have hooked this already (we can have repeats in the import table)
    for (unsigned int i = 0; i < m_referencedDlls.size(); i++)
    {
      if (loader->GetHModule() == m_referencedDlls[i])
        return false;
    }
  }
  CStdStringW strdllNameW;
  g_charsetConverter.utf8ToW(_P(dllName), strdllNameW, false);
  HMODULE hModule = GetModuleHandleW(strdllNameW.c_str());
  wchar_t filepathW[MAX_PATH];
  GetModuleFileNameW(hModule, filepathW, MAX_PATH);
  CStdString dllPath;
  g_charsetConverter.wToUTF8(filepathW, dllPath);

  // compare this filepath with some special directories
  CStdString xbmcPath = _P("special://xbmc");
  CStdString homePath = _P("special://home");
  CStdString tempPath = _P("special://temp");
  return ((strncmp(xbmcPath.c_str(), dllPath.c_str(), xbmcPath.GetLength()) == 0) ||
    (strncmp(homePath.c_str(), dllPath.c_str(), homePath.GetLength()) == 0) ||
    (strncmp(tempPath.c_str(), dllPath.c_str(), tempPath.GetLength()) == 0));
}
开发者ID:marlboroman,项目名称:xbmc,代码行数:28,代码来源:Win32DllLoader.cpp

示例15: GetFileName

bool Win32DllLoader::Load()
{
  if (m_dllHandle != NULL)
    return true;

  CStdString strFileName = GetFileName();

  CStdStringW strDllW;
  g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(strFileName), strDllW);
  m_dllHandle = LoadLibraryExW(strDllW.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  if (!m_dllHandle)
  {
    LPVOID lpMsgBuf;
    DWORD dw = GetLastError(); 

    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, 0, (LPTSTR) &lpMsgBuf, 0, NULL );
    CLog::Log(LOGERROR, "%s: Failed to load %s with error %d:%s", __FUNCTION__, CSpecialProtocol::TranslatePath(strFileName).c_str(), dw, lpMsgBuf);
    LocalFree(lpMsgBuf);
    return false;
  }

  // handle functions that the dll imports
  if (NeedsHooking(strFileName.c_str()))
    OverrideImports(strFileName);
  else
    bIsSystemDll = true;

  return true;
}
开发者ID:2BReality,项目名称:xbmc,代码行数:29,代码来源:Win32DllLoader.cpp


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