Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Lib_Find.h

Go to the documentation of this file.
00001 //=============================================================================
00002 /**
00003  *  @file   Lib_Find.h
00004  *
00005  *  $Id: Lib_Find.h,v 1.1.1.2 2003/02/21 18:36:32 chad Exp $
00006  *
00007  *  @author Priyanka Gontla <pgontla@ece.uci.edu>
00008  */
00009 //=============================================================================
00010 
00011 #ifndef ACE_LIB_FIND_H
00012 #define ACE_LIB_FIND_H
00013 #include "ace/pre.h"
00014 
00015 #include "ace/OS.h"
00016 
00017 /**
00018  * @class ACE_Lib_Find
00019  *
00020  * This class includes all the static function calls needed to search
00021  * and open shared libraries.
00022  */
00023 class ACE_Export ACE_Lib_Find
00024 {
00025  public:
00026 
00027   // = Methods for searching and opening shared libraries.
00028 
00029   /**
00030    * Finds the file <filename> either using an absolute path or using
00031    * a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g.,
00032    * $LD_LIBRARY_PATH on UNIX or the directories scaned by Win32 API
00033    * SearchPath on Win32).  This function will add appropriate suffix
00034    * (e.g., .dll on Win32 or .so on UNIX) according to the OS
00035    * platform.  In addition, this function will apply the appropriate
00036    * prefix (e.g., "lib" on UNIX and "" on Win32) if the <filename>
00037    * doesn't match directly.
00038    */
00039   static int ldfind (const ACE_TCHAR* filename,
00040                      ACE_TCHAR pathname[],
00041                      size_t maxpathnamelen);
00042 
00043   /**
00044    * Uses <ldfind> to locate and open the appropriate <filename> and
00045    * returns a pointer to the file, else it returns a NULL
00046    * pointer. <type> specifies how the file should be open.
00047    */
00048   static FILE *ldopen (const ACE_TCHAR *filename,
00049                        const ACE_TCHAR *type);
00050 
00051   /**
00052    * Transforms <entry_point> into a form that can be located in a
00053    * dynamic library using <dlsym>. For example, with Win32/Borland
00054    * extern "C" functions which use the default calling convention
00055    * have a '_' prepended. Always returns a buffer that has been
00056    * dynamically allocated using <operator new>.
00057    */
00058   static ACE_TCHAR *ldname (const ACE_TCHAR *entry_point);
00059 
00060   /**
00061    * Returns the temporary directory including the trailing slash in
00062    * <buffer>.  Returns -1 for an error or if the buffer_len is not
00063    * long enough.
00064    */
00065   static int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len);
00066 
00067   /// Opening the temp file.  File is automagically unlinked when it is
00068   /// closed.  This is useful for have temp files.
00069   static ACE_HANDLE open_temp_file (const ACE_TCHAR *name,
00070                                     int mode,
00071                                     int perm = 0);
00072 
00073   // @@ Though the following functions dont come under the same category as
00074   // above, these are used only in the functions in this class. So it makes
00075   // more sense to move these functions too to this class.
00076   //
00077   /// Replace all instances of <search> in <s> with <replace>.  Returns
00078   /// the number of replacements made.
00079   static size_t strrepl (char *s, char search, char replace);
00080 
00081   /**
00082    * Splits string <s> into pieces separated by the string <token>.
00083    * <next_start> is an opaque cookie handed back by the call to store
00084    * its state for the next invocation, thus making it re-entrant.
00085    * This operates very similar to Perl's <split> function except that
00086    * it returns pieces one at a time instead of into an array.
00087    */
00088   static char *strsplit_r (char *s, const char *token, char *&next_start);
00089 
00090 #if defined (ACE_HAS_WCHAR)
00091   /// As strrepl, but for wide characters.
00092   static size_t strrepl (wchar_t *s, wchar_t search, wchar_t replace);
00093 
00094   /// As strsplit_r, but for wide characters.
00095   static wchar_t *strsplit_r (wchar_t *s, const wchar_t *token,
00096                               wchar_t *&next_start);
00097 #endif /* ACE_HAS_WCHAR */
00098 };
00099 
00100 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00101 #include "ace/Lib_Find.i"
00102 #endif /* ACE_LACKS_INLINE_FUNCTIONS */
00103 
00104 #include "ace/post.h"
00105 #endif  /* ACE_LIB_FIND_H */

Generated on Mon Jun 16 11:19:55 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002