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

📄 rvstrstream.h

📁 h.248协议源码
💻 H
字号:
/******************************************************************************
Filename:    rvstrstream.h
Description: Stream string class
*******************************************************************************
                Copyright (c) 2000 RADVision Inc.
*******************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever 
without written prior approval by RADVision LTD..

RADVision LTD. reserves the right to revise this publication and make 
changes without obligation to notify any person of such revisions or 
changes.
******************************************************************************
Revision: 
Date:   10.5.00
Author: Dan Elbert
******************************************************************************/
#ifndef RV_STRSTREAM_H
#define RV_STRSTREAM_H

#ifdef __cplusplus
extern "C" {
#endif

#include "rvstring.h"

/* Fail to allocate enough space for the operation */
#define RV_STRSTREAM_ERROR_ALLOC -1

/******************************************************************************/
/*    rvStrStreamBuf definitions											  */
/******************************************************************************/
typedef struct {
	RvAlloc *alloc;
	char * obegin;
	char * onext;
	char * oend;
} RvStrStreamBuf;

#define rvStrStreamBufIsValid(x) ((x)->obegin!=NULL)
#define rvStrStreamBufMustGrow(x,n) ( (x)->onext+n > (x)->oend )

void rvStrStreamBufSetP(RvStrStreamBuf * x,char * begin,char * next,char * end);
char * rvStrStreamBufReserve(RvStrStreamBuf * x,size_t n);
void rvStrStreamBufPutC(RvStrStreamBuf * x,char c);
void rvStrStreamBufPutN(RvStrStreamBuf * x,const char * s,size_t n);
void rvStrStreamBufInvalidate(RvStrStreamBuf * x);
void rvStrStreamBufConstructA(RvStrStreamBuf * x,size_t n,RvAlloc * a);
void rvStrStreamBufConstructEB(RvStrStreamBuf * x,size_t n,char * buf);
/* Destructor */
void rvStrStreamBufDestruct(RvStrStreamBuf * x);

void rvStrStreamBufSeekOffCur(RvStrStreamBuf * x,int off);
size_t rvStrStreamBufTellPos(RvStrStreamBuf * x);
void rvStrStreamBufSeekPos(RvStrStreamBuf * x,size_t pos);
char * rvStrStreamBufGetStr(RvStrStreamBuf * x);

/******************************************************************************/
/*    rvStrStream definitions												  */
/******************************************************************************/

typedef struct {
	RvStrStreamBuf sbuf;
	RvStatus status;
	void *	 data; 
} RvStrStream;

/* Constructors */
void rvStrStreamConstruct(RvStrStream * x,size_t size,RvAlloc * a);
void rvStrStreamConstructBuf(RvStrStream * x,size_t size,char * buf);

/* Destructor */
void rvStrStreamDestruct(RvStrStream * x);

/* Access functions */
void		rvStrStreamSetUserData(RvStrStream * x,void * data);
void *		rvStrStreamGetUserData(RvStrStream * x);
void		rvStrStreamSetErrorStatus(RvStrStream * x,RvStatus status);
RvStatus	rvStrStreamGetStatus(RvStrStream * x);
char*		rvStrStreamGetStr(RvStrStream * x);
size_t      rvStrStreamGetSize(RvStrStream * x);
RvAlloc*	rvStrStreamGetAllocator(RvStrStream * x);

/* Write (stream) functions */
void rvStrStreamPut(RvStrStream * x,char c);
void rvStrStreamWriteStrN(RvStrStream * x,const char * s,size_t len);
void rvStrStreamWriteStr(RvStrStream * x,const char * s);
void rvStrStreamWriteString(RvStrStream * x,const RvString * s);
void rvStrStreamWriteMem(RvStrStream * x,const char * s,size_t len);
void rvStrStreamWriteUInt(RvStrStream * x,RvUint32 i);
void rvStrStreamWriteUIntW(RvStrStream *x, RvUint32 i, size_t width, char fill);
void rvStrStreamWriteHexInt(RvStrStream *x, RvUint32 i);
void rvStrStreamWriteHexIntW(RvStrStream *x, RvUint32 i, size_t width, char fill);
void rvStrStreamEndl(RvStrStream * x);
void rvStrStreamEnds(RvStrStream * x);

/* Stream manipulation functions */
/* Move the current put position by offset off */
#define rvStrStreamSeekOffCur(x,off) rvStrStreamBufSeekOffCur(&(x)->sbuf,(off))
#define rvStrStreamTellPos(x)		 rvStrStreamBufTellPos(&(x)->sbuf) 
#define rvStrStreamSeekPos(x,pos)	 rvStrStreamBufSeekPos(&(x)->sbuf,(pos))

#ifdef __cplusplus
}
#endif

#endif /* RV_STRSTREAM_H */

⌨️ 快捷键说明

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