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


C++ StringData::GetData方法代码示例

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


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

示例1: Append

	AsciiStringBase& Append(const wchar_t* lpData, size_t nLength)
	{
		if ( !lpData || !nLength ) //*lpData??
			return *this;

		size_t nNewLength = WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, 0, 0, 0, 0);
		size_t nSize = nNewLength+m_pData->GetLength();

		if ( m_pData->Unique() && (nSize < m_pData->GetSize()) ) //check!!!
		{
			WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, m_pData->GetData()+m_pData->GetLength(), nNewLength, 0, 0);
			m_pData->SetLength(nSize);
		}
		else
		{
			StringData<char>* pNewData = new StringData<char>(nSize+1);

			memcpy(pNewData->GetData(), m_pData->GetData(), m_pData->GetLength());
			WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, pNewData->GetData()+m_pData->GetLength(), nNewLength, 0, 0);

			pNewData->SetLength(nSize);
			FreeData();

			m_pData = pNewData;
		}

		return *this;
	}
开发者ID:FarGroup,项目名称:FarManager,代码行数:28,代码来源:AsciiStringBase.hpp

示例2: SetData

	StringBase& SetData(const char* lpData, size_t nLength, int nCodePage = CP_OEMCP)
	{
		m_nEncoding = nCodePage;

		if ( !lpData || !nLength )
		{
			FreeData();
			SetEmpty();
		}
		else
		{
			size_t nSize = Traits::GetAnsiDataLength(lpData, nLength, m_nEncoding);

			if ( m_pData && m_pData->Unique() && (nSize < m_pData->GetSize()) )
			{
				Traits::CopyAnsiData(m_pData->GetData(), nSize, lpData, nLength, m_nEncoding);
				m_pData->SetLength(nLength);
			}
			else
			{
				StringData<T>* pNewData = new StringData<T>(nSize+1);

				Traits::CopyAnsiData(pNewData->GetData(), nSize, lpData, nLength, m_nEncoding);
				pNewData->SetLength(nLength);

				FreeData();
				m_pData = pNewData;
			}
		}

		return *this;
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:32,代码来源:StringBase2.hpp

示例3: Append

	StringBase& Append(const wchar_t* lpData, size_t nLength, int nCodePage = CP_OEMCP)
	{
		if ( !lpData || !nLength ) //*lpData??
			return *this;

		size_t nNewLength = Traits::GetUnicodeDataLength(lpData, nLength, nCodePage);
		size_t nSize = nNewLength+m_pData->GetLength();

		if ( m_pData->Unique() && (nSize < m_pData->GetSize()) ) //check!!!
		{
			Traits::CopyUnicodeData(m_pData->GetData()+m_pData->GetLength(), nSize, lpData, nLength, nCodePage);
			m_pData->SetLength(nSize);
		}
		else
		{
			StringData<T>* pNewData = new StringData<T>(nSize+1);

			memcpy(pNewData->GetData(), m_pData->GetData(), m_pData->GetLength()*sizeof(T));
			Traits::CopyUnicodeData(pNewData->GetData()+m_pData->GetLength(), nNewLength, lpData, nLength, nCodePage);

			pNewData->SetLength(nSize);
			FreeData();

			m_pData = pNewData;
		}

		return *this;
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:28,代码来源:StringBase2.hpp

示例4: SetData

	AsciiStringBase& SetData(const wchar_t* lpData, size_t nLength)
	{
		if ( !lpData || !nLength )
		{
			FreeData();
			SetEmpty();
		}
		else
		{
			size_t nSize = WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, 0, 0, 0, 0);

			if ( m_pData && m_pData->Unique() && (nSize < m_pData->GetSize()) )
			{
				WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, m_pData->GetData(), nSize, 0, 0);
				m_pData->SetLength(nSize);
			}
			else
			{
				StringData<char>* pNewData = new StringData<char>(nSize+1);

				WideCharToMultiByte(m_nEncoding, 0, lpData, nLength, pNewData->GetData(), nSize, 0, 0);
				pNewData->SetLength(nSize);

				FreeData();
				m_pData = pNewData;
			}
		}

		return *this;
	}
