Line | |
---|
1 | /* ************************************************************************** * |
---|
2 | * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * |
---|
3 | * ************************************************************************** */ |
---|
4 | |
---|
5 | |
---|
6 | #ifndef __ICUTIL_HPP__ |
---|
7 | #define __ICUTIL_HPP__ |
---|
8 | |
---|
9 | #include <string> |
---|
10 | |
---|
11 | // ///////////////////////// Définitions/Déclarations /////////////////////// // |
---|
12 | |
---|
13 | inline bool cstr2string(const char * cstr, int cstr_size, std::string & str) |
---|
14 | { |
---|
15 | std::string valtemp; |
---|
16 | std::size_t d, f = 0; |
---|
17 | if (cstr_size != -1) |
---|
18 | { |
---|
19 | valtemp.append (cstr, cstr_size); |
---|
20 | d = valtemp.find_first_not_of(' '); |
---|
21 | f = valtemp.find_last_not_of (' '); |
---|
22 | str = valtemp.substr(d, f-d+1); |
---|
23 | return (true); |
---|
24 | } |
---|
25 | else |
---|
26 | { |
---|
27 | return (false); |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | #endif // __ICUTIL_HPP__ |
---|
Note: See
TracBrowser
for help on using the repository browser.