mirror of
https://github.com/taglib/taglib.git
synced 2025-05-25 12:10:26 -04:00
Add file_new and file_new_type wchar variants for C binding (#1271)
This commit is contained in:
parent
fbbead3efd
commit
3ccc390155
@ -149,7 +149,15 @@ TagLib_File *taglib_file_new(const char *filename)
|
||||
return reinterpret_cast<TagLib_File *>(new FileRef(filename));
|
||||
}
|
||||
|
||||
TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
|
||||
#ifdef _WIN32
|
||||
TagLib_File *taglib_file_new_wchar(const wchar_t *filename)
|
||||
{
|
||||
return reinterpret_cast<TagLib_File *>(new FileRef(filename));
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
TagLib_File *taglib_file_new_type_any_char(const T *filename, TagLib_File_Type type)
|
||||
{
|
||||
File *file = NULL;
|
||||
switch(type) {
|
||||
@ -240,6 +248,18 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
|
||||
return file ? reinterpret_cast<TagLib_File *>(new FileRef(file)) : NULL;
|
||||
}
|
||||
|
||||
TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
|
||||
{
|
||||
return taglib_file_new_type_any_char(filename, type);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
TagLib_File *taglib_file_new_type_wchar(const wchar_t *filename, TagLib_File_Type type)
|
||||
{
|
||||
return taglib_file_new_type_any_char(filename, type);
|
||||
}
|
||||
#endif
|
||||
|
||||
TagLib_File *taglib_file_new_iostream(TagLib_IOStream *stream)
|
||||
{
|
||||
return reinterpret_cast<TagLib_File *>(
|
||||
|
@ -142,12 +142,18 @@ typedef enum {
|
||||
* be opened.
|
||||
*/
|
||||
TAGLIB_C_EXPORT TagLib_File *taglib_file_new(const char *filename);
|
||||
#ifdef _WIN32
|
||||
TAGLIB_C_EXPORT TagLib_File *taglib_file_new_wchar(const wchar_t *filename);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Creates a TagLib file based on \a filename. Rather than attempting to guess
|
||||
* the type, it will use the one specified by \a type.
|
||||
*/
|
||||
TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type);
|
||||
#ifdef _WIN32
|
||||
TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type_wchar(const wchar_t *filename, TagLib_File_Type type);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Creates a TagLib file from a \a stream.
|
||||
|
Loading…
Reference in New Issue
Block a user