2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 #include <toollib/error.h>
9 #include <toollib/stringcb.h>
12 StringGetCB (StringStream
* ss
, int dummy
, CBD data
)
16 if (ss
->pos
== ss
->max
)
22 c
= ss
->string
[ss
->pos
++];
31 StringUngetCB (StringStream
* ss
, int c
, CBD data
)
42 if (c
!= ss
->string
[ss
->pos
])
50 if (ss
->pos
!= ss
->max
)
61 StringPutCB (StringStream
* ss
, int c
, CBD data
)
64 ss
->out
= VS_New (NULL
);
66 VS_AppendChar (ss
->out
, c
);
72 StringPutsCB (StringStream
* ss
, const char * str
, CBD data
)
75 ss
->out
= VS_New (NULL
);
77 VS_AppendString (ss
->out
, str
);
83 StrStr_New (const char * string
)
85 StringStream
* ss
= new (StringStream
);
87 Str_Init (&ss
->stream
, "string");
89 ss
->stream
.get
= (CB
) StringGetCB
;
90 ss
->stream
.unget
= (CB
) StringUngetCB
;
91 ss
->stream
.put
= (CB
) StringPutCB
;
92 ss
->stream
.puts
= (CB
) StringPutsCB
;
97 ss
->max
= strlen (string
);
103 StrStr_Delete (StringStream
* ss
)
108 Str_Delete (&ss
->stream
);