~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/file_to_string.hpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Boost.Geometry (aka GGL, Generic Geometry Library)
 
2
//
 
3
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
 
4
// Use, modification and distribution is subject to the Boost Software License,
 
5
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 
6
// http://www.boost.org/LICENSE_1_0.txt)
 
7
//
 
8
//
 
9
#ifndef FILE_TO_STRING_HPP
 
10
#define FILE_TO_STRING_HPP
 
11
 
 
12
 
 
13
#include <string>
 
14
#include <fstream>
 
15
 
 
16
 
 
17
inline std::string file_to_string(std::string const& filename)
 
18
{
 
19
    std::string result;
 
20
 
 
21
    std::ifstream cpp_file(filename.c_str());
 
22
    if (cpp_file.is_open())
 
23
    {
 
24
        while (! cpp_file.eof() )
 
25
        {
 
26
            std::string line;
 
27
            std::getline(cpp_file, line);
 
28
            result += line + "\n";
 
29
        }
 
30
    }
 
31
    return result;
 
32
}
 
33
 
 
34
 
 
35
#endif // FILE_TO_STRING_HPP