#ifndef _UTILLIB_H_
#define _UTILLIB_H_

/*****************************************************************
*  Project.....:  UtilLib
*  Application.:  UtilLib
*  Library.....:  UtilLib.lib
*  Description.:  Utility Static library
*  Compiler....:  MS Visual C++
*  Written by..:  R. Mitchell
*  Environment.:  Windows 9x/NT
******************************************************************/

// TODO: add exception specifications
/*---------------------------------------------------------------*/
//                        INCLUDE section
/*---------------------------------------------------------------*/
#include "stdafx.h"
#include <string>
#include <tchar.h>


class CUtilLib {

public:

   int StdToInt( const std::string& s );                             // Converts std::string to int
   std::string  IntToStr( int i);                                    // Converts int to std::string
   std::string mid(const std::string s, int iPos);                      // Outputs std::string a copy of input from iPos

   // Enquiry
   bool     FileExists(const std::string& sPath);                    // Tests if file exists             
   bool     IsPathInQuotes(const std::string& sPath);                // Tests for quotes at beginning and end of path
   bool     IsPathTooBig( const std::string& sPath );                // Tests param against MAX_PATH
   bool     IsValidDriveFormat( const std::string& sPath );             // Tests drive component in path is of "C:\" format
   bool     IsValidFilename( const std::string& sFilename );            // Tests whether filename is valid
   bool     PathExists( const std::string& sPath );                     // Tests if directory path exists

   // Setters
   std::string    PathAddExt( const std::string& sPath, const std::string& sExt );  // Adds extension and dot as required         


   std::string    PathAppend(std::string& sPath, const std::string& sToAppend);     // Returns std::string with appended std::string


   std::string    PathGetExt(const std::string& sPath );                   // Returns std::string with extension extracted 
   std::string    PathMakeDblBackslash(const std::string& sPath);             // Returns std::string with double backslashes
   std::string    PathMakeSnglBackslash(const std::string& sPath);               // Returns std::string with single backslashes
   std::string    PathRemoveExt(const std::string& sPath );                // Returns std::string with removed extension and "."

   std::string  PathReplaceExt( const std::string& sPath, const std::string& sNewExt );
   std::string  PathReplaceFileName( const std::string& sPath, const std::string& sNewExt ); // Returns std::string sPath replacing filename 

   // Getters

   std::string::value_type PathGetDriveLetter(const std::string& sPath );              // Returns std::string::value_type with drive letter
   std::string PathGetFileName(const std::string& sPath);                  // Returns std::string consists of filename extracted from path

};
#endif // _UTILLIB_H_


Hosted by www.Geocities.ws

1