Carna  Version 3.3.2
text.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef TEXT_H_6014714286
13 #define TEXT_H_6014714286
14 
15 #include <Carna/Carna.h>
16 #include <string>
17 #include <sstream>
18 
23 namespace Carna
24 {
25 
26 namespace base
27 {
28 
32 namespace text
33 {
34 
35 
36 
37 // ----------------------------------------------------------------------------------
38 // cat
39 // ----------------------------------------------------------------------------------
40 
44 std::string CARNA_LIB cat( const std::string& file );
45 
46 
47 
48 // ----------------------------------------------------------------------------------
49 // lexical_cast
50 // ----------------------------------------------------------------------------------
51 
67 template< typename To, typename From >
68 To lexical_cast( const From& from )
69 {
70  To to;
71  std::stringstream ss;
72  ss << from;
73  ss >> to;
74  return to;
75 }
76 
77 
78 
79 } // namespace Carna :: base :: text
80 
81 } // namespace Carna :: base
82 
83 } // namespace Carna
84 
85 #endif // TEXT_H_6014714286
To lexical_cast(const From &from)
Performs lexical cast.
Definition: text.h:68
std::string cat(const std::string &file)
Reads file in text mode and returns contents.