Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » PROPOSAL: small / usefull Stream iface extension
Re: PROPOSAL: small / usefull Stream iface extension [message #28012 is a reply to message #28009] Fri, 13 August 2010 10:47 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
another one...
	const byte * Peek(int size = 1)  { if(size <= 0 || (ptr + size > rdlim)) return NULL; return ptr; }
	byte *    PutReserve(int size)   { if(size <= 0 || (ptr + size > wrlim)) return NULL; byte * p = ptr; ptr+= size; return p; }


concerning Head():
if anyone really wants to break things its even possible with Peek then (brutal cast away const). those who really use these options are aware of it and use it with caution.

Peek shouldnt advance ptr. Peek only peeks Smile advancing if needed should be done with Seek(GetPos() + size) afterwards, if desired.

advancing ptr in Head is a protection though, that same buffer section is not returned twice.. but the name is maybe irritating.

[Updated on: Fri, 13 August 2010 10:49]

Report message to a moderator

 
Read Message icon3.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NEW: Tree<T> container
Next Topic: better Stream manual....more info needed
Goto Forum:
  


Current Time: Sat Jun 01 11:48:28 CEST 2024

Total time taken to generate the page: 0.03231 seconds