PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/iostreams/detail/absolute_path.hpp

http://hadesmem.googlecode.com/
C++ Header | 46 lines | 24 code | 6 blank | 16 comment | 9 complexity | 6e30b4bc1a57b45f0d458f53f4f1b54e MD5 | raw file
 1/*
 2 * Distributed under the Boost Software License, Version 1.0.(See accompanying 
 3 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
 4 * 
 5 * See http://www.boost.org/libs/iostreams for documentation.
 6
 7 * File:        boost/iostreams/detail/execute.hpp
 8 * Date:        Thu Dec 06 13:21:54 MST 2007
 9 * Copyright:   2007-2008 CodeRage, LLC
10 * Author:      Jonathan Turkanis
11 * Contact:     turkanis at coderage dot com
12 *
13 * Defines the function boost::iostreams::detail::absolute_path, used for 
14 * debug output for mapped files.
15 */
16
17#ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
18#define BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
19
20#include <string>
21#include <boost/iostreams/detail/config/windows_posix.hpp>
22#ifdef BOOST_IOSTREAMS_WINDOWS
23# include <cctype>
24#endif
25#include <boost/iostreams/detail/current_directory.hpp>
26
27namespace boost { namespace iostreams { namespace detail {
28
29// Resolves the given path relative to the current working directory
30inline std::string absolute_path(const std::string& path)
31{
32#ifdef BOOST_IOSTREAMS_WINDOWS
33    return path.size() && (path[0] == '/' || path[0] == '\\') ||
34           path.size() > 1 && std::isalpha(path[0]) && path[1] == ':' ?
35               path :
36               current_directory() + '\\' + path;
37#else // #ifdef BOOST_IOSTREAMS_WINDOWS
38    return path.size() && (path[0] == '/') ?
39        path :
40        current_directory() + '/' + path;
41#endif // #ifdef BOOST_IOSTREAMS_WINDOWS
42}
43
44} } } // End namespaces detail, iostreams, boost.
45
46#endif // #ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED