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


C++ nglString::IsEmpty方法代码示例

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


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

示例1: nuiAudioDevice

nuiAudioDevice_DirectSound::nuiAudioDevice_DirectSound(GUID IGuid, GUID OGuid, const nglString& rInName, const nglString& rOutName, const nglString& rInModule, const nglString& rOutModule)
: nuiAudioDevice()
{
  mInName = rInName;
  mOutName = rOutName;
  if (rOutName.IsEmpty())
    mName = rInName;
  else
    mName = rOutName;

  mManufacturer = rOutModule;
  mIsPresent = false;
  mHasInput = false;
  mHasOutput = false;

  mIDeviceID = IGuid;
  mODeviceID = OGuid;

  mpDirectSound = NULL;
  mpDirectSoundCapture = NULL;

  mAPIName = API_NAME;

  mpRingBuffer = NULL;
  mpInputBuffer = NULL;
  mpOutputBuffer = NULL;

  mpProcessingTh = NULL;
  mpOutputTh = NULL;

  mNotifInputEvent[0] = NULL;
  mNotifInputEvent[1] = NULL;
  mNotifOutputEvent[0] = NULL;
  mNotifOutputEvent[1] = NULL;

  HRESULT hr;
  // Get Input device caps:
  hr = DirectSoundCaptureCreate(&mIDeviceID, &mpDirectSoundCapture, NULL);
  if (hr != S_OK || !mpDirectSoundCapture)
  {
    NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_INFO, _T("constructor ERROR : could not create DirectSoundCapture object!\n"));
  }

  // Get Output device caps:
  hr = DirectSoundCreate(&mODeviceID, &mpDirectSound, NULL);
  if (hr != S_OK || !mpDirectSound)
  {
    NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_ERROR, _T("constructor ERROR : could not create DirectSound object!\n")); // if there is no output, consider the device as not valid
    return;
  }


  Init();
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:54,代码来源:nuiAudioDevice_DirectSound.cpp

示例2: Load

bool nuiHTML::Load(nglIStream& rStream, nglTextEncoding OverrideContentsEncoding, const nglString& rSourceURL)
{
  if (!rSourceURL.IsEmpty())
    SetSourceURL(rSourceURL);
  
  int res = -1;
  nglTextEncoding encoding = eUTF8;
  TidyDoc tdoc = NULL;
  {
    HTMLStream strm(rStream);
    tdoc = tidyCreate();
    tidyOptSetBool(tdoc, TidyShowMarkup, no);
    tidyOptSetBool(tdoc, TidyShowWarnings, no);
    tidyOptSetInt(tdoc, TidyShowErrors, 0);
    tidyOptSetBool(tdoc, TidyQuiet, yes);
    tidySetCharEncoding(tdoc, "utf8");
    
    TidyInputSource source;
    tidyInitSource( &source, &strm, &HTMLStream::TidyGetByte, &HTMLStream::TidyUngetByte, &HTMLStream::TidyEOF);
    res = tidyParseSource(tdoc, &source);
    
    if ( res >= 0 )
      res = tidyCleanAndRepair(tdoc);               // Tidy it up!
    if ( res >= 0 )
      res = tidyRunDiagnostics(tdoc);               // Kvetch
  
    if (OverrideContentsEncoding == eEncodingUnknown)
    {
      nglString encoding_string(GetEncodingString(tidyGetRoot(tdoc)));
      
      //ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5 shiftjis
      encoding = nuiGetTextEncodingFromString(encoding_string);
    }
    else
    {
      encoding = OverrideContentsEncoding;
    }
  }
  
  char* pStr = NULL;

  if (encoding != eUTF8)
  {
    // Release the doc to create a new one
    tidyRelease(tdoc);
    
    nglOMemory omem;
    rStream.SetPos(0, eStreamFromStart);
    rStream.PipeTo(omem);
    nglString decoded;
    decoded.Import(omem.GetBufferData(), omem.GetSize(), encoding);
    pStr = decoded.Export(eUTF8);
    nglIMemory imem(pStr, strlen(pStr));
    
    HTMLStream strm(imem);
    tdoc = tidyCreate();
    tidySetCharEncoding(tdoc, "utf8");

    TidyInputSource source;
    tidyInitSource( &source, &strm, &HTMLStream::TidyGetByte, &HTMLStream::TidyUngetByte, &HTMLStream::TidyEOF);
    res = tidyParseSource(tdoc, &source);
    if ( res >= 0 )
      res = tidyCleanAndRepair(tdoc);               // Tidy it up!
    if ( res >= 0 )
      res = tidyRunDiagnostics(tdoc);               // Kvetch
  }    
    
  BuildTree(tdoc, tidyGetRoot(tdoc), eUTF8, mComputeStyle);
  
  tidyRelease(tdoc);
  
  if (pStr)
    free(pStr);
  
  return res < 2;
}
开发者ID:,项目名称:,代码行数:76,代码来源:

示例3: WriteText

int64 nglOStream::WriteText (const nglString& rData)
{
  if (rData.IsEmpty() ||
    ((GetState() != eStreamReady) && (GetState() != eStreamEnd)))
    return 0;

  // Make sure we have a text conversion context
  if (!GetOConv())
    return 0;

  char buffer[BUFFER_SIZE];
  int64 written = 0;
  int32 out_offset = 0;

  do
  {
    int64 bytes;
    const char* data;
    int64 todo;
    int32 buffer_free = BUFFER_SIZE;

    // FIXME!!!!!!!!!!!
    rData.Export(out_offset, buffer, buffer_free, *mpConv);
    switch (mpConv->GetState())
    {
    case eStringConv_OK:
    case eStringConv_NeedOutput:
      break;

    default:
      //SetError() FIXME
      return written;
    }

    data = buffer;
    todo = BUFFER_SIZE - buffer_free;

    // Now write data[0 .. todo-1] with line-ending conversion if necessary
    if (mTextFormat == eTextNone)
    {
      bytes = Write(data, todo, 1);
      if (bytes > 0) written += bytes;
      if (bytes < todo) return written;
    }
    else
    {
      int64 done = 0;
      int64 last_ending, ending = -1;

      while (ending < todo)
      {
        last_ending = ending;
        do
        {
          ending++;
        }
        while ((ending < todo) && (data[ending] != '\n'));

        int64 line_size = ending - last_ending - 1;
        bytes = Write(&(data[last_ending + 1]), line_size, 1);
        if (bytes > 0)
        {
          done += bytes;
          written += bytes;
        }
        if (bytes < line_size) return written;

        if (done < todo)
        {
          switch (mTextFormat)
          {
          case eTextDOS : bytes = Write("\r\n", 1, 2) * 2; break;
          case eTextUnix: bytes = Write("\n", 1, 1); break;
          case eTextMac : bytes = Write("\r", 1, 1); break;
          case eTextZero: bytes = Write("\0", 1, 1); break;
          case eTextNone: break;
          }
          if (bytes > 0)
          {
            done++;
            written += bytes;
          }
          if (bytes < 1) return written;
        }
      }
    }
  }
  while (mpConv->GetState() == eStringConv_NeedOutput);

  return written;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:91,代码来源:nglOStream.cpp

示例4: AddFile

bool nuiZipWriter::AddFile(const nglPath& rPath, const nglString& rPathInZip, const nglString& rComment)
{
  return AddFile(rPath.OpenRead(), rPathInZip.IsEmpty() ? rPath.GetPathName() : rPathInZip, rComment, true);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:4,代码来源:nglZipFS.cpp


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