mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
exposed StringFromUTF16 utility function so it can be used from within form1.ui.h
This commit is contained in:
@@ -819,14 +819,7 @@ void mainForm::executeQuery()
|
||||
mustCreateColumns = false;
|
||||
}
|
||||
for (int e=0; e<ncol; e++){
|
||||
const ushort* utf16data = static_cast<const ushort*>(sqlite3_column_text16(vm, e));
|
||||
QString rv;
|
||||
uint utf16len=0;
|
||||
if ( utf16data ) {
|
||||
for ( const ushort* p = utf16data; *p; ++p )
|
||||
++utf16len;
|
||||
rv.setUnicodeCodes(utf16data, utf16len);
|
||||
}
|
||||
QString rv(StringFromUTF16(sqlite3_column_text16(vm, e)));
|
||||
//show it here
|
||||
QString firstline = rv.section( '\n', 0,0 );
|
||||
if (firstline.length()>MAX_DISPLAY_LENGTH)
|
||||
|
||||
@@ -7,24 +7,23 @@
|
||||
#include <qfiledialog.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
namespace {
|
||||
uint utf16len(const ushort* utf16)
|
||||
{
|
||||
uint len=0;
|
||||
if ( utf16 )
|
||||
while ( *utf16++ ) ++len;
|
||||
return len;
|
||||
}
|
||||
|
||||
QString StringFromUTF16(const void* utf16)
|
||||
{
|
||||
QString result;
|
||||
result.setUnicodeCodes(static_cast<const ushort*>(utf16), utf16len(static_cast<const ushort*>(utf16)));
|
||||
return result;
|
||||
}
|
||||
|
||||
//utility functions
|
||||
uint utf16len(const ushort* utf16)
|
||||
{
|
||||
uint len=0;
|
||||
if ( utf16 )
|
||||
while ( *utf16++ ) ++len;
|
||||
return len;
|
||||
}
|
||||
|
||||
QString StringFromUTF16(const void* utf16)
|
||||
{
|
||||
QString result;
|
||||
result.setUnicodeCodes(static_cast<const ushort*>(utf16), utf16len(static_cast<const ushort*>(utf16)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void DBBrowserTable::addField(int order, const QString& wfield,const QString& wtype)
|
||||
{
|
||||
fldmap[order] = DBBrowserField(wfield,wtype);
|
||||
|
||||
@@ -34,6 +34,10 @@ typedef QMap<int, int> rowIdMap;
|
||||
typedef QValueList<QStringList> rowList;
|
||||
typedef QMap<int, QString> resultMap;
|
||||
|
||||
//utility functions
|
||||
uint utf16len(const ushort* utf16);
|
||||
QString StringFromUTF16(const void* utf16);
|
||||
|
||||
class DBBrowserField
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user