From 229c98b195b283b9a5dc798480fb12f78eee06cd Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Fri, 3 Mar 2006 15:23:24 +0000 Subject: Created Utils.cpp - Moved file utility functions from Utils.h to Utils.cpp - Created FileCanOpen() git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@191 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkbasecxx/Utils.h | 49 +++++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) (limited to 'orkbasecxx/Utils.h') diff --git a/orkbasecxx/Utils.h b/orkbasecxx/Utils.h index dcd22f2..7c14f28 100644 --- a/orkbasecxx/Utils.h +++ b/orkbasecxx/Utils.h @@ -25,6 +25,9 @@ #include "OrkBase.h" +//============================================ +// String related stuff + inline CStdString IntToString(int integer) { CStdString ret; @@ -59,42 +62,24 @@ inline double StringToDouble(CStdString& value) return doubleValue; } -inline CStdString BaseName(CStdString& path) -{ - CStdString result; - int lastSeparatorPosition = path.ReverseFind('/'); - if(lastSeparatorPosition == -1) - { - lastSeparatorPosition = path.ReverseFind('\\'); - } - if(lastSeparatorPosition != -1 && path.GetLength()>3) - { - result = path.Right(path.GetLength() - lastSeparatorPosition - 1); - } - else - { - result = path; - } - return result; -} +//======================================================== +// file related stuff -inline CStdString StripFileExtension(CStdString& filename) -{ - CStdString result; - int extensionPosition = filename.ReverseFind('.'); - if (extensionPosition != -1) - { - result = filename.Left(extensionPosition); - } - else - { - result = filename; - } - return result; -} +CStdString DLL_IMPORT_EXPORT FileBaseName(CStdString& path); +CStdString DLL_IMPORT_EXPORT FileStripExtension(CStdString& filename); +bool DLL_IMPORT_EXPORT FileCanOpen(CStdString& path); + + + +//===================================================== +// threading related stuff typedef ACE_Guard MutexSentinel; + +//===================================================== +// Miscellanous stuff + /** A counter that generates a "counting" 3 character strings, i.e. aaa, aab, ..., zzz that represents a number between 0 and 26^3-1 (wrapping counter) and starts at a random location in this range. -- cgit v1.2.3