greenplumn COstreamString 源码

2022-08-18 浏览 (329)

greenplumn COstreamString 代码

文件路径:/src/backend/gporca/libgpos/src/io/COstreamString.cpp

/---------------------------------------------------------------------------
/	Greenplum Database
/	Copyright (C) 2009 - 2010 Greenplum Inc.
/
/	@filename:
/		COstreamString.cpp
/
/	@doc:
/		Implementation of basic wide character output stream
/---------------------------------------------------------------------------

#include "gpos/io/COstreamString.h"

#include "gpos/base.h"
#include "gpos/string/CWStringConst.h"

using namespace gpos;


/---------------------------------------------------------------------------
/	@function:
/		COstreamString::COstreamString
/
/	@doc:
/		ctor
/
/---------------------------------------------------------------------------
COstreamString::COstreamString(CWString *pws) : COstream(), m_string(pws)
{
	GPOS_ASSERT(m_string && "Backing string cannot be NULL");
}

/---------------------------------------------------------------------------
/	@function:
/		COstreamString::operator<<
/
/	@doc:
/		WCHAR array write thru;
/
/---------------------------------------------------------------------------
IOstream &
COstreamString::operator<<(const WCHAR *wc_array)
{
	m_string->AppendWideCharArray(wc_array);

	return *this;
}

/---------------------------------------------------------------------------
/	@function:
/		COstreamString::operator<<
/
/	@doc:
/		CHAR array write thru;
/
/---------------------------------------------------------------------------
IOstream &
COstreamString::operator<<(const CHAR *c)
{
	m_string->AppendCharArray(c);

	return *this;
}


/---------------------------------------------------------------------------
/	@function:
/		COstreamString::operator<<
/
/	@doc:
/		WCHAR write thru;
/
/---------------------------------------------------------------------------
IOstream &
COstreamString::operator<<(const WCHAR wc)
{
	WCHAR wc_array[2];
	wc_array[0] = wc;
	wc_array[1] = L'\0';
	m_string->AppendWideCharArray(wc_array);

	return *this;
}


/---------------------------------------------------------------------------
/	@function:
/		COstreamString::operator<<
/
/	@doc:
/		CHAR write thru;
/
/---------------------------------------------------------------------------
IOstream &
COstreamString::operator<<(const CHAR c)
{
	CHAR char_array[2];
	char_array[0] = c;
	char_array[1] = '\0';
	m_string->AppendCharArray(char_array);

	return *this;
}


/ EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CFileDescriptor 源码

greenplumn CFileReader 源码

greenplumn CFileWriter 源码

greenplumn COstream 源码

greenplumn COstreamBasic 源码

greenplumn COstreamStdString 源码

greenplumn ioutils 源码

^