⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sh_string.h

📁 rsa算法打的一个包
💻 H
字号:
// SH_String.h: interface for the SH_String class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SH_STRING_H__AF59786B_8A15_4AE1_97AC_D6DD5BE76A75__INCLUDED_)
#define AFX_SH_STRING_H__AF59786B_8A15_4AE1_97AC_D6DD5BE76A75__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#include "SH_Object.h"
#include "SH_String.h"

class AFX_EXT_CLASS SH_String : public SH_Object  
{
public:
	SH_String();
    SH_String(const char * s);
	virtual ~SH_String();

    VOID   Resize(const size_t newSize);
    BOOL   AutoResize();
    void   Clear();
    void   Delete();
    void   Put(const int c);
    void   Cat(const char * s);
    void   Cat(const char * s,const size_t length);
    void   StripNewLine();
    void   StripLeading();
    void   StripLeading(const int c);
    void   StripTrailing();
    void   StripTrailing(const int c);
    void   Chop();
    void   Copy(const char * s);
    void   Copy(const char * s,const size_t length);
    BOOL   CopyToLower(SH_String * dest);
    VOID   Terminate();
    void   SetLength();
    size_t GetSize();
    size_t GetLength();
    char * GetString();

    const SH_String & operator =  (const SH_String & vs);
    const SH_String & operator =  (const char *   & vs);
  	const SH_String & operator += (const int ch);
  	const SH_String & operator += (const char ch);
  	const SH_String & operator += (const char * lpsz);
  	const SH_String & operator += (const SH_String & string);

    operator LPCTSTR ();

    friend SH_String operator +  (const SH_String& string1, const SH_String& string2);
    friend SH_String operator +  (const SH_String& string, const char * lpsz);
    friend SH_String operator +  (const char * lpsz,const SH_String & string);
    friend BOOL      operator == (const SH_String& s1, const SH_String& s2);
    friend BOOL      operator == (const SH_String& s1, const char * s2);
    friend BOOL      operator == (const char * s1, const SH_String& s2);

private:
    size_t	m_nLength;		
    size_t	m_nSize;		
    char *	m_pBuffer;		

};

SH_String operator +  (const SH_String& string1, const SH_String& string2);
SH_String operator +  (const SH_String& string, const char * lpsz);
SH_String operator +  (const char * lpsz,const SH_String & string);
BOOL      operator == (const SH_String& s1, const SH_String& s2);
BOOL      operator == (const SH_String& s1, const char * s2);
BOOL      operator == (const char * s1, const SH_String& s2);

AFX_INLINE SH_String operator+(const SH_String& string1, const SH_String& string2)
{
    SH_String s;
    s.Cat(string1.m_pBuffer);
    s.Cat(string2.m_pBuffer);
    return s;
}

AFX_INLINE SH_String operator+(const SH_String& string, const char * lpsz)
{
    SH_String s;
    s.Cat(string.m_pBuffer);
    s.Cat(lpsz);
    return s;
}

AFX_INLINE SH_String operator+(const char * lpsz,const SH_String & string)
{
    SH_String s;
    s.Cat(lpsz);
    s.Cat(string.m_pBuffer);
    return s;
}

AFX_INLINE BOOL operator==(const SH_String& s1, const SH_String& s2)
{
    return (BOOL)(strcmp(s1.m_pBuffer,s2.m_pBuffer) == 0);
}

AFX_INLINE BOOL operator==(const SH_String& s1, const char * s2)
{
    return (BOOL)(strcmp(s1.m_pBuffer,s2) == 0);
}

AFX_INLINE BOOL operator==(const char * s1, const SH_String& s2)
{
    return (BOOL)(strcmp(s1,s2.m_pBuffer) == 0);
}

#endif // !defined(AFX_SH_STRING_H__AF59786B_8A15_4AE1_97AC_D6DD5BE76A75__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -