From 11ae1b690fe08b117ab76119f574b53e89107331 Mon Sep 17 00:00:00 2001 From: prozacx Date: Sat, 7 May 2005 09:43:26 +0000 Subject: [PATCH] Moved CUtils::Ellipsize() into CString class git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@245 726aef4b-f618-498e-8847-2d620e286838 --- UserSock.cpp | 2 +- Utils.cpp | 20 -------------------- Utils.h | 1 - modules/email.cpp | 7 +++++-- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/UserSock.cpp b/UserSock.cpp index 640c13c7..d66a13f3 100644 --- a/UserSock.cpp +++ b/UserSock.cpp @@ -743,7 +743,7 @@ void CUserSock::UserCommand(const CString& sLine) { for (unsigned int b = 0; b < Modules.size(); b++) { Table.AddRow(); Table.SetCell("Name", Modules[b]->GetModName()); - Table.SetCell("Description", CUtils::Ellipsize(Modules[b]->GetDescription(), 128)); + Table.SetCell("Description", Modules[b]->GetDescription().Ellipsize(128)); } unsigned int uTableIdx = 0; CString sLine; diff --git a/Utils.cpp b/Utils.cpp index 566150f1..8254206e 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -430,26 +430,6 @@ string& CUtils::RightChomp(string& s, unsigned int uLen) { return s; } -string CUtils::Ellipsize(const string& s, unsigned int uLen) { - if (uLen >= s.size()) { - return s; - } - - string sRet; - - if (uLen < 4) { - for (unsigned int a = 0; a < uLen; a++) { - sRet += "."; - } - - return sRet; - } - - sRet = s.substr(0, uLen -3) + "..."; - - return sRet; -} - bool CUtils::wildcmp(const string& sWild, const string& sString) { // Written by Jack Handy - jakkhandy@hotmail.com const char *wild = sWild.c_str(), *string = sString.c_str(); diff --git a/Utils.h b/Utils.h index f4f708e7..82b8c31d 100644 --- a/Utils.h +++ b/Utils.h @@ -61,7 +61,6 @@ public: static string& Trim(string& s); static string& LeftChomp(string& s, unsigned int uLen = 1); static string& RightChomp(string& s, unsigned int uLen = 1); - static string Ellipsize(const string& s, unsigned int uLen); static bool wildcmp(const string& sWild, const string& sString); static unsigned long long GetMillTime() { diff --git a/modules/email.cpp b/modules/email.cpp index c1236b02..ed1ae6d0 100644 --- a/modules/email.cpp +++ b/modules/email.cpp @@ -15,6 +15,9 @@ * Author: imaginos * * $Log$ + * Revision 1.5 2005/05/07 09:43:26 prozacx + * Moved CUtils::Ellipsize() into CString class + * * Revision 1.4 2005/05/05 18:11:04 prozacx * Changed all references to std::string over to CString * @@ -133,9 +136,9 @@ public: { //PutModule( "------------------- New Email -------------------" ); Table.AddRow(); - Table.SetCell( "From", CUtils::Ellipsize( vEmails[a].sFrom, 32 ) ); + Table.SetCell( "From", vEmails[a].sFrom.Ellipsize( 32 ) ); Table.SetCell( "Size", CUtils::ToString( vEmails[a].iSize ) ); - Table.SetCell( "Subject", CUtils::Ellipsize( vEmails[a].sSubject, 64 ) ); + Table.SetCell( "Subject", vEmails[a].sSubject.Ellipsize( 64 ) ); } ssUidls.insert( vEmails[a].sUidl ); }