diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2007-06-17 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2007-06-17 18:00:00 +0200 |
commit | b1e4da3be6552f58f3890bf2ad48879823d2e130 (patch) | |
tree | cf42a1e6b296956b82a2820948c7b90dbcddf26e /tools.h | |
parent | b9b9ace9a8d2d1c0beda1dc0a2ebc6be9b47c305 (diff) | |
download | vdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.gz vdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.bz2 |
Version 1.5.4vdr-1.5.4
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3).
- Fixed a crash in i18n character set conversion (thanks to Alexander Riedel,
Jose Alberto Reguero and Christian Wieninger for patches that cured part of
the problem).
- Adjusted the 'skincurses' plugin to UTF-8 handling.
- Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to
Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the
canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out).
- Modified handling invalid characters in VFAT mode.
- Replaced strn0cpy() with Utf8Strn0Cpy() where necessary.
- Now using 'fontconfig' to determine which fonts to use (thanks to Anssi Hannula
for code and hints on how to do this).
- If no fonts are installed, VDR now uses a dummy font that doesn't actually draw
any text, and logs an error message.
- The new function cFont::CreateFont() can be used by plugins to create and use
fonts of their own, independent of VDR's standard fonts.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Changed the parameter "OSD font" to "Default font" in "Setup/OSD" (suggested
by Rolf Ahrenberg).
- Fixed handling detached processes in SystemExec() (thanks to Udo Richter).
- The info.vdr file now also stores the name of the channel, and the new function
cRecordingInfo::ChannelName() returns this information if available (based on
a patch from Alexander Hans).
- The new function cOsd::SetOsdPosition() can be used to dynamically change the
position and size of the OSD (based on a request from Christoph Haubrich).
Plugins that implement skins should no longer use Setup.OSDWidth etc. directly,
but should rather use cOsd::OsdWidth() etc. instead.
Currently a change to the OSD position will only apply to newly opened OSDs.
Diffstat (limited to 'tools.h')
-rw-r--r-- | tools.h | 52 |
1 files changed, 45 insertions, 7 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.98 2007/06/10 08:46:23 kls Exp $ + * $Id: tools.h 1.102 2007/06/17 11:00:20 kls Exp $ */ #ifndef __TOOLS_H @@ -92,7 +92,15 @@ int Utf8CharSet(uint c, char *s = NULL); ///< is given, only the number of bytes is returned and nothing is copied. int Utf8SymChars(const char *s, int Symbols); ///< Returns the number of character bytes at the beginning of the given - ///< string that form at most the given number of UTF-8 Symbols. + ///< string that form at most the given number of UTF-8 symbols. +int Utf8StrLen(const char *s); + ///< Returns the number of UTF-8 symbols formed by the given string of + ///< character bytes. +char *Utf8Strn0Cpy(char *Dest, const char *Src, int n); + ///< Copies at most n character bytes from Src to Dst, making sure that the + ///< resulting copy ends with a complete UTF-8 symbol. The copy is guaranteed + ///< to be zero terminated. + ///< Returns a pointer to Dest. int Utf8ToArray(const char *s, uint *a, int Size); ///< Converts the given character bytes (including the terminating 0) into an ///< array of UTF-8 symbols of the given Size. Returns the number of symbols @@ -394,7 +402,17 @@ private: mutable int allocated; mutable int size; mutable T *data; - void Realloc(int NewAllocated) const { data = (T *)realloc(data, (allocated = NewAllocated) * sizeof(T)); } + cVector(const cVector &Vector) {} // don't copy... + cVector &operator=(const cVector &Vector) { return *this; } // ...or assign this! + void Realloc(int Index) const + { + if (++Index > allocated) { + data = (T *)realloc(data, Index * sizeof(T)); + for (int i = allocated; i < Index; i++) + data[i] = T(0); + allocated = Index; + } + } public: cVector(int Allocated = 10) { @@ -406,8 +424,9 @@ public: virtual ~cVector() { free(data); } T& At(int Index) const { + Realloc(Index); if (Index >= size) - Realloc(size = Index + 1); + size = Index + 1; return data[Index]; } const T& operator[](int Index) const @@ -419,12 +438,24 @@ public: return At(Index); } int Size(void) const { return size; } + virtual void Insert(T Data, int Before = 0) + { + if (Before < size) { + Realloc(size); + memmove(&data[Before + 1], &data[Before], (size - Before) * sizeof(T)); + size++; + data[Before] = Data; + } + else + Append(Data); + } virtual void Append(T Data) { if (size >= allocated) Realloc(allocated * 4 / 2); // increase size by 50% data[size++] = Data; } + virtual void Clear(void) {} void Sort(__compar_fn_t Compare) { qsort(data, size, sizeof(T), Compare); @@ -436,12 +467,19 @@ inline int CompareStrings(const void *a, const void *b) return strcmp(*(const char **)a, *(const char **)b); } -class cFileNameList : public cVector<char *> { +class cStringList : public cVector<char *> { +public: + cStringList(int Allocated = 10): cVector<char *>(Allocated) {} + virtual ~cStringList(); + int Find(const char *s) const; + void Sort(void) { cVector<char *>::Sort(CompareStrings); } + virtual void Clear(void); + }; + +class cFileNameList : public cStringList { public: cFileNameList(const char *Directory = NULL); - virtual ~cFileNameList(); bool Load(const char *Directory); - int Find(const char *FileName); }; class cHashObject : public cListObject { |