Ejemplo n.º 1
0
nsresult
nsJSONWriter::Write(const PRUnichar *aBuffer, uint32_t aLength)
{
  if (mStream) {
    return WriteToStream(mStream, mEncoder, aBuffer, aLength);
  }

  if (!mDidWrite) {
    mBuffer = new PRUnichar[JSON_STREAM_BUFSIZE];
    if (!mBuffer)
      return NS_ERROR_OUT_OF_MEMORY;
    mDidWrite = true;
  }

  if (JSON_STREAM_BUFSIZE <= aLength + mBufferCount) {
    mOutputString.Append(mBuffer, mBufferCount);
    mBufferCount = 0;
  }

  if (JSON_STREAM_BUFSIZE <= aLength) {
    // we know mBufferCount is 0 because we know we hit the if above
    mOutputString.Append(aBuffer, aLength);
  } else {
    memcpy(&mBuffer[mBufferCount], aBuffer, aLength * sizeof(PRUnichar));
    mBufferCount += aLength;
  }

  return NS_OK;
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------------
void AnimationMotion::WriteToFile(const char* filename)
{
    BinaryFileWriter writer;
    ASSERT_OR_DIE(writer.Open(filename), "File Open failed!");
    {
        WriteToStream(writer);
    }
    writer.Close();
}
Ejemplo n.º 3
0
//
// Save
//
// Save the contents of this Stream.
STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty)
{

    HRESULT hr = WriteInt(pStm, GetSoftwareVersion());
    if (FAILED(hr)) {
        return hr;
    }

    hr = WriteToStream(pStm);
    if (FAILED(hr)) {
        return hr;
    }

    mPS_fDirty = !fClearDirty;

    return hr;
} // Save
    /**
       Writes the configuration file.
    */
    void ConfigurationFileWriter::Write()
    {
        SCXCoreLib::SCXLogHandle log = SCXLogHandleFactory::GetLogHandle(L"scx.core.providers.runasprovider.configparser");

        WriteToStream(*SCXFile::OpenWFstream(m_file, std::ios_base::out));
    }
Ejemplo n.º 5
0
inline void WriteBSTRToStream( std::basic_ostream< WCHAR, CharTraitsT > &Ostream, BSTR Str )
{
   //В этом случае никакие преобразования не нужны
   WriteToStream( Ostream, static_cast<const WCHAR *>(Str) );
}
Ejemplo n.º 6
0
inline void WriteBSTRToStream( std::basic_ostream< CharT, CharTraitsT > &Ostream, BSTR Str )
{
   std::basic_string<CharT, CharTraitsT> StrTmp;
   Convert( std::wstring(Str), StrTmp );
   WriteToStream( Ostream, StrTmp );
}
Ejemplo n.º 7
0
void Tree::Phylip(ostream& os, int withLengths, int withProbs, int withSpeciesNames, int withInternalLabels)	{
	WriteToStream(os, 0, withLengths, withProbs, withSpeciesNames, withInternalLabels);
}