00001
00009 #ifndef _tinyrl_history_h
00010 #define _tinyrl_history_h
00011
00012 #include "lub/c_decl.h"
00013 #include "lub/types.h"
00014
00015 _BEGIN_C_DECL
00016
00017
00018
00019
00020 typedef struct _tinyrl_history_entry tinyrl_history_entry_t;
00021
00022 extern const char *
00023 tinyrl_history_entry__get_line(const tinyrl_history_entry_t *instance);
00024 extern unsigned
00025 tinyrl_history_entry__get_index(const tinyrl_history_entry_t *instance);
00026
00027
00028
00029
00030 typedef struct _tinyrl_history tinyrl_history_t;
00031
00035 typedef struct _tinyrl_history_iterator tinyrl_history_iterator_t;
00039 struct _tinyrl_history_iterator
00040 {
00041 const tinyrl_history_t *history;
00042 unsigned offset;
00043 };
00044
00045
00046 extern tinyrl_history_t *
00047 tinyrl_history_new(unsigned stifle);
00048
00049 extern void
00050 tinyrl_history_delete(tinyrl_history_t *instance);
00051
00052 extern void
00053 tinyrl_history_add (tinyrl_history_t *instance,
00054 const char *line);
00055
00056 extern tinyrl_history_entry_t *
00057 tinyrl_history_getfirst (const tinyrl_history_t *instance,
00058 tinyrl_history_iterator_t *iter);
00059 extern tinyrl_history_entry_t *
00060 tinyrl_history_getlast (const tinyrl_history_t *instance,
00061 tinyrl_history_iterator_t *iter);
00062
00063 extern tinyrl_history_entry_t *
00064 tinyrl_history_getnext(tinyrl_history_iterator_t *iter);
00065
00066 extern tinyrl_history_entry_t *
00067 tinyrl_history_getprevious(tinyrl_history_iterator_t *iter);
00068
00069
00070
00071
00072
00073
00074
00075 extern tinyrl_history_entry_t *
00076 tinyrl_history_remove(tinyrl_history_t *instance,
00077 unsigned offset);
00078 extern void
00079 tinyrl_history_clear(tinyrl_history_t *instance);
00080 extern void
00081 tinyrl_history_stifle(tinyrl_history_t *instance,
00082 unsigned stifle);
00083 extern unsigned
00084 tinyrl_history_unstifle(tinyrl_history_t *instance);
00085 extern bool_t
00086 tinyrl_history_is_stifled(const tinyrl_history_t *instance);
00087
00088
00089
00090
00091 extern tinyrl_history_entry_t **
00092 tinyrl_history_list(const tinyrl_history_t *instance);
00093 extern tinyrl_history_entry_t *
00094 tinyrl_history_get(const tinyrl_history_t *instance,
00095 unsigned offset);
00096
00097
00098
00099
00100 typedef enum
00101 {
00102 tinyrl_history_NO_EXPANSION,
00103 tinyrl_history_EXPANDED
00104 } tinyrl_history_expand_t;
00105
00106 extern tinyrl_history_expand_t
00107 tinyrl_history_expand(const tinyrl_history_t *instance,
00108 const char *string,
00109 char **output);
00110
00111 _END_C_DECL
00112
00113 #endif
00114