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


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

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


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

示例1: 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

示例2: 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

示例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

	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

示例5: 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

示例6: 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

示例7: 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

示例8: PRINT

// Visit
void
RequestDumper::Visit(RequestMember* member, StringData& data)
{
    PRINT(("%sstring: \"%s\" (%p, %ld bytes)\n", _Indentation(),
           data.GetString(), data.GetString(), data.GetSize()));
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:7,代码来源:RequestDumper.cpp


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