greenplumn IOstream 源码

  • 2022-08-18
  • 浏览 (381)

greenplumn IOstream 代码

文件路径:/src/backend/gporca/libgpos/include/gpos/io/IOstream.h

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 EMC Corp.
//
//	@filename:
//		IOstream.h
//
//	@doc:
//		Output stream interface;
//---------------------------------------------------------------------------
#ifndef GPOS_IOstream_H
#define GPOS_IOstream_H

#include "gpos/types.h"

namespace gpos
{
// wide char ostream
using WOSTREAM = std::basic_ostream<WCHAR, std::char_traits<WCHAR>>;

//---------------------------------------------------------------------------
//	@class:
//		IOstream
//
//	@doc:
//		Defines all available operator interfaces; avoids having to overload
//		system stream classes or their operators/member functions
//
//---------------------------------------------------------------------------
class IOstream
{
protected:
	// ctor
	IOstream() = default;

	BOOL m_fullPrecision{false};

public:
	enum EStreamManipulator
	{
		EsmDec,
		EsmHex
		// no sentinel to enforce strict switch-ing
	};

	// virtual dtor
	virtual ~IOstream() = default;

	// operator interface
	virtual IOstream &operator<<(const CHAR *) = 0;
	virtual IOstream &operator<<(const WCHAR) = 0;
	virtual IOstream &operator<<(const CHAR) = 0;
	virtual IOstream &operator<<(ULONG) = 0;
	virtual IOstream &operator<<(ULLONG) = 0;
	virtual IOstream &operator<<(INT) = 0;
	virtual IOstream &operator<<(LINT) = 0;
	virtual IOstream &operator<<(DOUBLE) = 0;
	virtual IOstream &operator<<(const void *) = 0;
	virtual IOstream &operator<<(WOSTREAM &(*) (WOSTREAM &) ) = 0;
	virtual IOstream &operator<<(EStreamManipulator) = 0;

	// needs to be implemented by subclass
	virtual IOstream &operator<<(const WCHAR *) = 0;

	void
	SetFullPrecision(BOOL fullPrecision)
	{
		m_fullPrecision = fullPrecision;
	}
};

}  // namespace gpos

#endif	// !GPOS_IOstream_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CFileDescriptor 源码

greenplumn CFileReader 源码

greenplumn CFileWriter 源码

greenplumn COstream 源码

greenplumn COstreamBasic 源码

greenplumn COstreamStdString 源码

greenplumn COstreamString 源码

greenplumn iotypes 源码

greenplumn ioutils 源码

0  赞