util.hxx

Go to the documentation of this file.
00001 #ifndef LIBSHERPA_UTIL_HXX
00002 #define LIBSHERPA_UTIL_HXX
00003 
00004 /**************************************************************************
00005  *
00006  * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, The EROS
00007  *   Group, LLC.
00008  * Copyright (C) 2004, 2005, 2006, Johns Hopkins University.
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or
00012  * without modification, are permitted provided that the following
00013  * conditions are met:
00014  *
00015  *   - Redistributions of source code must contain the above
00016  *     copyright notice, this list of conditions, and the following
00017  *     disclaimer.
00018  *
00019  *   - Redistributions in binary form must reproduce the above
00020  *     copyright notice, this list of conditions, and the following
00021  *     disclaimer in the documentation and/or other materials
00022  *     provided with the distribution.
00023  *
00024  *   - Neither the names of the copyright holders nor the names of any
00025  *     of any contributors may be used to endorse or promote products
00026  *     derived from this software without specific prior written
00027  *     permission.
00028  *
00029  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00030  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00031  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00032  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00033  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00034  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00035  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00036  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00037  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00038  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00039  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00040  *
00041  **************************************************************************/
00042 
00043 namespace sherpa {
00044   std::string strdowncase(const std::string&);
00045 
00046   std::string unsigned_str(uint32_t);
00047   std::string unsigned64_str(uint64_t);
00048 
00049   std::string sgetenv(const char *);
00050 
00051   inline std::string sgetenv(const std::string& s)
00052   {
00053     return sgetenv(s.c_str());
00054   }
00055 
00056   uint64_t atollu(const char *);
00057   uint64_t atollu(const std::string&);
00058 
00059   typedef uint32_t hash32_t;
00060 
00061   extern const char * strnchr(const char *s, size_t len, char c);
00062   inline const unsigned char *
00063   ustrnchr(const unsigned char *s, size_t len, unsigned char c) {
00064     return (unsigned char *) strnchr((const char *) s, len, (char) c);
00065   }
00066 
00067 #ifdef NEED_CONVERT
00068   void* xbsearch(const void *key, const void *base, size_t nmemb,
00069                  size_t size, int (*compar)(const void *, const void *));
00070 
00071 #endif /* NEED_CONVERT */
00072 
00073 } /* namespace sherpa */
00074 
00075 #endif /* LIBSHERPA_UTIL_HXX */

Generated on Fri May 18 07:59:18 2012 for BitC Compiler by  doxygen 1.4.7