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

📄 pool.cpp

📁 将OCI封装,方便C++编程,本类不支持多线程,使用时要注意,
💻 CPP
字号:
// Pool.cpp: implementation of the CPool class.
//
//////////////////////////////////////////////////////////////////////


#include "string.h"
#include "pool.h"


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPool::CPool(int size)
{
    m_pBuff=new char[size];
    m_DataSize=0;
    m_BuffSize=size;
}

CPool::~CPool()
{
    delete []m_pBuff;
}

char *CPool::GetData(int &size)
{
    size=m_DataSize;
    return m_pBuff;
}

int CPool::OutPool(int size)
{
    if(size>m_DataSize||size<0)
    {   
        return 0;
    }
    memmove(m_pBuff,((char*)m_pBuff)+size,m_DataSize-size);
    m_DataSize-=size;
    return 1;
}

int CPool::PutPool(char *pBuff,int size)
{
    if(m_DataSize+size > m_BuffSize||size<0)
    {
        return 0;
    }
    memcpy(((char*)m_pBuff)+m_DataSize,pBuff,size);
    m_DataSize+=size;
    return 1;
}


void CPool::ClearBuffer()
{
    m_DataSize=0;
}
 

⌨️ 快捷键说明

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