Main Page | Class List | File List | Class Members | File Members

view.h

Go to the documentation of this file.
00001 
00164 #ifndef _VIEW_H
00165 #define _VIEW_H
00166 #include "list.h"
00167 #include "tuple.h"
00168 #include "segment.h"
00169 
00172 enum segtype { owned, borrowed };
00173 
00175 typedef struct _view View;
00176 
00178 struct _view {
00179   enum segtype type;  
00180   unsigned int len;   
00181   List *tuple;        
00182 };
00183 
00185 typedef struct _IOElement IOElement;
00186 
00189 struct _IOElement {
00190   char *ptr;          
00191   size_t length;      
00192 };
00193 
00195 typedef struct _IOVec IOVec;
00196 
00198 struct _IOVec {
00199   unsigned int vecLength;  
00200   IOElement *vec;          
00201 };
00202 
00203 
00226 extern void view_Init(void *(*view_allocate)(size_t), void (*view_deallocate)(void *));
00227 
00254 extern View *view_CreateBorrowed(char *input, unsigned int length);
00255 
00275 extern View *view_CreateOwned(char *input, unsigned int length);
00276 
00288 extern void view_Delete(View *view);
00289 
00303 extern unsigned int view_DeleteFront(View *view, unsigned int N);
00304 
00328 extern unsigned int view_AppendData(View *view, char *input, unsigned int length);
00329 
00342 extern View *view_Copy(const View *view);
00343 
00360 extern View *view_CopyFront(const View *view, unsigned int N);
00361 
00380 extern View *view_ViewCat(View *v1, const View *v2);
00381 
00397 extern View *view_Cut(View *v1, unsigned int cutIndex);
00398 
00541 unsigned int view_ViewDelete(View *vParent, const View *vChild);
00542 
00559 extern unsigned int view_GetChar(const View *view, unsigned int pos, char *retval);
00560 
00578 extern char *view_CopyChunk(View *view, unsigned int begin, unsigned int end);
00579 
00596 extern unsigned int view_DeleteChunk(View *view, unsigned int begin, unsigned int end);
00597 
00598 /*
00599  * \brief 
00600  *    Insert a string into a view.
00601  *
00602  * \return 0 failure
00603  * \return 1 success
00604  *
00605  * \param view the view that the new segment will be inserted into.
00606  * \param input the new segment.
00607  * \param length the length of the new segment.
00608  *
00609  */
00610 /* not functional.
00611    extern unsigned int view_InsertRef(View *view, unsigned int insertPos, char *input, unsigned int length); */
00612 
00618 unsigned int view_Length(const View *view);
00619 
00649 size_t view_Strcspn(View *view, const char *charset, size_t s2Len);
00650 
00676 int view_Strspn(View *view, const char *charset, size_t s2Len);
00677 
00689 extern int view_Strstr(View *view, const char *str2, size_t s2Len);
00690 
00699 extern void view_Print(View *view);
00700 
00709 extern void view_DebugPrint(View *view);
00710 
00740 extern IOVec *view_IOVec(View *view);
00741 
00751 extern void iovec_Delete(IOVec *iovec);
00752 
00753 #endif  /* _VIEW_H */

Generated on Wed Feb 25 23:01:10 2004 by doxygen 1.3.4