pinmem.cxx

来自「PTypes是一个扩充了多线程和网络功能的STL库」· CXX 代码 · 共 103 行

CXX
103
字号
/* * *  C++ Portable Types Library (PTypes) *  Version 2.0.2  Released 17-May-2004 * *  Copyright (C) 2001-2004 Hovik Melikyan * *  http://www.melikyan.com/ptypes/ * */#include "pstreams.h"PTYPES_BEGINinmemory::inmemory(const string& imem)    : instm(length(imem)), mem(imem) {}inmemory::~inmemory() {    close();}int inmemory::classid(){    return CLASS2_INMEMORY;}void inmemory::bufalloc() {    bufdata = pchar(pconst(mem));    abspos = bufsize = bufend = length(mem);}void inmemory::buffree() {    bufclear();    bufdata = nil;}void inmemory::bufvalidate() {    eof = bufpos >= bufend;}void inmemory::doopen() {}void inmemory::doclose() {}int inmemory::doseek(int, ioseekmode){    return -1;}int inmemory::dorawread(char*, int) {    return 0;}string inmemory::get_streamname() {    return "mem";}int inmemory::seek(int newpos, ioseekmode mode){    if (mode == IO_END)    {        newpos += bufsize;        mode = IO_BEGIN;    }    return instm::seek(newpos, mode);}void inmemory::set_strdata(const string& data){    close();    mem = data;}PTYPES_END

⌨️ 快捷键说明

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