开发者ID:FarGroup,项目名称:FarManager,代码行数:30,代码来源:AsciiStringBase.hpp

示例5: GetLength

	bool operator==(const StringBase& strCmp)
	{
		return (strCmp.m_pData == m_pData) ||
				(
					(strCmp.GetLength() == GetLength()) &&
					!memcmp(m_pData->GetData(), strCmp.m_pData->GetData(), GetLength()*sizeof(T))
				);
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:8,代码来源:StringBase2.hpp

示例6: GetBuffer

	T* GetBuffer(size_t nLength = (size_t)-1)
	{
		size_t nNewLength = (nLength == (size_t)-1)?m_pData->GetLength():nLength;

		if ( !m_pData->Unique() || (nNewLength > m_pData->GetSize()) )
		{
			StringData<T>* pNewData = new StringData<T>(nNewLength+1);

			memcpy(pNewData->GetData(), m_pData->GetData(), m_pData->GetLength()*sizeof(T));
			pNewData->SetLength(m_pData->GetLength());

			FreeData();

			m_pData = pNewData;
		}

		return m_pData->GetData();
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:18,代码来源:StringBase2.hpp

示例7: ReleaseBuffer

	void ReleaseBuffer(size_t nLength = (size_t)-1)
	{
		//неправильна¤ логика
		if ( nLength == (size_t)-1 )
			nLength = strlen(m_pData->GetData());

		if ( nLength >= m_pData->GetSize() )
			nLength = m_pData->GetSize()-1;

		m_pData->SetLength (nLength);
	}
开发者ID:FarGroup,项目名称:FarManager,代码行数:11,代码来源:AsciiStringBase.hpp

示例8: ReleaseBuffer

	void ReleaseBuffer(size_t nLength = (size_t)-1)
	{
		//неправильная логика
		if ( nLength == (size_t)-1 )
			nLength = Traits::StrLength(m_pData->GetData());

		if ( nLength >= m_pData->GetSize() )
			nLength = m_pData->GetSize()-1;

		m_pData->SetLength (nLength);
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:11,代码来源:StringBase2.hpp

示例9: SetEncoding

	bool SetEncoding(int nEncoding)
	{
		if ( (m_nEncoding == CP_UNICODE) || (nEncoding == CP_UNICODE) )
			return false;

		if ( m_pData )
		{
			char* pData = Traits::ConvertString(m_pData->GetData(), m_nEncoding, nEncoding);

			//m_nEncoding = nEncoding;

			SetData(pData, nEncoding);

			Traits::Free(pData);
		}
		else
			m_nEncoding = nEncoding;

		return true;
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:20,代码来源:StringBase2.hpp

示例10: ToBSTR

	BSTR ToBSTR(int nCodePage = CP_OEMCP) const
	{
		return Traits::ToBSTR(m_pData->GetData(), nCodePage);
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:4,代码来源:StringBase2.hpp

示例11:

	operator const T*() const
	{
		return m_pData->GetData();
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:4,代码来源:StringBase2.hpp

示例12: GetString

	const T* GetString() const
	{
		return m_pData->GetData();
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:4,代码来源:StringBase2.hpp

示例13: GetLength

	bool operator==(const char* lpCmp)
	{
		return (lpCmp && (strlen(lpCmp) == GetLength()) && !memcmp(lpCmp, m_pData->GetData(), GetLength()));
	}
开发者ID:FarGroup,项目名称:FarManager,代码行数:4,代码来源:AsciiStringBase.hpp

示例14: IsEmpty

	bool IsEmpty() const
	{
		return !(m_pData->GetLength() && *m_pData->GetData());
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:4,代码来源:StringBase2.hpp

示例15: At

	T At(size_t nIndex) const
	{
		return m_pData->GetData()[nIndex];
	}
开发者ID:CyberShadow,项目名称:FAR,代码行数:4,代码来源:StringBase2.hpp


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