greenplumn CWString 源码

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

greenplumn CWString 代码

文件路径:/src/backend/gporca/libgpos/include/gpos/string/CWString.h

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2010 Greenplum, Inc.
//
//	@filename:
//		CWString.h
//
//	@doc:
//		Wide character string interface.
//---------------------------------------------------------------------------
#ifndef GPOS_CWString_H
#define GPOS_CWString_H

#include "gpos/string/CWStringBase.h"

#define GPOS_MAX_FMT_STR_LENGTH (10 * 1024 * 1024)	// 10MB

namespace gpos
{
//---------------------------------------------------------------------------
//	@class:
//		CWString
//
//	@doc:
//		Wide character String interface.
//		Internally, the class uses a null-terminated WCHAR buffer to store the string characters.
//		The class API provides functions for accessing the wide-character buffer and its length,
//		as well as functions that modify the current string by appending another string to it,
//		or that construct a string according to a given format.
//		For constant strings consider using the CWStringConst class.
//
//---------------------------------------------------------------------------
class CWString : public CWStringBase
{
protected:
	// null-terminated wide character buffer
	WCHAR *m_w_str_buffer;

	// appends the contents of a buffer to the current string
	virtual void AppendBuffer(const WCHAR *w_str_buffer) = 0;

public:
	// ctor
	CWString(ULONG length);

	// dtor
	~CWString() override = default;

	// returns the wide character buffer storing the string
	const WCHAR *GetBuffer() const override;

	// appends a string
	void Append(const CWStringBase *str);

	// appends a formatted string
	virtual void AppendFormat(const WCHAR *format, ...) = 0;

	// appends a string and replaces character with string
	virtual void AppendEscape(const CWStringBase *str, WCHAR wc,
							  const WCHAR *w_str_replace) = 0;

	// appends a null terminated character array
	virtual void AppendCharArray(const CHAR *sz) = 0;

	// appends a null terminated wide character array
	virtual void AppendWideCharArray(const WCHAR *w_str) = 0;

	// resets string
	virtual void Reset() = 0;
};
}  // namespace gpos

#endif	// !GPOS_CWString_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CStringStatic 源码

greenplumn CWStringBase 源码

greenplumn CWStringConst 源码

greenplumn CWStringDynamic 源码

greenplumn CWStringStatic 源码

0  赞